📄 mips.h
字号:
#define STRUCTURE_SIZE_BOUNDARY 8/* There is no point aligning anything to a rounder boundary than this. */#define BIGGEST_ALIGNMENT 64/* Set this nonzero if move instructions will actually fail to work when given unaligned data. */#define STRICT_ALIGNMENT 1/* Define this if you wish to imitate the way many other C compilers handle alignment of bitfields and the structures that contain them. The behavior is that the type written for a bitfield (`int', `short', or other integer type) imposes an alignment for the entire structure, as if the structure really did contain an ordinary field of that type. In addition, the bitfield is placed within the structure so that it would fit within such a field, not crossing a boundary for it. Thus, on most machines, a bitfield whose type is written as `int' would not cross a four-byte boundary, and would force four-byte alignment for the whole structure. (The alignment used may not be four bytes; it is controlled by the other alignment parameters.) If the macro is defined, its definition should be a C expression; a nonzero value for the expression enables this behavior. */#define PCC_BITFIELD_TYPE_MATTERS 1/* If defined, a C expression to compute the alignment given to a constant that is being placed in memory. CONSTANT is the constant and ALIGN is the alignment that the object would ordinarily have. The value of this macro is used instead of that alignment to align the object. If this macro is not defined, then ALIGN is used. The typical use of this macro is to increase alignment for string constants to be word aligned so that `strcpy' calls that copy constants can be done inline. */#define CONSTANT_ALIGNMENT(EXP, ALIGN) \ ((TREE_CODE (EXP) == STRING_CST || TREE_CODE (EXP) == CONSTRUCTOR) \ && (ALIGN) < BITS_PER_WORD \ ? BITS_PER_WORD \ : (ALIGN))/* If defined, a C expression to compute the alignment for a static variable. TYPE is the data type, and ALIGN is the alignment that the object would ordinarily have. The value of this macro is used instead of that alignment to align the object. If this macro is not defined, then ALIGN is used. One use of this macro is to increase alignment of medium-size data to make it all fit in fewer cache lines. Another is to cause character arrays to be word-aligned so that `strcpy' calls that copy constants to character arrays can be done inline. */#undef DATA_ALIGNMENT#define DATA_ALIGNMENT(TYPE, ALIGN) \ ((((ALIGN) < BITS_PER_WORD) \ && (TREE_CODE (TYPE) == ARRAY_TYPE \ || TREE_CODE (TYPE) == UNION_TYPE \ || TREE_CODE (TYPE) == RECORD_TYPE)) ? BITS_PER_WORD : (ALIGN))/* Define this macro if an argument declared as `char' or `short' in a prototype should actually be passed as an `int'. In addition to avoiding errors in certain cases of mismatch, it also makes for better code on certain machines. */#define PROMOTE_PROTOTYPES/* Define if operations between registers always perform the operation on the full register even if a narrower mode is specified. */#define WORD_REGISTER_OPERATIONS/* Define if loading in MODE, an integral mode narrower than BITS_PER_WORD will either zero-extend or sign-extend. The value of this macro should be the code that says which one of the two operations is implicitly done, NIL if none. When in 64 bit mode, mips_move_1word will sign extend SImode and CCmode moves. All other referces are zero extended. */#define LOAD_EXTEND_OP(MODE) \ (TARGET_64BIT && ((MODE) == SImode || (MODE) == CCmode) \ ? SIGN_EXTEND : ZERO_EXTEND)/* Define this macro if it is advisable to hold scalars in registers in a wider mode than that declared by the program. In such cases, the value is constrained to be within the bounds of the declared type, but kept valid in the wider mode. The signedness of the extension may differ from that of the type. We promote any value smaller than SImode up to SImode. We don't want to promote to DImode when in 64 bit mode, because that would prevent us from using the faster SImode multiply and divide instructions. */#define PROMOTE_MODE(MODE, UNSIGNEDP, TYPE) \ if (GET_MODE_CLASS (MODE) == MODE_INT \ && GET_MODE_SIZE (MODE) < 4) \ (MODE) = SImode;/* Define this if function arguments should also be promoted using the above procedure. */#define PROMOTE_FUNCTION_ARGS/* Likewise, if the function return value is promoted. */#define PROMOTE_FUNCTION_RETURN/* Standard register usage. *//* Number of actual hardware registers. The hardware registers are assigned numbers for the compiler from 0 to just below FIRST_PSEUDO_REGISTER. All registers that the compiler knows about must be given numbers, even those that are not normally considered general registers. On the Mips, we have 32 integer registers, 32 floating point registers, 8 condition code registers, and the special registers hi, lo, hilo, and rap. The 8 condition code registers are only used if mips_isa >= 4. The hilo register is only used in 64 bit mode. It represents a 64 bit value stored as two 32 bit values in the hi and lo registers; this is the result of the mult instruction. rap is a pointer to the stack where the return address reg ($31) was stored. This is needed for C++ exception handling. */#define FIRST_PSEUDO_REGISTER 76/* 1 for registers that have pervasive standard uses and are not available for the register allocator. On the MIPS, see conventions, page D-2 */#define FIXED_REGISTERS \{ \ 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, \ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 \}/* 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. */#define CALL_USED_REGISTERS \{ \ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \ 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, \ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \ 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 \}/* Internal macros to classify a register number as to whether it's a general purpose register, a floating point register, a multiply/divide register, or a status register. */#define GP_REG_FIRST 0#define GP_REG_LAST 31#define GP_REG_NUM (GP_REG_LAST - GP_REG_FIRST + 1)#define GP_DBX_FIRST 0#define FP_REG_FIRST 32#define FP_REG_LAST 63#define FP_REG_NUM (FP_REG_LAST - FP_REG_FIRST + 1)#define FP_DBX_FIRST ((write_symbols == DBX_DEBUG) ? 38 : 32)#define MD_REG_FIRST 64#define MD_REG_LAST 66#define MD_REG_NUM (MD_REG_LAST - MD_REG_FIRST + 1)#define ST_REG_FIRST 67#define ST_REG_LAST 74#define ST_REG_NUM (ST_REG_LAST - ST_REG_FIRST + 1)#define RAP_REG_NUM 75#define AT_REGNUM (GP_REG_FIRST + 1)#define HI_REGNUM (MD_REG_FIRST + 0)#define LO_REGNUM (MD_REG_FIRST + 1)#define HILO_REGNUM (MD_REG_FIRST + 2)/* FPSW_REGNUM is the single condition code used if mips_isa < 4. If mips_isa >= 4, it should not be used, and an arbitrary ST_REG should be used instead. */#define FPSW_REGNUM ST_REG_FIRST#define GP_REG_P(REGNO) ((unsigned) ((REGNO) - GP_REG_FIRST) < GP_REG_NUM)#define M16_REG_P(REGNO) \ (((REGNO) >= 2 && (REGNO) <= 7) || (REGNO) == 16 || (REGNO) == 17)#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. We pretend that the frame pointer is $1, and then eliminate it to HARD_FRAME_POINTER_REGNUM. We can get away with this because $1 is a fixed register, and will not be used for anything else. */#define FRAME_POINTER_REGNUM (GP_REG_FIRST + 1)/* $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)/* 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 \do { \ embedded_pic_fnaddr_rtx = NULL; \ mips16_gp_pseudo_rtx = NULL; \} while (0)/* 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. */e
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -