diff options
author | (no author) <(no author)@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-05-10 23:56:25 +0000 |
---|---|---|
committer | (no author) <(no author)@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-05-10 23:56:25 +0000 |
commit | 2bffd6f3bba6e1746f5b7cd524d76b5b2e2eb48e (patch) | |
tree | 0d98bcea72447280d7282a59a38a7b203eabc2ef /gcc/config/i386 | |
parent | 59bc598e01e292d67c32b6ae240b4544d4c234ab (diff) |
This commit was manufactured by cvs2svn to create tagapple/gcc-1749
'apple-gcc-1749'.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/tags/apple-gcc-1749@81686 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/i386')
-rw-r--r-- | gcc/config/i386/darwin.h | 89 | ||||
-rw-r--r-- | gcc/config/i386/i386.c | 68 | ||||
-rw-r--r-- | gcc/config/i386/i386.h | 23 |
3 files changed, 169 insertions, 11 deletions
diff --git a/gcc/config/i386/darwin.h b/gcc/config/i386/darwin.h index accffeee90c..f20c9d896b5 100644 --- a/gcc/config/i386/darwin.h +++ b/gcc/config/i386/darwin.h @@ -23,15 +23,21 @@ Boston, MA 02111-1307, USA. */ #undef TARGET_MACHO #define TARGET_MACHO 1 -#define TARGET_VERSION fprintf (stderr, " (i686 Darwin)"); +/* APPLE LOCAL begin default to ppro */ +/* Default to -mcpu=pentiumpro instead of i386 (radar 2730299) ilr */ +#undef TARGET_CPU_DEFAULT +#define TARGET_CPU_DEFAULT 4 +/* APPLE LOCAL end default to ppro */ + +#define TARGET_VERSION fprintf (stderr, " (i386 Darwin)"); #define TARGET_OS_CPP_BUILTINS() \ do \ { \ builtin_define ("__i386__"); \ builtin_define ("__LITTLE_ENDIAN__"); \ - builtin_define ("__MACH__"); \ - builtin_define ("__APPLE__"); \ + /* APPLE LOCAL constant cfstrings */ \ + SUBTARGET_OS_CPP_BUILTINS (); \ } \ while (0) @@ -39,19 +45,51 @@ Boston, MA 02111-1307, USA. */ the kernel or some such. */ #undef CC1_SPEC -#define CC1_SPEC "%{!static:-fPIC}" +/* APPLE LOCAL dynamic-no-pic */ +/* APPLE LOCAL ignore -mcpu=G4 -mcpu=G5 */ +/* When -mdynamic-no-pic finally works, remove the "xx" below. FIXME!! */ +#define CC1_SPEC "%{!static:%{!mxxdynamic-no-pic:-fPIC}} %<faltivec %<mlong-branch %<mlongcall %<mcpu=G4 %<mcpu=G5" + +/* APPLE LOCAL AltiVec */ +#define CPP_ALTIVEC_SPEC "%<faltivec" + +/* APPLE LOCAL begin 3492132 */ -#define ASM_SPEC "-arch i686 \ +#define ASM_SPEC "%(darwin_arch_asm_spec)\ -force_cpusubtype_ALL \ %{Zforce_cpusubtype_ALL:-force_cpusubtype_ALL} \ %{!Zforce_cpusubtype_ALL:%{mmmx:-force_cpusubtype_ALL}\ %{msse:-force_cpusubtype_ALL}\ %{msse2:-force_cpusubtype_ALL}}" +#define DARWIN_ARCH_LD_SPEC \ +"%{march=i386: %{!Zdynamiclib:-arch i386} %{Zdynamiclib:-arch_only i386}} \ + %{march=i486: %{!Zdynamiclib:-arch i486} %{Zdynamiclib:-arch_only i486}} \ + %{march=i586: %{!Zdynamiclib:-arch i586} %{Zdynamiclib:-arch_only i586}} \ + %{march=pentium: %{!Zdynamiclib:-arch pentium} %{Zdynamiclib:-arch_only pentium}} \ + %{march=pentiumpro: %{!Zdynamiclib:-arch pentpro} %{Zdynamiclib:-arch_only pentpro}} \ + %{march=i686: %{!Zdynamiclib:-arch i686} %{Zdynamiclib:-arch_only i686}} \ + %{march=pentium3: %{!Zdynamiclib:-arch pentIIm3} %{Zdynamiclib:-arch_only pentIIm3}} \ + %{!mcpu*:%{!march*:%{!Zdynamiclib:-arch i686} %{Zdynamiclib:-arch_only i686}}} " + +#define DARWIN_ARCH_ASM_SPEC \ +"%{march=i386: -arch i386} \ + %{march=i486: -arch i486} \ + %{march=i586: -arch i586} \ + %{march=pentium: -arch pentium} \ + %{march=pentiumpro: -arch pentpro} \ + %{march=i686: -arch i686} \ + %{march=pentium3: -arch pentIIm3} \ + %{!mcpu*:%{!march*: -arch i686}} " + #undef SUBTARGET_EXTRA_SPECS -#define SUBTARGET_EXTRA_SPECS \ +#define SUBTARGET_EXTRA_SPECS \ + { "darwin_arch_asm_spec", DARWIN_ARCH_ASM_SPEC }, \ + { "darwin_arch_ld_spec", DARWIN_ARCH_LD_SPEC }, \ { "darwin_arch", "i686" }, +/* APPLE LOCAL end 3492132 */ + /* Use the following macro for any Darwin/x86-specific command-line option translation. */ #define SUBTARGET_OPTION_TRANSLATE_TABLE \ @@ -104,7 +142,12 @@ Boston, MA 02111-1307, USA. */ #define ASM_OUTPUT_ALIGN(FILE,LOG) \ do { if ((LOG) != 0) \ { \ - if (in_text_section ()) \ + /* APPLE LOCAL coalescing */ \ + if (in_text_section () \ + || in_unlikely_text_section () \ + || darwin_named_section_is ("__TEXT,__textcoal,coalesced") \ + || darwin_named_section_is ("__TEXT,__textcoal_nt,coalesced,no_toc") \ + || darwin_named_section_is (STATIC_INIT_SECTION)) \ fprintf (FILE, "\t%s %d,0x90\n", ALIGN_ASM_OP, (LOG)); \ else \ fprintf (FILE, "\t%s %d\n", ALIGN_ASM_OP, (LOG)); \ @@ -127,6 +170,27 @@ Boston, MA 02111-1307, USA. */ assemble_name ((FILE), (NAME)), \ fprintf ((FILE), ","HOST_WIDE_INT_PRINT_UNSIGNED"\n", (ROUNDED))) + +/* APPLE LOCAL begin Macintosh alignment 2002-2-19 ff */ +#define MASK_ALIGN_NATURAL 0x40000000 +#define TARGET_ALIGN_NATURAL (target_flags & MASK_ALIGN_NATURAL) +#define rs6000_alignment_flags target_flags +#define MASK_ALIGN_MAC68K 0x20000000 +#define TARGET_ALIGN_MAC68K (target_flags & MASK_ALIGN_MAC68K) + +#undef SUBTARGET_SWITCHES +#define SUBTARGET_SWITCHES \ + {"align-mac68k", MASK_ALIGN_MAC68K, \ + N_("Align structs and unions according to mac68k rules")}, \ + {"align-power", - (MASK_ALIGN_MAC68K | MASK_ALIGN_NATURAL), \ + N_("Align structs and unions according to PowerPC rules")}, \ + {"align-natural", MASK_ALIGN_NATURAL, \ + N_("Align structs and unions according to natural rules")}, \ + {"dynamic-no-pic", MASK_MACHO_DYNAMIC_NO_PIC, \ + N_("Generate code suitable for executables (NOT shared libs)")},\ + {"no-dynamic-no-pic", -MASK_MACHO_DYNAMIC_NO_PIC, ""}, +/* APPLE LOCAL end Macintosh alignment 2002-2-19 ff */ + /* Darwin profiling -- call mcount. */ #undef FUNCTION_PROFILER #define FUNCTION_PROFILER(FILE, LABELNO) \ @@ -139,3 +203,14 @@ Boston, MA 02111-1307, USA. */ } \ else fprintf (FILE, "\tcall mcount\n"); \ } while (0) + +/* APPLE LOCAL SSE stack alignment */ +#define BASIC_STACK_BOUNDARY (128) + +#undef SUBTARGET_OVERRIDE_OPTIONS +/* Force Darwin/x86 to default as "-march=i686 -mcpu=pentium4". */ +#define SUBTARGET_OVERRIDE_OPTIONS \ + do { \ + if (!ix86_arch_string) ix86_arch_string = "pentiumpro"; \ + if (!ix86_tune_string) ix86_tune_string = "pentium4"; \ + } while (0) diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 58e26333a5c..ceeecb7ebd1 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -459,6 +459,34 @@ struct processor_costs pentium4_cost = { const struct processor_costs *ix86_cost = &pentium_cost; +/* APPLE LOCAL begin Altivec */ +/* vector types */ +static GTY(()) tree unsigned_V16QI_type_node; +static GTY(()) tree unsigned_V4SI_type_node; +static GTY(()) tree unsigned_V8QI_type_node; +static GTY(()) tree unsigned_V8HI_type_node; +static GTY(()) tree unsigned_V4HI_type_node; +static GTY(()) tree unsigned_V2HI_type_node; +static GTY(()) tree unsigned_V2SI_type_node; +static GTY(()) tree unsigned_V2DI_type_node; +static GTY(()) tree unsigned_V1DI_type_node; + +static GTY(()) tree V16QI_type_node; +static GTY(()) tree V4SF_type_node; +static GTY(()) tree V4SI_type_node; +static GTY(()) tree V8QI_type_node; +static GTY(()) tree V8HI_type_node; +static GTY(()) tree V4HI_type_node; +static GTY(()) tree V2HI_type_node; +static GTY(()) tree V2SI_type_node; +static GTY(()) tree V2SF_type_node; +static GTY(()) tree V2DI_type_node; +static GTY(()) tree V2DF_type_node; +static GTY(()) tree V16SF_type_node; +static GTY(()) tree V1DI_type_node; +static GTY(()) tree V4DF_type_node; +/* APPLE LOCAL end Altivec */ + /* Processor feature/optimization bitmasks. */ #define m_386 (1<<PROCESSOR_I386) #define m_486 (1<<PROCESSOR_I486) @@ -1004,6 +1032,12 @@ static void init_ext_80387_constants (void); #undef TARGET_ADDRESS_COST #define TARGET_ADDRESS_COST ix86_address_cost +/* APPLE LOCAL begin SSE stack alignment */ +#ifndef BASIC_STACK_BOUNDARY +#define BASIC_STACK_BOUNDARY (32) +#endif +/* APPLE LOCAL end SSE stack alignment */ + #undef TARGET_FIXED_CONDITION_CODE_REGS #define TARGET_FIXED_CONDITION_CODE_REGS ix86_fixed_condition_code_regs #undef TARGET_CC_MODES_COMPATIBLE @@ -1165,6 +1199,12 @@ override_options (void) SUBTARGET_OVERRIDE_OPTIONS; #endif + /* APPLE LOCAL begin constant cfstrings */ +#ifdef SUBSUBTARGET_OVERRIDE_OPTIONS + SUBSUBTARGET_OVERRIDE_OPTIONS; +#endif + /* APPLE LOCAL end constant cfstrings */ + if (!ix86_tune_string && ix86_arch_string) ix86_tune_string = ix86_arch_string; if (!ix86_tune_string) @@ -1345,9 +1385,11 @@ override_options (void) The default of 128 bits is for Pentium III's SSE __m128, but we don't want additional code to keep the stack aligned when optimizing for code size. */ + /* APPLE LOCAL begin SSE stack alignment */ ix86_preferred_stack_boundary = (optimize_size - ? TARGET_64BIT ? 128 : 32 + ? TARGET_64BIT ? 128 : BASIC_STACK_BOUNDARY : 128); + /* APPLE LOCAL end SSE stack alignment */ if (ix86_preferred_stack_boundary_string) { i = atoi (ix86_preferred_stack_boundary_string); @@ -1485,11 +1527,24 @@ override_options (void) internal_label_prefix_len = p - internal_label_prefix; *p = '\0'; } + + /* APPLE LOCAL begin dynamic-no-pic */ + if (flag_pic == 1) + { + /* Darwin doesn't support -fpic. */ + warning ("-fpic is not supported; -fPIC assumed"); + flag_pic = 2; + } + /* APPLE LOCAL end dynamic-no-pic */ } void optimization_options (int level, int size ATTRIBUTE_UNUSED) { + /* APPLE LOCAL disable strict aliasing; breaks too much existing code. */ +#if TARGET_MACHO + flag_strict_aliasing = 0; +#endif /* For -O2 and beyond, turn off -fschedule-insns by default. It tends to make the problem with not enough registers even worse. */ #ifdef INSN_SCHEDULING @@ -1529,6 +1584,11 @@ const struct attribute_spec ix86_attribute_table[] = #endif { "ms_struct", 0, 0, false, false, false, ix86_handle_struct_attribute }, { "gcc_struct", 0, 0, false, false, false, ix86_handle_struct_attribute }, + /* APPLE LOCAL begin double destructor */ +#ifdef SUBTARGET_ATTRIBUTE_TABLE + SUBTARGET_ATTRIBUTE_TABLE +#endif + /* APPLE LOCAL end double destructor */ { NULL, 0, 0, false, false, false, NULL } }; @@ -12914,6 +12974,12 @@ ix86_init_builtins (void) { if (TARGET_MMX) ix86_init_mmx_sse_builtins (); + + /* APPLE LOCAL begin constant cfstrings */ +#ifdef SUBTARGET_INIT_BUILTINS + SUBTARGET_INIT_BUILTINS; +#endif + /* APPLE LOCAL end constant cfstrings */ } /* Set up all the MMX/SSE builtins. This is not called if TARGET_MMX diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h index b90f590b98a..009ef8fae57 100644 --- a/gcc/config/i386/i386.h +++ b/gcc/config/i386/i386.h @@ -34,6 +34,9 @@ Boston, MA 02111-1307, USA. */ ADDR_BEG, ADDR_END, PRINT_IREG, PRINT_SCALE, PRINT_B_I_S, and many that start with ASM_ or end in ASM_OP. */ +/* APPLE LOCAL fat builds */ +#define DEFAULT_TARGET_ARCH "i386" + /* Define the specific costs for a given cpu */ struct processor_costs { @@ -207,6 +210,11 @@ extern int target_flags; #endif #endif +/* APPLE LOCAL begin hot/cold partitioning */ +#define HAS_LONG_COND_BRANCH 1 +#define HAS_LONG_UNCOND_BRANCH 1 +/* APPLE LOCAL end hot/cold partitioning */ + /* Avoid adding %gs:0 in TLS references; use %gs:address directly. */ #define TARGET_TLS_DIRECT_SEG_REFS (target_flags & MASK_TLS_DIRECT_SEG_REFS) @@ -774,7 +782,8 @@ extern int x86_prefetch_sse; #define PARM_BOUNDARY BITS_PER_WORD /* Boundary (in *bits*) on which stack pointer should be aligned. */ -#define STACK_BOUNDARY BITS_PER_WORD +/* APPLE LOCAL 3232990 - compiler should obey -mpreferred-stack-boundary */ +#define STACK_BOUNDARY ((ix86_preferred_stack_boundary > 128) ? 128 : ix86_preferred_stack_boundary) /* Boundary (in *bits*) on which the stack pointer prefers to be aligned; the compiler cannot rely on having this alignment. */ @@ -825,7 +834,8 @@ extern int x86_prefetch_sse; #define BIGGEST_FIELD_ALIGNMENT 32 #endif #else -#define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \ +/* APPLE LOCAL Macintosh alignment */ +#define ADJUST_FIELD_ALIGN(FIELD, COMPUTED, FIRST_FIELD_P) \ x86_field_alignment (FIELD, COMPUTED) #endif @@ -1069,6 +1079,10 @@ do { \ : VALID_MMX_REG_MODE (MODE) && TARGET_MMX ? 1 \ : VALID_MMX_REG_MODE_3DNOW (MODE) && TARGET_3DNOW ? 1 : 0) +/* ??? Shouldn't be needed... */ +#define UNITS_PER_SIMD_WORD \ + (TARGET_SSE ? 16 : TARGET_MMX || TARGET_3DNOW ? 8 : 0) + #define VALID_FP_MODE_P(MODE) \ ((MODE) == SFmode || (MODE) == DFmode || (MODE) == XFmode \ || (MODE) == SCmode || (MODE) == DCmode || (MODE) == XCmode) \ @@ -2485,7 +2499,10 @@ enum ix86_builtins IX86_BUILTIN_MONITOR, IX86_BUILTIN_MWAIT, - IX86_BUILTIN_MAX + /* APPLE LOCAL begin constant cfstrings */ + IX86_BUILTIN_MAX, + TARGET_BUILTIN_MAX = IX86_BUILTIN_MAX + /* APPLE LOCAL end constant cfstrings */ }; /* Max number of args passed in registers. If this is more than 3, we will |