📄 mips.h
字号:
/* Register to use for pushing function arguments. */#define STACK_POINTER_REGNUM (GP_REG_FIRST + 29)/* These two registers don't really exist: they get eliminated to either the stack or hard frame pointer. */#define ARG_POINTER_REGNUM 77#define FRAME_POINTER_REGNUM 78/* $30 is not available on the mips16, so we use $17 as the frame pointer. */#define HARD_FRAME_POINTER_REGNUM \ (TARGET_MIPS16 ? GP_REG_FIRST + 17 : GP_REG_FIRST + 30)/* 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 (current_function_calls_alloca)/* Register in which static-chain is passed to a function. */#define STATIC_CHAIN_REGNUM (GP_REG_FIRST + 2)/* Registers used as temporaries in prologue/epilogue code. If we're generating mips16 code, these registers must come from the core set of 8. The prologue register mustn't conflict with any incoming arguments, the static chain pointer, or the frame pointer. The epilogue temporary mustn't conflict with the return registers, the frame pointer, the EH stack adjustment, or the EH data registers. */#define MIPS_PROLOGUE_TEMP_REGNUM (GP_REG_FIRST + 3)#define MIPS_EPILOGUE_TEMP_REGNUM (GP_REG_FIRST + (TARGET_MIPS16 ? 6 : 8))#define MIPS_PROLOGUE_TEMP(MODE) gen_rtx_REG (MODE, MIPS_PROLOGUE_TEMP_REGNUM)#define MIPS_EPILOGUE_TEMP(MODE) gen_rtx_REG (MODE, MIPS_EPILOGUE_TEMP_REGNUM)/* Define this macro if it is as good or better to call a constant function address than to call an address kept in a register. */#define NO_FUNCTION_CSE 1/* The ABI-defined global pointer. Sometimes we use a different register in leaf functions: see PIC_OFFSET_TABLE_REGNUM. */#define GLOBAL_POINTER_REGNUM (GP_REG_FIRST + 28)/* We normally use $28 as the global pointer. However, when generating n32/64 PIC, it is better for leaf functions to use a call-clobbered register instead. They can then avoid saving and restoring $28 and perhaps avoid using a frame at all. When a leaf function uses something other than $28, mips_expand_prologue will modify pic_offset_table_rtx in place. Take the register number from there after reload. */#define PIC_OFFSET_TABLE_REGNUM \ (reload_completed ? REGNO (pic_offset_table_rtx) : GLOBAL_POINTER_REGNUM)#define PIC_FUNCTION_ADDR_REGNUM (GP_REG_FIRST + 25)/* Define the classes of registers for register constraints in the machine description. Also define ranges of constants. One of the classes must always be named ALL_REGS and include all hard regs. If there is more than one class, another class must be named NO_REGS and contain no registers. The name GENERAL_REGS must be the name of a class (or an alias for another name such as ALL_REGS). This is the class of registers that is allowed by "g" or "r" in a register constraint. Also, registers outside this class are allocated only when instructions express preferences for them. The classes must be numbered in nondecreasing order; that is, a larger-numbered class must never be contained completely in a smaller-numbered class. For any two classes, it is very desirable that there be another class that represents their union. */enum reg_class{ NO_REGS, /* no registers in set */ M16_NA_REGS, /* mips16 regs not used to pass args */ M16_REGS, /* mips16 directly accessible registers */ T_REG, /* mips16 T register ($24) */ M16_T_REGS, /* mips16 registers plus T register */ PIC_FN_ADDR_REG, /* SVR4 PIC function address register */ V1_REG, /* Register $v1 ($3) used for TLS access. */ LEA_REGS, /* Every GPR except $25 */ GR_REGS, /* integer registers */ FP_REGS, /* floating point registers */ HI_REG, /* hi register */ LO_REG, /* lo register */ MD_REGS, /* multiply/divide registers (hi/lo) */ COP0_REGS, /* generic coprocessor classes */ COP2_REGS, COP3_REGS, HI_AND_GR_REGS, /* union classes */ LO_AND_GR_REGS, HI_AND_FP_REGS, COP0_AND_GR_REGS, COP2_AND_GR_REGS, COP3_AND_GR_REGS, ALL_COP_REGS, ALL_COP_AND_GR_REGS, ST_REGS, /* status registers (fp status) */ DSP_ACC_REGS, /* DSP accumulator registers */ ACC_REGS, /* Hi/Lo and DSP accumulator registers */ ALL_REGS, /* all registers */ LIM_REG_CLASSES /* max value + 1 */};#define N_REG_CLASSES (int) LIM_REG_CLASSES#define GENERAL_REGS GR_REGS/* An initializer containing the names of the register classes as C string constants. These names are used in writing some of the debugging dumps. */#define REG_CLASS_NAMES \{ \ "NO_REGS", \ "M16_NA_REGS", \ "M16_REGS", \ "T_REG", \ "M16_T_REGS", \ "PIC_FN_ADDR_REG", \ "V1_REG", \ "LEA_REGS", \ "GR_REGS", \ "FP_REGS", \ "HI_REG", \ "LO_REG", \ "MD_REGS", \ /* coprocessor registers */ \ "COP0_REGS", \ "COP2_REGS", \ "COP3_REGS", \ "HI_AND_GR_REGS", \ "LO_AND_GR_REGS", \ "HI_AND_FP_REGS", \ "COP0_AND_GR_REGS", \ "COP2_AND_GR_REGS", \ "COP3_AND_GR_REGS", \ "ALL_COP_REGS", \ "ALL_COP_AND_GR_REGS", \ "ST_REGS", \ "DSP_ACC_REGS", \ "ACC_REGS", \ "ALL_REGS" \}/* An initializer containing the contents of the register classes, as integers which are bit masks. The Nth integer specifies the contents of class N. The way the integer MASK is interpreted is that register R is in the class if `MASK & (1 << R)' is 1. When the machine has more than 32 registers, an integer does not suffice. Then the integers are replaced by sub-initializers, braced groupings containing several integers. Each sub-initializer must be suitable as an initializer for the type `HARD_REG_SET' which is defined in `hard-reg-set.h'. */#define REG_CLASS_CONTENTS \{ \ { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, /* no registers */ \ { 0x0003000c, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, /* mips16 nonarg regs */\ { 0x000300fc, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, /* mips16 registers */ \ { 0x01000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, /* mips16 T register */ \ { 0x010300fc, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, /* mips16 and T regs */ \ { 0x02000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, /* SVR4 PIC function address register */ \ { 0x00000008, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, /* only $v1 */ \ { 0xfdffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, /* Every other GPR except $25 */ \ { 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, /* integer registers */ \ { 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, /* floating registers*/ \ { 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000 }, /* hi register */ \ { 0x00000000, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000 }, /* lo register */ \ { 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000000, 0x00000000 }, /* mul/div registers */ \ { 0x00000000, 0x00000000, 0xffff0000, 0x0000ffff, 0x00000000, 0x00000000 }, /* cop0 registers */ \ { 0x00000000, 0x00000000, 0x00000000, 0xffff0000, 0x0000ffff, 0x00000000 }, /* cop2 registers */ \ { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffff0000, 0x0000ffff }, /* cop3 registers */ \ { 0xffffffff, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000 }, /* union classes */ \ { 0xffffffff, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000 }, \ { 0x00000000, 0xffffffff, 0x00000001, 0x00000000, 0x00000000, 0x00000000 }, \ { 0xffffffff, 0x00000000, 0xffff0000, 0x0000ffff, 0x00000000, 0x00000000 }, \ { 0xffffffff, 0x00000000, 0x00000000, 0xffff0000, 0x0000ffff, 0x00000000 }, \ { 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0xffff0000, 0x0000ffff }, \ { 0x00000000, 0x00000000, 0xffff0000, 0xffffffff, 0xffffffff, 0x0000ffff }, \ { 0xffffffff, 0x00000000, 0xffff0000, 0xffffffff, 0xffffffff, 0x0000ffff }, \ { 0x00000000, 0x00000000, 0x000007f8, 0x00000000, 0x00000000, 0x00000000 }, /* status registers */ \ { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x003f0000 }, /* dsp accumulator registers */ \ { 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000000, 0x003f0000 }, /* hi/lo and dsp accumulator registers */ \ { 0xffffffff, 0xffffffff, 0xffff07ff, 0xffffffff, 0xffffffff, 0x0fffffff } /* all registers */ \}/* A C expression whose value is a register class containing hard register REGNO. In general there is more that one such class; choose a class which is "minimal", meaning that no smaller class also contains the register. */extern const enum reg_class mips_regno_to_class[];#define REGNO_REG_CLASS(REGNO) mips_regno_to_class[ (REGNO) ]/* A macro whose definition is the name of the class to which a valid base register must belong. A base register is one used in an address which is the register value plus a displacement. */#define BASE_REG_CLASS (TARGET_MIPS16 ? M16_REGS : GR_REGS)/* A macro whose definition is the name of the class to which a valid index register must belong. An index register is one used in an address where its value is either multiplied by a scale factor or added to another register (as well as added to a displacement). */#define INDEX_REG_CLASS NO_REGS/* When SMALL_REGISTER_CLASSES is nonzero, the compiler allows registers explicitly used in the rtl to be used as spill registers but prevents the compiler from extending the lifetime of these registers. */#define SMALL_REGISTER_CLASSES (TARGET_MIPS16)/* This macro is used later on in the file. */#define GR_REG_CLASS_P(CLASS) \ ((CLASS) == GR_REGS || (CLASS) == M16_REGS || (CLASS) == T_REG \ || (CLASS) == M16_T_REGS || (CLASS) == M16_NA_REGS \ || (CLASS) == V1_REG \ || (CLASS) == PIC_FN_ADDR_REG || (CLASS) == LEA_REGS)/* This macro is also used later on in the file. */#define COP_REG_CLASS_P(CLASS) \ ((CLASS) == COP0_REGS || (CLASS) == COP2_REGS || (CLASS) == COP3_REGS)/* REG_ALLOC_ORDER is to order in which to allocate registers. This is the default value (allocate the registers in numeric order). We define it just so that we can override it for the mips16 target in ORDER_REGS_FOR_LOCAL_ALLOC. */#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, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, \ 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, \ 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, \ 96, 97, 98, 99, 100,101,102,103,104,105,106,107,108,109,110,111, \ 112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127, \ 128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143, \ 144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159, \ 160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175, \ 176,177,178,179,180,181,182,183,184,185,186,187 \}/* ORDER_REGS_FOR_LOCAL_ALLOC is a macro which permits reg_alloc_order to be rearranged based on a particular function. On the mips16, we want to allocate $24 (T_REG) before other registers for instructions for which it is possible. */#define ORDER_REGS_FOR_LOCAL_ALLOC mips_order_regs_for_local_alloc ()/* REGISTER AND CONSTANT CLASSES *//* Get reg_class from a letter such as appears in the machine description. DEFINED REGISTER CLASSES: 'd' General (aka integer) registers Normally this is GR_REGS, but in mips16 mode this is M16_REGS 'y' General registers (in both mips16 and non mips16 mode) 'e' Effective address registers (general registers except $25) 't' mips16 temporary register ($24) 'f' Floating point registers 'h' Hi register 'l' Lo register 'v' $v1 only 'x' Multiply/divide registers 'z' FP Status register 'B' Cop0 register 'C' Cop2 register 'D' Cop3 register 'A' DSP accumulator registers 'a' MD registers and DSP accumulator registers 'b' All registers */extern enum reg_class mips_char_to_class[256];#define REG_CLASS_FROM_LETTER(C) mips_char_to_class[(unsigned char)(C)]/* True if VALUE is an unsigned 6-bit number. */#define UIMM6_OPERAND(VALUE) \ (((VALUE) & ~(unsigned HOST_WIDE_INT) 0x3f) == 0)/* True if VALUE is a signed 10-bit number. */#define IMM10_OPERAND(VALUE) \ ((unsigned HOST_WIDE_INT) (VALUE) + 0x200 < 0x400)/* True if VALUE is a signed 16-bit number. */#define SMALL_OPERAND(VALUE) \ ((unsigned HOST_WIDE_INT) (VALUE) + 0x8000 < 0x10000)/* True if VALUE is an unsigned 16-bit number. */#define SMALL_OPERAND_UNSIGNED(VALUE) \ (((VALUE) & ~(unsigned HOST_WIDE_INT) 0xffff) == 0)/* True if VALUE can be loaded into a register using LUI. */#define LUI_OPERAND(VALUE) \ (((VALUE) | 0x7fff0000) == 0x7fff0000 \ || ((VALUE) | 0x7fff0000) + 0x10000 == 0)/* Return a value X with the low 16 bits clear, and such that VALUE - X is a signed 16-bit value. */#define CONST_HIGH_PART(VALUE) \ (((VALUE) + 0x8000) & ~(unsigned HOST_WIDE_INT) 0xffff)#define CONST_LOW_PART(VALUE) \ ((VALUE) - CONST_HIGH_PART (VALUE))#define SMALL_INT(X) SMALL_OPERAND (INTVAL (X))#define SMALL_INT_UNSIGNED(X) SMALL_OPERAND_UNSIGNED (INTVAL (X))#define LUI_INT(X) LUI_OPERAND (INTVAL (X))/* The letters I, J, K, L, M, N, O, and P in a register constraint string can be used to stand for particular ranges of immediate operands. This macro defines what the ranges are. C is the letter, and VALUE is a constant value. Return 1 if VALUE is in the range specified by C. *//* For MIPS: `I' is used for the range of constants an arithmetic insn can actually contain
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -