📄 mips.h
字号:
#define FPSW_REGNUM ST_REG_FIRST#define GP_REG_P(REGNO) ((unsigned) ((REGNO) - GP_REG_FIRST) < GP_REG_NUM)#define FP_REG_P(REGNO) ((unsigned) ((REGNO) - FP_REG_FIRST) < FP_REG_NUM)#define MD_REG_P(REGNO) ((unsigned) ((REGNO) - MD_REG_FIRST) < MD_REG_NUM)#define ST_REG_P(REGNO) ((unsigned) ((REGNO) - ST_REG_FIRST) < ST_REG_NUM)/* 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. On the MIPS, all general registers are one word long. Except on the R4000 with the FR bit set, the floating point uses register pairs, with the second register not being allocable. */#define HARD_REGNO_NREGS(REGNO, MODE) \ (! FP_REG_P (REGNO) \ ? ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD) \ : ((GET_MODE_SIZE (MODE) + UNITS_PER_FPREG - 1) / UNITS_PER_FPREG))/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE. In 32 bit mode, require that DImode and DFmode be in even registers. For DImode, this makes some of the insns easier to write, since you don't have to worry about a DImode value in registers 3 & 4, producing a result in 4 & 5. To make the code simpler HARD_REGNO_MODE_OK now just references an array built in override_options. Because machmodes.h is not yet included before this file is processed, the MODE bound can't be expressed here. */extern char mips_hard_regno_mode_ok[][FIRST_PSEUDO_REGISTER];#define HARD_REGNO_MODE_OK(REGNO, MODE) \ mips_hard_regno_mode_ok[ (int)(MODE) ][ (REGNO) ]/* 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) \ ((GET_MODE_CLASS (MODE1) == MODE_FLOAT || \ GET_MODE_CLASS (MODE1) == MODE_COMPLEX_FLOAT) \ == (GET_MODE_CLASS (MODE2) == MODE_FLOAT || \ GET_MODE_CLASS (MODE2) == MODE_COMPLEX_FLOAT))/* MIPS pc is not overloaded on a register. *//* #define PC_REGNUM xx *//* Register to use for pushing function arguments. */#define STACK_POINTER_REGNUM (GP_REG_FIRST + 29)/* Offset from the stack pointer to the first available location. Use the default value zero. *//* #define STACK_POINTER_OFFSET 0 *//* Base register for access to local variables of the function. */#define FRAME_POINTER_REGNUM (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)/* Base register for access to arguments of the function. */#define ARG_POINTER_REGNUM GP_REG_FIRST/* Fake register that holds the address on the stack of the current function's return address. */#define RETURN_ADDRESS_POINTER_REGNUM RAP_REG_NUM/* Register in which static-chain is passed to a function. */#define STATIC_CHAIN_REGNUM (GP_REG_FIRST + 2)/* If the structure value address is passed in a register, then `STRUCT_VALUE_REGNUM' should be the number of that register. *//* #define STRUCT_VALUE_REGNUM (GP_REG_FIRST + 4) *//* If the structure value address is not passed in a register, define `STRUCT_VALUE' as an expression returning an RTX for the place where the address is passed. If it returns 0, the address is passed as an "invisible" first argument. */#define STRUCT_VALUE 0/* Mips registers used in prologue/epilogue code when the stack frame is larger than 32K bytes. These registers must come from the scratch register set, and not used for passing and returning arguments and any other information used in the calling sequence (such as pic). Must start at 12, since t0/t3 are parameter passing registers in the 64 bit ABI. */#define MIPS_TEMP1_REGNUM (GP_REG_FIRST + 12)#define MIPS_TEMP2_REGNUM (GP_REG_FIRST + 13)/* 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/* Define this macro if it is as good or better for a function to call itself with an explicit address than to call an address kept in a register. */#define NO_RECURSIVE_FUNCTION_CSE 1/* The register number of the register used to address a table of static data addresses in memory. In some cases this register is defined by a processor's "application binary interface" (ABI). When this macro is defined, RTL is generated for this register once, as with the stack pointer and frame pointer registers. If this macro is not defined, it is up to the machine-dependent files to allocate such a register (if necessary). */#define PIC_OFFSET_TABLE_REGNUM (GP_REG_FIRST + 28)#define PIC_FUNCTION_ADDR_REGNUM (GP_REG_FIRST + 25)/* Initialize embedded_pic_fnaddr_rtx before RTL generation for each function. We used to do this in FINALIZE_PIC, but FINALIZE_PIC isn't always called for static inline functions. */#define INIT_EXPANDERS embedded_pic_fnaddr_rtx = NULL;/* 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 */ GR_REGS, /* integer registers */ FP_REGS, /* floating point registers */ HI_REG, /* hi register */ LO_REG, /* lo register */ HILO_REG, /* hilo register pair for 64 bit mode mult */ MD_REGS, /* multiply/divide registers (hi/lo) */ ST_REGS, /* status registers (fp status) */ 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", \ "GR_REGS", \ "FP_REGS", \ "HI_REG", \ "LO_REG", \ "HILO_REG", \ "MD_REGS", \ "ST_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 }, /* no registers */ \ { 0xffffffff, 0x00000000, 0x00000000 }, /* integer registers */ \ { 0x00000000, 0xffffffff, 0x00000000 }, /* floating registers*/ \ { 0x00000000, 0x00000000, 0x00000001 }, /* hi register */ \ { 0x00000000, 0x00000000, 0x00000002 }, /* lo register */ \ { 0x00000000, 0x00000000, 0x00000004 }, /* hilo register */ \ { 0x00000000, 0x00000000, 0x00000003 }, /* mul/div registers */ \ { 0x00000000, 0x00000000, 0x000007f8 }, /* status registers */ \ { 0xffffffff, 0xffffffff, 0x000007ff } /* 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 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 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/* 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 'f' Floating point registers 'h' Hi register 'l' Lo register 'x' Multiply/divide registers 'a' HILO_REG 'z' FP Status register 'b' All registers */extern enum reg_class mips_char_to_class[];#define REG_CLASS_FROM_LETTER(C) mips_char_to_class[ (C) ]/* 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 (16 bits signed integers). `J' is used for the range which is just zero (ie, $r0). `K' is used for the range of constants a logical insn can actually contain (16 bit zero-extended integers). `L' is used for the range of constants that be loaded with lui (ie, the bottom 16 bits are zero). `M' is used for the range of constants that take two words to load (ie, not matched by `I', `K', and `L'). `N' is used for negative 16 bit constants. `O' is an exact power of 2 (not yet used in the md file). `P' is used for positive 16 bit constants. */#define SMALL_INT(X) ((unsigned HOST_WIDE_INT) (INTVAL (X) + 0x8000) < 0x10000)#define SMALL_INT_UNSIGNED(X) ((unsigned HOST_WIDE_INT) (INTVAL (X)) < 0x10000)#define CONST_OK_FOR_LETTER_P(VALUE, C) \ ((C) == 'I' ? ((unsigned HOST_WIDE_INT) ((VALUE) + 0x8000) < 0x10000) \ : (C) == 'J' ? ((VALUE) == 0) \ : (C) == 'K' ? ((unsigned HOST_WIDE_INT) (VALUE) < 0x10000) \ : (C) == 'L' ? (((VALUE) & 0x0000ffff) == 0 \ && (((VALUE) & ~2147483647) == 0 \ || ((VALUE) & ~2147483647) == ~2147483647)) \ : (C) == 'M' ? ((((VALUE) & ~0x0000ffff) != 0) \ && (((VALUE) & ~0x0000ffff) != ~0x0000ffff) \ && (((VALUE) & 0x0000ffff) != 0 \ || (((VALUE) & ~2147483647) != 0 \ && ((VALUE) & ~2147483647) != ~2147483647))) \ : (C) == 'N' ? (((VALUE) & ~0x0000ffff) == ~0x0000ffff) \ : (C) == 'O' ? (exact_log2 (VALUE) >= 0) \ : (C) == 'P' ? ((VALUE) != 0 && (((VALUE) & ~0x0000ffff) == 0)) \ : 0)/* Similar, but for floating constants, and defining letters G and H. Here VALUE is the CONST_DOUBLE rtx itself. *//* For Mips 'G' : Floating point 0 */#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \ ((C) == 'G' \ && (VALUE) == CONST0_RTX (GET_MODE (VALUE)))/* Letters in the range `Q' through `U' may be defined in a machine-dependent fashion to stand for arbitrary operand types. The machine description macro `EXTRA_CONSTRAINT' is passed the operand as its first argument and the constraint letter as its second operand. `Q' is for memory references which take more than 1 instruction. `R' is for memory references which take 1 word for the instruction. `S' is for references to extern items which are PIC for OSF/rose. */#define EXTRA_CONSTRAINT(OP,CODE) \ ((GET_CODE (OP) != MEM) ? FALSE \ : ((CODE) == 'Q') ? !simple_memory_operand (OP, GET_MODE (OP)) \ : ((CODE) == 'R') ? simple_memory_operand (OP, GET_MODE (OP)) \ : ((CODE) == 'S') ? (HALF_PIC_P () && CONSTANT_P (OP) \ && HALF_PIC_ADDRESS_P (OP)) \ : FALSE)/* Given an rtx X being reloaded into a reg required to be in class CLASS, return the class of reg to actually use. In general this is just CLASS; but on some machines in some cases it is preferable to use a more restrictive class. */#define PREFERRED_RELOAD_CLASS(X,CLASS) \ ((CLASS) != ALL_REGS \ ? (CLASS) \ : ((GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT \ || GET_MODE_CLASS (GET_MODE (X)) == MODE_COMPLEX_FLOAT) \ ? (TARGET_SOFT_FLOAT ? GR_REGS : FP_REGS) \ : ((GET_MODE_CLASS (GET_MODE (X)) == MODE_INT \ || GET_MODE (X) == VOIDmode) \ ? GR_REGS \ : (CLASS))))/* Certain machines have the property that some registers cannot be copied to some other registers without using memory. Define this macro on those machines to be a C expression that is non-zero if objects of mode MODE in registers of CLASS1 can only be copied to registers of class CLASS2 by storing a register of CLASS1 into memory and loading that memory location into a register of CLASS2. Do not define this macro if its value would always be zero. */#define SECONDARY_MEMORY_NEEDED(CLASS1, CLASS2, MODE) \ ((!TARGET_DEBUG_H_MODE \ && GET_MODE_CLASS (MODE) == MODE_INT \ && ((CLASS1 == FP_REGS && CLASS2 == GR_REGS) \ || (CLASS1 == GR_REGS && CLASS2 == FP_REGS))) \ || (TARGET_FLOAT64 && !TARGET_64BIT && (MODE) == DFmode \ && ((CLASS1 == GR_REGS && CLASS2 == FP_REGS) \ || (CLASS2 == GR_REGS && CLASS1 == FP_REGS))))/* The HI and LO registers can only be reloaded via the general registers. Condition code registers can only be loaded to the general registers, and from the flo
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -