📄 m68k.h
字号:
#define CONSTANT_ADDRESS_P(X) CONSTANT_P (X)/* Nonzero if the constant value X is a legitimate general operand. It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */#define LEGITIMATE_CONSTANT_P(X) 1/* Nonzero if the constant value X is a legitimate general operand when generating PIC code. It is given that flag_pic is on and that X satisfies CONSTANT_P or is a CONST_DOUBLE. */#define LEGITIMATE_PIC_OPERAND_P(X) \ (! symbolic_operand (X, VOIDmode))/* 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. Most source files want to accept pseudo regs in the hope that they will get allocated to the class that the insn wants them to be in. Source files for reload pass need to be strict. After reload, it makes no difference, since pseudo regs have been eliminated by then. */#ifndef REG_OK_STRICT/* 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) ((REGNO (X) ^ 020) >= 8)/* 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) & ~027) != 0)#else/* 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))/* 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))#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. When generating PIC, an address involving a SYMBOL_REF is legitimate if and only if it is the sum of pic_offset_table_rtx and the SYMBOL_REF. We use LEGITIMATE_PIC_OPERAND_P to throw out the illegitimate addresses, and we explicitly check for the sum of pic_offset_table_rtx and a SYMBOL_REF. Likewise for a LABEL_REF when generating PIC. The other macros defined here are used only in GO_IF_LEGITIMATE_ADDRESS. */#define INDIRECTABLE_1_ADDRESS_P(X) \ ((CONSTANT_ADDRESS_P (X) && (!flag_pic || LEGITIMATE_PIC_OPERAND_P (X))) \ || (GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X)) \ || ((GET_CODE (X) == PRE_DEC || GET_CODE (X) == POST_INC) \ && REG_P (XEXP (X, 0)) \ && REG_OK_FOR_BASE_P (XEXP (X, 0))) \ || (GET_CODE (X) == PLUS \ && REG_P (XEXP (X, 0)) && REG_OK_FOR_BASE_P (XEXP (X, 0)) \ && GET_CODE (XEXP (X, 1)) == CONST_INT \ && ((unsigned) INTVAL (XEXP (X, 1)) + 0x8000) < 0x10000) \ || (GET_CODE (X) == PLUS && XEXP (X, 0) == pic_offset_table_rtx \ && flag_pic && GET_CODE (XEXP (X, 1)) == SYMBOL_REF) \ || (GET_CODE (X) == PLUS && XEXP (X, 0) == pic_offset_table_rtx \ && flag_pic && GET_CODE (XEXP (X, 1)) == LABEL_REF)) \#if 0/* This should replace the last two (non-pic) lines except that Sun's assembler does not seem to handle such operands. */ && (TARGET_68020 ? CONSTANT_ADDRESS_P (XEXP (X, 1)) \ : (GET_CODE (XEXP (X, 1)) == CONST_INT \ && ((unsigned) INTVAL (XEXP (X, 1)) + 0x8000) < 0x10000))))#endif#define GO_IF_NONINDEXED_ADDRESS(X, ADDR) \{ if (INDIRECTABLE_1_ADDRESS_P (X)) goto ADDR; }/* Only labels on dispatch tables are valid for indexing from. */#define GO_IF_INDEXABLE_BASE(X, ADDR) \{ rtx temp; \ if (GET_CODE (X) == LABEL_REF \ && (temp = next_nonnote_insn (XEXP (X, 0))) != 0 \ && GET_CODE (temp) == JUMP_INSN \ && (GET_CODE (PATTERN (temp)) == ADDR_VEC \ || GET_CODE (PATTERN (temp)) == ADDR_DIFF_VEC)) \ goto ADDR; \ if (GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X)) goto ADDR; }#define GO_IF_INDEXING(X, ADDR) \{ if (GET_CODE (X) == PLUS && LEGITIMATE_INDEX_P (XEXP (X, 0))) \ { GO_IF_INDEXABLE_BASE (XEXP (X, 1), ADDR); } \ if (GET_CODE (X) == PLUS && LEGITIMATE_INDEX_P (XEXP (X, 1))) \ { GO_IF_INDEXABLE_BASE (XEXP (X, 0), ADDR); } }#define GO_IF_INDEXED_ADDRESS(X, ADDR) \{ GO_IF_INDEXING (X, ADDR); \ if (GET_CODE (X) == PLUS) \ { if (GET_CODE (XEXP (X, 1)) == CONST_INT \ && (unsigned) INTVAL (XEXP (X, 1)) + 0x80 < 0x100) \ { rtx go_temp = XEXP (X, 0); GO_IF_INDEXING (go_temp, ADDR); } \ if (GET_CODE (XEXP (X, 0)) == CONST_INT \ && (unsigned) INTVAL (XEXP (X, 0)) + 0x80 < 0x100) \ { rtx go_temp = XEXP (X, 1); GO_IF_INDEXING (go_temp, ADDR); } } }#define LEGITIMATE_INDEX_REG_P(X) \ ((GET_CODE (X) == REG && REG_OK_FOR_INDEX_P (X)) \ || (GET_CODE (X) == SIGN_EXTEND \ && GET_CODE (XEXP (X, 0)) == REG \ && GET_MODE (XEXP (X, 0)) == HImode \ && REG_OK_FOR_INDEX_P (XEXP (X, 0))))#define LEGITIMATE_INDEX_P(X) \ (LEGITIMATE_INDEX_REG_P (X) \ || (TARGET_68020 && GET_CODE (X) == MULT \ && LEGITIMATE_INDEX_REG_P (XEXP (X, 0)) \ && GET_CODE (XEXP (X, 1)) == CONST_INT \ && (INTVAL (XEXP (X, 1)) == 2 \ || INTVAL (XEXP (X, 1)) == 4 \ || INTVAL (XEXP (X, 1)) == 8)))#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \{ GO_IF_NONINDEXED_ADDRESS (X, ADDR); \ GO_IF_INDEXED_ADDRESS (X, ADDR); }/* 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. For the 68000, we handle X+REG by loading X into a register R and using R+REG. R will go in an address reg and indexing will be used. However, if REG is a broken-out memory address or multiplication, nothing needs to be done because REG can certainly go in an address reg. */#define COPY_ONCE(Y) if (!copied) { Y = copy_rtx (Y); copied = ch = 1; }#define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) \{ register int ch = (X) != (OLDX); \ if (GET_CODE (X) == PLUS) \ { int copied = 0; \ if (GET_CODE (XEXP (X, 0)) == MULT) \ { COPY_ONCE (X); XEXP (X, 0) = force_operand (XEXP (X, 0), 0);} \ if (GET_CODE (XEXP (X, 1)) == MULT) \ { COPY_ONCE (X); XEXP (X, 1) = force_operand (XEXP (X, 1), 0);} \ if (ch && GET_CODE (XEXP (X, 1)) == REG \ && GET_CODE (XEXP (X, 0)) == REG) \ goto WIN; \ if (ch) { GO_IF_LEGITIMATE_ADDRESS (MODE, X, WIN); } \ if (GET_CODE (XEXP (X, 0)) == REG \ || (GET_CODE (XEXP (X, 0)) == SIGN_EXTEND \ && GET_CODE (XEXP (XEXP (X, 0), 0)) == REG \ && GET_MODE (XEXP (XEXP (X, 0), 0)) == HImode)) \ { register rtx temp = gen_reg_rtx (Pmode); \ register rtx val = force_operand (XEXP (X, 1), 0); \ emit_move_insn (temp, val); \ COPY_ONCE (X); \ XEXP (X, 1) = temp; \ goto WIN; } \ else if (GET_CODE (XEXP (X, 1)) == REG \ || (GET_CODE (XEXP (X, 1)) == SIGN_EXTEND \ && GET_CODE (XEXP (XEXP (X, 1), 0)) == REG \ && GET_MODE (XEXP (XEXP (X, 1), 0)) == HImode)) \ { register rtx temp = gen_reg_rtx (Pmode); \ register rtx val = force_operand (XEXP (X, 0), 0); \ emit_move_insn (temp, val); \ COPY_ONCE (X); \ XEXP (X, 0) = temp; \ goto WIN; }}}/* Go to LABEL if ADDR (a legitimate address expression) has an effect that depends on the machine mode it is used for. On the 68000, only predecrement and postincrement address depend thus (the amount of decrement or increment being the length of the operand). */#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) \ if (GET_CODE (ADDR) == POST_INC || GET_CODE (ADDR) == PRE_DEC) goto LABEL/* Specify the machine mode that this machine uses for the index in the tablejump instruction. */#define CASE_VECTOR_MODE HImode/* Define this 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/* 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/* Define this as 1 if `char' should by default be signed; else as 0. */#define DEFAULT_SIGNED_CHAR 1/* Don't cse the address of the function being compiled. */#define NO_RECURSIVE_FUNCTION_CSE/* Max number of bytes we can move from memory to memory in one reasonably fast instruction. */#define MOVE_MAX 4/* Define this if zero-extension is slow (more than one real instruction). */#define SLOW_ZERO_EXTEND/* Nonzero if access to memory by bytes is slow and undesirable. */#define SLOW_BYTE_ACCESS 0/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits is done just by pretending it is already truncated. */#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1/* We assume that the store-condition-codes instructions store 0 for false and some other value for true. This is the value stored for true. */#define STORE_FLAG_VALUE -1/* When a prototype says `char' or `short', really pass an `int'. */#define PROMOTE_PROTOTYPES/* Specify the machine mode that pointers have. After generation of rtl, the compiler makes no further distinction between pointers and any other objects of this machine mode. */#define Pmode SImode/* A function address in a call instruction is a byte address (for indexing purposes) so give the MEM rtx a byte's mode. */#define FUNCTION_MODE QImode/* Compute the cost of computing a constant rtl expression RTX whose rtx-code is CODE. The body of this macro is a portion of a switch statement. If the code is computed here, return it with a return statement. Otherwise, break from the switch. */#define CONST_COSTS(RTX,CODE,OUTER_CODE) \ case CONST_INT: \ /* Constant zero is super cheap due to clr instruction. */ \ if (RTX == const0_rtx) return 0; \ /* Constants between -128 and 127 are cheap due to moveq */ \ if (INTVAL (RTX) >= -128 && INTVAL (RTX) <= 127) return 1; \ /* Constants between -136 and 254 are easily generated */ \ /* by intelligent uses of moveq, add[q], and subq */ \ if ((OUTER_CODE) == SET && INTVAL (RTX) >= -136 \ && INTVAL (RTX) <= 254) return 2; \ case CONST: \ case LABEL_REF: \ case SYMBOL_REF: \ return 3; \ case CONST_DOUBLE: \ return 5;/* Compute the cost of various arithmetic operations. These are vaguely right for a 68020. *//* The costs for long multiply have been adjusted to work properly in synth_mult on the 68020, relative to an average of the time for add and the time for shift, taking away a little more because sometimes move insns are needed. */#define MULL_COST (TARGET_68040 ? 5 : 13)#define MULW_COST (TARGET_68040 ? 3 : 8)#define RTX_COSTS(X,CODE,OUTER_CODE) \ case PLUS: \ /* An lea costs about three times as much as a simple add. */ \ if (GET_MODE (X) == SImode \ && GET_CODE (XEXP (X, 0)) == REG \ && GET_CODE (XEXP (X, 1)) == MULT \ && GET_CODE (XEXP (XEXP (X, 1), 0)) == REG \ && GET_CODE (XEXP (XEXP (X, 1), 1)) == CONST_INT \ && (INTVAL (XEXP (XEXP (X, 1), 1)) == 2 \ || INTVAL (XEXP (XEXP (X, 1), 1)) == 4 \ || INTVAL (XEXP (XEXP (X, 1), 1)) == 8)) \ return COSTS_N_INSNS (3); /* lea an@(dx:l:i),am */ \ break; \ case ASHIFT: \ case ASHIFTRT: \ case LSHIFT: \ case LSHIFTRT: \ /* A shift by a big integer takes an extra instruction. */ \ if (GET_CODE (XEXP (X, 1)) == CONST_INT \ && (INTVAL (XEXP (X, 1)) == 16)) \ return COSTS_N_INSNS (2); /* clrw;swap */ \ if (GET_CODE (XEXP (X, 1)) == CONST_INT \ && !(INTVAL (XEXP (X, 1)) > 0 \ && INTVAL (XEXP (X, 1)) <= 8)) \ return COSTS_N_INSNS (3); /* lsr #i,dn */ \ break; \ case MULT: \ if (GET_CODE (XEXP (x, 1)) == CONST_INT \ && exact_log2 (INTVAL (XEXP (x, 1))) >= 0) \ { \ /* A shift by a big integer takes an extra instruction. */ \ if (GET_CODE (XEXP (X, 1)) == CONST_INT \ && (INTVAL (XEXP (X, 1)) == (1 << 16))) \ return COSTS_N_INSNS (2); /* clrw;swap */ \ if (GET_CODE (XEXP (X, 1)) == CONST_INT \ && !(INTVAL (XEXP (X, 1)) > 1 \ && INTVAL (XEXP (X, 1)) <= 256)) \ return COSTS_N_INSNS (3); /* lsr #i,dn */ \ break; \ } \ else if (GET_MODE (X) == QImode || GET_MODE (X) == HImode) \ return COSTS_N_INSNS (MULW_COST); \ else \ return COSTS_N_INSNS (MULL_COST); \ break; \ case DIV: \ case UDIV: \ case MOD: \ case UMOD: \ if (GET_MODE (X) == QImode || GET_MODE (X) == HImode) \ return COSTS_N_INSNS (27); /* div.w */ \ return COSTS_N_INSNS (43); /* div.l *//* Tell final.c how to eliminate redundant test instructions. *//* Here we define machine-dependent flags and fields in cc_status (see `conditions.h'). *//* Set if the cc value is actually in the 68881, so a floating point conditional branch must be output. */#define CC_IN_68881 04000/* Store in cc_status the expressions that the condition codes will describe after execution of an instruction whose pattern is EXP. Do not alter them if the instruction would not alter the cc's. *//* On the 68000, all the insns to store in an address register fail to set the cc's. However, in some cases these instructions can make it possibly invalid to use the saved cc's. In those cases we clear out some or all of the saved cc's so they won't be used. */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -