OSDN Git Service

2010-05-05 Andrew Pinski <andrew.pinski@caviumnetworks.com>
[pf3gnuchains/gcc-fork.git] / gcc / config / rs6000 / darwin.h
index 9617a7e..077f74b 100644 (file)
@@ -1,5 +1,5 @@
 /* Target definitions for PowerPC running Darwin (Mac OS X).
-   Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006
+   Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2007, 2008
    Free Software Foundation, Inc.
    Contributed by Apple Computer Inc.
 
@@ -7,7 +7,7 @@
 
    GCC is free software; you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published
-   by the Free Software Foundation; either version 2, or (at your
+   by the Free Software Foundation; either version 3, or (at your
    option) any later version.
 
    GCC is distributed in the hope that it will be useful, but WITHOUT
@@ -16,9 +16,8 @@
    License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with GCC; see the file COPYING.  If not, write to the
-   Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
-   MA 02110-1301, USA.  */
+   along with GCC; see the file COPYING3.  If not see
+   <http://www.gnu.org/licenses/>.  */
 
 #undef  TARGET_VERSION
 #define TARGET_VERSION fprintf (stderr, " (Darwin/PowerPC)");
 /* Translate config/rs6000/darwin.opt to config/darwin.h.  */
 #define TARGET_DYNAMIC_NO_PIC (TARGET_MACHO_DYNAMIC_NO_PIC)
 
-#define TARGET_OS_CPP_BUILTINS()                \
-  do                                            \
-    {                                           \
-      if (!TARGET_64BIT) builtin_define ("__ppc__");   \
-      if (TARGET_64BIT) builtin_define ("__ppc64__");  \
-      builtin_define ("__POWERPC__");           \
-      builtin_define ("__NATURAL_ALIGNMENT__"); \
-      darwin_cpp_builtins (pfile);             \
-    }                                           \
+#define TARGET_OS_CPP_BUILTINS()                       \
+  do                                                   \
+    {                                                  \
+      if (!TARGET_64BIT) builtin_define ("__ppc__");   \
+      if (TARGET_64BIT) builtin_define ("__ppc64__");  \
+      builtin_define ("__POWERPC__");                  \
+      builtin_define ("__NATURAL_ALIGNMENT__");                \
+      darwin_cpp_builtins (pfile);                     \
+    }                                                  \
   while (0)
 
-
-#define SUBTARGET_OVERRIDE_OPTIONS                                     \
-do {                                                                   \
-  /* The Darwin ABI always includes AltiVec, can't be (validly) turned \
-     off.  */                                                          \
-  rs6000_altivec_abi = 1;                                              \
-  TARGET_ALTIVEC_VRSAVE = 1;                                           \
-  if (DEFAULT_ABI == ABI_DARWIN)                                       \
-  {                                                                    \
-    if (MACHO_DYNAMIC_NO_PIC_P)                                                \
-      {                                                                        \
-        if (flag_pic)                                                  \
-            warning (0, "-mdynamic-no-pic overrides -fpic or -fPIC");  \
-        flag_pic = 0;                                                  \
-      }                                                                        \
-    else if (flag_pic == 1)                                            \
-      {                                                                        \
-        flag_pic = 2;                                                  \
-      }                                                                        \
-  }                                                                    \
-  if (TARGET_64BIT && ! TARGET_POWERPC64)                              \
-    {                                                                  \
-      target_flags |= MASK_POWERPC64;                                  \
-      warning (0, "-m64 requires PowerPC64 architecture, enabling");   \
-    }                                                                  \
-  if (flag_mkernel)                                                     \
-    {                                                                  \
-      rs6000_default_long_calls = 1;                                   \
-      target_flags |= MASK_SOFT_FLOAT;                                 \
-    }                                                                  \
-} while(0)
+#define SUBTARGET_OVERRIDE_OPTIONS darwin_rs6000_override_options ()
 
 #define C_COMMON_OVERRIDE_OPTIONS do {                                 \
   /* On powerpc, __cxa_get_exception_ptr is available starting in the  \
      10.4.6 libstdc++.dylib.  */                                       \
-  if ((! darwin_macosx_version_min                                     \
-       || strverscmp (darwin_macosx_version_min, "10.4.6") < 0)                \
+  if (strverscmp (darwin_macosx_version_min, "10.4.6") < 0             \
       && flag_use_cxa_get_exception_ptr == 2)                          \
     flag_use_cxa_get_exception_ptr = 0;                                        \
   if (flag_mkernel)                                                    \
@@ -122,8 +90,10 @@ do {                                                                        \
    the kernel or some such.  */
 
 #define CC1_SPEC "\
+  %(cc1_cpu) \
   %{g: %{!fno-eliminate-unused-debug-symbols: -feliminate-unused-debug-symbols }} \
   %{static: %{Zdynamic: %e conflicting code gen style switches are used}}\
+  %{!mmacosx-version-min=*:-mmacosx-version-min=%(darwin_minversion)} \
   %{!mkernel:%{!static:%{!mdynamic-no-pic:-fPIC}}}"
 
 #define DARWIN_ARCH_SPEC "%{m64:ppc64;:ppc}"
@@ -151,8 +121,20 @@ do {                                                                       \
 #define DARWIN_CRT2_SPEC \
   "%{!m64:%:version-compare(!> 10.4 mmacosx-version-min= crt2.o%s)}"
 
+/* Determine a minimum version based on compiler options.  */
+#define DARWIN_MINVERSION_SPEC                                 \
+  "%{m64:%{fgnu-runtime:10.4;                                  \
+          ,objective-c|,objc-cpp-output:10.5;                  \
+          ,objective-c-header:10.5;                            \
+          ,objective-c++|,objective-c++-cpp-output:10.5;       \
+          ,objective-c++-header|,objc++-cpp-output:10.5;       \
+          :10.4};                                              \
+     shared-libgcc:10.3;                                       \
+     :10.1}"
+
 #undef SUBTARGET_EXTRA_SPECS
 #define SUBTARGET_EXTRA_SPECS                  \
+  DARWIN_EXTRA_SPECS                            \
   { "darwin_arch", DARWIN_ARCH_SPEC },         \
   { "darwin_crt2", DARWIN_CRT2_SPEC },         \
   { "darwin_subarch", DARWIN_SUBARCH_SPEC },
@@ -191,12 +173,12 @@ do {                                                                      \
 #define STARTING_FRAME_OFFSET                                          \
   (FRAME_GROWS_DOWNWARD                                                        \
    ? 0                                                                 \
-   : (RS6000_ALIGN (current_function_outgoing_args_size, 16)           \
+   : (RS6000_ALIGN (crtl->outgoing_args_size, 16)              \
       + RS6000_SAVE_AREA))
 
 #undef STACK_DYNAMIC_OFFSET
 #define STACK_DYNAMIC_OFFSET(FUNDECL)                                  \
-  (RS6000_ALIGN (current_function_outgoing_args_size, 16)              \
+  (RS6000_ALIGN (crtl->outgoing_args_size, 16)         \
    + (STACK_POINTER_OFFSET))
 
 /* These are used by -fbranch-probabilities */
@@ -209,6 +191,8 @@ do {                                                                        \
 
 #undef FP_SAVE_INLINE
 #define FP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) < 64)
+#undef GP_SAVE_INLINE
+#define GP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) < 32)
 
 /* Darwin uses a function call if everything needs to be saved/restored.  */
 #undef WORLD_SAVE_P
@@ -260,8 +244,6 @@ do {                                                                        \
 
 /* This says how to output an assembler line to define a global common
    symbol.  */
-/* ? */
-#undef  ASM_OUTPUT_ALIGNED_COMMON
 #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED)                   \
   do {                                                                 \
     unsigned HOST_WIDE_INT _new_size = SIZE;                           \
@@ -373,14 +355,11 @@ do {                                                                      \
    ? GENERAL_REGS                                              \
    : (CLASS))
 
-/* Fix for emit_group_load (): force large constants to be pushed via regs.  */
-#define ALWAYS_PUSH_CONSTS_USING_REGS_P                1
-
 /* Compute field alignment.  This is similar to the version of the
    macro in the Apple version of GCC, except that version supports
    'mac68k' alignment, and that version uses the computed alignment
    always for the first field of a structure.  The first-field
-   behaviour is dealt with by
+   behavior is dealt with by
    darwin_rs6000_special_round_type_align.  */
 #define ADJUST_FIELD_ALIGN(FIELD, COMPUTED)    \
   (TARGET_ALIGN_NATURAL ? (COMPUTED)           \
@@ -428,9 +407,9 @@ do {                                                                        \
 #include <stdbool.h>
 #endif
 
+#if !defined(__LP64__) && !defined(DARWIN_LIBSYSTEM_HAS_UNWIND)
 #define MD_UNWIND_SUPPORT "config/rs6000/darwin-unwind.h"
-
-#define HAS_MD_FALLBACK_FRAME_STATE_FOR 1
+#endif
 
 /* True, iff we're generating fast turn around debugging code.  When
    true, we arrange for function prologues to start with 5 nops so
@@ -450,9 +429,11 @@ do {                                                                       \
 #undef TARGET_C99_FUNCTIONS
 #define TARGET_C99_FUNCTIONS                                   \
   (TARGET_64BIT                                                        \
-   || (darwin_macosx_version_min                               \
-       && strverscmp (darwin_macosx_version_min, "10.3") >= 0))
+   || strverscmp (darwin_macosx_version_min, "10.3") >= 0)
 
 /* When generating kernel code or kexts, we don't use Altivec by
    default, as kernel code doesn't save/restore those registers.  */
 #define OS_MISSING_ALTIVEC (flag_mkernel || flag_apple_kext)
+
+/* Darwin has to rename some of the long double builtins.  */
+#define SUBTARGET_INIT_BUILTINS darwin_patch_builtins ()