📄 i386.h
字号:
All registers that the compiler knows about must be given numbers, even those that are not normally considered general registers. In the 80386 we give the 8 general purpose registers the numbers 0-7. We number the floating point registers 8-15. Note that registers 0-7 can be accessed as a short or int, while only 0-3 may be used with byte `mov' instructions. Reg 16 does not correspond to any hardware register, but instead appears in the RTL as an argument pointer prior to reload, and is eliminated during reloading in favor of either the stack or frame pointer. */#define FIRST_PSEUDO_REGISTER 53/* Number of hardware registers that go into the DWARF-2 unwind info. If not defined, equals FIRST_PSEUDO_REGISTER. */#define DWARF_FRAME_REGISTERS 17/* 1 for registers that have pervasive standard uses and are not available for the register allocator. On the 80386, the stack pointer is such, as is the arg pointer. The value is zero if the register is not fixed on either 32 or 64 bit targets, one if the register if fixed on both 32 and 64 bit targets, two if it is only fixed on 32bit targets and three if its only fixed on 64bit targets. Proper values are computed in the CONDITIONAL_REGISTER_USAGE. */#define FIXED_REGISTERS \/*ax,dx,cx,bx,si,di,bp,sp,st,st1,st2,st3,st4,st5,st6,st7*/ \{ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, \/*arg,flags,fpsr,dir,frame*/ \ 1, 1, 1, 1, 1, \/*xmm0,xmm1,xmm2,xmm3,xmm4,xmm5,xmm6,xmm7*/ \ 0, 0, 0, 0, 0, 0, 0, 0, \/*mmx0,mmx1,mmx2,mmx3,mmx4,mmx5,mmx6,mmx7*/ \ 0, 0, 0, 0, 0, 0, 0, 0, \/* r8, r9, r10, r11, r12, r13, r14, r15*/ \ 2, 2, 2, 2, 2, 2, 2, 2, \/*xmm8,xmm9,xmm10,xmm11,xmm12,xmm13,xmm14,xmm15*/ \ 2, 2, 2, 2, 2, 2, 2, 2}/* 1 for registers not available across function calls. These must include the FIXED_REGISTERS and also any registers that can be used without being saved. The latter must include the registers where values are returned and the register where structure-value addresses are passed. Aside from that, you can include as many other registers as you like. The value is zero if the register is not call used on either 32 or 64 bit targets, one if the register if call used on both 32 and 64 bit targets, two if it is only call used on 32bit targets and three if its only call used on 64bit targets. Proper values are computed in the CONDITIONAL_REGISTER_USAGE.*/#define CALL_USED_REGISTERS \/*ax,dx,cx,bx,si,di,bp,sp,st,st1,st2,st3,st4,st5,st6,st7*/ \{ 1, 1, 1, 0, 3, 3, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, \/*arg,flags,fpsr,dir,frame*/ \ 1, 1, 1, 1, 1, \/*xmm0,xmm1,xmm2,xmm3,xmm4,xmm5,xmm6,xmm7*/ \ 1, 1, 1, 1, 1, 1, 1, 1, \/*mmx0,mmx1,mmx2,mmx3,mmx4,mmx5,mmx6,mmx7*/ \ 1, 1, 1, 1, 1, 1, 1, 1, \/* r8, r9, r10, r11, r12, r13, r14, r15*/ \ 1, 1, 1, 1, 2, 2, 2, 2, \/*xmm8,xmm9,xmm10,xmm11,xmm12,xmm13,xmm14,xmm15*/ \ 1, 1, 1, 1, 1, 1, 1, 1} \/* Order in which to allocate registers. Each register must be listed once, even those in FIXED_REGISTERS. List frame pointer late and fixed registers last. Note that, in general, we prefer registers listed in CALL_USED_REGISTERS, keeping the others available for storage of persistent values. The ORDER_REGS_FOR_LOCAL_ALLOC actually overwrite the order, so this is just empty initializer for array. */#define REG_ALLOC_ORDER \{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,\ 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, \ 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, \ 48, 49, 50, 51, 52 }/* ORDER_REGS_FOR_LOCAL_ALLOC is a macro which permits reg_alloc_order to be rearranged based on a particular function. When using sse math, we want to allocate SSE before x87 registers and vice vera. */#define ORDER_REGS_FOR_LOCAL_ALLOC x86_order_regs_for_local_alloc ()/* Macro to conditionally modify fixed_regs/call_used_regs. */#define CONDITIONAL_REGISTER_USAGE \do { \ int i; \ for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) \ { \ if (fixed_regs[i] > 1) \ fixed_regs[i] = (fixed_regs[i] == (TARGET_64BIT ? 3 : 2)); \ if (call_used_regs[i] > 1) \ call_used_regs[i] = (call_used_regs[i] \ == (TARGET_64BIT ? 3 : 2)); \ } \ if (PIC_OFFSET_TABLE_REGNUM != INVALID_REGNUM) \ { \ fixed_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \ call_used_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \ } \ if (! TARGET_MMX) \ { \ int i; \ for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) \ if (TEST_HARD_REG_BIT (reg_class_contents[(int)MMX_REGS], i)) \ fixed_regs[i] = call_used_regs[i] = 1, reg_names[i] = ""; \ } \ if (! TARGET_SSE) \ { \ int i; \ for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) \ if (TEST_HARD_REG_BIT (reg_class_contents[(int)SSE_REGS], i)) \ fixed_regs[i] = call_used_regs[i] = 1, reg_names[i] = ""; \ } \ if (! TARGET_80387 && ! TARGET_FLOAT_RETURNS_IN_80387) \ { \ int i; \ HARD_REG_SET x; \ COPY_HARD_REG_SET (x, reg_class_contents[(int)FLOAT_REGS]); \ for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) \ if (TEST_HARD_REG_BIT (x, i)) \ fixed_regs[i] = call_used_regs[i] = 1, reg_names[i] = ""; \ } \ if (! TARGET_64BIT) \ { \ int i; \ for (i = FIRST_REX_INT_REG; i <= LAST_REX_INT_REG; i++) \ reg_names[i] = ""; \ for (i = FIRST_REX_SSE_REG; i <= LAST_REX_SSE_REG; i++) \ reg_names[i] = ""; \ } \ } while (0)/* Return number of consecutive hard regs needed starting at reg REGNO to hold something of mode MODE. This is ordinarily the length in words of a value of mode MODE but can be less for certain modes in special long registers. Actually there are no two word move instructions for consecutive registers. And only registers 0-3 may have mov byte instructions applied to them. */#define HARD_REGNO_NREGS(REGNO, MODE) \ (FP_REGNO_P (REGNO) || SSE_REGNO_P (REGNO) || MMX_REGNO_P (REGNO) \ ? (COMPLEX_MODE_P (MODE) ? 2 : 1) \ : ((MODE) == XFmode \ ? (TARGET_64BIT ? 2 : 3) \ : (MODE) == XCmode \ ? (TARGET_64BIT ? 4 : 6) \ : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)))#define VALID_SSE2_REG_MODE(MODE) \ ((MODE) == V16QImode || (MODE) == V8HImode || (MODE) == V2DFmode \ || (MODE) == V2DImode || (MODE) == DFmode)#define VALID_SSE_REG_MODE(MODE) \ ((MODE) == TImode || (MODE) == V4SFmode || (MODE) == V4SImode \ || (MODE) == SFmode || (MODE) == TFmode)#define VALID_MMX_REG_MODE_3DNOW(MODE) \ ((MODE) == V2SFmode || (MODE) == SFmode)#define VALID_MMX_REG_MODE(MODE) \ ((MODE) == DImode || (MODE) == V8QImode || (MODE) == V4HImode \ || (MODE) == V2SImode || (MODE) == SImode)/* ??? No autovectorization into MMX or 3DNOW until we can reliably place emms and femms instructions. */#define UNITS_PER_SIMD_WORD (TARGET_SSE ? 16 : UNITS_PER_WORD)#define VALID_FP_MODE_P(MODE) \ ((MODE) == SFmode || (MODE) == DFmode || (MODE) == XFmode \ || (MODE) == SCmode || (MODE) == DCmode || (MODE) == XCmode) \#define VALID_INT_MODE_P(MODE) \ ((MODE) == QImode || (MODE) == HImode || (MODE) == SImode \ || (MODE) == DImode \ || (MODE) == CQImode || (MODE) == CHImode || (MODE) == CSImode \ || (MODE) == CDImode \ || (TARGET_64BIT && ((MODE) == TImode || (MODE) == CTImode \ || (MODE) == TFmode || (MODE) == TCmode)))/* Return true for modes passed in SSE registers. */#define SSE_REG_MODE_P(MODE) \ ((MODE) == TImode || (MODE) == V16QImode || (MODE) == TFmode \ || (MODE) == V8HImode || (MODE) == V2DFmode || (MODE) == V2DImode \ || (MODE) == V4SFmode || (MODE) == V4SImode)/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE. */#define HARD_REGNO_MODE_OK(REGNO, MODE) \ ix86_hard_regno_mode_ok ((REGNO), (MODE))/* Value is 1 if it is a good idea to tie two pseudo registers when one has mode MODE1 and one has mode MODE2. If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2, for any hard reg, then this must be 0 for correct output. */#define MODES_TIEABLE_P(MODE1, MODE2) ix86_modes_tieable_p (MODE1, MODE2)/* It is possible to write patterns to move flags; but until someone does it, */#define AVOID_CCMODE_COPIES/* Specify the modes required to caller save a given hard regno. We do this on i386 to prevent flags from being saved at all. Kill any attempts to combine saving of modes. */#define HARD_REGNO_CALLER_SAVE_MODE(REGNO, NREGS, MODE) \ (CC_REGNO_P (REGNO) ? VOIDmode \ : (MODE) == VOIDmode && (NREGS) != 1 ? VOIDmode \ : (MODE) == VOIDmode ? choose_hard_reg_mode ((REGNO), (NREGS), false)\ : (MODE) == HImode && !TARGET_PARTIAL_REG_STALL ? SImode \ : (MODE) == QImode && (REGNO) >= 4 && !TARGET_64BIT ? SImode \ : (MODE))/* Specify the registers used for certain standard purposes. The values of these macros are register numbers. *//* on the 386 the pc register is %eip, and is not usable as a general register. The ordinary mov instructions won't work *//* #define PC_REGNUM *//* Register to use for pushing function arguments. */#define STACK_POINTER_REGNUM 7/* Base register for access to local variables of the function. */#define HARD_FRAME_POINTER_REGNUM 6/* Base register for access to local variables of the function. */#define FRAME_POINTER_REGNUM 20/* First floating point reg */#define FIRST_FLOAT_REG 8/* First & last stack-like regs */#define FIRST_STACK_REG FIRST_FLOAT_REG#define LAST_STACK_REG (FIRST_FLOAT_REG + 7)#define FIRST_SSE_REG (FRAME_POINTER_REGNUM + 1)#define LAST_SSE_REG (FIRST_SSE_REG + 7)#define FIRST_MMX_REG (LAST_SSE_REG + 1)#define LAST_MMX_REG (FIRST_MMX_REG + 7)#define FIRST_REX_INT_REG (LAST_MMX_REG + 1)#define LAST_REX_INT_REG (FIRST_REX_INT_REG + 7)#define FIRST_REX_SSE_REG (LAST_REX_INT_REG + 1)#define LAST_REX_SSE_REG (FIRST_REX_SSE_REG + 7)/* Value should be nonzero if functions must have frame pointers. Zero means the frame pointer need not be set up (and parms may be accessed via the stack pointer) in functions that seem suitable. This is computed in `reload', in reload1.c. */#define FRAME_POINTER_REQUIRED ix86_frame_pointer_required ()/* Override this in other tm.h files to cope with various OS lossage requiring a frame pointer. */#ifndef SUBTARGET_FRAME_POINTER_REQUIRED#define SUBTARGET_FRAME_POINTER_REQUIRED 0#endif/* Make sure we can access arbitrary call frames. */#define SETUP_FRAME_ADDRESSES() ix86_setup_frame_addresses ()/* Base register for access to arguments of the function. */#define ARG_POINTER_REGNUM 16/* Register in which static-chain is passed to a function. We do use ECX as static chain register for 32 bit ABI. On the 64bit ABI, ECX is an argument register, so we use R10 instead. */#define STATIC_CHAIN_REGNUM (TARGET_64BIT ? FIRST_REX_INT_REG + 10 - 8 : 2)/* Register to hold the addressing base for position independent code access to data items. We don't use PIC pointer for 64bit mode. Define the regnum to dummy value to prevent gcc from pessimizing code dealing with EBX. To avoid clobbering a call-saved register unnecessarily, we renumber the pic register when possible. The change is visible after the prologue has been emitted. */#define REAL_PIC_OFFSET_TABLE_REGNUM 3#define PIC_OFFSET_TABLE_REGNUM \ ((TARGET_64BIT && ix86_cmodel == CM_SMALL_PIC) \ || !flag_pic ? INVALID_REGNUM \ : reload_completed ? REGNO (pic_offset_table_rtx) \ : REAL_PIC_OFFSET_TABLE_REGNUM)#define GOT_SYMBOL_NAME "_GLOBAL_OFFSET_TABLE_"/* A C expression which can inhibit the returning of certain function values in registers, based on the type of value. A nonzero value says to return the function value in memory, just as large structures are always returned. Here TYPE will be a C expression of type `tree', representing the data type of the value. Note that values of mode `BLKmode' must be explicitly handled by this macro. Also, the option `-fpcc-struct-return' takes effect regardless of this macro. On most systems, it is possible to leave the macro undefined; this causes a default definition to be used, whose value is the constant 1 for `BLKmode' values, and 0 otherwise. Do not use this macro to indicate that structures and unions should always be returned in memory. You should instead use `DEFAULT_PCC_STRUCT_RETURN' to indicate this. */#define RETURN_IN_MEMORY(TYPE) \ ix86_return_in_memory (TYPE)/* This is overridden by <cygwin.h>. */#define MS_AGGREGATE_RETURN 0/* This is overridden by <netware.h>. */#define KEEP_AGGREGATE_RETURN_POINTER 0/* Define the classes of registers for register constraints in the machine description. Also define ranges of constants.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -