i386.h revision 169706
1132744Skan/* Definitions of target machine for GCC for IA-32. 290285Sobrien Copyright (C) 1988, 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 3169706Skan 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. 418334Speter 5132744SkanThis file is part of GCC. 618334Speter 7132744SkanGCC is free software; you can redistribute it and/or modify 818334Speterit under the terms of the GNU General Public License as published by 918334Speterthe Free Software Foundation; either version 2, or (at your option) 1018334Speterany later version. 1118334Speter 12132744SkanGCC is distributed in the hope that it will be useful, 1318334Speterbut WITHOUT ANY WARRANTY; without even the implied warranty of 1418334SpeterMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1518334SpeterGNU General Public License for more details. 1618334Speter 1718334SpeterYou should have received a copy of the GNU General Public License 18132744Skanalong with GCC; see the file COPYING. If not, write to 19169706Skanthe Free Software Foundation, 51 Franklin Street, Fifth Floor, 20169706SkanBoston, MA 02110-1301, USA. */ 2118334Speter 2218334Speter/* The purpose of this file is to define the characteristics of the i386, 2318334Speter independent of assembler syntax or operating system. 2418334Speter 2518334Speter Three other files build on this one to describe a specific assembler syntax: 2618334Speter bsd386.h, att386.h, and sun386.h. 2718334Speter 2818334Speter The actual tm.h file for a particular system should include 2918334Speter this file, and then the file for the appropriate assembler syntax. 3018334Speter 3118334Speter Many macros that specify assembler syntax are omitted entirely from 3218334Speter this file because they really belong in the files for particular 3390285Sobrien assemblers. These include RP, IP, LPREFIX, PUT_OP_SIZE, USE_STAR, 3490285Sobrien ADDR_BEG, ADDR_END, PRINT_IREG, PRINT_SCALE, PRINT_B_I_S, and many 3590285Sobrien that start with ASM_ or end in ASM_OP. */ 3618334Speter 3750654Sobrien/* Define the specific costs for a given cpu */ 3850654Sobrien 3950654Sobrienstruct processor_costs { 4090285Sobrien const int add; /* cost of an add instruction */ 4190285Sobrien const int lea; /* cost of a lea instruction */ 4290285Sobrien const int shift_var; /* variable shift costs */ 4390285Sobrien const int shift_const; /* constant shift costs */ 44169706Skan const int mult_init[5]; /* cost of starting a multiply 45132744Skan in QImode, HImode, SImode, DImode, TImode*/ 4690285Sobrien const int mult_bit; /* cost of multiply per each bit set */ 47169706Skan const int divide[5]; /* cost of a divide/mod 48132744Skan in QImode, HImode, SImode, DImode, TImode*/ 4990285Sobrien int movsx; /* The cost of movsx operation. */ 5090285Sobrien int movzx; /* The cost of movzx operation. */ 5190285Sobrien const int large_insn; /* insns larger than this cost more */ 5290285Sobrien const int move_ratio; /* The threshold of number of scalar 5390285Sobrien memory-to-memory move insns. */ 5490285Sobrien const int movzbl_load; /* cost of loading using movzbl */ 5590285Sobrien const int int_load[3]; /* cost of loading integer registers 5690285Sobrien in QImode, HImode and SImode relative 5790285Sobrien to reg-reg move (2). */ 5890285Sobrien const int int_store[3]; /* cost of storing integer register 5990285Sobrien in QImode, HImode and SImode */ 6090285Sobrien const int fp_move; /* cost of reg,reg fld/fst */ 6190285Sobrien const int fp_load[3]; /* cost of loading FP register 6290285Sobrien in SFmode, DFmode and XFmode */ 6390285Sobrien const int fp_store[3]; /* cost of storing FP register 6490285Sobrien in SFmode, DFmode and XFmode */ 6590285Sobrien const int mmx_move; /* cost of moving MMX register. */ 6690285Sobrien const int mmx_load[2]; /* cost of loading MMX register 6790285Sobrien in SImode and DImode */ 6890285Sobrien const int mmx_store[2]; /* cost of storing MMX register 6990285Sobrien in SImode and DImode */ 7090285Sobrien const int sse_move; /* cost of moving SSE register. */ 7190285Sobrien const int sse_load[3]; /* cost of loading SSE register 7290285Sobrien in SImode, DImode and TImode*/ 7390285Sobrien const int sse_store[3]; /* cost of storing SSE register 7490285Sobrien in SImode, DImode and TImode*/ 7590285Sobrien const int mmxsse_to_integer; /* cost of moving mmxsse register to 7690285Sobrien integer and vice versa. */ 7790285Sobrien const int prefetch_block; /* bytes moved to cache for prefetch. */ 7890285Sobrien const int simultaneous_prefetches; /* number of parallel prefetch 7990285Sobrien operations. */ 80132744Skan const int branch_cost; /* Default value for BRANCH_COST. */ 81117407Skan const int fadd; /* cost of FADD and FSUB instructions. */ 82117407Skan const int fmul; /* cost of FMUL instruction. */ 83117407Skan const int fdiv; /* cost of FDIV instruction. */ 84117407Skan const int fabs; /* cost of FABS instruction. */ 85117407Skan const int fchs; /* cost of FCHS instruction. */ 86117407Skan const int fsqrt; /* cost of FSQRT instruction. */ 8750654Sobrien}; 8850654Sobrien 8990285Sobrienextern const struct processor_costs *ix86_cost; 9050654Sobrien 9118334Speter/* Macros used in the machine description to test the flags. */ 9218334Speter 9318334Speter/* configure can arrange to make this 2, to force a 486. */ 9490285Sobrien 9518334Speter#ifndef TARGET_CPU_DEFAULT 96169706Skan#define TARGET_CPU_DEFAULT TARGET_CPU_DEFAULT_generic 9718334Speter#endif 98169706Skan 99169706Skan#ifndef TARGET_FPMATH_DEFAULT 100169706Skan#define TARGET_FPMATH_DEFAULT \ 101169706Skan (TARGET_64BIT && TARGET_SSE ? FPMATH_SSE : FPMATH_387) 102132744Skan#endif 10318334Speter 104169706Skan#define TARGET_FLOAT_RETURNS_IN_80387 TARGET_FLOAT_RETURNS 105117407Skan 106117407Skan/* 64bit Sledgehammer mode. For libgcc2 we make sure this is a 107117407Skan compile-time constant. */ 108117407Skan#ifdef IN_LIBGCC2 109169706Skan#undef TARGET_64BIT 110117407Skan#ifdef __x86_64__ 111117407Skan#define TARGET_64BIT 1 112117407Skan#else 113117407Skan#define TARGET_64BIT 0 114117407Skan#endif 115117407Skan#else 116169706Skan#ifndef TARGET_BI_ARCH 117169706Skan#undef TARGET_64BIT 118117407Skan#if TARGET_64BIT_DEFAULT 11990285Sobrien#define TARGET_64BIT 1 12090285Sobrien#else 12190285Sobrien#define TARGET_64BIT 0 12290285Sobrien#endif 12390285Sobrien#endif 124117407Skan#endif 12518334Speter 126169706Skan#define HAS_LONG_COND_BRANCH 1 127169706Skan#define HAS_LONG_UNCOND_BRANCH 1 12852295Sobrien 129132744Skan#define TARGET_386 (ix86_tune == PROCESSOR_I386) 130132744Skan#define TARGET_486 (ix86_tune == PROCESSOR_I486) 131132744Skan#define TARGET_PENTIUM (ix86_tune == PROCESSOR_PENTIUM) 132132744Skan#define TARGET_PENTIUMPRO (ix86_tune == PROCESSOR_PENTIUMPRO) 133132744Skan#define TARGET_K6 (ix86_tune == PROCESSOR_K6) 134132744Skan#define TARGET_ATHLON (ix86_tune == PROCESSOR_ATHLON) 135132744Skan#define TARGET_PENTIUM4 (ix86_tune == PROCESSOR_PENTIUM4) 136132744Skan#define TARGET_K8 (ix86_tune == PROCESSOR_K8) 137132744Skan#define TARGET_ATHLON_K8 (TARGET_K8 || TARGET_ATHLON) 138169706Skan#define TARGET_NOCONA (ix86_tune == PROCESSOR_NOCONA) 139169706Skan#define TARGET_GENERIC32 (ix86_tune == PROCESSOR_GENERIC32) 140169706Skan#define TARGET_GENERIC64 (ix86_tune == PROCESSOR_GENERIC64) 141169706Skan#define TARGET_GENERIC (TARGET_GENERIC32 || TARGET_GENERIC64) 142132744Skan 143132744Skan#define TUNEMASK (1 << ix86_tune) 14452295Sobrienextern const int x86_use_leave, x86_push_memory, x86_zero_extend_with_and; 14552295Sobrienextern const int x86_use_bit_test, x86_cmove, x86_deep_branch; 14690285Sobrienextern const int x86_branch_hints, x86_unroll_strlen; 14790285Sobrienextern const int x86_double_with_add, x86_partial_reg_stall, x86_movx; 148169706Skanextern const int x86_use_himode_fiop, x86_use_simode_fiop; 149169706Skanextern const int x86_use_mov0, x86_use_cltd, x86_read_modify_write; 15090285Sobrienextern const int x86_read_modify, x86_split_long_moves; 151117407Skanextern const int x86_promote_QImode, x86_single_stringop, x86_fast_prefix; 15290285Sobrienextern const int x86_himode_math, x86_qimode_math, x86_promote_qi_regs; 15390285Sobrienextern const int x86_promote_hi_regs, x86_integer_DFmode_moves; 15490285Sobrienextern const int x86_add_esp_4, x86_add_esp_8, x86_sub_esp_4, x86_sub_esp_8; 15590285Sobrienextern const int x86_partial_reg_dependency, x86_memory_mismatch_stall; 15690285Sobrienextern const int x86_accumulate_outgoing_args, x86_prologue_using_move; 15790285Sobrienextern const int x86_epilogue_using_move, x86_decompose_lea; 158117407Skanextern const int x86_arch_always_fancy_math_387, x86_shift1; 159169706Skanextern const int x86_sse_partial_reg_dependency, x86_sse_split_regs; 160132744Skanextern const int x86_sse_typeless_stores, x86_sse_load0_by_pxor; 161169706Skanextern const int x86_use_ffreep; 162169706Skanextern const int x86_inter_unit_moves, x86_schedule; 163169706Skanextern const int x86_use_bt; 164169706Skanextern const int x86_cmpxchg, x86_cmpxchg8b, x86_cmpxchg16b, x86_xadd; 165169706Skanextern const int x86_use_incdec; 166169706Skanextern const int x86_pad_returns; 167169706Skanextern const int x86_partial_flag_reg_stall; 16890285Sobrienextern int x86_prefetch_sse; 16952295Sobrien 170132744Skan#define TARGET_USE_LEAVE (x86_use_leave & TUNEMASK) 171132744Skan#define TARGET_PUSH_MEMORY (x86_push_memory & TUNEMASK) 172132744Skan#define TARGET_ZERO_EXTEND_WITH_AND (x86_zero_extend_with_and & TUNEMASK) 173132744Skan#define TARGET_USE_BIT_TEST (x86_use_bit_test & TUNEMASK) 174132744Skan#define TARGET_UNROLL_STRLEN (x86_unroll_strlen & TUNEMASK) 17590285Sobrien/* For sane SSE instruction set generation we need fcomi instruction. It is 17690285Sobrien safe to enable all CMOVE instructions. */ 17790285Sobrien#define TARGET_CMOVE ((x86_cmove & (1 << ix86_arch)) || TARGET_SSE) 178169706Skan#define TARGET_FISTTP (TARGET_SSE3 && TARGET_80387) 179132744Skan#define TARGET_DEEP_BRANCH_PREDICTION (x86_deep_branch & TUNEMASK) 180132744Skan#define TARGET_BRANCH_PREDICTION_HINTS (x86_branch_hints & TUNEMASK) 181132744Skan#define TARGET_DOUBLE_WITH_ADD (x86_double_with_add & TUNEMASK) 182132744Skan#define TARGET_USE_SAHF ((x86_use_sahf & TUNEMASK) && !TARGET_64BIT) 183132744Skan#define TARGET_MOVX (x86_movx & TUNEMASK) 184132744Skan#define TARGET_PARTIAL_REG_STALL (x86_partial_reg_stall & TUNEMASK) 185169706Skan#define TARGET_PARTIAL_FLAG_REG_STALL (x86_partial_flag_reg_stall & TUNEMASK) 186169706Skan#define TARGET_USE_HIMODE_FIOP (x86_use_himode_fiop & TUNEMASK) 187169706Skan#define TARGET_USE_SIMODE_FIOP (x86_use_simode_fiop & TUNEMASK) 188132744Skan#define TARGET_USE_MOV0 (x86_use_mov0 & TUNEMASK) 189132744Skan#define TARGET_USE_CLTD (x86_use_cltd & TUNEMASK) 190132744Skan#define TARGET_SPLIT_LONG_MOVES (x86_split_long_moves & TUNEMASK) 191132744Skan#define TARGET_READ_MODIFY_WRITE (x86_read_modify_write & TUNEMASK) 192132744Skan#define TARGET_READ_MODIFY (x86_read_modify & TUNEMASK) 193132744Skan#define TARGET_PROMOTE_QImode (x86_promote_QImode & TUNEMASK) 194132744Skan#define TARGET_FAST_PREFIX (x86_fast_prefix & TUNEMASK) 195132744Skan#define TARGET_SINGLE_STRINGOP (x86_single_stringop & TUNEMASK) 196132744Skan#define TARGET_QIMODE_MATH (x86_qimode_math & TUNEMASK) 197132744Skan#define TARGET_HIMODE_MATH (x86_himode_math & TUNEMASK) 198132744Skan#define TARGET_PROMOTE_QI_REGS (x86_promote_qi_regs & TUNEMASK) 199132744Skan#define TARGET_PROMOTE_HI_REGS (x86_promote_hi_regs & TUNEMASK) 200132744Skan#define TARGET_ADD_ESP_4 (x86_add_esp_4 & TUNEMASK) 201132744Skan#define TARGET_ADD_ESP_8 (x86_add_esp_8 & TUNEMASK) 202132744Skan#define TARGET_SUB_ESP_4 (x86_sub_esp_4 & TUNEMASK) 203132744Skan#define TARGET_SUB_ESP_8 (x86_sub_esp_8 & TUNEMASK) 204132744Skan#define TARGET_INTEGER_DFMODE_MOVES (x86_integer_DFmode_moves & TUNEMASK) 205132744Skan#define TARGET_PARTIAL_REG_DEPENDENCY (x86_partial_reg_dependency & TUNEMASK) 206132744Skan#define TARGET_SSE_PARTIAL_REG_DEPENDENCY \ 207132744Skan (x86_sse_partial_reg_dependency & TUNEMASK) 208169706Skan#define TARGET_SSE_SPLIT_REGS (x86_sse_split_regs & TUNEMASK) 209132744Skan#define TARGET_SSE_TYPELESS_STORES (x86_sse_typeless_stores & TUNEMASK) 210132744Skan#define TARGET_SSE_LOAD0_BY_PXOR (x86_sse_load0_by_pxor & TUNEMASK) 211132744Skan#define TARGET_MEMORY_MISMATCH_STALL (x86_memory_mismatch_stall & TUNEMASK) 212132744Skan#define TARGET_PROLOGUE_USING_MOVE (x86_prologue_using_move & TUNEMASK) 213132744Skan#define TARGET_EPILOGUE_USING_MOVE (x86_epilogue_using_move & TUNEMASK) 21490285Sobrien#define TARGET_PREFETCH_SSE (x86_prefetch_sse) 215132744Skan#define TARGET_SHIFT1 (x86_shift1 & TUNEMASK) 216132744Skan#define TARGET_USE_FFREEP (x86_use_ffreep & TUNEMASK) 217132744Skan#define TARGET_REP_MOVL_OPTIMAL (x86_rep_movl_optimal & TUNEMASK) 218132744Skan#define TARGET_INTER_UNIT_MOVES (x86_inter_unit_moves & TUNEMASK) 219169706Skan#define TARGET_FOUR_JUMP_LIMIT (x86_four_jump_limit & TUNEMASK) 220169706Skan#define TARGET_SCHEDULE (x86_schedule & TUNEMASK) 221169706Skan#define TARGET_USE_BT (x86_use_bt & TUNEMASK) 222169706Skan#define TARGET_USE_INCDEC (x86_use_incdec & TUNEMASK) 223169706Skan#define TARGET_PAD_RETURNS (x86_pad_returns & TUNEMASK) 22452295Sobrien 22590285Sobrien#define ASSEMBLER_DIALECT (ix86_asm_dialect) 22690285Sobrien 22790285Sobrien#define TARGET_SSE_MATH ((ix86_fpmath & FPMATH_SSE) != 0) 22890285Sobrien#define TARGET_MIX_SSE_I387 ((ix86_fpmath & FPMATH_SSE) \ 22990285Sobrien && (ix86_fpmath & FPMATH_387)) 23090285Sobrien 231117407Skan#define TARGET_GNU_TLS (ix86_tls_dialect == TLS_DIALECT_GNU) 232169706Skan#define TARGET_GNU2_TLS (ix86_tls_dialect == TLS_DIALECT_GNU2) 233169706Skan#define TARGET_ANY_GNU_TLS (TARGET_GNU_TLS || TARGET_GNU2_TLS) 234117407Skan#define TARGET_SUN_TLS (ix86_tls_dialect == TLS_DIALECT_SUN) 235117407Skan 236169706Skan#define TARGET_CMPXCHG (x86_cmpxchg & (1 << ix86_arch)) 237169706Skan#define TARGET_CMPXCHG8B (x86_cmpxchg8b & (1 << ix86_arch)) 238169706Skan#define TARGET_CMPXCHG16B (x86_cmpxchg16b & (1 << ix86_arch)) 239169706Skan#define TARGET_XADD (x86_xadd & (1 << ix86_arch)) 24096294Sobrien 241117407Skan#ifndef TARGET_64BIT_DEFAULT 242117407Skan#define TARGET_64BIT_DEFAULT 0 24390285Sobrien#endif 244132744Skan#ifndef TARGET_TLS_DIRECT_SEG_REFS_DEFAULT 245132744Skan#define TARGET_TLS_DIRECT_SEG_REFS_DEFAULT 0 246132744Skan#endif 24790285Sobrien 248117407Skan/* Once GDB has been enhanced to deal with functions without frame 249117407Skan pointers, we can change this to allow for elimination of 250117407Skan the frame pointer in leaf functions. */ 251117407Skan#define TARGET_DEFAULT 0 25250654Sobrien 253117407Skan/* This is not really a target flag, but is done this way so that 254117407Skan it's analogous to similar code for Mach-O on PowerPC. darwin.h 255117407Skan redefines this to 1. */ 256117407Skan#define TARGET_MACHO 0 25750654Sobrien 258146908Skan/* Subtargets may reset this to 1 in order to enable 96-bit long double 259146908Skan with the rounding mode forced to 53 bits. */ 260146908Skan#define TARGET_96_ROUND_53_LONG_DOUBLE 0 261146908Skan 26218334Speter/* Sometimes certain combinations of command options do not make 26318334Speter sense on a particular target machine. You can define a macro 26418334Speter `OVERRIDE_OPTIONS' to take account of this. This macro, if 26518334Speter defined, is executed once just after all the command options have 26618334Speter been parsed. 26718334Speter 26818334Speter Don't use this macro to turn on various extra optimizations for 26918334Speter `-O'. That is what `OPTIMIZATION_OPTIONS' is for. */ 27018334Speter 27118334Speter#define OVERRIDE_OPTIONS override_options () 27218334Speter 27350654Sobrien/* Define this to change the optimizations performed by default. */ 27490285Sobrien#define OPTIMIZATION_OPTIONS(LEVEL, SIZE) \ 27590285Sobrien optimization_options ((LEVEL), (SIZE)) 27650654Sobrien 277169706Skan/* -march=native handling only makes sense with compiler running on 278169706Skan an x86 or x86_64 chip. If changing this condition, also change 279169706Skan the condition in driver-i386.c. */ 280169706Skan#if defined(__i386__) || defined(__x86_64__) 281169706Skan/* In driver-i386.c. */ 282169706Skanextern const char *host_detect_local_cpu (int argc, const char **argv); 283169706Skan#define EXTRA_SPEC_FUNCTIONS \ 284169706Skan { "local_cpu_detect", host_detect_local_cpu }, 285169706Skan#define HAVE_LOCAL_CPU_DETECT 286169706Skan#endif 287169706Skan 288169706Skan/* Support for configure-time defaults of some command line options. 289169706Skan The order here is important so that -march doesn't squash the 290169706Skan tune or cpu values. */ 291132744Skan#define OPTION_DEFAULT_SPECS \ 292132744Skan {"tune", "%{!mtune=*:%{!mcpu=*:%{!march=*:-mtune=%(VALUE)}}}" }, \ 293169706Skan {"cpu", "%{!mtune=*:%{!mcpu=*:%{!march=*:-mtune=%(VALUE)}}}" }, \ 294169706Skan {"arch", "%{!march=*:-march=%(VALUE)}"} 295132744Skan 29650654Sobrien/* Specs for the compiler proper */ 29750654Sobrien 29850654Sobrien#ifndef CC1_CPU_SPEC 299169706Skan#define CC1_CPU_SPEC_1 "\ 300132744Skan%{!mtune*: \ 301132744Skan%{m386:mtune=i386 \ 302132744Skan%n`-m386' is deprecated. Use `-march=i386' or `-mtune=i386' instead.\n} \ 303132744Skan%{m486:-mtune=i486 \ 304132744Skan%n`-m486' is deprecated. Use `-march=i486' or `-mtune=i486' instead.\n} \ 305132744Skan%{mpentium:-mtune=pentium \ 306132744Skan%n`-mpentium' is deprecated. Use `-march=pentium' or `-mtune=pentium' instead.\n} \ 307132744Skan%{mpentiumpro:-mtune=pentiumpro \ 308132744Skan%n`-mpentiumpro' is deprecated. Use `-march=pentiumpro' or `-mtune=pentiumpro' instead.\n} \ 309132744Skan%{mcpu=*:-mtune=%* \ 310132744Skan%n`-mcpu=' is deprecated. Use `-mtune=' or '-march=' instead.\n}} \ 311132744Skan%<mcpu=* \ 31290285Sobrien%{mintel-syntax:-masm=intel \ 31390285Sobrien%n`-mintel-syntax' is deprecated. Use `-masm=intel' instead.\n} \ 31490285Sobrien%{mno-intel-syntax:-masm=att \ 31590285Sobrien%n`-mno-intel-syntax' is deprecated. Use `-masm=att' instead.\n}" 316169706Skan 317169706Skan#ifndef HAVE_LOCAL_CPU_DETECT 318169706Skan#define CC1_CPU_SPEC CC1_CPU_SPEC_1 319169706Skan#else 320169706Skan#define CC1_CPU_SPEC CC1_CPU_SPEC_1 \ 321169706Skan"%{march=native:%<march=native %:local_cpu_detect(arch) \ 322169706Skan %{!mtune=*:%<mtune=native %:local_cpu_detect(tune)}} \ 323169706Skan%{mtune=native:%<mtune=native %:local_cpu_detect(tune)}" 32450654Sobrien#endif 325169706Skan#endif 32618334Speter 327117407Skan/* Target CPU builtins. */ 328117407Skan#define TARGET_CPU_CPP_BUILTINS() \ 329117407Skan do \ 330117407Skan { \ 331117407Skan size_t arch_len = strlen (ix86_arch_string); \ 332132744Skan size_t tune_len = strlen (ix86_tune_string); \ 333117407Skan int last_arch_char = ix86_arch_string[arch_len - 1]; \ 334132744Skan int last_tune_char = ix86_tune_string[tune_len - 1]; \ 335117407Skan \ 336117407Skan if (TARGET_64BIT) \ 337117407Skan { \ 338117407Skan builtin_assert ("cpu=x86_64"); \ 339132744Skan builtin_assert ("machine=x86_64"); \ 340132744Skan builtin_define ("__amd64"); \ 341132744Skan builtin_define ("__amd64__"); \ 342117407Skan builtin_define ("__x86_64"); \ 343117407Skan builtin_define ("__x86_64__"); \ 344117407Skan } \ 345117407Skan else \ 346117407Skan { \ 347117407Skan builtin_assert ("cpu=i386"); \ 348117407Skan builtin_assert ("machine=i386"); \ 349117407Skan builtin_define_std ("i386"); \ 350117407Skan } \ 351117407Skan \ 352132744Skan /* Built-ins based on -mtune= (or -march= if no \ 353132744Skan -mtune= given). */ \ 354117407Skan if (TARGET_386) \ 355117407Skan builtin_define ("__tune_i386__"); \ 356117407Skan else if (TARGET_486) \ 357117407Skan builtin_define ("__tune_i486__"); \ 358117407Skan else if (TARGET_PENTIUM) \ 359117407Skan { \ 360117407Skan builtin_define ("__tune_i586__"); \ 361117407Skan builtin_define ("__tune_pentium__"); \ 362132744Skan if (last_tune_char == 'x') \ 363117407Skan builtin_define ("__tune_pentium_mmx__"); \ 364117407Skan } \ 365117407Skan else if (TARGET_PENTIUMPRO) \ 366117407Skan { \ 367117407Skan builtin_define ("__tune_i686__"); \ 368117407Skan builtin_define ("__tune_pentiumpro__"); \ 369132744Skan switch (last_tune_char) \ 370117407Skan { \ 371117407Skan case '3': \ 372117407Skan builtin_define ("__tune_pentium3__"); \ 373117407Skan /* FALLTHRU */ \ 374117407Skan case '2': \ 375117407Skan builtin_define ("__tune_pentium2__"); \ 376117407Skan break; \ 377117407Skan } \ 378117407Skan } \ 379117407Skan else if (TARGET_K6) \ 380117407Skan { \ 381117407Skan builtin_define ("__tune_k6__"); \ 382132744Skan if (last_tune_char == '2') \ 383117407Skan builtin_define ("__tune_k6_2__"); \ 384132744Skan else if (last_tune_char == '3') \ 385117407Skan builtin_define ("__tune_k6_3__"); \ 386117407Skan } \ 387117407Skan else if (TARGET_ATHLON) \ 388117407Skan { \ 389117407Skan builtin_define ("__tune_athlon__"); \ 390148163Sobrien /* Plain "athlon" & "athlon-tbird" lacks SSE. */ \ 391148163Sobrien if (last_tune_char != 'n' && last_tune_char != 'd') \ 392117407Skan builtin_define ("__tune_athlon_sse__"); \ 393117407Skan } \ 394132744Skan else if (TARGET_K8) \ 395132744Skan builtin_define ("__tune_k8__"); \ 396117407Skan else if (TARGET_PENTIUM4) \ 397117407Skan builtin_define ("__tune_pentium4__"); \ 398169706Skan else if (TARGET_NOCONA) \ 399169706Skan builtin_define ("__tune_nocona__"); \ 400117407Skan \ 401117407Skan if (TARGET_MMX) \ 402117407Skan builtin_define ("__MMX__"); \ 403117407Skan if (TARGET_3DNOW) \ 404117407Skan builtin_define ("__3dNOW__"); \ 405117407Skan if (TARGET_3DNOW_A) \ 406117407Skan builtin_define ("__3dNOW_A__"); \ 407117407Skan if (TARGET_SSE) \ 408117407Skan builtin_define ("__SSE__"); \ 409117407Skan if (TARGET_SSE2) \ 410117407Skan builtin_define ("__SSE2__"); \ 411132744Skan if (TARGET_SSE3) \ 412169706Skan builtin_define ("__SSE3__"); \ 413117407Skan if (TARGET_SSE_MATH && TARGET_SSE) \ 414117407Skan builtin_define ("__SSE_MATH__"); \ 415117407Skan if (TARGET_SSE_MATH && TARGET_SSE2) \ 416117407Skan builtin_define ("__SSE2_MATH__"); \ 417117407Skan \ 418117407Skan /* Built-ins based on -march=. */ \ 419117407Skan if (ix86_arch == PROCESSOR_I486) \ 420117407Skan { \ 421117407Skan builtin_define ("__i486"); \ 422117407Skan builtin_define ("__i486__"); \ 423117407Skan } \ 424117407Skan else if (ix86_arch == PROCESSOR_PENTIUM) \ 425117407Skan { \ 426117407Skan builtin_define ("__i586"); \ 427117407Skan builtin_define ("__i586__"); \ 428117407Skan builtin_define ("__pentium"); \ 429117407Skan builtin_define ("__pentium__"); \ 430117407Skan if (last_arch_char == 'x') \ 431117407Skan builtin_define ("__pentium_mmx__"); \ 432117407Skan } \ 433117407Skan else if (ix86_arch == PROCESSOR_PENTIUMPRO) \ 434117407Skan { \ 435117407Skan builtin_define ("__i686"); \ 436117407Skan builtin_define ("__i686__"); \ 437117407Skan builtin_define ("__pentiumpro"); \ 438117407Skan builtin_define ("__pentiumpro__"); \ 439117407Skan } \ 440117407Skan else if (ix86_arch == PROCESSOR_K6) \ 441117407Skan { \ 442117407Skan \ 443117407Skan builtin_define ("__k6"); \ 444117407Skan builtin_define ("__k6__"); \ 445117407Skan if (last_arch_char == '2') \ 446117407Skan builtin_define ("__k6_2__"); \ 447117407Skan else if (last_arch_char == '3') \ 448117407Skan builtin_define ("__k6_3__"); \ 449117407Skan } \ 450117407Skan else if (ix86_arch == PROCESSOR_ATHLON) \ 451117407Skan { \ 452117407Skan builtin_define ("__athlon"); \ 453117407Skan builtin_define ("__athlon__"); \ 454148163Sobrien /* Plain "athlon" & "athlon-tbird" lacks SSE. */ \ 455148163Sobrien if (last_tune_char != 'n' && last_tune_char != 'd') \ 456117407Skan builtin_define ("__athlon_sse__"); \ 457117407Skan } \ 458132744Skan else if (ix86_arch == PROCESSOR_K8) \ 459132744Skan { \ 460132744Skan builtin_define ("__k8"); \ 461132744Skan builtin_define ("__k8__"); \ 462132744Skan } \ 463117407Skan else if (ix86_arch == PROCESSOR_PENTIUM4) \ 464117407Skan { \ 465117407Skan builtin_define ("__pentium4"); \ 466117407Skan builtin_define ("__pentium4__"); \ 467117407Skan } \ 468169706Skan else if (ix86_arch == PROCESSOR_NOCONA) \ 469169706Skan { \ 470169706Skan builtin_define ("__nocona"); \ 471169706Skan builtin_define ("__nocona__"); \ 472169706Skan } \ 473117407Skan } \ 474117407Skan while (0) 475117407Skan 47690285Sobrien#define TARGET_CPU_DEFAULT_i386 0 47790285Sobrien#define TARGET_CPU_DEFAULT_i486 1 47890285Sobrien#define TARGET_CPU_DEFAULT_pentium 2 47990285Sobrien#define TARGET_CPU_DEFAULT_pentium_mmx 3 48090285Sobrien#define TARGET_CPU_DEFAULT_pentiumpro 4 48190285Sobrien#define TARGET_CPU_DEFAULT_pentium2 5 48290285Sobrien#define TARGET_CPU_DEFAULT_pentium3 6 48390285Sobrien#define TARGET_CPU_DEFAULT_pentium4 7 48490285Sobrien#define TARGET_CPU_DEFAULT_k6 8 48590285Sobrien#define TARGET_CPU_DEFAULT_k6_2 9 48690285Sobrien#define TARGET_CPU_DEFAULT_k6_3 10 48790285Sobrien#define TARGET_CPU_DEFAULT_athlon 11 48890285Sobrien#define TARGET_CPU_DEFAULT_athlon_sse 12 489132744Skan#define TARGET_CPU_DEFAULT_k8 13 490132744Skan#define TARGET_CPU_DEFAULT_pentium_m 14 491132744Skan#define TARGET_CPU_DEFAULT_prescott 15 492132744Skan#define TARGET_CPU_DEFAULT_nocona 16 493169706Skan#define TARGET_CPU_DEFAULT_generic 17 49450654Sobrien 49590285Sobrien#define TARGET_CPU_DEFAULT_NAMES {"i386", "i486", "pentium", "pentium-mmx",\ 49690285Sobrien "pentiumpro", "pentium2", "pentium3", \ 49790285Sobrien "pentium4", "k6", "k6-2", "k6-3",\ 498132744Skan "athlon", "athlon-4", "k8", \ 499169706Skan "pentium-m", "prescott", "nocona", \ 500169706Skan "generic"} 50150654Sobrien 50250654Sobrien#ifndef CC1_SPEC 50390285Sobrien#define CC1_SPEC "%(cc1_cpu) " 50450654Sobrien#endif 50550654Sobrien 50650654Sobrien/* This macro defines names of additional specifications to put in the 50750654Sobrien specs that can be used in various specifications like CC1_SPEC. Its 50850654Sobrien definition is an initializer with a subgrouping for each command option. 50950654Sobrien 51050654Sobrien Each subgrouping contains a string constant, that defines the 511132744Skan specification name, and a string constant that used by the GCC driver 51250654Sobrien program. 51350654Sobrien 51450654Sobrien Do not define this macro if it does not need to do anything. */ 51550654Sobrien 51650654Sobrien#ifndef SUBTARGET_EXTRA_SPECS 51750654Sobrien#define SUBTARGET_EXTRA_SPECS 51850654Sobrien#endif 51950654Sobrien 52050654Sobrien#define EXTRA_SPECS \ 52150654Sobrien { "cc1_cpu", CC1_CPU_SPEC }, \ 52250654Sobrien SUBTARGET_EXTRA_SPECS 52350654Sobrien 52418334Speter/* target machine storage layout */ 52518334Speter 526169706Skan#define LONG_DOUBLE_TYPE_SIZE 80 52718334Speter 528117407Skan/* Set the value of FLT_EVAL_METHOD in float.h. When using only the 529117407Skan FPU, assume that the fpcw is set to extended precision; when using 530117407Skan only SSE, rounding is correct; when using both SSE and the FPU, 531117407Skan the rounding precision is indeterminate, since either may be chosen 532117407Skan apparently at random. */ 533117407Skan#define TARGET_FLT_EVAL_METHOD \ 534132744Skan (TARGET_MIX_SSE_I387 ? -1 : TARGET_SSE_MATH ? 0 : 2) 53590285Sobrien 53690285Sobrien#define SHORT_TYPE_SIZE 16 53790285Sobrien#define INT_TYPE_SIZE 32 53890285Sobrien#define FLOAT_TYPE_SIZE 32 53997912Sobrien#ifndef LONG_TYPE_SIZE 54090285Sobrien#define LONG_TYPE_SIZE BITS_PER_WORD 54197912Sobrien#endif 54290285Sobrien#define DOUBLE_TYPE_SIZE 64 54390285Sobrien#define LONG_LONG_TYPE_SIZE 64 54490285Sobrien 545117407Skan#if defined (TARGET_BI_ARCH) || TARGET_64BIT_DEFAULT 54690285Sobrien#define MAX_BITS_PER_WORD 64 54790285Sobrien#else 54890285Sobrien#define MAX_BITS_PER_WORD 32 54990285Sobrien#endif 55090285Sobrien 55118334Speter/* Define this if most significant byte of a word is the lowest numbered. */ 55218334Speter/* That is true on the 80386. */ 55318334Speter 55418334Speter#define BITS_BIG_ENDIAN 0 55518334Speter 55618334Speter/* Define this if most significant byte of a word is the lowest numbered. */ 55718334Speter/* That is not true on the 80386. */ 55818334Speter#define BYTES_BIG_ENDIAN 0 55918334Speter 56018334Speter/* Define this if most significant word of a multiword number is the lowest 56118334Speter numbered. */ 56218334Speter/* Not true for 80386 */ 56318334Speter#define WORDS_BIG_ENDIAN 0 56418334Speter 56518334Speter/* Width of a word, in units (bytes). */ 56690285Sobrien#define UNITS_PER_WORD (TARGET_64BIT ? 8 : 4) 567117407Skan#ifdef IN_LIBGCC2 568117407Skan#define MIN_UNITS_PER_WORD (TARGET_64BIT ? 8 : 4) 569117407Skan#else 570117407Skan#define MIN_UNITS_PER_WORD 4 571117407Skan#endif 57218334Speter 57318334Speter/* Allocation boundary (in *bits*) for storing arguments in argument list. */ 57490285Sobrien#define PARM_BOUNDARY BITS_PER_WORD 57518334Speter 57690285Sobrien/* Boundary (in *bits*) on which stack pointer should be aligned. */ 57790285Sobrien#define STACK_BOUNDARY BITS_PER_WORD 57818334Speter 579132744Skan/* Boundary (in *bits*) on which the stack pointer prefers to be 58052295Sobrien aligned; the compiler cannot rely on having this alignment. */ 58190285Sobrien#define PREFERRED_STACK_BOUNDARY ix86_preferred_stack_boundary 58252295Sobrien 583169706Skan/* As of July 2001, many runtimes do not align the stack properly when 584132744Skan entering main. This causes expand_main_function to forcibly align 58590285Sobrien the stack, which results in aligned frames for functions called from 58690285Sobrien main, though it does nothing for the alignment of main itself. */ 58790285Sobrien#define FORCE_PREFERRED_STACK_BOUNDARY_IN_MAIN \ 58890285Sobrien (ix86_preferred_stack_boundary > STACK_BOUNDARY && !TARGET_64BIT) 58918334Speter 590104768Skan/* Minimum allocation boundary for the code of a function. */ 591104768Skan#define FUNCTION_BOUNDARY 8 59218334Speter 593104768Skan/* C++ stores the virtual bit in the lowest bit of function pointers. */ 594104768Skan#define TARGET_PTRMEMFUNC_VBIT_LOCATION ptrmemfunc_vbit_in_pfn 595104768Skan 59690285Sobrien/* Alignment of field after `int : 0' in a structure. */ 59718334Speter 59890285Sobrien#define EMPTY_FIELD_BOUNDARY BITS_PER_WORD 59990285Sobrien 60018334Speter/* Minimum size in bits of the largest boundary to which any 60118334Speter and all fundamental data types supported by the hardware 60218334Speter might need to be aligned. No data type wants to be aligned 60390285Sobrien rounder than this. 604117407Skan 605132744Skan Pentium+ prefers DFmode values to be aligned to 64 bit boundary 60690285Sobrien and Pentium Pro XFmode values at 128 bit boundaries. */ 60718334Speter 60890285Sobrien#define BIGGEST_ALIGNMENT 128 60990285Sobrien 610117407Skan/* Decide whether a variable of mode MODE should be 128 bit aligned. */ 61190285Sobrien#define ALIGN_MODE_128(MODE) \ 612169706Skan ((MODE) == XFmode || SSE_REG_MODE_P (MODE)) 61390285Sobrien 61490285Sobrien/* The published ABIs say that doubles should be aligned on word 615132744Skan boundaries, so lower the alignment for structure fields unless 61690285Sobrien -malign-double is set. */ 617102801Skan 618102801Skan/* ??? Blah -- this macro is used directly by libobjc. Since it 619102801Skan supports no vector modes, cut out the complexity and fall back 620102801Skan on BIGGEST_FIELD_ALIGNMENT. */ 621102801Skan#ifdef IN_TARGET_LIBS 622117407Skan#ifdef __x86_64__ 623117407Skan#define BIGGEST_FIELD_ALIGNMENT 128 624117407Skan#else 625102801Skan#define BIGGEST_FIELD_ALIGNMENT 32 626117407Skan#endif 62790285Sobrien#else 628102801Skan#define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \ 629102801Skan x86_field_alignment (FIELD, COMPUTED) 63090285Sobrien#endif 63190285Sobrien 63250654Sobrien/* If defined, a C expression to compute the alignment given to a 63390285Sobrien constant that is being placed in memory. EXP is the constant 63450654Sobrien and ALIGN is the alignment that the object would ordinarily have. 63550654Sobrien The value of this macro is used instead of that alignment to align 63650654Sobrien the object. 63750654Sobrien 63850654Sobrien If this macro is not defined, then ALIGN is used. 63950654Sobrien 64050654Sobrien The typical use of this macro is to increase alignment for string 64150654Sobrien constants to be word aligned so that `strcpy' calls that copy 64250654Sobrien constants can be done inline. */ 64350654Sobrien 64490285Sobrien#define CONSTANT_ALIGNMENT(EXP, ALIGN) ix86_constant_alignment ((EXP), (ALIGN)) 64550654Sobrien 64650654Sobrien/* If defined, a C expression to compute the alignment for a static 64750654Sobrien variable. TYPE is the data type, and ALIGN is the alignment that 64850654Sobrien the object would ordinarily have. The value of this macro is used 64950654Sobrien instead of that alignment to align the object. 65050654Sobrien 65150654Sobrien If this macro is not defined, then ALIGN is used. 65250654Sobrien 65350654Sobrien One use of this macro is to increase alignment of medium-size 65450654Sobrien data to make it all fit in fewer cache lines. Another is to 65550654Sobrien cause character arrays to be word-aligned so that `strcpy' calls 65650654Sobrien that copy constants to character arrays can be done inline. */ 65750654Sobrien 65890285Sobrien#define DATA_ALIGNMENT(TYPE, ALIGN) ix86_data_alignment ((TYPE), (ALIGN)) 65950654Sobrien 66052295Sobrien/* If defined, a C expression to compute the alignment for a local 66152295Sobrien variable. TYPE is the data type, and ALIGN is the alignment that 66252295Sobrien the object would ordinarily have. The value of this macro is used 66352295Sobrien instead of that alignment to align the object. 66452295Sobrien 66552295Sobrien If this macro is not defined, then ALIGN is used. 66652295Sobrien 66752295Sobrien One use of this macro is to increase alignment of medium-size 66852295Sobrien data to make it all fit in fewer cache lines. */ 66952295Sobrien 67090285Sobrien#define LOCAL_ALIGNMENT(TYPE, ALIGN) ix86_local_alignment ((TYPE), (ALIGN)) 67152295Sobrien 67290285Sobrien/* If defined, a C expression that gives the alignment boundary, in 67390285Sobrien bits, of an argument with the specified mode and type. If it is 67490285Sobrien not defined, `PARM_BOUNDARY' is used for all arguments. */ 67590285Sobrien 67690285Sobrien#define FUNCTION_ARG_BOUNDARY(MODE, TYPE) \ 67790285Sobrien ix86_function_arg_boundary ((MODE), (TYPE)) 67890285Sobrien 679117407Skan/* Set this nonzero if move instructions will actually fail to work 68018334Speter when given unaligned data. */ 68118334Speter#define STRICT_ALIGNMENT 0 68218334Speter 68318334Speter/* If bit field type is int, don't let it cross an int, 68418334Speter and give entire struct the alignment of an int. */ 685117407Skan/* Required on the 386 since it doesn't have bit-field insns. */ 68618334Speter#define PCC_BITFIELD_TYPE_MATTERS 1 68718334Speter 68818334Speter/* Standard register usage. */ 68918334Speter 69018334Speter/* This processor has special stack-like registers. See reg-stack.c 69190285Sobrien for details. */ 69218334Speter 69318334Speter#define STACK_REGS 69490285Sobrien#define IS_STACK_MODE(MODE) \ 695169706Skan (((MODE) == SFmode && (!TARGET_SSE || !TARGET_SSE_MATH)) \ 696169706Skan || ((MODE) == DFmode && (!TARGET_SSE2 || !TARGET_SSE_MATH)) \ 697169706Skan || (MODE) == XFmode) 69818334Speter 69918334Speter/* Number of actual hardware registers. 70018334Speter The hardware registers are assigned numbers for the compiler 70118334Speter from 0 to just below FIRST_PSEUDO_REGISTER. 70218334Speter All registers that the compiler knows about must be given numbers, 70318334Speter even those that are not normally considered general registers. 70418334Speter 70518334Speter In the 80386 we give the 8 general purpose registers the numbers 0-7. 70618334Speter We number the floating point registers 8-15. 70718334Speter Note that registers 0-7 can be accessed as a short or int, 70818334Speter while only 0-3 may be used with byte `mov' instructions. 70918334Speter 71018334Speter Reg 16 does not correspond to any hardware register, but instead 71118334Speter appears in the RTL as an argument pointer prior to reload, and is 71218334Speter eliminated during reloading in favor of either the stack or frame 71390285Sobrien pointer. */ 71418334Speter 71590285Sobrien#define FIRST_PSEUDO_REGISTER 53 71618334Speter 71790285Sobrien/* Number of hardware registers that go into the DWARF-2 unwind info. 71890285Sobrien If not defined, equals FIRST_PSEUDO_REGISTER. */ 71990285Sobrien 72090285Sobrien#define DWARF_FRAME_REGISTERS 17 72190285Sobrien 72218334Speter/* 1 for registers that have pervasive standard uses 72318334Speter and are not available for the register allocator. 72490285Sobrien On the 80386, the stack pointer is such, as is the arg pointer. 725117407Skan 726169706Skan The value is zero if the register is not fixed on either 32 or 727169706Skan 64 bit targets, one if the register if fixed on both 32 and 64 728169706Skan bit targets, two if it is only fixed on 32bit targets and three 729169706Skan if its only fixed on 64bit targets. 730169706Skan Proper values are computed in the CONDITIONAL_REGISTER_USAGE. 73190285Sobrien */ 73290285Sobrien#define FIXED_REGISTERS \ 73390285Sobrien/*ax,dx,cx,bx,si,di,bp,sp,st,st1,st2,st3,st4,st5,st6,st7*/ \ 734169706Skan{ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, \ 73590285Sobrien/*arg,flags,fpsr,dir,frame*/ \ 736169706Skan 1, 1, 1, 1, 1, \ 73790285Sobrien/*xmm0,xmm1,xmm2,xmm3,xmm4,xmm5,xmm6,xmm7*/ \ 73890285Sobrien 0, 0, 0, 0, 0, 0, 0, 0, \ 73990285Sobrien/*mmx0,mmx1,mmx2,mmx3,mmx4,mmx5,mmx6,mmx7*/ \ 74090285Sobrien 0, 0, 0, 0, 0, 0, 0, 0, \ 74190285Sobrien/* r8, r9, r10, r11, r12, r13, r14, r15*/ \ 742169706Skan 2, 2, 2, 2, 2, 2, 2, 2, \ 74390285Sobrien/*xmm8,xmm9,xmm10,xmm11,xmm12,xmm13,xmm14,xmm15*/ \ 744169706Skan 2, 2, 2, 2, 2, 2, 2, 2} 74518334Speter 746117407Skan 74718334Speter/* 1 for registers not available across function calls. 74818334Speter These must include the FIXED_REGISTERS and also any 74918334Speter registers that can be used without being saved. 75018334Speter The latter must include the registers where values are returned 75118334Speter and the register where structure-value addresses are passed. 752117407Skan Aside from that, you can include as many other registers as you like. 753117407Skan 754169706Skan The value is zero if the register is not call used on either 32 or 755169706Skan 64 bit targets, one if the register if call used on both 32 and 64 756169706Skan bit targets, two if it is only call used on 32bit targets and three 757169706Skan if its only call used on 64bit targets. 758169706Skan Proper values are computed in the CONDITIONAL_REGISTER_USAGE. 75990285Sobrien*/ 76090285Sobrien#define CALL_USED_REGISTERS \ 76190285Sobrien/*ax,dx,cx,bx,si,di,bp,sp,st,st1,st2,st3,st4,st5,st6,st7*/ \ 762169706Skan{ 1, 1, 1, 0, 3, 3, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, \ 76390285Sobrien/*arg,flags,fpsr,dir,frame*/ \ 764169706Skan 1, 1, 1, 1, 1, \ 76590285Sobrien/*xmm0,xmm1,xmm2,xmm3,xmm4,xmm5,xmm6,xmm7*/ \ 766169706Skan 1, 1, 1, 1, 1, 1, 1, 1, \ 76790285Sobrien/*mmx0,mmx1,mmx2,mmx3,mmx4,mmx5,mmx6,mmx7*/ \ 768169706Skan 1, 1, 1, 1, 1, 1, 1, 1, \ 76990285Sobrien/* r8, r9, r10, r11, r12, r13, r14, r15*/ \ 770169706Skan 1, 1, 1, 1, 2, 2, 2, 2, \ 77190285Sobrien/*xmm8,xmm9,xmm10,xmm11,xmm12,xmm13,xmm14,xmm15*/ \ 772169706Skan 1, 1, 1, 1, 1, 1, 1, 1} \ 77318334Speter 77418334Speter/* Order in which to allocate registers. Each register must be 77518334Speter listed once, even those in FIXED_REGISTERS. List frame pointer 77618334Speter late and fixed registers last. Note that, in general, we prefer 77718334Speter registers listed in CALL_USED_REGISTERS, keeping the others 77818334Speter available for storage of persistent values. 77918334Speter 78096294Sobrien The ORDER_REGS_FOR_LOCAL_ALLOC actually overwrite the order, 78196294Sobrien so this is just empty initializer for array. */ 78218334Speter 78396294Sobrien#define REG_ALLOC_ORDER \ 78496294Sobrien{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,\ 78596294Sobrien 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, \ 78696294Sobrien 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, \ 78796294Sobrien 48, 49, 50, 51, 52 } 78818334Speter 78996294Sobrien/* ORDER_REGS_FOR_LOCAL_ALLOC is a macro which permits reg_alloc_order 79096294Sobrien to be rearranged based on a particular function. When using sse math, 791132744Skan we want to allocate SSE before x87 registers and vice vera. */ 79218334Speter 79396294Sobrien#define ORDER_REGS_FOR_LOCAL_ALLOC x86_order_regs_for_local_alloc () 79418334Speter 79518334Speter 79618334Speter/* Macro to conditionally modify fixed_regs/call_used_regs. */ 79790285Sobrien#define CONDITIONAL_REGISTER_USAGE \ 79890285Sobriendo { \ 79990285Sobrien int i; \ 80090285Sobrien for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) \ 80190285Sobrien { \ 802169706Skan if (fixed_regs[i] > 1) \ 803169706Skan fixed_regs[i] = (fixed_regs[i] == (TARGET_64BIT ? 3 : 2)); \ 804169706Skan if (call_used_regs[i] > 1) \ 805169706Skan call_used_regs[i] = (call_used_regs[i] \ 806169706Skan == (TARGET_64BIT ? 3 : 2)); \ 80790285Sobrien } \ 80896294Sobrien if (PIC_OFFSET_TABLE_REGNUM != INVALID_REGNUM) \ 80990285Sobrien { \ 81090285Sobrien fixed_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \ 81190285Sobrien call_used_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \ 81290285Sobrien } \ 81390285Sobrien if (! TARGET_MMX) \ 81490285Sobrien { \ 81590285Sobrien int i; \ 81690285Sobrien for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) \ 81790285Sobrien if (TEST_HARD_REG_BIT (reg_class_contents[(int)MMX_REGS], i)) \ 818169706Skan fixed_regs[i] = call_used_regs[i] = 1, reg_names[i] = ""; \ 81990285Sobrien } \ 82090285Sobrien if (! TARGET_SSE) \ 82190285Sobrien { \ 82290285Sobrien int i; \ 82390285Sobrien for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) \ 82490285Sobrien if (TEST_HARD_REG_BIT (reg_class_contents[(int)SSE_REGS], i)) \ 825169706Skan fixed_regs[i] = call_used_regs[i] = 1, reg_names[i] = ""; \ 82690285Sobrien } \ 82790285Sobrien if (! TARGET_80387 && ! TARGET_FLOAT_RETURNS_IN_80387) \ 82890285Sobrien { \ 82990285Sobrien int i; \ 83090285Sobrien HARD_REG_SET x; \ 83190285Sobrien COPY_HARD_REG_SET (x, reg_class_contents[(int)FLOAT_REGS]); \ 83290285Sobrien for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) \ 83390285Sobrien if (TEST_HARD_REG_BIT (x, i)) \ 834169706Skan fixed_regs[i] = call_used_regs[i] = 1, reg_names[i] = ""; \ 83590285Sobrien } \ 836169706Skan if (! TARGET_64BIT) \ 837169706Skan { \ 838169706Skan int i; \ 839169706Skan for (i = FIRST_REX_INT_REG; i <= LAST_REX_INT_REG; i++) \ 840169706Skan reg_names[i] = ""; \ 841169706Skan for (i = FIRST_REX_SSE_REG; i <= LAST_REX_SSE_REG; i++) \ 842169706Skan reg_names[i] = ""; \ 843169706Skan } \ 84490285Sobrien } while (0) 84518334Speter 84618334Speter/* Return number of consecutive hard regs needed starting at reg REGNO 84718334Speter to hold something of mode MODE. 84818334Speter This is ordinarily the length in words of a value of mode MODE 84918334Speter but can be less for certain modes in special long registers. 85018334Speter 851117407Skan Actually there are no two word move instructions for consecutive 85218334Speter registers. And only registers 0-3 may have mov byte instructions 85318334Speter applied to them. 85418334Speter */ 85518334Speter 85618334Speter#define HARD_REGNO_NREGS(REGNO, MODE) \ 85790285Sobrien (FP_REGNO_P (REGNO) || SSE_REGNO_P (REGNO) || MMX_REGNO_P (REGNO) \ 85890285Sobrien ? (COMPLEX_MODE_P (MODE) ? 2 : 1) \ 859132744Skan : ((MODE) == XFmode \ 86090285Sobrien ? (TARGET_64BIT ? 2 : 3) \ 861132744Skan : (MODE) == XCmode \ 86290285Sobrien ? (TARGET_64BIT ? 4 : 6) \ 86390285Sobrien : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))) 86418334Speter 865169706Skan#define HARD_REGNO_NREGS_HAS_PADDING(REGNO, MODE) \ 866169706Skan ((TARGET_128BIT_LONG_DOUBLE && !TARGET_64BIT) \ 867169706Skan ? (FP_REGNO_P (REGNO) || SSE_REGNO_P (REGNO) || MMX_REGNO_P (REGNO) \ 868169706Skan ? 0 \ 869169706Skan : ((MODE) == XFmode || (MODE) == XCmode)) \ 870169706Skan : 0) 871169706Skan 872169706Skan#define HARD_REGNO_NREGS_WITH_PADDING(REGNO, MODE) ((MODE) == XFmode ? 4 : 8) 873169706Skan 874117407Skan#define VALID_SSE2_REG_MODE(MODE) \ 875117407Skan ((MODE) == V16QImode || (MODE) == V8HImode || (MODE) == V2DFmode \ 876146908Skan || (MODE) == V2DImode || (MODE) == DFmode) 877117407Skan 87890285Sobrien#define VALID_SSE_REG_MODE(MODE) \ 87990285Sobrien ((MODE) == TImode || (MODE) == V4SFmode || (MODE) == V4SImode \ 880146908Skan || (MODE) == SFmode || (MODE) == TFmode) 88118334Speter 88290285Sobrien#define VALID_MMX_REG_MODE_3DNOW(MODE) \ 88390285Sobrien ((MODE) == V2SFmode || (MODE) == SFmode) 88418334Speter 88590285Sobrien#define VALID_MMX_REG_MODE(MODE) \ 88690285Sobrien ((MODE) == DImode || (MODE) == V8QImode || (MODE) == V4HImode \ 88790285Sobrien || (MODE) == V2SImode || (MODE) == SImode) 88818334Speter 889169706Skan/* ??? No autovectorization into MMX or 3DNOW until we can reliably 890169706Skan place emms and femms instructions. */ 891169706Skan#define UNITS_PER_SIMD_WORD (TARGET_SSE ? 16 : UNITS_PER_WORD) 89290285Sobrien 89390285Sobrien#define VALID_FP_MODE_P(MODE) \ 894132744Skan ((MODE) == SFmode || (MODE) == DFmode || (MODE) == XFmode \ 895132744Skan || (MODE) == SCmode || (MODE) == DCmode || (MODE) == XCmode) \ 89690285Sobrien 89790285Sobrien#define VALID_INT_MODE_P(MODE) \ 89890285Sobrien ((MODE) == QImode || (MODE) == HImode || (MODE) == SImode \ 89990285Sobrien || (MODE) == DImode \ 90090285Sobrien || (MODE) == CQImode || (MODE) == CHImode || (MODE) == CSImode \ 90190285Sobrien || (MODE) == CDImode \ 902132744Skan || (TARGET_64BIT && ((MODE) == TImode || (MODE) == CTImode \ 903132744Skan || (MODE) == TFmode || (MODE) == TCmode))) 90490285Sobrien 905117407Skan/* Return true for modes passed in SSE registers. */ 906117407Skan#define SSE_REG_MODE_P(MODE) \ 907132744Skan ((MODE) == TImode || (MODE) == V16QImode || (MODE) == TFmode \ 908117407Skan || (MODE) == V8HImode || (MODE) == V2DFmode || (MODE) == V2DImode \ 909117407Skan || (MODE) == V4SFmode || (MODE) == V4SImode) 910117407Skan 91190285Sobrien/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE. */ 91290285Sobrien 91390285Sobrien#define HARD_REGNO_MODE_OK(REGNO, MODE) \ 91490285Sobrien ix86_hard_regno_mode_ok ((REGNO), (MODE)) 91590285Sobrien 91618334Speter/* Value is 1 if it is a good idea to tie two pseudo registers 91718334Speter when one has mode MODE1 and one has mode MODE2. 91818334Speter If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2, 91918334Speter for any hard reg, then this must be 0 for correct output. */ 92018334Speter 921169706Skan#define MODES_TIEABLE_P(MODE1, MODE2) ix86_modes_tieable_p (MODE1, MODE2) 92218334Speter 923132744Skan/* It is possible to write patterns to move flags; but until someone 924132744Skan does it, */ 925132744Skan#define AVOID_CCMODE_COPIES 92690285Sobrien 92790285Sobrien/* Specify the modes required to caller save a given hard regno. 92890285Sobrien We do this on i386 to prevent flags from being saved at all. 92990285Sobrien 93090285Sobrien Kill any attempts to combine saving of modes. */ 93190285Sobrien 93290285Sobrien#define HARD_REGNO_CALLER_SAVE_MODE(REGNO, NREGS, MODE) \ 93390285Sobrien (CC_REGNO_P (REGNO) ? VOIDmode \ 93490285Sobrien : (MODE) == VOIDmode && (NREGS) != 1 ? VOIDmode \ 935132744Skan : (MODE) == VOIDmode ? choose_hard_reg_mode ((REGNO), (NREGS), false)\ 93690285Sobrien : (MODE) == HImode && !TARGET_PARTIAL_REG_STALL ? SImode \ 93790285Sobrien : (MODE) == QImode && (REGNO) >= 4 && !TARGET_64BIT ? SImode \ 93890285Sobrien : (MODE)) 93918334Speter/* Specify the registers used for certain standard purposes. 94018334Speter The values of these macros are register numbers. */ 94118334Speter 94218334Speter/* on the 386 the pc register is %eip, and is not usable as a general 94318334Speter register. The ordinary mov instructions won't work */ 94418334Speter/* #define PC_REGNUM */ 94518334Speter 94618334Speter/* Register to use for pushing function arguments. */ 94718334Speter#define STACK_POINTER_REGNUM 7 94818334Speter 94918334Speter/* Base register for access to local variables of the function. */ 95090285Sobrien#define HARD_FRAME_POINTER_REGNUM 6 95118334Speter 95290285Sobrien/* Base register for access to local variables of the function. */ 95390285Sobrien#define FRAME_POINTER_REGNUM 20 95490285Sobrien 95518334Speter/* First floating point reg */ 95618334Speter#define FIRST_FLOAT_REG 8 95718334Speter 95818334Speter/* First & last stack-like regs */ 95918334Speter#define FIRST_STACK_REG FIRST_FLOAT_REG 96018334Speter#define LAST_STACK_REG (FIRST_FLOAT_REG + 7) 96118334Speter 96290285Sobrien#define FIRST_SSE_REG (FRAME_POINTER_REGNUM + 1) 96390285Sobrien#define LAST_SSE_REG (FIRST_SSE_REG + 7) 964117407Skan 96590285Sobrien#define FIRST_MMX_REG (LAST_SSE_REG + 1) 96690285Sobrien#define LAST_MMX_REG (FIRST_MMX_REG + 7) 96790285Sobrien 96890285Sobrien#define FIRST_REX_INT_REG (LAST_MMX_REG + 1) 96990285Sobrien#define LAST_REX_INT_REG (FIRST_REX_INT_REG + 7) 97090285Sobrien 97190285Sobrien#define FIRST_REX_SSE_REG (LAST_REX_INT_REG + 1) 97290285Sobrien#define LAST_REX_SSE_REG (FIRST_REX_SSE_REG + 7) 97390285Sobrien 97418334Speter/* Value should be nonzero if functions must have frame pointers. 97518334Speter Zero means the frame pointer need not be set up (and parms 97618334Speter may be accessed via the stack pointer) in functions that seem suitable. 97718334Speter This is computed in `reload', in reload1.c. */ 97890285Sobrien#define FRAME_POINTER_REQUIRED ix86_frame_pointer_required () 97918334Speter 980169706Skan/* Override this in other tm.h files to cope with various OS lossage 98190285Sobrien requiring a frame pointer. */ 98290285Sobrien#ifndef SUBTARGET_FRAME_POINTER_REQUIRED 98390285Sobrien#define SUBTARGET_FRAME_POINTER_REQUIRED 0 98490285Sobrien#endif 98590285Sobrien 98690285Sobrien/* Make sure we can access arbitrary call frames. */ 98790285Sobrien#define SETUP_FRAME_ADDRESSES() ix86_setup_frame_addresses () 98890285Sobrien 98918334Speter/* Base register for access to arguments of the function. */ 99018334Speter#define ARG_POINTER_REGNUM 16 99118334Speter 99290285Sobrien/* Register in which static-chain is passed to a function. 99390285Sobrien We do use ECX as static chain register for 32 bit ABI. On the 99490285Sobrien 64bit ABI, ECX is an argument register, so we use R10 instead. */ 99590285Sobrien#define STATIC_CHAIN_REGNUM (TARGET_64BIT ? FIRST_REX_INT_REG + 10 - 8 : 2) 99618334Speter 99718334Speter/* Register to hold the addressing base for position independent 99896294Sobrien code access to data items. We don't use PIC pointer for 64bit 99996294Sobrien mode. Define the regnum to dummy value to prevent gcc from 1000117407Skan pessimizing code dealing with EBX. 100118334Speter 1002117407Skan To avoid clobbering a call-saved register unnecessarily, we renumber 1003117407Skan the pic register when possible. The change is visible after the 1004117407Skan prologue has been emitted. */ 1005117407Skan 1006117407Skan#define REAL_PIC_OFFSET_TABLE_REGNUM 3 1007117407Skan 1008117407Skan#define PIC_OFFSET_TABLE_REGNUM \ 1009169706Skan ((TARGET_64BIT && ix86_cmodel == CM_SMALL_PIC) \ 1010169706Skan || !flag_pic ? INVALID_REGNUM \ 1011117407Skan : reload_completed ? REGNO (pic_offset_table_rtx) \ 1012117407Skan : REAL_PIC_OFFSET_TABLE_REGNUM) 1013117407Skan 1014117407Skan#define GOT_SYMBOL_NAME "_GLOBAL_OFFSET_TABLE_" 1015117407Skan 101618334Speter/* A C expression which can inhibit the returning of certain function 101718334Speter values in registers, based on the type of value. A nonzero value 101818334Speter says to return the function value in memory, just as large 101918334Speter structures are always returned. Here TYPE will be a C expression 102018334Speter of type `tree', representing the data type of the value. 102118334Speter 102218334Speter Note that values of mode `BLKmode' must be explicitly handled by 102318334Speter this macro. Also, the option `-fpcc-struct-return' takes effect 102418334Speter regardless of this macro. On most systems, it is possible to 102518334Speter leave the macro undefined; this causes a default definition to be 102618334Speter used, whose value is the constant 1 for `BLKmode' values, and 0 102718334Speter otherwise. 102818334Speter 102918334Speter Do not use this macro to indicate that structures and unions 103018334Speter should always be returned in memory. You should instead use 103118334Speter `DEFAULT_PCC_STRUCT_RETURN' to indicate this. */ 103218334Speter 103318334Speter#define RETURN_IN_MEMORY(TYPE) \ 103490285Sobrien ix86_return_in_memory (TYPE) 103518334Speter 1036132744Skan/* This is overridden by <cygwin.h>. */ 1037132744Skan#define MS_AGGREGATE_RETURN 0 1038132744Skan 1039169706Skan/* This is overridden by <netware.h>. */ 1040169706Skan#define KEEP_AGGREGATE_RETURN_POINTER 0 104118334Speter 104218334Speter/* Define the classes of registers for register constraints in the 104318334Speter machine description. Also define ranges of constants. 104418334Speter 104518334Speter One of the classes must always be named ALL_REGS and include all hard regs. 104618334Speter If there is more than one class, another class must be named NO_REGS 104718334Speter and contain no registers. 104818334Speter 104918334Speter The name GENERAL_REGS must be the name of a class (or an alias for 105018334Speter another name such as ALL_REGS). This is the class of registers 105118334Speter that is allowed by "g" or "r" in a register constraint. 105218334Speter Also, registers outside this class are allocated only when 105318334Speter instructions express preferences for them. 105418334Speter 105518334Speter The classes must be numbered in nondecreasing order; that is, 105618334Speter a larger-numbered class must never be contained completely 105718334Speter in a smaller-numbered class. 105818334Speter 105918334Speter For any two classes, it is very desirable that there be another 106018334Speter class that represents their union. 106118334Speter 106218334Speter It might seem that class BREG is unnecessary, since no useful 386 106318334Speter opcode needs reg %ebx. But some systems pass args to the OS in ebx, 106490285Sobrien and the "b" register constraint is useful in asms for syscalls. 106518334Speter 106690285Sobrien The flags and fpsr registers are in no class. */ 106790285Sobrien 106818334Speterenum reg_class 106918334Speter{ 107018334Speter NO_REGS, 107190285Sobrien AREG, DREG, CREG, BREG, SIREG, DIREG, 107218334Speter AD_REGS, /* %eax/%edx for DImode */ 107318334Speter Q_REGS, /* %eax %ebx %ecx %edx */ 107490285Sobrien NON_Q_REGS, /* %esi %edi %ebp %esp */ 107518334Speter INDEX_REGS, /* %eax %ebx %ecx %edx %esi %edi %ebp */ 107690285Sobrien LEGACY_REGS, /* %eax %ebx %ecx %edx %esi %edi %ebp %esp */ 107790285Sobrien GENERAL_REGS, /* %eax %ebx %ecx %edx %esi %edi %ebp %esp %r8 - %r15*/ 107818334Speter FP_TOP_REG, FP_SECOND_REG, /* %st(0) %st(1) */ 107918334Speter FLOAT_REGS, 108090285Sobrien SSE_REGS, 108190285Sobrien MMX_REGS, 108290285Sobrien FP_TOP_SSE_REGS, 108390285Sobrien FP_SECOND_SSE_REGS, 108490285Sobrien FLOAT_SSE_REGS, 108590285Sobrien FLOAT_INT_REGS, 108690285Sobrien INT_SSE_REGS, 108790285Sobrien FLOAT_INT_SSE_REGS, 108818334Speter ALL_REGS, LIM_REG_CLASSES 108918334Speter}; 109018334Speter 109190285Sobrien#define N_REG_CLASSES ((int) LIM_REG_CLASSES) 109218334Speter 109390285Sobrien#define INTEGER_CLASS_P(CLASS) \ 109490285Sobrien reg_class_subset_p ((CLASS), GENERAL_REGS) 109590285Sobrien#define FLOAT_CLASS_P(CLASS) \ 109690285Sobrien reg_class_subset_p ((CLASS), FLOAT_REGS) 109790285Sobrien#define SSE_CLASS_P(CLASS) \ 1098169706Skan ((CLASS) == SSE_REGS) 109990285Sobrien#define MMX_CLASS_P(CLASS) \ 1100169706Skan ((CLASS) == MMX_REGS) 110190285Sobrien#define MAYBE_INTEGER_CLASS_P(CLASS) \ 110290285Sobrien reg_classes_intersect_p ((CLASS), GENERAL_REGS) 110390285Sobrien#define MAYBE_FLOAT_CLASS_P(CLASS) \ 110490285Sobrien reg_classes_intersect_p ((CLASS), FLOAT_REGS) 110590285Sobrien#define MAYBE_SSE_CLASS_P(CLASS) \ 110690285Sobrien reg_classes_intersect_p (SSE_REGS, (CLASS)) 110790285Sobrien#define MAYBE_MMX_CLASS_P(CLASS) \ 110890285Sobrien reg_classes_intersect_p (MMX_REGS, (CLASS)) 110918334Speter 111090285Sobrien#define Q_CLASS_P(CLASS) \ 111190285Sobrien reg_class_subset_p ((CLASS), Q_REGS) 111290285Sobrien 1113132744Skan/* Give names of register classes as strings for dump file. */ 111418334Speter 111518334Speter#define REG_CLASS_NAMES \ 111618334Speter{ "NO_REGS", \ 111718334Speter "AREG", "DREG", "CREG", "BREG", \ 111890285Sobrien "SIREG", "DIREG", \ 111918334Speter "AD_REGS", \ 112090285Sobrien "Q_REGS", "NON_Q_REGS", \ 112118334Speter "INDEX_REGS", \ 112290285Sobrien "LEGACY_REGS", \ 112318334Speter "GENERAL_REGS", \ 112418334Speter "FP_TOP_REG", "FP_SECOND_REG", \ 112518334Speter "FLOAT_REGS", \ 112690285Sobrien "SSE_REGS", \ 112790285Sobrien "MMX_REGS", \ 112890285Sobrien "FP_TOP_SSE_REGS", \ 112990285Sobrien "FP_SECOND_SSE_REGS", \ 113090285Sobrien "FLOAT_SSE_REGS", \ 113190285Sobrien "FLOAT_INT_REGS", \ 113290285Sobrien "INT_SSE_REGS", \ 113390285Sobrien "FLOAT_INT_SSE_REGS", \ 113418334Speter "ALL_REGS" } 113518334Speter 113618334Speter/* Define which registers fit in which classes. 113718334Speter This is an initializer for a vector of HARD_REG_SET 113818334Speter of length N_REG_CLASSES. */ 113918334Speter 114090285Sobrien#define REG_CLASS_CONTENTS \ 114190285Sobrien{ { 0x00, 0x0 }, \ 114290285Sobrien { 0x01, 0x0 }, { 0x02, 0x0 }, /* AREG, DREG */ \ 114390285Sobrien { 0x04, 0x0 }, { 0x08, 0x0 }, /* CREG, BREG */ \ 114490285Sobrien { 0x10, 0x0 }, { 0x20, 0x0 }, /* SIREG, DIREG */ \ 114590285Sobrien { 0x03, 0x0 }, /* AD_REGS */ \ 114690285Sobrien { 0x0f, 0x0 }, /* Q_REGS */ \ 114790285Sobrien { 0x1100f0, 0x1fe0 }, /* NON_Q_REGS */ \ 114890285Sobrien { 0x7f, 0x1fe0 }, /* INDEX_REGS */ \ 114990285Sobrien { 0x1100ff, 0x0 }, /* LEGACY_REGS */ \ 115090285Sobrien { 0x1100ff, 0x1fe0 }, /* GENERAL_REGS */ \ 115190285Sobrien { 0x100, 0x0 }, { 0x0200, 0x0 },/* FP_TOP_REG, FP_SECOND_REG */\ 115290285Sobrien { 0xff00, 0x0 }, /* FLOAT_REGS */ \ 115390285Sobrien{ 0x1fe00000,0x1fe000 }, /* SSE_REGS */ \ 115490285Sobrien{ 0xe0000000, 0x1f }, /* MMX_REGS */ \ 115590285Sobrien{ 0x1fe00100,0x1fe000 }, /* FP_TOP_SSE_REG */ \ 115690285Sobrien{ 0x1fe00200,0x1fe000 }, /* FP_SECOND_SSE_REG */ \ 115790285Sobrien{ 0x1fe0ff00,0x1fe000 }, /* FLOAT_SSE_REGS */ \ 115890285Sobrien { 0x1ffff, 0x1fe0 }, /* FLOAT_INT_REGS */ \ 115990285Sobrien{ 0x1fe100ff,0x1fffe0 }, /* INT_SSE_REGS */ \ 116090285Sobrien{ 0x1fe1ffff,0x1fffe0 }, /* FLOAT_INT_SSE_REGS */ \ 116190285Sobrien{ 0xffffffff,0x1fffff } \ 116290285Sobrien} 116318334Speter 116418334Speter/* The same information, inverted: 116518334Speter Return the class number of the smallest class containing 116618334Speter reg number REGNO. This could be a conditional expression 116718334Speter or could index an array. */ 116818334Speter 116918334Speter#define REGNO_REG_CLASS(REGNO) (regclass_map[REGNO]) 117018334Speter 117118334Speter/* When defined, the compiler allows registers explicitly used in the 117218334Speter rtl to be used as spill registers but prevents the compiler from 117390285Sobrien extending the lifetime of these registers. */ 117418334Speter 117550654Sobrien#define SMALL_REGISTER_CLASSES 1 117618334Speter 117718334Speter#define QI_REG_P(X) \ 117818334Speter (REG_P (X) && REGNO (X) < 4) 117990285Sobrien 118090285Sobrien#define GENERAL_REGNO_P(N) \ 118190285Sobrien ((N) < 8 || REX_INT_REGNO_P (N)) 118290285Sobrien 118390285Sobrien#define GENERAL_REG_P(X) \ 118490285Sobrien (REG_P (X) && GENERAL_REGNO_P (REGNO (X))) 118590285Sobrien 118690285Sobrien#define ANY_QI_REG_P(X) (TARGET_64BIT ? GENERAL_REG_P(X) : QI_REG_P (X)) 118790285Sobrien 118818334Speter#define NON_QI_REG_P(X) \ 118918334Speter (REG_P (X) && REGNO (X) >= 4 && REGNO (X) < FIRST_PSEUDO_REGISTER) 119018334Speter 119190285Sobrien#define REX_INT_REGNO_P(N) ((N) >= FIRST_REX_INT_REG && (N) <= LAST_REX_INT_REG) 119290285Sobrien#define REX_INT_REG_P(X) (REG_P (X) && REX_INT_REGNO_P (REGNO (X))) 119390285Sobrien 119418334Speter#define FP_REG_P(X) (REG_P (X) && FP_REGNO_P (REGNO (X))) 119590285Sobrien#define FP_REGNO_P(N) ((N) >= FIRST_STACK_REG && (N) <= LAST_STACK_REG) 119690285Sobrien#define ANY_FP_REG_P(X) (REG_P (X) && ANY_FP_REGNO_P (REGNO (X))) 119790285Sobrien#define ANY_FP_REGNO_P(N) (FP_REGNO_P (N) || SSE_REGNO_P (N)) 119890285Sobrien 119990285Sobrien#define SSE_REGNO_P(N) \ 120090285Sobrien (((N) >= FIRST_SSE_REG && (N) <= LAST_SSE_REG) \ 120190285Sobrien || ((N) >= FIRST_REX_SSE_REG && (N) <= LAST_REX_SSE_REG)) 120290285Sobrien 1203132744Skan#define REX_SSE_REGNO_P(N) \ 1204132744Skan ((N) >= FIRST_REX_SSE_REG && (N) <= LAST_REX_SSE_REG) 1205132744Skan 120690285Sobrien#define SSE_REGNO(N) \ 120790285Sobrien ((N) < 8 ? FIRST_SSE_REG + (N) : FIRST_REX_SSE_REG + (N) - 8) 120890285Sobrien#define SSE_REG_P(N) (REG_P (N) && SSE_REGNO_P (REGNO (N))) 120990285Sobrien 121090285Sobrien#define SSE_FLOAT_MODE_P(MODE) \ 121196294Sobrien ((TARGET_SSE && (MODE) == SFmode) || (TARGET_SSE2 && (MODE) == DFmode)) 121290285Sobrien 121390285Sobrien#define MMX_REGNO_P(N) ((N) >= FIRST_MMX_REG && (N) <= LAST_MMX_REG) 121490285Sobrien#define MMX_REG_P(XOP) (REG_P (XOP) && MMX_REGNO_P (REGNO (XOP))) 1215117407Skan 121690285Sobrien#define STACK_REG_P(XOP) \ 121790285Sobrien (REG_P (XOP) && \ 121890285Sobrien REGNO (XOP) >= FIRST_STACK_REG && \ 121990285Sobrien REGNO (XOP) <= LAST_STACK_REG) 122018334Speter 122190285Sobrien#define NON_STACK_REG_P(XOP) (REG_P (XOP) && ! STACK_REG_P (XOP)) 122218334Speter 122390285Sobrien#define STACK_TOP_P(XOP) (REG_P (XOP) && REGNO (XOP) == FIRST_STACK_REG) 122418334Speter 122590285Sobrien#define CC_REG_P(X) (REG_P (X) && CC_REGNO_P (REGNO (X))) 122690285Sobrien#define CC_REGNO_P(X) ((X) == FLAGS_REG || (X) == FPSR_REG) 122718334Speter 122818334Speter/* The class value for index registers, and the one for base regs. */ 122918334Speter 123018334Speter#define INDEX_REG_CLASS INDEX_REGS 123118334Speter#define BASE_REG_CLASS GENERAL_REGS 123218334Speter 123318334Speter/* Place additional restrictions on the register class to use when it 123418334Speter is necessary to be able to hold a value of mode MODE in a reload 123590285Sobrien register for which class CLASS would ordinarily be used. */ 123618334Speter 123790285Sobrien#define LIMIT_RELOAD_CLASS(MODE, CLASS) \ 123890285Sobrien ((MODE) == QImode && !TARGET_64BIT \ 123990285Sobrien && ((CLASS) == ALL_REGS || (CLASS) == GENERAL_REGS \ 124090285Sobrien || (CLASS) == LEGACY_REGS || (CLASS) == INDEX_REGS) \ 124118334Speter ? Q_REGS : (CLASS)) 124218334Speter 124318334Speter/* Given an rtx X being reloaded into a reg required to be 124418334Speter in class CLASS, return the class of reg to actually use. 124518334Speter In general this is just CLASS; but on some machines 124618334Speter in some cases it is preferable to use a more restrictive class. 124718334Speter On the 80386 series, we prevent floating constants from being 124818334Speter reloaded into floating registers (since no move-insn can do that) 124918334Speter and we ensure that QImodes aren't reloaded into the esi or edi reg. */ 125018334Speter 125118334Speter/* Put float CONST_DOUBLE in the constant pool instead of fp regs. 125218334Speter QImode must go into class Q_REGS. 125318334Speter Narrow ALL_REGS to GENERAL_REGS. This supports allowing movsf and 125490285Sobrien movdf to do mem-to-mem moves through integer regs. */ 125518334Speter 125690285Sobrien#define PREFERRED_RELOAD_CLASS(X, CLASS) \ 125790285Sobrien ix86_preferred_reload_class ((X), (CLASS)) 125818334Speter 1259169706Skan/* Discourage putting floating-point values in SSE registers unless 1260169706Skan SSE math is being used, and likewise for the 387 registers. */ 1261169706Skan 1262169706Skan#define PREFERRED_OUTPUT_RELOAD_CLASS(X, CLASS) \ 1263169706Skan ix86_preferred_output_reload_class ((X), (CLASS)) 1264169706Skan 126518334Speter/* If we are copying between general and FP registers, we need a memory 126690285Sobrien location. The same is true for SSE and MMX registers. */ 126790285Sobrien#define SECONDARY_MEMORY_NEEDED(CLASS1, CLASS2, MODE) \ 126890285Sobrien ix86_secondary_memory_needed ((CLASS1), (CLASS2), (MODE), 1) 126918334Speter 127090285Sobrien/* QImode spills from non-QI registers need a scratch. This does not 1271117407Skan happen often -- the only example so far requires an uninitialized 127290285Sobrien pseudo. */ 127318334Speter 127490285Sobrien#define SECONDARY_OUTPUT_RELOAD_CLASS(CLASS, MODE, OUT) \ 127590285Sobrien (((CLASS) == GENERAL_REGS || (CLASS) == LEGACY_REGS \ 127690285Sobrien || (CLASS) == INDEX_REGS) && !TARGET_64BIT && (MODE) == QImode \ 127790285Sobrien ? Q_REGS : NO_REGS) 127890285Sobrien 127918334Speter/* Return the maximum number of consecutive registers 128018334Speter needed to represent mode MODE in a register of class CLASS. */ 128118334Speter/* On the 80386, this is the size of MODE in words, 1282132744Skan except in the FP regs, where a single reg is always enough. */ 128390285Sobrien#define CLASS_MAX_NREGS(CLASS, MODE) \ 128490285Sobrien (!MAYBE_INTEGER_CLASS_P (CLASS) \ 128590285Sobrien ? (COMPLEX_MODE_P (MODE) ? 2 : 1) \ 1286132744Skan : (((((MODE) == XFmode ? 12 : GET_MODE_SIZE (MODE))) \ 1287132744Skan + UNITS_PER_WORD - 1) / UNITS_PER_WORD)) 128818334Speter 128918334Speter/* A C expression whose value is nonzero if pseudos that have been 129018334Speter assigned to registers of class CLASS would likely be spilled 129118334Speter because registers of CLASS are needed for spill registers. 129218334Speter 129318334Speter The default value of this macro returns 1 if CLASS has exactly one 129418334Speter register and zero otherwise. On most machines, this default 129518334Speter should be used. Only define this macro to some other expression 129618334Speter if pseudo allocated by `local-alloc.c' end up in memory because 129718334Speter their hard registers were needed for spill registers. If this 129818334Speter macro returns nonzero for those classes, those pseudos will only 129918334Speter be allocated by `global.c', which knows how to reallocate the 130018334Speter pseudo to another register. If there would not be another 130118334Speter register available for reallocation, you should not change the 130218334Speter definition of this macro since the only effect of such a 130318334Speter definition would be to slow down register allocation. */ 130418334Speter 130518334Speter#define CLASS_LIKELY_SPILLED_P(CLASS) \ 130618334Speter (((CLASS) == AREG) \ 130718334Speter || ((CLASS) == DREG) \ 130818334Speter || ((CLASS) == CREG) \ 130918334Speter || ((CLASS) == BREG) \ 131018334Speter || ((CLASS) == AD_REGS) \ 131118334Speter || ((CLASS) == SIREG) \ 1312132744Skan || ((CLASS) == DIREG) \ 1313132744Skan || ((CLASS) == FP_TOP_REG) \ 1314132744Skan || ((CLASS) == FP_SECOND_REG)) 131518334Speter 1316169706Skan/* Return a class of registers that cannot change FROM mode to TO mode. */ 1317117407Skan 1318169706Skan#define CANNOT_CHANGE_MODE_CLASS(FROM, TO, CLASS) \ 1319169706Skan ix86_cannot_change_mode_class (FROM, TO, CLASS) 132018334Speter 132118334Speter/* Stack layout; function entry, exit and calling. */ 132218334Speter 132318334Speter/* Define this if pushing a word on the stack 132418334Speter makes the stack pointer a smaller address. */ 132518334Speter#define STACK_GROWS_DOWNWARD 132618334Speter 1327169706Skan/* Define this to nonzero if the nominal address of the stack frame 132818334Speter is at the high-address end of the local variables; 132918334Speter that is, each additional local variable allocated 133018334Speter goes at a more negative offset in the frame. */ 1331169706Skan#define FRAME_GROWS_DOWNWARD 1 133218334Speter 133318334Speter/* Offset within stack frame to start allocating local variables at. 133418334Speter If FRAME_GROWS_DOWNWARD, this is the offset to the END of the 133518334Speter first local allocated. Otherwise, it is the offset to the BEGINNING 133618334Speter of the first local allocated. */ 133718334Speter#define STARTING_FRAME_OFFSET 0 133818334Speter 133918334Speter/* If we generate an insn to push BYTES bytes, 134018334Speter this says how many the stack pointer really advances by. 1341169706Skan On 386, we have pushw instruction that decrements by exactly 2 no 1342169706Skan matter what the position was, there is no pushb. 1343169706Skan But as CIE data alignment factor on this arch is -4, we need to make 1344169706Skan sure all stack pointer adjustments are in multiple of 4. 1345117407Skan 134690285Sobrien For 64bit ABI we round up to 8 bytes. 134790285Sobrien */ 134818334Speter 134990285Sobrien#define PUSH_ROUNDING(BYTES) \ 135090285Sobrien (TARGET_64BIT \ 135190285Sobrien ? (((BYTES) + 7) & (-8)) \ 1352169706Skan : (((BYTES) + 3) & (-4))) 135318334Speter 135490285Sobrien/* If defined, the maximum amount of space required for outgoing arguments will 135590285Sobrien be computed and placed into the variable 135690285Sobrien `current_function_outgoing_args_size'. No space will be pushed onto the 135790285Sobrien stack for each call; instead, the function prologue should increase the stack 135890285Sobrien frame size by this amount. */ 135990285Sobrien 136090285Sobrien#define ACCUMULATE_OUTGOING_ARGS TARGET_ACCUMULATE_OUTGOING_ARGS 136190285Sobrien 136290285Sobrien/* If defined, a C expression whose value is nonzero when we want to use PUSH 136390285Sobrien instructions to pass outgoing arguments. */ 136490285Sobrien 136590285Sobrien#define PUSH_ARGS (TARGET_PUSH_ARGS && !ACCUMULATE_OUTGOING_ARGS) 136690285Sobrien 1367107598Sobrien/* We want the stack and args grow in opposite directions, even if 1368107598Sobrien PUSH_ARGS is 0. */ 1369107598Sobrien#define PUSH_ARGS_REVERSED 1 1370107598Sobrien 137118334Speter/* Offset of first parameter from the argument pointer register value. */ 137218334Speter#define FIRST_PARM_OFFSET(FNDECL) 0 137318334Speter 137490285Sobrien/* Define this macro if functions should assume that stack space has been 137590285Sobrien allocated for arguments even when their values are passed in registers. 137690285Sobrien 137790285Sobrien The value of this macro is the size, in bytes, of the area reserved for 137890285Sobrien arguments passed in registers for the function represented by FNDECL. 137990285Sobrien 138090285Sobrien This space can be allocated by the caller, or be a part of the 138190285Sobrien machine-dependent stack frame: `OUTGOING_REG_PARM_STACK_SPACE' says 138290285Sobrien which. */ 138390285Sobrien#define REG_PARM_STACK_SPACE(FNDECL) 0 138490285Sobrien 138518334Speter/* Value is the number of bytes of arguments automatically 138618334Speter popped when returning from a subroutine call. 138718334Speter FUNDECL is the declaration node of the function (as a tree), 138818334Speter FUNTYPE is the data type of the function (as a tree), 138918334Speter or for a library call it is an identifier node for the subroutine name. 139018334Speter SIZE is the number of bytes of arguments passed on the stack. 139118334Speter 139218334Speter On the 80386, the RTD insn may be used to pop them if the number 139318334Speter of args is fixed, but if the number is variable then the caller 139418334Speter must pop them all. RTD can't be used for library calls now 139518334Speter because the library is compiled with the Unix compiler. 139618334Speter Use of RTD is a selectable option, since it is incompatible with 139718334Speter standard Unix calling sequences. If the option is not selected, 139818334Speter the caller must always pop the args. 139918334Speter 140018334Speter The attribute stdcall is equivalent to RTD on a per module basis. */ 140118334Speter 140290285Sobrien#define RETURN_POPS_ARGS(FUNDECL, FUNTYPE, SIZE) \ 140390285Sobrien ix86_return_pops_args ((FUNDECL), (FUNTYPE), (SIZE)) 140418334Speter 140590285Sobrien#define FUNCTION_VALUE_REGNO_P(N) \ 140690285Sobrien ix86_function_value_regno_p (N) 140790285Sobrien 140818334Speter/* Define how to find the value returned by a library function 140918334Speter assuming the value has mode MODE. */ 141018334Speter 141118334Speter#define LIBCALL_VALUE(MODE) \ 141290285Sobrien ix86_libcall_value (MODE) 141318334Speter 141418334Speter/* Define the size of the result block used for communication between 141518334Speter untyped_call and untyped_return. The block contains a DImode value 141618334Speter followed by the block used by fnsave and frstor. */ 141718334Speter 141818334Speter#define APPLY_RESULT_SIZE (8+108) 141918334Speter 142018334Speter/* 1 if N is a possible register number for function argument passing. */ 142190285Sobrien#define FUNCTION_ARG_REGNO_P(N) ix86_function_arg_regno_p (N) 142218334Speter 142318334Speter/* Define a data type for recording info about an argument list 142418334Speter during the scan of that argument list. This data type should 142518334Speter hold all necessary information about the function itself 142618334Speter and about the args processed so far, enough to enable macros 142718334Speter such as FUNCTION_ARG to determine where the next arg should go. */ 142818334Speter 142990285Sobrientypedef struct ix86_args { 143018334Speter int words; /* # words passed so far */ 143118334Speter int nregs; /* # registers available for passing */ 143218334Speter int regno; /* next available register number */ 1433169706Skan int fastcall; /* fastcall calling convention is used */ 143490285Sobrien int sse_words; /* # sse words passed so far */ 143590285Sobrien int sse_nregs; /* # sse registers available for passing */ 1436132744Skan int warn_sse; /* True when we want to warn about SSE ABI. */ 1437132744Skan int warn_mmx; /* True when we want to warn about MMX ABI. */ 143890285Sobrien int sse_regno; /* next available sse register number */ 1439132744Skan int mmx_words; /* # mmx words passed so far */ 1440132744Skan int mmx_nregs; /* # mmx registers available for passing */ 1441132744Skan int mmx_regno; /* next available mmx register number */ 144290285Sobrien int maybe_vaarg; /* true for calls to possibly vardic fncts. */ 1443169706Skan int float_in_sse; /* 1 if in 32-bit mode SFmode (2 for DFmode) should 1444169706Skan be passed in SSE registers. Otherwise 0. */ 144518334Speter} CUMULATIVE_ARGS; 144618334Speter 144718334Speter/* Initialize a variable CUM of type CUMULATIVE_ARGS 144818334Speter for a call to a function whose data type is FNTYPE. 144918334Speter For a library call, FNTYPE is 0. */ 145018334Speter 1451132744Skan#define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, FNDECL, N_NAMED_ARGS) \ 1452132744Skan init_cumulative_args (&(CUM), (FNTYPE), (LIBNAME), (FNDECL)) 145318334Speter 145418334Speter/* Update the data in CUM to advance over an argument 145518334Speter of mode MODE and data type TYPE. 145618334Speter (TYPE is null for libcalls where that information may not be available.) */ 145718334Speter 145890285Sobrien#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \ 145990285Sobrien function_arg_advance (&(CUM), (MODE), (TYPE), (NAMED)) 146018334Speter 146118334Speter/* Define where to put the arguments to a function. 146218334Speter Value is zero to push the argument on the stack, 146318334Speter or a hard register in which to store the argument. 146418334Speter 146518334Speter MODE is the argument's machine mode. 146618334Speter TYPE is the data type of the argument (as a tree). 146718334Speter This is null for libcalls where that information may 146818334Speter not be available. 146918334Speter CUM is a variable of type CUMULATIVE_ARGS which gives info about 147018334Speter the preceding args and about the function being called. 147118334Speter NAMED is nonzero if this argument is a named parameter 147218334Speter (otherwise it is an extra parameter matching an ellipsis). */ 147318334Speter 147418334Speter#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \ 147590285Sobrien function_arg (&(CUM), (MODE), (TYPE), (NAMED)) 147618334Speter 147790285Sobrien/* Implement `va_start' for varargs and stdarg. */ 1478117407Skan#define EXPAND_BUILTIN_VA_START(VALIST, NEXTARG) \ 1479117407Skan ix86_va_start (VALIST, NEXTARG) 148018334Speter 1481132744Skan#define TARGET_ASM_FILE_END ix86_file_end 1482132744Skan#define NEED_INDICATE_EXEC_STACK 0 148318334Speter 148490285Sobrien/* Output assembler code to FILE to increment profiler label # LABELNO 148590285Sobrien for profiling a function entry. */ 148650654Sobrien 1487117407Skan#define FUNCTION_PROFILER(FILE, LABELNO) x86_function_profiler (FILE, LABELNO) 148818334Speter 1489117407Skan#define MCOUNT_NAME "_mcount" 1490117407Skan 1491117407Skan#define PROFILE_COUNT_REGISTER "edx" 1492117407Skan 149318334Speter/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function, 149418334Speter the stack pointer does not matter. The value is tested only in 149518334Speter functions that have frame pointers. 149618334Speter No definition is equivalent to always zero. */ 1497117407Skan/* Note on the 386 it might be more efficient not to define this since 149818334Speter we have to restore it ourselves from the frame pointer, in order to 149918334Speter use pop */ 150018334Speter 150118334Speter#define EXIT_IGNORE_STACK 1 150218334Speter 150318334Speter/* Output assembler code for a block containing the constant parts 150418334Speter of a trampoline, leaving space for the variable parts. */ 150518334Speter 150652295Sobrien/* On the 386, the trampoline contains two instructions: 150718334Speter mov #STATIC,ecx 150852295Sobrien jmp FUNCTION 150952295Sobrien The trampoline is generated entirely at runtime. The operand of JMP 151052295Sobrien is the address of FUNCTION relative to the instruction following the 151152295Sobrien JMP (which is 5 bytes long). */ 151218334Speter 151318334Speter/* Length in units of the trampoline for entering a nested function. */ 151418334Speter 151590285Sobrien#define TRAMPOLINE_SIZE (TARGET_64BIT ? 23 : 10) 151618334Speter 151718334Speter/* Emit RTL insns to initialize the variable parts of a trampoline. 151818334Speter FNADDR is an RTX for the address of the function's pure code. 151918334Speter CXT is an RTX for the static chain value for the function. */ 152018334Speter 152190285Sobrien#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \ 152290285Sobrien x86_initialize_trampoline ((TRAMP), (FNADDR), (CXT)) 152318334Speter 152418334Speter/* Definitions for register eliminations. 152518334Speter 152618334Speter This is an array of structures. Each structure initializes one pair 152718334Speter of eliminable registers. The "from" register number is given first, 152818334Speter followed by "to". Eliminations of the same "from" register are listed 152918334Speter in order of preference. 153018334Speter 153190285Sobrien There are two registers that can always be eliminated on the i386. 153290285Sobrien The frame pointer and the arg pointer can be replaced by either the 153390285Sobrien hard frame pointer or to the stack pointer, depending upon the 153490285Sobrien circumstances. The hard frame pointer is not used before reload and 153590285Sobrien so it is not eligible for elimination. */ 153618334Speter 153790285Sobrien#define ELIMINABLE_REGS \ 153890285Sobrien{{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \ 153990285Sobrien { ARG_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}, \ 154090285Sobrien { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}, \ 154190285Sobrien { FRAME_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}} \ 154218334Speter 154390285Sobrien/* Given FROM and TO register numbers, say whether this elimination is 154490285Sobrien allowed. Frame pointer elimination is automatically handled. 154518334Speter 154618334Speter All other eliminations are valid. */ 154718334Speter 154890285Sobrien#define CAN_ELIMINATE(FROM, TO) \ 154990285Sobrien ((TO) == STACK_POINTER_REGNUM ? ! frame_pointer_needed : 1) 155018334Speter 155118334Speter/* Define the offset between two registers, one to be eliminated, and the other 155218334Speter its replacement, at the start of a routine. */ 155318334Speter 155490285Sobrien#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \ 155590285Sobrien ((OFFSET) = ix86_initial_elimination_offset ((FROM), (TO))) 155618334Speter 155718334Speter/* Addressing modes, and classification of registers for them. */ 155818334Speter 155918334Speter/* Macros to check register numbers against specific register classes. */ 156018334Speter 156118334Speter/* These assume that REGNO is a hard or pseudo reg number. 156218334Speter They give nonzero only if REGNO is a hard reg of the suitable class 156318334Speter or a pseudo reg currently allocated to a suitable hard reg. 156418334Speter Since they use reg_renumber, they are safe only once reg_renumber 156518334Speter has been allocated, which happens in local-alloc.c. */ 156618334Speter 156790285Sobrien#define REGNO_OK_FOR_INDEX_P(REGNO) \ 156890285Sobrien ((REGNO) < STACK_POINTER_REGNUM \ 156990285Sobrien || (REGNO >= FIRST_REX_INT_REG \ 157090285Sobrien && (REGNO) <= LAST_REX_INT_REG) \ 157190285Sobrien || ((unsigned) reg_renumber[(REGNO)] >= FIRST_REX_INT_REG \ 157290285Sobrien && (unsigned) reg_renumber[(REGNO)] <= LAST_REX_INT_REG) \ 157390285Sobrien || (unsigned) reg_renumber[(REGNO)] < STACK_POINTER_REGNUM) 157418334Speter 157590285Sobrien#define REGNO_OK_FOR_BASE_P(REGNO) \ 157690285Sobrien ((REGNO) <= STACK_POINTER_REGNUM \ 157790285Sobrien || (REGNO) == ARG_POINTER_REGNUM \ 157890285Sobrien || (REGNO) == FRAME_POINTER_REGNUM \ 157990285Sobrien || (REGNO >= FIRST_REX_INT_REG \ 158090285Sobrien && (REGNO) <= LAST_REX_INT_REG) \ 158190285Sobrien || ((unsigned) reg_renumber[(REGNO)] >= FIRST_REX_INT_REG \ 158290285Sobrien && (unsigned) reg_renumber[(REGNO)] <= LAST_REX_INT_REG) \ 158390285Sobrien || (unsigned) reg_renumber[(REGNO)] <= STACK_POINTER_REGNUM) 158418334Speter 158590285Sobrien#define REGNO_OK_FOR_SIREG_P(REGNO) \ 158690285Sobrien ((REGNO) == 4 || reg_renumber[(REGNO)] == 4) 158790285Sobrien#define REGNO_OK_FOR_DIREG_P(REGNO) \ 158890285Sobrien ((REGNO) == 5 || reg_renumber[(REGNO)] == 5) 158918334Speter 159018334Speter/* The macros REG_OK_FOR..._P assume that the arg is a REG rtx 159118334Speter and check its validity for a certain class. 159218334Speter We have two alternate definitions for each of them. 159318334Speter The usual definition accepts all pseudo regs; the other rejects 159418334Speter them unless they have been allocated suitable hard regs. 159518334Speter The symbol REG_OK_STRICT causes the latter definition to be used. 159618334Speter 159718334Speter Most source files want to accept pseudo regs in the hope that 159818334Speter they will get allocated to the class that the insn wants them to be in. 159918334Speter Source files for reload pass need to be strict. 160018334Speter After reload, it makes no difference, since pseudo regs have 160118334Speter been eliminated by then. */ 160218334Speter 160318334Speter 1604169706Skan/* Non strict versions, pseudos are ok. */ 160518334Speter#define REG_OK_FOR_INDEX_NONSTRICT_P(X) \ 160618334Speter (REGNO (X) < STACK_POINTER_REGNUM \ 160790285Sobrien || (REGNO (X) >= FIRST_REX_INT_REG \ 160890285Sobrien && REGNO (X) <= LAST_REX_INT_REG) \ 160918334Speter || REGNO (X) >= FIRST_PSEUDO_REGISTER) 161018334Speter 161118334Speter#define REG_OK_FOR_BASE_NONSTRICT_P(X) \ 161218334Speter (REGNO (X) <= STACK_POINTER_REGNUM \ 161318334Speter || REGNO (X) == ARG_POINTER_REGNUM \ 161490285Sobrien || REGNO (X) == FRAME_POINTER_REGNUM \ 161590285Sobrien || (REGNO (X) >= FIRST_REX_INT_REG \ 161690285Sobrien && REGNO (X) <= LAST_REX_INT_REG) \ 161718334Speter || REGNO (X) >= FIRST_PSEUDO_REGISTER) 161818334Speter 161918334Speter/* Strict versions, hard registers only */ 162018334Speter#define REG_OK_FOR_INDEX_STRICT_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X)) 162118334Speter#define REG_OK_FOR_BASE_STRICT_P(X) REGNO_OK_FOR_BASE_P (REGNO (X)) 162218334Speter 162318334Speter#ifndef REG_OK_STRICT 162490285Sobrien#define REG_OK_FOR_INDEX_P(X) REG_OK_FOR_INDEX_NONSTRICT_P (X) 162590285Sobrien#define REG_OK_FOR_BASE_P(X) REG_OK_FOR_BASE_NONSTRICT_P (X) 162618334Speter 162718334Speter#else 162890285Sobrien#define REG_OK_FOR_INDEX_P(X) REG_OK_FOR_INDEX_STRICT_P (X) 162990285Sobrien#define REG_OK_FOR_BASE_P(X) REG_OK_FOR_BASE_STRICT_P (X) 163018334Speter#endif 163118334Speter 163218334Speter/* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression 163318334Speter that is a valid memory address for an instruction. 163418334Speter The MODE argument is the machine mode for the MEM expression 163518334Speter that wants to use this address. 163618334Speter 163718334Speter The other macros defined here are used only in GO_IF_LEGITIMATE_ADDRESS, 163818334Speter except for CONSTANT_ADDRESS_P which is usually machine-independent. 163918334Speter 164018334Speter See legitimize_pic_address in i386.c for details as to what 164118334Speter constitutes a legitimate address when -fpic is used. */ 164218334Speter 164318334Speter#define MAX_REGS_PER_ADDRESS 2 164418334Speter 1645117407Skan#define CONSTANT_ADDRESS_P(X) constant_address_p (X) 164618334Speter 164718334Speter/* Nonzero if the constant value X is a legitimate general operand. 164818334Speter It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */ 164918334Speter 1650117407Skan#define LEGITIMATE_CONSTANT_P(X) legitimate_constant_p (X) 165118334Speter 165218334Speter#ifdef REG_OK_STRICT 165318334Speter#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \ 165490285Sobriendo { \ 165590285Sobrien if (legitimate_address_p ((MODE), (X), 1)) \ 165618334Speter goto ADDR; \ 165790285Sobrien} while (0) 165818334Speter 165918334Speter#else 166018334Speter#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \ 166190285Sobriendo { \ 166290285Sobrien if (legitimate_address_p ((MODE), (X), 0)) \ 166318334Speter goto ADDR; \ 166490285Sobrien} while (0) 166518334Speter 166618334Speter#endif 166718334Speter 166890285Sobrien/* If defined, a C expression to determine the base term of address X. 166990285Sobrien This macro is used in only one place: `find_base_term' in alias.c. 167090285Sobrien 167190285Sobrien It is always safe for this macro to not be defined. It exists so 167290285Sobrien that alias analysis can understand machine-dependent addresses. 167390285Sobrien 167490285Sobrien The typical use of this macro is to handle addresses containing 167590285Sobrien a label_ref or symbol_ref within an UNSPEC. */ 167690285Sobrien 167790285Sobrien#define FIND_BASE_TERM(X) ix86_find_base_term (X) 167890285Sobrien 167918334Speter/* Try machine-dependent ways of modifying an illegitimate address 168018334Speter to be legitimate. If we find one, return the new, valid address. 168118334Speter This macro is used in only one place: `memory_address' in explow.c. 168218334Speter 168318334Speter OLDX is the address as it was before break_out_memory_refs was called. 168418334Speter In some cases it is useful to look at this to decide what needs to be done. 168518334Speter 168618334Speter MODE and WIN are passed so that this macro can use 168718334Speter GO_IF_LEGITIMATE_ADDRESS. 168818334Speter 168918334Speter It is always safe for this macro to do nothing. It exists to recognize 169018334Speter opportunities to optimize the output. 169118334Speter 169218334Speter For the 80386, we handle X+REG by loading X into a register R and 169318334Speter using R+REG. R will go in a general reg and indexing will be used. 169418334Speter However, if REG is a broken-out memory address or multiplication, 169518334Speter nothing needs to be done because REG can certainly go in a general reg. 169618334Speter 169718334Speter When -fpic is used, special handling is needed for symbolic references. 169818334Speter See comments by legitimize_pic_address in i386.c for details. */ 169918334Speter 170018334Speter#define LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN) \ 170190285Sobriendo { \ 170290285Sobrien (X) = legitimize_address ((X), (OLDX), (MODE)); \ 170390285Sobrien if (memory_address_p ((MODE), (X))) \ 170418334Speter goto WIN; \ 170590285Sobrien} while (0) 170618334Speter 170790285Sobrien#define REWRITE_ADDRESS(X) rewrite_address (X) 170850654Sobrien 170918334Speter/* Nonzero if the constant value X is a legitimate general operand 1710117407Skan when generating PIC code. It is given that flag_pic is on and 171118334Speter that X satisfies CONSTANT_P or is a CONST_DOUBLE. */ 171218334Speter 1713117407Skan#define LEGITIMATE_PIC_OPERAND_P(X) legitimate_pic_operand_p (X) 171418334Speter 171518334Speter#define SYMBOLIC_CONST(X) \ 171690285Sobrien (GET_CODE (X) == SYMBOL_REF \ 171790285Sobrien || GET_CODE (X) == LABEL_REF \ 171890285Sobrien || (GET_CODE (X) == CONST && symbolic_reference_mentioned_p (X))) 171918334Speter 172018334Speter/* Go to LABEL if ADDR (a legitimate address expression) 172118334Speter has an effect that depends on the machine mode it is used for. 172218334Speter On the 80386, only postdecrement and postincrement address depend thus 172318334Speter (the amount of decrement or increment being the length of the operand). */ 172490285Sobrien#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR, LABEL) \ 172590285Sobriendo { \ 172690285Sobrien if (GET_CODE (ADDR) == POST_INC \ 172790285Sobrien || GET_CODE (ADDR) == POST_DEC) \ 172890285Sobrien goto LABEL; \ 172990285Sobrien} while (0) 173018334Speter 173118334Speter/* Max number of args passed in registers. If this is more than 3, we will 173218334Speter have problems with ebx (register #4), since it is a caller save register and 173318334Speter is also used as the pic register in ELF. So for now, don't allow more than 173418334Speter 3 registers to be passed in registers. */ 173518334Speter 173690285Sobrien#define REGPARM_MAX (TARGET_64BIT ? 6 : 3) 173718334Speter 1738132744Skan#define SSE_REGPARM_MAX (TARGET_64BIT ? 8 : (TARGET_SSE ? 3 : 0)) 173990285Sobrien 1740132744Skan#define MMX_REGPARM_MAX (TARGET_64BIT ? 0 : (TARGET_MMX ? 3 : 0)) 1741132744Skan 174218334Speter 174318334Speter/* Specify the machine mode that this machine uses 174418334Speter for the index in the tablejump instruction. */ 174590285Sobrien#define CASE_VECTOR_MODE (!TARGET_64BIT || flag_pic ? SImode : DImode) 174618334Speter 174718334Speter/* Define this as 1 if `char' should by default be signed; else as 0. */ 174818334Speter#define DEFAULT_SIGNED_CHAR 1 174918334Speter 175090285Sobrien/* Number of bytes moved into a data cache for a single prefetch operation. */ 175190285Sobrien#define PREFETCH_BLOCK ix86_cost->prefetch_block 175290285Sobrien 175390285Sobrien/* Number of prefetch operations that can be done in parallel. */ 175490285Sobrien#define SIMULTANEOUS_PREFETCHES ix86_cost->simultaneous_prefetches 175590285Sobrien 175618334Speter/* Max number of bytes we can move from memory to memory 175718334Speter in one reasonably fast instruction. */ 175890285Sobrien#define MOVE_MAX 16 175918334Speter 176090285Sobrien/* MOVE_MAX_PIECES is the number of bytes at a time which we can 176190285Sobrien move efficiently, as opposed to MOVE_MAX which is the maximum 176290285Sobrien number of bytes we can move with a single instruction. */ 176390285Sobrien#define MOVE_MAX_PIECES (TARGET_64BIT ? 8 : 4) 176490285Sobrien 176552295Sobrien/* If a memory-to-memory move would take MOVE_RATIO or more simple 1766169706Skan move-instruction pairs, we will do a movmem or libcall instead. 176752295Sobrien Increasing the value will always make code faster, but eventually 176852295Sobrien incurs high cost in increased code size. 176918334Speter 177090285Sobrien If you don't define this, a reasonable default is used. */ 177118334Speter 177290285Sobrien#define MOVE_RATIO (optimize_size ? 3 : ix86_cost->move_ratio) 177318334Speter 1774169706Skan/* If a clear memory operation would take CLEAR_RATIO or more simple 1775169706Skan move-instruction sequences, we will do a clrmem or libcall instead. */ 1776169706Skan 1777169706Skan#define CLEAR_RATIO (optimize_size ? 2 \ 1778169706Skan : ix86_cost->move_ratio > 6 ? 6 : ix86_cost->move_ratio) 1779169706Skan 178018334Speter/* Define if shifts truncate the shift count 178118334Speter which implies one can omit a sign-extension or zero-extension 178218334Speter of a shift count. */ 178390285Sobrien/* On i386, shifts do truncate the count. But bit opcodes don't. */ 178418334Speter 178518334Speter/* #define SHIFT_COUNT_TRUNCATED */ 178618334Speter 178718334Speter/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits 178818334Speter is done just by pretending it is already truncated. */ 178918334Speter#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1 179018334Speter 179190285Sobrien/* A macro to update M and UNSIGNEDP when an object whose type is 179290285Sobrien TYPE and which has the specified mode and signedness is to be 179390285Sobrien stored in a register. This macro is only called when TYPE is a 179490285Sobrien scalar type. 179590285Sobrien 179690285Sobrien On i386 it is sometimes useful to promote HImode and QImode 179790285Sobrien quantities to SImode. The choice depends on target type. */ 179890285Sobrien 179990285Sobrien#define PROMOTE_MODE(MODE, UNSIGNEDP, TYPE) \ 180090285Sobriendo { \ 180190285Sobrien if (((MODE) == HImode && TARGET_PROMOTE_HI_REGS) \ 180290285Sobrien || ((MODE) == QImode && TARGET_PROMOTE_QI_REGS)) \ 180390285Sobrien (MODE) = SImode; \ 180490285Sobrien} while (0) 180590285Sobrien 180618334Speter/* Specify the machine mode that pointers have. 180718334Speter After generation of rtl, the compiler makes no further distinction 180818334Speter between pointers and any other objects of this machine mode. */ 180990285Sobrien#define Pmode (TARGET_64BIT ? DImode : SImode) 181018334Speter 181118334Speter/* A function address in a call instruction 181218334Speter is a byte address (for indexing purposes) 181318334Speter so give the MEM rtx a byte's mode. */ 181418334Speter#define FUNCTION_MODE QImode 181550654Sobrien 181690285Sobrien/* A C expression for the cost of moving data from a register in class FROM to 181790285Sobrien one in class TO. The classes are expressed using the enumeration values 181890285Sobrien such as `GENERAL_REGS'. A value of 2 is the default; other values are 181990285Sobrien interpreted relative to that. 182050654Sobrien 182190285Sobrien It is not required that the cost always equal 2 when FROM is the same as TO; 182290285Sobrien on some machines it is expensive to move between registers if they are not 182390285Sobrien general registers. */ 182450654Sobrien 182590285Sobrien#define REGISTER_MOVE_COST(MODE, CLASS1, CLASS2) \ 182690285Sobrien ix86_register_move_cost ((MODE), (CLASS1), (CLASS2)) 182750654Sobrien 182850654Sobrien/* A C expression for the cost of moving data of mode M between a 182950654Sobrien register and memory. A value of 2 is the default; this cost is 183050654Sobrien relative to those in `REGISTER_MOVE_COST'. 183150654Sobrien 183250654Sobrien If moving between registers and memory is more expensive than 183350654Sobrien between two registers, you should define this macro to express the 183450654Sobrien relative cost. */ 183550654Sobrien 183690285Sobrien#define MEMORY_MOVE_COST(MODE, CLASS, IN) \ 183790285Sobrien ix86_memory_move_cost ((MODE), (CLASS), (IN)) 183850654Sobrien 183950654Sobrien/* A C expression for the cost of a branch instruction. A value of 1 184050654Sobrien is the default; other values are interpreted relative to that. */ 184150654Sobrien 184290285Sobrien#define BRANCH_COST ix86_branch_cost 184350654Sobrien 184450654Sobrien/* Define this macro as a C expression which is nonzero if accessing 184550654Sobrien less than a word of memory (i.e. a `char' or a `short') is no 184650654Sobrien faster than accessing a word of memory, i.e., if such access 184750654Sobrien require more than one instruction or if there is no difference in 184850654Sobrien cost between byte and (aligned) word loads. 184950654Sobrien 185050654Sobrien When this macro is not defined, the compiler will access a field by 185150654Sobrien finding the smallest containing object; when it is defined, a 185250654Sobrien fullword load will be used if alignment permits. Unless bytes 185350654Sobrien accesses are faster than word accesses, using word accesses is 185450654Sobrien preferable since it may eliminate subsequent memory access if 185550654Sobrien subsequent accesses occur to other fields in the same word of the 185650654Sobrien structure, but to different bytes. */ 185750654Sobrien 185850654Sobrien#define SLOW_BYTE_ACCESS 0 185950654Sobrien 186050654Sobrien/* Nonzero if access to memory by shorts is slow and undesirable. */ 186150654Sobrien#define SLOW_SHORT_ACCESS 0 186250654Sobrien 186350654Sobrien/* Define this macro to be the value 1 if unaligned accesses have a 186450654Sobrien cost many times greater than aligned accesses, for example if they 186550654Sobrien are emulated in a trap handler. 186650654Sobrien 1867117407Skan When this macro is nonzero, the compiler will act as if 1868117407Skan `STRICT_ALIGNMENT' were nonzero when generating code for block 186950654Sobrien moves. This can cause significantly more instructions to be 1870117407Skan produced. Therefore, do not set this macro nonzero if unaligned 187150654Sobrien accesses only add a cycle or two to the time for a memory access. 187250654Sobrien 187350654Sobrien If the value of this macro is always zero, it need not be defined. */ 187450654Sobrien 187590285Sobrien/* #define SLOW_UNALIGNED_ACCESS(MODE, ALIGN) 0 */ 187650654Sobrien 187750654Sobrien/* Define this macro if it is as good or better to call a constant 187850654Sobrien function address than to call an address kept in a register. 187950654Sobrien 188050654Sobrien Desirable on the 386 because a CALL with a constant address is 188150654Sobrien faster than one with a register address. */ 188250654Sobrien 188350654Sobrien#define NO_FUNCTION_CSE 188490285Sobrien 188518334Speter/* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE, 188618334Speter return the mode to be used for the comparison. 188718334Speter 188818334Speter For floating-point equality comparisons, CCFPEQmode should be used. 188990285Sobrien VOIDmode should be used in all other cases. 189018334Speter 189190285Sobrien For integer comparisons against zero, reduce to CCNOmode or CCZmode if 189290285Sobrien possible, to allow for more combinations. */ 189318334Speter 189490285Sobrien#define SELECT_CC_MODE(OP, X, Y) ix86_cc_mode ((OP), (X), (Y)) 189518334Speter 1896117407Skan/* Return nonzero if MODE implies a floating point inequality can be 189790285Sobrien reversed. */ 189818334Speter 189990285Sobrien#define REVERSIBLE_CC_MODE(MODE) 1 190018334Speter 190190285Sobrien/* A C expression whose value is reversed condition code of the CODE for 190290285Sobrien comparison done in CC_MODE mode. */ 1903169706Skan#define REVERSE_CONDITION(CODE, MODE) ix86_reverse_condition ((CODE), (MODE)) 190418334Speter 190518334Speter 190618334Speter/* Control the assembler format that we output, to the extent 190718334Speter this does not vary between assemblers. */ 190818334Speter 190918334Speter/* How to refer to registers in assembler output. 191090285Sobrien This sequence is indexed by compiler's hard-register-number (see above). */ 191118334Speter 1912169706Skan/* In order to refer to the first 8 regs as 32 bit regs, prefix an "e". 191318334Speter For non floating point regs, the following are the HImode names. 191418334Speter 191518334Speter For float regs, the stack top is sometimes referred to as "%st(0)" 1916132744Skan instead of just "%st". PRINT_OPERAND handles this with the "y" code. */ 191718334Speter 191890285Sobrien#define HI_REGISTER_NAMES \ 191990285Sobrien{"ax","dx","cx","bx","si","di","bp","sp", \ 1920132744Skan "st","st(1)","st(2)","st(3)","st(4)","st(5)","st(6)","st(7)", \ 1921132744Skan "argp", "flags", "fpsr", "dirflag", "frame", \ 192290285Sobrien "xmm0","xmm1","xmm2","xmm3","xmm4","xmm5","xmm6","xmm7", \ 192390285Sobrien "mm0", "mm1", "mm2", "mm3", "mm4", "mm5", "mm6", "mm7" , \ 192490285Sobrien "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", \ 192590285Sobrien "xmm8", "xmm9", "xmm10", "xmm11", "xmm12", "xmm13", "xmm14", "xmm15"} 192618334Speter 192718334Speter#define REGISTER_NAMES HI_REGISTER_NAMES 192818334Speter 192918334Speter/* Table of additional register names to use in user input. */ 193018334Speter 193118334Speter#define ADDITIONAL_REGISTER_NAMES \ 193250654Sobrien{ { "eax", 0 }, { "edx", 1 }, { "ecx", 2 }, { "ebx", 3 }, \ 193350654Sobrien { "esi", 4 }, { "edi", 5 }, { "ebp", 6 }, { "esp", 7 }, \ 193490285Sobrien { "rax", 0 }, { "rdx", 1 }, { "rcx", 2 }, { "rbx", 3 }, \ 193590285Sobrien { "rsi", 4 }, { "rdi", 5 }, { "rbp", 6 }, { "rsp", 7 }, \ 193650654Sobrien { "al", 0 }, { "dl", 1 }, { "cl", 2 }, { "bl", 3 }, \ 1937169706Skan { "ah", 0 }, { "dh", 1 }, { "ch", 2 }, { "bh", 3 } } 193818334Speter 193918334Speter/* Note we are omitting these since currently I don't know how 194018334Speterto get gcc to use these, since they want the same but different 194118334Speternumber as al, and ax. 194218334Speter*/ 194318334Speter 194418334Speter#define QI_REGISTER_NAMES \ 194590285Sobrien{"al", "dl", "cl", "bl", "sil", "dil", "bpl", "spl",} 194618334Speter 194718334Speter/* These parallel the array above, and can be used to access bits 8:15 194890285Sobrien of regs 0 through 3. */ 194918334Speter 195018334Speter#define QI_HIGH_REGISTER_NAMES \ 195118334Speter{"ah", "dh", "ch", "bh", } 195218334Speter 195318334Speter/* How to renumber registers for dbx and gdb. */ 195418334Speter 195590285Sobrien#define DBX_REGISTER_NUMBER(N) \ 195690285Sobrien (TARGET_64BIT ? dbx64_register_map[(N)] : dbx_register_map[(N)]) 195718334Speter 195890285Sobrienextern int const dbx_register_map[FIRST_PSEUDO_REGISTER]; 195990285Sobrienextern int const dbx64_register_map[FIRST_PSEUDO_REGISTER]; 196090285Sobrienextern int const svr4_dbx_register_map[FIRST_PSEUDO_REGISTER]; 196190285Sobrien 196250654Sobrien/* Before the prologue, RA is at 0(%esp). */ 196350654Sobrien#define INCOMING_RETURN_ADDR_RTX \ 196450654Sobrien gen_rtx_MEM (VOIDmode, gen_rtx_REG (VOIDmode, STACK_POINTER_REGNUM)) 1965117407Skan 196650654Sobrien/* After the prologue, RA is at -4(AP) in the current frame. */ 196790285Sobrien#define RETURN_ADDR_RTX(COUNT, FRAME) \ 196890285Sobrien ((COUNT) == 0 \ 196990285Sobrien ? gen_rtx_MEM (Pmode, plus_constant (arg_pointer_rtx, -UNITS_PER_WORD)) \ 197090285Sobrien : gen_rtx_MEM (Pmode, plus_constant (FRAME, UNITS_PER_WORD))) 197150654Sobrien 197290285Sobrien/* PC is dbx register 8; let's use that column for RA. */ 197390285Sobrien#define DWARF_FRAME_RETURN_COLUMN (TARGET_64BIT ? 16 : 8) 197450654Sobrien 197550654Sobrien/* Before the prologue, the top of the frame is at 4(%esp). */ 197690285Sobrien#define INCOMING_FRAME_SP_OFFSET UNITS_PER_WORD 197750654Sobrien 197890285Sobrien/* Describe how we implement __builtin_eh_return. */ 197990285Sobrien#define EH_RETURN_DATA_REGNO(N) ((N) < 2 ? (N) : INVALID_REGNUM) 198090285Sobrien#define EH_RETURN_STACKADJ_RTX gen_rtx_REG (Pmode, 2) 198118334Speter 198218334Speter 198390285Sobrien/* Select a format to encode pointers in exception handling data. CODE 198490285Sobrien is 0 for data, 1 for code labels, 2 for function pointers. GLOBAL is 198590285Sobrien true if the symbol may be affected by dynamic relocations. 198618334Speter 198790285Sobrien ??? All x86 object file formats are capable of representing this. 198890285Sobrien After all, the relocation needed is the same as for the call insn. 198990285Sobrien Whether or not a particular assembler allows us to enter such, I 199090285Sobrien guess we'll have to see. */ 199190285Sobrien#define ASM_PREFERRED_EH_DATA_FORMAT(CODE, GLOBAL) \ 1992169706Skan asm_preferred_eh_data_format ((CODE), (GLOBAL)) 199318334Speter 199418334Speter/* This is how to output an insn to push a register on the stack. 199518334Speter It need not be very fast code. */ 199618334Speter 199790285Sobrien#define ASM_OUTPUT_REG_PUSH(FILE, REGNO) \ 1998107598Sobriendo { \ 1999107598Sobrien if (TARGET_64BIT) \ 2000107598Sobrien asm_fprintf ((FILE), "\tpush{q}\t%%r%s\n", \ 2001107598Sobrien reg_names[(REGNO)] + (REX_INT_REGNO_P (REGNO) != 0)); \ 2002107598Sobrien else \ 2003107598Sobrien asm_fprintf ((FILE), "\tpush{l}\t%%e%s\n", reg_names[(REGNO)]); \ 2004107598Sobrien} while (0) 200518334Speter 200618334Speter/* This is how to output an insn to pop a register from the stack. 200718334Speter It need not be very fast code. */ 200818334Speter 200990285Sobrien#define ASM_OUTPUT_REG_POP(FILE, REGNO) \ 2010107598Sobriendo { \ 2011107598Sobrien if (TARGET_64BIT) \ 2012107598Sobrien asm_fprintf ((FILE), "\tpop{q}\t%%r%s\n", \ 2013107598Sobrien reg_names[(REGNO)] + (REX_INT_REGNO_P (REGNO) != 0)); \ 2014107598Sobrien else \ 2015107598Sobrien asm_fprintf ((FILE), "\tpop{l}\t%%e%s\n", reg_names[(REGNO)]); \ 2016107598Sobrien} while (0) 201718334Speter 201890285Sobrien/* This is how to output an element of a case-vector that is absolute. */ 201918334Speter 202018334Speter#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \ 202190285Sobrien ix86_output_addr_vec_elt ((FILE), (VALUE)) 202218334Speter 202390285Sobrien/* This is how to output an element of a case-vector that is relative. */ 202418334Speter 202550654Sobrien#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \ 202690285Sobrien ix86_output_addr_diff_elt ((FILE), (VALUE), (REL)) 202718334Speter 2028169706Skan/* Under some conditions we need jump tables in the text section, 2029169706Skan because the assembler cannot handle label differences between 2030169706Skan sections. This is the case for x86_64 on Mach-O for example. */ 203118334Speter 203290285Sobrien#define JUMP_TABLES_IN_TEXT_SECTION \ 2033169706Skan (flag_pic && ((TARGET_MACHO && TARGET_64BIT) \ 2034169706Skan || (!TARGET_64BIT && !HAVE_AS_GOTOFF_IN_DATA))) 203518334Speter 203690285Sobrien/* Switch to init or fini section via SECTION_OP, emit a call to FUNC, 203790285Sobrien and switch back. For x86 we do this only to save a few bytes that 203890285Sobrien would otherwise be unused in the text section. */ 203990285Sobrien#define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC) \ 204090285Sobrien asm (SECTION_OP "\n\t" \ 204190285Sobrien "call " USER_LABEL_PREFIX #FUNC "\n" \ 204290285Sobrien TEXT_SECTION_ASM_OP); 204318334Speter 204418334Speter/* Print operand X (an rtx) in assembler syntax to file FILE. 204518334Speter CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified. 204690285Sobrien Effect of various CODE letters is described in i386.c near 204790285Sobrien print_operand function. */ 204818334Speter 204990285Sobrien#define PRINT_OPERAND_PUNCT_VALID_P(CODE) \ 2050117407Skan ((CODE) == '*' || (CODE) == '+' || (CODE) == '&') 205118334Speter 205218334Speter#define PRINT_OPERAND(FILE, X, CODE) \ 205390285Sobrien print_operand ((FILE), (X), (CODE)) 205418334Speter 205518334Speter#define PRINT_OPERAND_ADDRESS(FILE, ADDR) \ 205690285Sobrien print_operand_address ((FILE), (ADDR)) 205718334Speter 2058117407Skan#define OUTPUT_ADDR_CONST_EXTRA(FILE, X, FAIL) \ 2059117407Skando { \ 2060117407Skan if (! output_addr_const_extra (FILE, (X))) \ 2061117407Skan goto FAIL; \ 2062117407Skan} while (0); 2063117407Skan 206418334Speter/* a letter which is not needed by the normal asm syntax, which 206518334Speter we can use for operand syntax in the extended asm */ 206618334Speter 206718334Speter#define ASM_OPERAND_LETTER '#' 206818334Speter#define RET return "" 206990285Sobrien#define AT_SP(MODE) (gen_rtx_MEM ((MODE), stack_pointer_rtx)) 207018334Speter 2071117407Skan/* Which processor to schedule for. The cpu attribute defines a list that 2072117407Skan mirrors this list, so changes to i386.md must be made at the same time. */ 2073117407Skan 2074117407Skanenum processor_type 2075117407Skan{ 2076117407Skan PROCESSOR_I386, /* 80386 */ 2077117407Skan PROCESSOR_I486, /* 80486DX, 80486SX, 80486DX[24] */ 2078117407Skan PROCESSOR_PENTIUM, 2079117407Skan PROCESSOR_PENTIUMPRO, 2080117407Skan PROCESSOR_K6, 2081117407Skan PROCESSOR_ATHLON, 2082117407Skan PROCESSOR_PENTIUM4, 2083132744Skan PROCESSOR_K8, 2084169706Skan PROCESSOR_NOCONA, 2085169706Skan PROCESSOR_GENERIC32, 2086169706Skan PROCESSOR_GENERIC64, 2087117407Skan PROCESSOR_max 2088117407Skan}; 2089117407Skan 2090132744Skanextern enum processor_type ix86_tune; 2091117407Skanextern enum processor_type ix86_arch; 2092117407Skan 2093117407Skanenum fpmath_unit 2094117407Skan{ 2095117407Skan FPMATH_387 = 1, 2096117407Skan FPMATH_SSE = 2 2097117407Skan}; 2098117407Skan 2099117407Skanextern enum fpmath_unit ix86_fpmath; 2100117407Skan 2101117407Skanenum tls_dialect 2102117407Skan{ 2103117407Skan TLS_DIALECT_GNU, 2104169706Skan TLS_DIALECT_GNU2, 2105117407Skan TLS_DIALECT_SUN 2106117407Skan}; 2107117407Skan 2108117407Skanextern enum tls_dialect ix86_tls_dialect; 2109117407Skan 211090285Sobrienenum cmodel { 2111117407Skan CM_32, /* The traditional 32-bit ABI. */ 2112117407Skan CM_SMALL, /* Assumes all code and data fits in the low 31 bits. */ 2113117407Skan CM_KERNEL, /* Assumes all code and data fits in the high 31 bits. */ 2114117407Skan CM_MEDIUM, /* Assumes code fits in the low 31 bits; data unlimited. */ 2115117407Skan CM_LARGE, /* No assumptions. */ 2116169706Skan CM_SMALL_PIC, /* Assumes code+data+got/plt fits in a 31 bit region. */ 2117169706Skan CM_MEDIUM_PIC /* Assumes code+got/plt fits in a 31 bit region. */ 211890285Sobrien}; 211918334Speter 2120117407Skanextern enum cmodel ix86_cmodel; 2121117407Skan 212290285Sobrien/* Size of the RED_ZONE area. */ 212390285Sobrien#define RED_ZONE_SIZE 128 212490285Sobrien/* Reserved area of the red zone for temporaries. */ 212590285Sobrien#define RED_ZONE_RESERVE 8 212650654Sobrien 212790285Sobrienenum asm_dialect { 212890285Sobrien ASM_ATT, 212990285Sobrien ASM_INTEL 213090285Sobrien}; 2131117407Skan 213290285Sobrienextern enum asm_dialect ix86_asm_dialect; 2133169706Skanextern unsigned int ix86_preferred_stack_boundary; 2134169706Skanextern int ix86_branch_cost, ix86_section_threshold; 2135117407Skan 2136117407Skan/* Smallest class containing REGNO. */ 2137117407Skanextern enum reg_class const regclass_map[FIRST_PSEUDO_REGISTER]; 2138117407Skan 213990285Sobrienextern rtx ix86_compare_op0; /* operand 0 for comparisons */ 214090285Sobrienextern rtx ix86_compare_op1; /* operand 1 for comparisons */ 2141169706Skanextern rtx ix86_compare_emitted; 214290285Sobrien 214390285Sobrien/* To properly truncate FP values into integers, we need to set i387 control 214490285Sobrien word. We can't emit proper mode switching code before reload, as spills 214590285Sobrien generated by reload may truncate values incorrectly, but we still can avoid 214690285Sobrien redundant computation of new control word by the mode switching pass. 214790285Sobrien The fldcw instructions are still emitted redundantly, but this is probably 214890285Sobrien not going to be noticeable problem, as most CPUs do have fast path for 2149117407Skan the sequence. 215018334Speter 215190285Sobrien The machinery is to emit simple truncation instructions and split them 215290285Sobrien before reload to instructions having USEs of two memory locations that 215390285Sobrien are filled by this code to old and new control word. 2154117407Skan 215590285Sobrien Post-reload pass may be later used to eliminate the redundant fildcw if 215690285Sobrien needed. */ 215718334Speter 2158169706Skanenum ix86_entity 2159169706Skan{ 2160169706Skan I387_TRUNC = 0, 2161169706Skan I387_FLOOR, 2162169706Skan I387_CEIL, 2163169706Skan I387_MASK_PM, 2164169706Skan MAX_386_ENTITIES 2165169706Skan}; 216650654Sobrien 2167169706Skanenum ix86_stack_slot 2168169706Skan{ 2169169706Skan SLOT_TEMP = 0, 2170169706Skan SLOT_CW_STORED, 2171169706Skan SLOT_CW_TRUNC, 2172169706Skan SLOT_CW_FLOOR, 2173169706Skan SLOT_CW_CEIL, 2174169706Skan SLOT_CW_MASK_PM, 2175169706Skan MAX_386_STACK_LOCALS 2176169706Skan}; 2177169706Skan 217890285Sobrien/* Define this macro if the port needs extra instructions inserted 217990285Sobrien for mode switching in an optimizing compilation. */ 218090285Sobrien 2181169706Skan#define OPTIMIZE_MODE_SWITCHING(ENTITY) \ 2182169706Skan ix86_optimize_mode_switching[(ENTITY)] 218390285Sobrien 218490285Sobrien/* If you define `OPTIMIZE_MODE_SWITCHING', you have to define this as 218590285Sobrien initializer for an array of integers. Each initializer element N 218690285Sobrien refers to an entity that needs mode switching, and specifies the 218790285Sobrien number of different modes that might need to be set for this 218890285Sobrien entity. The position of the initializer in the initializer - 218990285Sobrien starting counting at zero - determines the integer that is used to 219090285Sobrien refer to the mode-switched entity in question. */ 219190285Sobrien 2192169706Skan#define NUM_MODES_FOR_MODE_SWITCHING \ 2193169706Skan { I387_CW_ANY, I387_CW_ANY, I387_CW_ANY, I387_CW_ANY } 219490285Sobrien 219590285Sobrien/* ENTITY is an integer specifying a mode-switched entity. If 219690285Sobrien `OPTIMIZE_MODE_SWITCHING' is defined, you must define this macro to 219790285Sobrien return an integer value not larger than the corresponding element 219890285Sobrien in `NUM_MODES_FOR_MODE_SWITCHING', to denote the mode that ENTITY 2199169706Skan must be switched into prior to the execution of INSN. */ 220090285Sobrien 2201169706Skan#define MODE_NEEDED(ENTITY, I) ix86_mode_needed ((ENTITY), (I)) 220290285Sobrien 220390285Sobrien/* This macro specifies the order in which modes for ENTITY are 220490285Sobrien processed. 0 is the highest priority. */ 220590285Sobrien 220690285Sobrien#define MODE_PRIORITY_TO_MODE(ENTITY, N) (N) 220790285Sobrien 220890285Sobrien/* Generate one or more insns to set ENTITY to MODE. HARD_REG_LIVE 220990285Sobrien is the set of hard registers live at the point where the insn(s) 221090285Sobrien are to be inserted. */ 221190285Sobrien 221290285Sobrien#define EMIT_MODE_SET(ENTITY, MODE, HARD_REGS_LIVE) \ 2213169706Skan ((MODE) != I387_CW_ANY && (MODE) != I387_CW_UNINITIALIZED \ 2214169706Skan ? emit_i387_cw_initialization (MODE), 0 \ 221590285Sobrien : 0) 2216169706Skan 221718334Speter 221890285Sobrien/* Avoid renaming of stack registers, as doing so in combination with 221990285Sobrien scheduling just increases amount of live registers at time and in 222090285Sobrien the turn amount of fxch instructions needed. 222190285Sobrien 2222132744Skan ??? Maybe Pentium chips benefits from renaming, someone can try.... */ 222390285Sobrien 222490285Sobrien#define HARD_REGNO_RENAME_OK(SRC, TARGET) \ 222590285Sobrien ((SRC) < FIRST_STACK_REG || (SRC) > LAST_STACK_REG) 222690285Sobrien 222790285Sobrien 2228132744Skan#define DLL_IMPORT_EXPORT_PREFIX '#' 2229117407Skan 2230132744Skan#define FASTCALL_PREFIX '@' 2231132744Skan 2232132744Skanstruct machine_function GTY(()) 2233132744Skan{ 2234132744Skan struct stack_local_entry *stack_locals; 2235132744Skan const char *some_ld_name; 2236169706Skan rtx force_align_arg_pointer; 2237132744Skan int save_varrargs_registers; 2238132744Skan int accesses_prev_frame; 2239169706Skan int optimize_mode_switching[MAX_386_ENTITIES]; 2240132744Skan /* Set by ix86_compute_frame_layout and used by prologue/epilogue expander to 2241132744Skan determine the style used. */ 2242132744Skan int use_fast_prologue_epilogue; 2243132744Skan /* Number of saved registers USE_FAST_PROLOGUE_EPILOGUE has been computed 2244132744Skan for. */ 2245132744Skan int use_fast_prologue_epilogue_nregs; 2246169706Skan /* If true, the current function needs the default PIC register, not 2247169706Skan an alternate register (on x86) and must not use the red zone (on 2248169706Skan x86_64), even if it's a leaf function. We don't want the 2249169706Skan function to be regarded as non-leaf because TLS calls need not 2250169706Skan affect register allocation. This flag is set when a TLS call 2251169706Skan instruction is expanded within a function, and never reset, even 2252169706Skan if all such instructions are optimized away. Use the 2253169706Skan ix86_current_function_calls_tls_descriptor macro for a better 2254169706Skan approximation. */ 2255169706Skan int tls_descriptor_call_expanded_p; 2256132744Skan}; 2257117407Skan 2258132744Skan#define ix86_stack_locals (cfun->machine->stack_locals) 2259132744Skan#define ix86_save_varrargs_registers (cfun->machine->save_varrargs_registers) 2260132744Skan#define ix86_optimize_mode_switching (cfun->machine->optimize_mode_switching) 2261169706Skan#define ix86_tls_descriptor_calls_expanded_in_cfun \ 2262169706Skan (cfun->machine->tls_descriptor_call_expanded_p) 2263169706Skan/* Since tls_descriptor_call_expanded is not cleared, even if all TLS 2264169706Skan calls are optimized away, we try to detect cases in which it was 2265169706Skan optimized away. Since such instructions (use (reg REG_SP)), we can 2266169706Skan verify whether there's any such instruction live by testing that 2267169706Skan REG_SP is live. */ 2268169706Skan#define ix86_current_function_calls_tls_descriptor \ 2269169706Skan (ix86_tls_descriptor_calls_expanded_in_cfun && regs_ever_live[SP_REG]) 2270132744Skan 2271132744Skan/* Control behavior of x86_file_start. */ 2272132744Skan#define X86_FILE_START_VERSION_DIRECTIVE false 2273132744Skan#define X86_FILE_START_FLTUSED false 2274132744Skan 2275169706Skan/* Flag to mark data that is in the large address area. */ 2276169706Skan#define SYMBOL_FLAG_FAR_ADDR (SYMBOL_FLAG_MACH_DEP << 0) 2277169706Skan#define SYMBOL_REF_FAR_ADDR_P(X) \ 2278169706Skan ((SYMBOL_REF_FLAGS (X) & SYMBOL_FLAG_FAR_ADDR) != 0) 227918334Speter/* 228018334SpeterLocal variables: 228118334Speterversion-control: t 228218334SpeterEnd: 228318334Speter*/ 2284