📄 arm.h
字号:
#define FIXED_REGISTERS \{ \ 0,0,0,0,0,0,0,0, \ 0,0,0,1,0,1,0,1, \ 0,0,0,0,0,0,0,0, \ 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. The CC is not preserved over function calls on the ARM 6, so it is easier to assume this for all. SFP is preserved, since FP is. */#define CALL_USED_REGISTERS \{ \ 1,1,1,1,0,0,0,0, \ 0,0,0,1,1,1,1,1, \ 1,1,1,1,0,0,0,0, \ 1,1,1 \}#ifndef SUBTARGET_CONDITIONAL_REGISTER_USAGE#define SUBTARGET_CONDITIONAL_REGISTER_USAGE#endif/* If doing stupid life analysis, avoid a bug causing a return value r0 to be trampled. This effectively reduces the number of available registers by 1. XXX It is a hack, I know. XXX Is this still needed? */#define CONDITIONAL_REGISTER_USAGE \{ \ if (obey_regdecls) \ fixed_regs[0] = 1; \ if (TARGET_SOFT_FLOAT) \ { \ int regno; \ for (regno = 16; regno < 24; ++regno) \ fixed_regs[regno] = call_used_regs[regno] = 1; \ } \ if (flag_pic) \ { \ fixed_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \ call_used_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \ } \ else if (TARGET_APCS_STACK) \ { \ fixed_regs[10] = 1; \ call_used_regs[10] = 1; \ } \ SUBTARGET_CONDITIONAL_REGISTER_USAGE \}/* 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 ARM regs are UNITS_PER_WORD bits wide; FPU regs can hold any FP mode. */#define HARD_REGNO_NREGS(REGNO, MODE) \ (((REGNO) >= 16 && REGNO != FRAME_POINTER_REGNUM \ && (REGNO) != ARG_POINTER_REGNUM) ? 1 \ : ((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. This is TRUE for ARM regs since they can hold anything, and TRUE for FPU regs holding FP. */#define HARD_REGNO_MODE_OK(REGNO, MODE) \ ((GET_MODE_CLASS (MODE) == MODE_CC) ? (REGNO == CC_REGNUM) : \ ((REGNO) < 16 || REGNO == FRAME_POINTER_REGNUM \ || REGNO == ARG_POINTER_REGNUM \ || GET_MODE_CLASS (MODE) == MODE_FLOAT))/* 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) == GET_MODE_CLASS (MODE2))/* Specify the registers used for certain standard purposes. The values of these macros are register numbers. *//* Define this if the program counter is overloaded on a register. */#define PC_REGNUM 15/* Register to use for pushing function arguments. */#define STACK_POINTER_REGNUM 13/* Base register for access to local variables of the function. */#define FRAME_POINTER_REGNUM 25/* Define this to be where the real frame pointer is if it is not possible to work out the offset between the frame pointer and the automatic variables until after register allocation has taken place. FRAME_POINTER_REGNUM should point to a special register that we will make sure is eliminated. */#define HARD_FRAME_POINTER_REGNUM 11/* 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. If we have to have a frame pointer we might as well make use of it. APCS says that the frame pointer does not need to be pushed in leaf functions, or simple tail call functions. */#define FRAME_POINTER_REQUIRED \ (current_function_has_nonlocal_label || (TARGET_APCS && !leaf_function_p ()))/* Base register for access to arguments of the function. */#define ARG_POINTER_REGNUM 26/* The native (Norcroft) Pascal compiler for the ARM passes the static chain as an invisible last argument (possible since varargs don't exist in Pascal), so the following is not true. */#define STATIC_CHAIN_REGNUM 8/* Register in which address to store a structure value is passed to a function. */#define STRUCT_VALUE_REGNUM 0/* Internal, so that we don't need to refer to a raw number */#define CC_REGNUM 24/* The order in which register should be allocated. It is good to use ip since no saving is required (though calls clobber it) and it never contains function parameters. It is quite good to use lr since other calls may clobber it anyway. Allocate r0 through r3 in reverse order since r3 is least likely to contain a function parameter; in addition results are returned in r0. */#define REG_ALLOC_ORDER \{ \ 3, 2, 1, 0, 12, 14, 4, 5, \ 6, 7, 8, 10, 9, 11, 13, 15, \ 16, 17, 18, 19, 20, 21, 22, 23, \ 24, 25, 26 \}/* Register and constant classes. *//* Register classes: all ARM regs or all FPU regs---simple! */enum reg_class{ NO_REGS, FPU_REGS, GENERAL_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", \ "FPU_REGS", \ "GENERAL_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. */#define REG_CLASS_CONTENTS \{ \ { 0x0000000 }, /* NO_REGS */ \ { 0x0FF0000 }, /* FPU_REGS */ \ { 0x200FFFF }, /* GENERAL_REGS */ \ { 0x2FFFFFF } /* 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. */#define REGNO_REG_CLASS(REGNO) \ (((REGNO) < 16 || REGNO == FRAME_POINTER_REGNUM \ || REGNO == ARG_POINTER_REGNUM) \ ? GENERAL_REGS : (REGNO) == CC_REGNUM \ ? NO_REGS : FPU_REGS)/* The class value for index registers, and the one for base regs. */#define INDEX_REG_CLASS GENERAL_REGS#define BASE_REG_CLASS GENERAL_REGS/* Get reg_class from a letter such as appears in the machine description. We only need constraint `f' for FPU_REGS (`r' == GENERAL_REGS). */#define REG_CLASS_FROM_LETTER(C) \ ((C)=='f' ? FPU_REGS : NO_REGS)/* The letters I, J, K, L and M 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: immediate arithmetic operand (i.e. 8 bits shifted as required). J: valid indexing constants. K: ~value ok in rhs argument of data operand. L: -value ok in rhs argument of data operand. M: 0..32, or a power of 2 (for shifts, or mult done by shift). */#define CONST_OK_FOR_LETTER_P(VALUE, C) \ ((C) == 'I' ? const_ok_for_arm (VALUE) : \ (C) == 'J' ? ((VALUE) < 4096 && (VALUE) > -4096) : \ (C) == 'K' ? (const_ok_for_arm (~(VALUE))) : \ (C) == 'L' ? (const_ok_for_arm (-(VALUE))) : \ (C) == 'M' ? (((VALUE >= 0 && VALUE <= 32)) \ || (((VALUE) & ((VALUE) - 1)) == 0)) \ : 0)/* For the ARM, `Q' means that this is a memory operand that is just an offset from a register. `S' means any symbol that has the SYMBOL_REF_FLAG set or a CONSTANT_POOL address. This means that the symbol is in the text segment and can be accessed without using a load. */#define EXTRA_CONSTRAINT(OP, C) \ ((C) == 'Q' ? GET_CODE (OP) == MEM && GET_CODE (XEXP (OP, 0)) == REG \ : (C) == 'R' ? (GET_CODE (OP) == MEM \ && GET_CODE (XEXP (OP, 0)) == SYMBOL_REF \ && CONSTANT_POOL_ADDRESS_P (XEXP (OP, 0))) \ : (C) == 'S' ? (optimize > 0 && CONSTANT_ADDRESS_P (OP)) \ : 0)/* Constant letter 'G' for the FPU immediate constants. 'H' means the same constant negated. */#define CONST_DOUBLE_OK_FOR_LETTER_P(X,C) \ ((C) == 'G' ? const_double_rtx_ok_for_fpu (X) \ : (C) == 'H' ? neg_const_double_rtx_ok_for_fpu (X) : 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) (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_OUTPUT_RELOAD_CLASS(CLASS,MODE,X) \ (((MODE) == HImode && ! arm_arch4 && true_regnum (X) == -1) \ ? GENERAL_REGS : NO_REGS)/* If we need to load shorts byte-at-a-time, then we need a scratch. */#define SECONDARY_INPUT_RELOAD_CLASS(CLASS,MODE,X) \ (((MODE) == HImode && ! arm_arch4 && TARGET_SHORT_BY_BYTES \ && (GET_CODE (X) == MEM \ || ((GET_CODE (X) == REG || GET_CODE (X) == SUBREG) \ && true_regnum (X) == -1))) \ ? GENERAL_REGS : NO_REGS)/* Try a machine-dependent way of reloading an illegitimate address operand. If we find one, push the reload and jump to WIN. This macro is used in only one place: `find_reloads_address' in reload.c. For the ARM, we wish to handle large displacements off a base register by splitting the addend across a MOV and the mem insn. This can cut the number of reloads needed. */#define LEGITIMIZE_RELOAD_ADDRESS(X,MODE,OPNUM,TYPE,IND_LEVELS,WIN) \do { \ if (GET_CODE (X) == PLUS \ && GET_CODE (XEXP (X, 0)) == REG \ && REGNO (XEXP (X, 0)) < FIRST_PSEUDO_REGISTER \ && REG_MODE_OK_FOR_BASE_P (XEXP (X, 0), MODE) \ && GET_CODE (XEXP (X, 1)) == CONST_INT) \ { \ HOST_WIDE_INT val = INTVAL (XEXP (X, 1)); \ HOST_WIDE_INT low, high; \ \ if (MODE == DImode || (TARGET_SOFT_FLOAT && MODE == DFmode)) \ low = ((val & 0xf) ^ 0x8) - 0x8; \ else if (MODE == SImode || MODE == QImode \ || (MODE == SFmode && TARGET_SOFT_FLOAT) \ || (MODE == HImode && ! arm_arch4)) \ /* Need to be careful, -4096 is not a valid offset */ \ low = val >= 0 ? (val & 0xfff) : -((-val) & 0xfff); \ else if (MODE == HImode && arm_arch4) \ /* Need to be careful, -256 is not a valid offset */ \ low = val >= 0 ? (val & 0xff) : -((-val) & 0xff); \ else if (GET_MODE_CLASS (MODE) == MODE_FLOAT \ && TARGET_HARD_FLOAT) \ /* Need to be careful, -1024 is not a valid offset */ \ low = val >= 0 ? (val & 0x3ff) : -((-val) & 0x3ff); \ else \ break; \ \ high = ((((val - low) & 0xffffffff) ^ 0x80000000) - 0x80000000); \ /* Check for overflow or zero */ \ if (low == 0 || high == 0 || (high + low != val)) \ break; \ \ /* Reload the high part into a base reg; leave the low part \ in the mem. */ \ X = gen_rtx_PLUS (GET_MODE (X), \ gen_rtx_PLUS (GET_MODE (X), XEXP (X, 0), \ GEN_INT (high)), \ GEN_INT (low)); \ push_reload (XEXP (X, 0), NULL_RTX, &XEXP (X, 0), NULL_PTR, \ BASE_REG_CLASS, GET_MODE (X), VOIDmode, 0, 0, \ OPNUM, TYPE); \ goto WIN; \ } \} while (0)/* Return the maximum number of consecutive registers needed to represent mode MODE in a register of class CLASS. ARM regs are UNITS_PER_WORD bits while FPU regs can hold any FP mode */#define CLASS_MAX_NREGS(CLASS, MODE) \ ((CLASS) == FPU_REGS ? 1 \ : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))/* Moves between FPU_REGS and GENERAL_REGS are two memory insns. */#define REGISTER_MOVE_COST(CLASS1, CLASS2) \ ((((CLASS1) == FPU_REGS && (CLASS2) != FPU_REGS) \ || ((CLASS2) == FPU_REGS && (CLASS1) != FPU_REGS)) \ ? 20 : 2)/* Stack layout; function entry, exit and calling. *//* Define this if pushing a word on the stack makes the stack pointer a smaller address. */#define STACK_GROWS_DOWNWARD 1/* 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. */#define FRAME_GROWS_DOWNWARD 1/* 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 we generate an insn to push BYTES bytes, this says how many the stack pointer really advances by. *//* The push insns do not do this rounding implicitly. So don't define this. *//* #define PUSH_ROUNDING(NPUSHED) (((NPUSHED) + 3) & ~3) */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -