📄 arm.h
字号:
that way. */#define SETUP_INCOMING_VARARGS(CUM, MODE, TYPE, PRETEND_SIZE, NO_RTL) \{ \ extern int current_function_anonymous_args; \ current_function_anonymous_args = 1; \ if ((CUM) < 16) \ (PRETEND_SIZE) = 16 - (CUM); \}/* Generate assembly output for the start of a function. */#define FUNCTION_PROLOGUE(STREAM, SIZE) \ output_func_prologue ((STREAM), (SIZE))/* Call the function profiler with a given profile label. The Acorn compiler puts this BEFORE the prolog but gcc puts it afterwards. The ``mov ip,lr'' seems like a good idea to stick with cc convention. ``prof'' doesn't seem to mind about this! */#define FUNCTION_PROFILER(STREAM,LABELNO) \{ \ fprintf(STREAM, "\tmov\t%sip, %slr\n", REGISTER_PREFIX, REGISTER_PREFIX); \ fprintf(STREAM, "\tbl\tmcount\n"); \ fprintf(STREAM, "\t.word\tLP%d\n", (LABELNO)); \}/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function, the stack pointer does not matter. The value is tested only in functions that have frame pointers. No definition is equivalent to always zero. On the ARM, the function epilogue recovers the stack pointer from the frame. */#define EXIT_IGNORE_STACK 1/* Generate the assembly code for function exit. */#define FUNCTION_EPILOGUE(STREAM, SIZE) \ output_func_epilogue ((STREAM), (SIZE))/* Determine if the epilogue should be output as RTL. You should override this if you define FUNCTION_EXTRA_EPILOGUE. */#define USE_RETURN_INSN use_return_insn ()/* Definitions for register eliminations. 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. We have two registers that can be eliminated on the ARM. First, the arg pointer register can often be eliminated in favor of the stack pointer register. Secondly, the pseudo frame pointer register can always be eliminated; it is replaced with either the stack or the real frame pointer. */#define ELIMINABLE_REGS \{{ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \ {ARG_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}, \ {FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}, \ {FRAME_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}}/* Given FROM and TO register numbers, say whether this elimination is allowed. Frame pointer elimination is automatically handled. All eliminations are permissible. Note that ARG_POINTER_REGNUM and HARD_FRAME_POINTER_REGNUM are in fact the same thing. If we need a frame pointer, we must eliminate FRAME_POINTER_REGNUM into HARD_FRAME_POINTER_REGNUM and not into STACK_POINTER_REGNUM. */#define CAN_ELIMINATE(FROM, TO) \ (((TO) == STACK_POINTER_REGNUM && frame_pointer_needed) ? 0 : 1)/* 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) \{ \ int volatile_func = arm_volatile_func (); \ if ((FROM) == ARG_POINTER_REGNUM && (TO) == HARD_FRAME_POINTER_REGNUM)\ (OFFSET) = 0; \ else if ((FROM) == FRAME_POINTER_REGNUM \ && (TO) == STACK_POINTER_REGNUM) \ (OFFSET) = (current_function_outgoing_args_size \ + (get_frame_size () + 3 & ~3)); \ else \ { \ int regno; \ int offset = 12; \ int saved_hard_reg = 0; \ \ if (! volatile_func) \ { \ for (regno = 0; regno <= 10; regno++) \ if (regs_ever_live[regno] && ! call_used_regs[regno]) \ saved_hard_reg = 1, offset += 4; \ for (regno = 16; regno <=23; regno++) \ if (regs_ever_live[regno] && ! call_used_regs[regno]) \ offset += 12; \ } \ if ((FROM) == FRAME_POINTER_REGNUM) \ (OFFSET) = -offset; \ else \ { \ if (! frame_pointer_needed) \ offset -= 16; \ if (! volatile_func \ && (regs_ever_live[14] || saved_hard_reg)) \ offset += 4; \ offset += current_function_outgoing_args_size; \ (OFFSET) = (get_frame_size () + 3 & ~3) + offset; \ } \ } \}/* Output assembler code for a block containing the constant parts of a trampoline, leaving space for the variable parts. On the ARM, (if r8 is the static chain regnum, and remembering that referencing pc adds an offset of 8) the trampoline looks like: ldr r8, [pc, #0] ldr pc, [pc] .word static chain value .word function's address ??? FIXME: When the trampoline returns, r8 will be clobbered. */#define TRAMPOLINE_TEMPLATE(FILE) \{ \ fprintf ((FILE), "\tldr\t%sr8, [%spc, #0]\n", \ REGISTER_PREFIX, REGISTER_PREFIX); \ fprintf ((FILE), "\tldr\t%spc, [%spc, #0]\n", \ REGISTER_PREFIX, REGISTER_PREFIX); \ fprintf ((FILE), "\t.word\t0\n"); \ fprintf ((FILE), "\t.word\t0\n"); \}/* Length in units of the trampoline for entering a nested function. */#define TRAMPOLINE_SIZE 16/* Alignment required for a trampoline in units. */#define TRAMPOLINE_ALIGN 4/* Emit RTL insns to initialize the variable parts of a trampoline. FNADDR is an RTX for the address of the function's pure code. CXT is an RTX for the static chain value for the function. */#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \{ \ emit_move_insn (gen_rtx (MEM, SImode, plus_constant ((TRAMP), 8)), \ (CXT)); \ emit_move_insn (gen_rtx (MEM, SImode, plus_constant ((TRAMP), 12)), \ (FNADDR)); \}/* Addressing modes, and classification of registers for them. */#define HAVE_POST_INCREMENT 1#define HAVE_PRE_INCREMENT 1#define HAVE_POST_DECREMENT 1#define HAVE_PRE_DECREMENT 1/* Macros to check register numbers against specific register classes. *//* These assume that REGNO is a hard or pseudo reg number. They give nonzero only if REGNO is a hard reg of the suitable class or a pseudo reg currently allocated to a suitable hard reg. Since they use reg_renumber, they are safe only once reg_renumber has been allocated, which happens in local-alloc.c. On the ARM, don't allow the pc to be used. */#define REGNO_OK_FOR_BASE_P(REGNO) \ ((REGNO) < 15 || (REGNO) == FRAME_POINTER_REGNUM \ || (REGNO) == ARG_POINTER_REGNUM \ || (unsigned) reg_renumber[(REGNO)] < 15 \ || (unsigned) reg_renumber[(REGNO)] == FRAME_POINTER_REGNUM \ || (unsigned) reg_renumber[(REGNO)] == ARG_POINTER_REGNUM)#define REGNO_OK_FOR_INDEX_P(REGNO) \ REGNO_OK_FOR_BASE_P(REGNO)/* Maximum number of registers that can appear in a valid memory address. Shifts in addresses can't be by a register. */#define MAX_REGS_PER_ADDRESS 2/* Recognize any constant value that is a valid address. *//* XXX We can address any constant, eventually... */#ifdef AOF_ASSEMBLER#define CONSTANT_ADDRESS_P(X) \ (GET_CODE (X) == SYMBOL_REF \ && CONSTANT_POOL_ADDRESS_P (X))#else#define CONSTANT_ADDRESS_P(X) \ (GET_CODE (X) == SYMBOL_REF \ && (CONSTANT_POOL_ADDRESS_P (X) \ || (optimize > 0 && SYMBOL_REF_FLAG (X))))#endif /* AOF_ASSEMBLER *//* Nonzero if the constant value X is a legitimate general operand. It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. On the ARM, allow any integer (invalid ones are removed later by insn patterns), nice doubles and symbol_refs which refer to the function's constant pool XXX. */#define LEGITIMATE_CONSTANT_P(X) (! label_mentioned_p (X))/* Symbols in the text segment can be accessed without indirecting via the constant pool; it may take an extra binary operation, but this is still faster than indirecting via memory. Don't do this when not optimizing, since we won't be calculating al of the offsets necessary to do this simplification. *//* This doesn't work with AOF syntax, since the string table may be in a different AREA. */#ifndef AOF_ASSEMBLER#define ENCODE_SECTION_INFO(decl) \{ \ if (optimize > 0 && TREE_CONSTANT (decl) \ && (!flag_writable_strings || TREE_CODE (decl) != STRING_CST)) \ { \ rtx rtl = (TREE_CODE_CLASS (TREE_CODE (decl)) != 'd' \ ? TREE_CST_RTL (decl) : DECL_RTL (decl)); \ SYMBOL_REF_FLAG (XEXP (rtl, 0)) = 1; \ } \}#endif/* The macros REG_OK_FOR..._P assume that the arg is a REG rtx and check its validity for a certain class. We have two alternate definitions for each of them. The usual definition accepts all pseudo regs; the other rejects them unless they have been allocated suitable hard regs. The symbol REG_OK_STRICT causes the latter definition to be used. */#ifndef REG_OK_STRICT/* Nonzero if X is a hard reg that can be used as a base reg or if it is a pseudo reg. */#define REG_OK_FOR_BASE_P(X) \ (REGNO (X) < 16 || REGNO (X) >= FIRST_PSEUDO_REGISTER \ || REGNO (X) == FRAME_POINTER_REGNUM || REGNO (X) == ARG_POINTER_REGNUM)/* Nonzero if X is a hard reg that can be used as an index or if it is a pseudo reg. */#define REG_OK_FOR_INDEX_P(X) \ REG_OK_FOR_BASE_P(X)#define REG_OK_FOR_PRE_POST_P(X) \ (REGNO (X) < 16 || REGNO (X) >= FIRST_PSEUDO_REGISTER \ || REGNO (X) == FRAME_POINTER_REGNUM || REGNO (X) == ARG_POINTER_REGNUM)#else/* Nonzero if X is a hard reg that can be used as a base reg. */#define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))/* Nonzero if X is a hard reg that can be used as an index. */#define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))#define REG_OK_FOR_PRE_POST_P(X) \ (REGNO (X) < 16 || (unsigned) reg_renumber[REGNO (X)] < 16 \ || REGNO (X) == FRAME_POINTER_REGNUM || REGNO (X) == ARG_POINTER_REGNUM \ || (unsigned) reg_renumber[REGNO (X)] == FRAME_POINTER_REGNUM \ || (unsigned) reg_renumber[REGNO (X)] == ARG_POINTER_REGNUM)#endif/* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression that is a valid memory address for an instruction. The MODE argument is the machine mode for the MEM expression that wants to use this address. The other macros defined here are used only in GO_IF_LEGITIMATE_ADDRESS. */#define BASE_REGISTER_RTX_P(X) \ (GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X))#define INDEX_REGISTER_RTX_P(X) \ (GET_CODE (X) == REG && REG_OK_FOR_INDEX_P (X))/* A C statement (sans semicolon) to jump to LABEL for legitimate index RTXs used by the macro GO_IF_LEGITIMATE_ADDRESS. Floating point indices can only be small constants. */#define GO_IF_LEGITIMATE_INDEX(MODE, BASE_REGNO, INDEX, LABEL) \do \{ \ HOST_WIDE_INT range; \ enum rtx_code code = GET_CODE (INDEX); \ \ if (TARGET_HARD_FLOAT && GET_MODE_CLASS (MODE) == MODE_FLOAT) \ { \ if (code == CONST_INT && INTVAL (INDEX) < 1024 \ && INTVAL (INDEX) > -1024 \ && (INTVAL (INDEX) & 3) == 0) \ goto LABEL; \ } \ else \ { \ if (INDEX_REGISTER_RTX_P (INDEX) && GET_MODE_SIZE (MODE) <= 4) \ goto LABEL; \ if (GET_MODE_SIZE (MODE) <= 4 && code == MULT \ && (! arm_arch4 || (MODE) != HImode)) \ { \ rtx xiop0 = XEXP (INDEX, 0); \ rtx xiop1 = XEXP (INDEX, 1); \ if (INDEX_REGISTER_RTX_P (xiop0) \ && power_of_two_operand (xiop1, SImode)) \ goto LABEL; \ if (INDEX_REGISTER_RTX_P (xiop1) \ && power_of_two_operand (xiop0, SImode)) \ goto LABEL; \ } \ if (GET_MODE_SIZE (MODE) <= 4 \ && (code == LSHIFTRT || code == ASHIFTRT \ || code == ASHIFT || code == ROTATERT) \ && (! arm_arch4 || (MODE) != HImode)) \ { \ rtx op = XEXP (INDEX, 1); \ if (INDEX_REGISTER_RTX_P (XEXP (INDEX, 0)) \ && GET_CODE (op) == CONST_INT && INTVAL (op) > 0 \ && INTVAL (op) <= 31) \ goto LABEL; \ } \ range = (MODE) == HImode ? (arm_arch4 ? 256 : 4095) : 4096; \ if (code == CONST_INT && INTVAL (INDEX) < range \ && INTVAL (INDEX) > -range) \ goto LABEL; \ } \} while (0)/* Jump to LABEL if X is a valid address RTX. This must also take REG_OK_STRICT into account when deciding about valid registers, but it uses the above macros so we are in luck. Allow REG, REG+REG, REG+INDEX, INDEX+REG, REG-INDEX, and non floating SYMBOL_REF to the constant pool. Allow REG-only and AUTINC-REG if handling TImode or HImode. Other symbol refs must be forced though a static cell to ensure addressability. */#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, LABEL) \{ \ if (BASE_REGISTER_RTX_P (X)) \ goto LABEL; \ else if ((GET_CODE (X) == POST_INC || GET_CODE (X) == PRE_DEC) \ && GET_CODE (XEXP (X, 0)) == REG \ && REG_OK_FOR_PRE_POST_P (XEXP (X, 0))) \ goto LABEL; \ else if (GET_MODE_SIZE (MODE) >= 4 && reload_completed \ && (GET_CODE (X) == LABEL_REF \ || (GET_CODE (X) == CONST \ && GET_CODE (XEXP ((X), 0)) == PLUS \ && GET_CODE (XEXP (XEXP ((X), 0), 0)) == LABEL_REF \ && GET_CODE (XEXP (XEXP ((X), 0), 1)) == CONST_INT)))\
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -