📄 mcore.h
字号:
even those that are not normally considered general registers. MCore has 16 integer registers and 2 control registers + the arg pointer. */#define FIRST_PSEUDO_REGISTER 20#define R1_REG 1 /* where literals are forced */#define LK_REG 15 /* overloaded on general register */#define AP_REG 16 /* fake arg pointer register *//* RBE: mcore.md depends on CC_REG being set to 17 */#define CC_REG 17 /* can't name it C_REG */#define FP_REG 18 /* fake frame pointer register *//* Specify the registers used for certain standard purposes. The values of these macros are register numbers. */#undef PC_REGNUM /* Define this if the program counter is overloaded on a register. */#define STACK_POINTER_REGNUM 0 /* Register to use for pushing function arguments. */#define FRAME_POINTER_REGNUM 8 /* When we need FP, use r8. *//* The assembler's names for the registers. RFP need not always be used as the Real framepointer; it can also be used as a normal general register. Note that the name `fp' is horribly misleading since `fp' is in fact only the argument-and-return-context pointer. */#define REGISTER_NAMES \{ \ "sp", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \ "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", \ "apvirtual", "c", "fpvirtual", "x19" \}/* 1 for registers that have pervasive standard uses and are not available for the register allocator. */#define FIXED_REGISTERS \ /* r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 r13 r14 r15 ap c fp x19 */ \ { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 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. *//* RBE: r15 {link register} not available across calls, * But we don't mark it that way here... */#define CALL_USED_REGISTERS \ /* r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 r13 r14 r15 ap c fp x19 */ \ { 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1}/* The order in which register should be allocated. */#define REG_ALLOC_ORDER \ /* r7 r6 r5 r4 r3 r2 r15 r14 r13 r12 r11 r10 r9 r8 r1 r0 ap c fp x19*/ \ { 7, 6, 5, 4, 3, 2, 15, 14, 13, 12, 11, 10, 9, 8, 1, 0, 16, 17, 18, 19}/* 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 MCore regs are UNITS_PER_WORD bits wide; */#define HARD_REGNO_NREGS(REGNO, MODE) \ (((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE. We may keep double values in even registers. */#define HARD_REGNO_MODE_OK(REGNO, MODE) \ ((TARGET_8ALIGN && GET_MODE_SIZE (MODE) > UNITS_PER_WORD) ? (((REGNO) & 1) == 0) : (REGNO < 18))/* 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) \ ((MODE1) == (MODE2) || GET_MODE_CLASS (MODE1) == GET_MODE_CLASS (MODE2))/* 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. */#define FRAME_POINTER_REQUIRED 0/* Definitions for register eliminations. We have two registers that can be eliminated on the MCore. First, the frame pointer register can often be eliminated in favor of the stack pointer register. Secondly, the argument pointer register can always be eliminated; it is replaced with either the stack or frame pointer. *//* Base register for access to arguments of the function. */#define ARG_POINTER_REGNUM 16/* Register in which the static-chain is passed to a function. */#define STATIC_CHAIN_REGNUM 1/* This is an array of structures. Each structure initializes one pair of eliminable registers. The "from" register number is given first, followed by "to". Eliminations of the same "from" register are listed in order of preference. */#define ELIMINABLE_REGS \{{ FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}, \ { ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \ { ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM},}/* Given FROM and TO register numbers, say whether this elimination is allowed. */#define CAN_ELIMINATE(FROM, TO) \ (!((FROM) == FRAME_POINTER_REGNUM && FRAME_POINTER_REQUIRED))/* Define the offset between two registers, one to be eliminated, and the other its replacement, at the start of a routine. */#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \ OFFSET = mcore_initial_elimination_offset (FROM, TO)/* Place that structure value return address is placed. */#define STRUCT_VALUE 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. *//* The MCore has only general registers. There are also some special purpose registers: the T bit register, the procedure Link and the Count Registers */enum reg_class{ NO_REGS, ONLYR1_REGS, LRW_REGS, GENERAL_REGS, C_REGS, ALL_REGS, LIM_REG_CLASSES};#define N_REG_CLASSES (int) LIM_REG_CLASSES/* Give names of register classes as strings for dump file. */#define REG_CLASS_NAMES \{ \ "NO_REGS", \ "ONLYR1_REGS", \ "LRW_REGS", \ "GENERAL_REGS", \ "C_REGS", \ "ALL_REGS", \}/* Define which registers fit in which classes. This is an initializer for a vector of HARD_REG_SET of length N_REG_CLASSES. *//* ??? STACK_POINTER_REGNUM should be excluded from LRW_REGS. */#define REG_CLASS_CONTENTS \{ \ {0x000000}, /* NO_REGS */ \ {0x000002}, /* ONLYR1_REGS */ \ {0x007FFE}, /* LRW_REGS */ \ {0x01FFFF}, /* GENERAL_REGS */ \ {0x020000}, /* C_REGS */ \ {0x0FFFFF} /* ALL_REGS */ \}/* The same information, inverted: Return the class number of the smallest class containing reg number REGNO. This could be a conditional expression or could index an array. */extern const int regno_reg_class[FIRST_PSEUDO_REGISTER];#define REGNO_REG_CLASS(REGNO) regno_reg_class[REGNO]/* When defined, 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 1 /* The class value for index registers, and the one for base regs. */#define INDEX_REG_CLASS NO_REGS#define BASE_REG_CLASS GENERAL_REGS/* Get reg_class from a letter such as appears in the machine description. */extern const enum reg_class reg_class_from_letter[];#define REG_CLASS_FROM_LETTER(C) \ ( ISLOWER (C) ? reg_class_from_letter[(C) - 'a'] : NO_REGS )/* 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. I: loadable by movi (0..127) J: arithmetic operand 1..32 K: shift operand 0..31 L: negative arithmetic operand -1..-32 M: powers of two, constants loadable by bgeni N: powers of two minus 1, constants loadable by bmaski, including -1 O: allowed by cmov with two constants +/- 1 of each other P: values we will generate 'inline' -- without an 'lrw' Others defined for use after reload Q: constant 1 R: a label S: 0/1/2 cleared bits out of 32 [for bclri's] T: 2 set bits out of 32 [for bseti's] U: constant 0 xxxS: 1 cleared bit out of 32 (complement of power of 2). for bclri xxxT: 2 cleared bits out of 32. for pairs of bclris. */#define CONST_OK_FOR_I(VALUE) (((int)(VALUE)) >= 0 && ((int)(VALUE)) <= 0x7f)#define CONST_OK_FOR_J(VALUE) (((int)(VALUE)) > 0 && ((int)(VALUE)) <= 32)#define CONST_OK_FOR_L(VALUE) (((int)(VALUE)) < 0 && ((int)(VALUE)) >= -32)#define CONST_OK_FOR_K(VALUE) (((int)(VALUE)) >= 0 && ((int)(VALUE)) <= 31)#define CONST_OK_FOR_M(VALUE) (exact_log2 (VALUE) >= 0)#define CONST_OK_FOR_N(VALUE) (((int)(VALUE)) == -1 || exact_log2 ((VALUE) + 1) >= 0)#define CONST_OK_FOR_O(VALUE) (CONST_OK_FOR_I(VALUE) || \ CONST_OK_FOR_M(VALUE) || \ CONST_OK_FOR_N(VALUE) || \ CONST_OK_FOR_M((int)(VALUE) - 1) || \ CONST_OK_FOR_N((int)(VALUE) + 1))#define CONST_OK_FOR_P(VALUE) (mcore_const_ok_for_inline (VALUE)) #define CONST_OK_FOR_LETTER_P(VALUE, C) \ ((C) == 'I' ? CONST_OK_FOR_I (VALUE) \ : (C) == 'J' ? CONST_OK_FOR_J (VALUE) \ : (C) == 'L' ? CONST_OK_FOR_L (VALUE) \ : (C) == 'K' ? CONST_OK_FOR_K (VALUE) \ : (C) == 'M' ? CONST_OK_FOR_M (VALUE) \ : (C) == 'N' ? CONST_OK_FOR_N (VALUE) \ : (C) == 'P' ? CONST_OK_FOR_P (VALUE) \ : (C) == 'O' ? CONST_OK_FOR_O (VALUE) \ : 0)/* Similar, but for floating constants, and defining letters G and H. Here VALUE is the CONST_DOUBLE rtx itself. */#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \ ((C) == 'G' ? CONST_OK_FOR_I (CONST_DOUBLE_HIGH (VALUE)) \ && CONST_OK_FOR_I (CONST_DOUBLE_LOW (VALUE)) \ : 0)/* Letters in the range `Q' through `U' in a register constraint string may be defined in a machine-dependent fashion to stand for arbitrary operand types. */#define EXTRA_CONSTRAINT(OP, C) \ ((C) == 'R' ? (GET_CODE (OP) == MEM \ && GET_CODE (XEXP (OP, 0)) == LABEL_REF) \ : (C) == 'S' ? (GET_CODE (OP) == CONST_INT \ && mcore_num_zeros (INTVAL (OP)) <= 2) \ : (C) == 'T' ? (GET_CODE (OP) == CONST_INT \ && mcore_num_ones (INTVAL (OP)) == 2) \ : (C) == 'Q' ? (GET_CODE (OP) == CONST_INT \ && INTVAL(OP) == 1) \ : (C) == 'U' ? (GET_CODE (OP) == CONST_INT \ && INTVAL(OP) == 0) \ : 0)/* 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) mcore_reload_class (X, CLASS)/* Return the register class of a scratch register needed to copy IN into or out of a register in CLASS in MODE. If it can be done directly, NO_REGS is returned. */#define SECONDARY_RELOAD_CLASS(CLASS, MODE, X) \ mcore_secondary_reload_class (CLASS, MODE, X)/* Return the maximum number of consecutive registers needed to represent mode MODE in a register of class CLASS. On MCore this is the size of MODE in words. */#define CLASS_MAX_NREGS(CLASS, MODE) \ (ROUND_ADVANCE (GET_MODE_SIZE (MODE)))/* Stack layout; function entry, exit and calling. *//* Define the number of register that can hold parameters. These two macros are used only in other macro definitions below. */#define NPARM_REGS 6#define FIRST_PARM_REG 2#define FIRST_RET_REG 2/* Define this if pushing a word on the stack makes the stack pointer a smaller address. */#define STACK_GROWS_DOWNWARD /* Define this if the nominal address of the stack frame is at the high-address end of the local variables; that is, each additional local variable allocated goes at a more negative offset in the frame. *//* We don't define this, because the MCore does not support addresses with negative offsets. *//* #define FRAME_GROWS_DOWNWARD *//* Offset within stack frame to start allocating local variables at. If FRAME_GROWS_DOWNWARD, this is the offset to the END of the first local allocated. Otherwise, it is the offset to the BEGINNING of the first local allocated. */#define STARTING_FRAME_OFFSET 0/* If defined, the maximum amount of space required for outgoing arguments will be computed and placed into the variable `current_function_outgoing_args_size'. No space will be pushed onto the stack for each call; instead, the function prologue should increase the stack frame size by this amount. */#define ACCUMULATE_OUTGOING_ARGS 1/* Offset of first parameter from the argument pointer register value. */#define FIRST_PARM_OFFSET(FNDECL) 0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -