📄 arm.h
字号:
#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; \ } \ /* NASTY: Since this limits the addressing of unsigned byte loads */ \ range = ((MODE) == HImode || (MODE) == QImode) \ ? (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)))\ goto LABEL; \ else if ((MODE) == TImode) \ ; \ else if ((MODE) == DImode || (TARGET_SOFT_FLOAT && (MODE) == DFmode)) \ { \ if (GET_CODE (X) == PLUS && BASE_REGISTER_RTX_P (XEXP (X, 0)) \ && GET_CODE (XEXP (X, 1)) == CONST_INT) \ { \ HOST_WIDE_INT val = INTVAL (XEXP (X, 1)); \ if (val == 4 || val == -4 || val == -8) \ goto LABEL; \ } \ } \ else if (GET_CODE (X) == PLUS) \ { \ rtx xop0 = XEXP(X,0); \ rtx xop1 = XEXP(X,1); \ \ if (BASE_REGISTER_RTX_P (xop0)) \ GO_IF_LEGITIMATE_INDEX (MODE, REGNO (xop0), xop1, LABEL); \ else if (BASE_REGISTER_RTX_P (xop1)) \ GO_IF_LEGITIMATE_INDEX (MODE, REGNO (xop1), xop0, LABEL); \ } \ /* Reload currently can't handle MINUS, so disable this for now */ \ /* else if (GET_CODE (X) == MINUS) \ { \ rtx xop0 = XEXP (X,0); \ rtx xop1 = XEXP (X,1); \ \ if (BASE_REGISTER_RTX_P (xop0)) \ GO_IF_LEGITIMATE_INDEX (MODE, -1, xop1, LABEL); \ } */ \ else if (GET_MODE_CLASS (MODE) != MODE_FLOAT \ && GET_CODE (X) == SYMBOL_REF \ && CONSTANT_POOL_ADDRESS_P (X) \ && ! (flag_pic \ && symbol_mentioned_p (get_pool_constant (X)))) \ goto LABEL; \ else if ((GET_CODE (X) == PRE_INC || GET_CODE (X) == POST_DEC) \ && (GET_MODE_SIZE (MODE) <= 4) \ && GET_CODE (XEXP (X, 0)) == REG \ && REG_OK_FOR_PRE_POST_P (XEXP (X, 0))) \ goto LABEL; \}/* Try machine-dependent ways of modifying an illegitimate address to be legitimate. If we find one, return the new, valid address. This macro is used in only one place: `memory_address' in explow.c. OLDX is the address as it was before break_out_memory_refs was called. In some cases it is useful to look at this to decide what needs to be done. MODE and WIN are passed so that this macro can use GO_IF_LEGITIMATE_ADDRESS. It is always safe for this macro to do nothing. It exists to recognize opportunities to optimize the output. On the ARM, try to convert [REG, #BIGCONST] into ADD BASE, REG, #UPPERCONST and [BASE, #VALIDCONST], where VALIDCONST == 0 in case of TImode. */extern struct rtx_def *legitimize_pic_address ();#define LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN) \{ \ if (GET_CODE (X) == PLUS) \ { \ rtx xop0 = XEXP (X, 0); \ rtx xop1 = XEXP (X, 1); \ \ if (CONSTANT_P (xop0) && ! symbol_mentioned_p (xop0)) \ xop0 = force_reg (SImode, xop0); \ if (CONSTANT_P (xop1) && ! symbol_mentioned_p (xop1)) \ xop1 = force_reg (SImode, xop1); \ if (BASE_REGISTER_RTX_P (xop0) && GET_CODE (xop1) == CONST_INT) \ { \ HOST_WIDE_INT n, low_n; \ rtx base_reg, val; \ n = INTVAL (xop1); \ \ if (MODE == DImode || (TARGET_SOFT_FLOAT && MODE == DFmode)) \ { \ low_n = n & 0x0f; \ n &= ~0x0f; \ if (low_n > 4) \ { \ n += 16; \ low_n -= 16; \ } \ } \ else \ { \ low_n = ((MODE) == TImode ? 0 \ : n >= 0 ? (n & 0xfff) : -((-n) & 0xfff)); \ n -= low_n; \ } \ base_reg = gen_reg_rtx (SImode); \ val = force_operand (gen_rtx_PLUS (SImode, xop0, \ GEN_INT (n)), NULL_RTX); \ emit_move_insn (base_reg, val); \ (X) = (low_n == 0 ? base_reg \ : gen_rtx_PLUS (SImode, base_reg, GEN_INT (low_n))); \ } \ else if (xop0 != XEXP (X, 0) || xop1 != XEXP (x, 1)) \ (X) = gen_rtx_PLUS (SImode, xop0, xop1); \ } \ else if (GET_CODE (X) == MINUS) \ { \ rtx xop0 = XEXP (X, 0); \ rtx xop1 = XEXP (X, 1); \ \ if (CONSTANT_P (xop0)) \ xop0 = force_reg (SImode, xop0); \ if (CONSTANT_P (xop1) && ! symbol_mentioned_p (xop1)) \ xop1 = force_reg (SImode, xop1); \ if (xop0 != XEXP (X, 0) || xop1 != XEXP (X, 1)) \ (X) = gen_rtx_MINUS (SImode, xop0, xop1); \ } \ if (flag_pic) \ (X) = legitimize_pic_address (OLDX, MODE, NULL_RTX); \ if (memory_address_p (MODE, X)) \ goto WIN; \}/* Go to LABEL if ADDR (a legitimate address expression) has an effect that depends on the machine mode it is used for. */#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) \{ \ if (GET_CODE(ADDR) == PRE_DEC || GET_CODE(ADDR) == POST_DEC \ || GET_CODE(ADDR) == PRE_INC || GET_CODE(ADDR) == POST_INC) \ goto LABEL; \}/* Specify the machine mode that this machine uses for the index in the tablejump instruction. */#define CASE_VECTOR_MODE SImode/* Define as C expression which evaluates to nonzero if the tablejump instruction expects the table to contain offsets from the address of the table. Do not define this if the table should contain absolute addresses. *//* #define CASE_VECTOR_PC_RELATIVE 1 *//* Specify the tree operation to be used to convert reals to integers. */#define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR/* This is the kind of divide that is easiest to do in the general case. */#define EASY_DIV_EXPR TRUNC_DIV_EXPR/* signed 'char' is most compatible, but RISC OS wants it unsigned. unsigned is probably best, but may break some code. */#ifndef DEFAULT_SIGNED_CHAR#define DEFAULT_SIGNED_CHAR 0#endif/* Don't cse the address of the function being compiled. */#define NO_RECURSIVE_FUNCTION_CSE 1/* Max number of bytes we can move from memory to memory in one reasonably fast instruction. */#define MOVE_MAX 4/* 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. */#define LOAD_EXTEND_OP(MODE) \ ((arm_arch4 || (MODE) == QImode) ? ZERO_EXTEND \ : ((BYTES_BIG_ENDIAN && (MODE) == HImode) ? SIGN_EXTEND : NIL))/* Define this if zero-extension is slow (more than one real instruction). On the ARM, it is more than one instruction only if not fetching from memory. *//* #define SLOW_ZERO_EXTEND *//* Nonzero if access to memory by bytes is slow and undesirable. */#define SLOW_BYTE_ACCESS 0/* Immediate shift c
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -