📄 alpha.h
字号:
_addr = memory_address (Pmode, plus_constant ((TRAMP), 16)); \ emit_move_insn (gen_rtx (MEM, Pmode, _addr), (FNADDR)); \ _addr = memory_address (Pmode, plus_constant ((TRAMP), 24)); \ emit_move_insn (gen_rtx (MEM, Pmode, _addr), (CXT)); \ \ _temp = force_operand (plus_constant ((TRAMP), 12), NULL_RTX); \ _temp = expand_binop (DImode, sub_optab, (FNADDR), _temp, _temp, 1, \ OPTAB_WIDEN); \ _temp = expand_shift (RSHIFT_EXPR, Pmode, _temp, \ build_int_2 (2, 0), NULL_RTX, 1); \ _temp = expand_and (gen_lowpart (SImode, _temp), \ GEN_INT (0x3fff), 0); \ \ _addr = memory_address (SImode, plus_constant ((TRAMP), 8)); \ _temp1 = force_reg (SImode, gen_rtx (MEM, SImode, _addr)); \ _temp1 = expand_and (_temp1, GEN_INT (0xffffc000), NULL_RTX); \ _temp1 = expand_binop (SImode, ior_optab, _temp1, _temp, _temp1, 1, \ OPTAB_WIDEN); \ \ emit_move_insn (gen_rtx (MEM, SImode, _addr), _temp1); \ \ emit_library_call (gen_rtx (SYMBOL_REF, Pmode, \ "__enable_execute_stack"), \ 0, VOIDmode, 1,_addr, Pmode); \ \ emit_insn (gen_rtx (UNSPEC_VOLATILE, VOIDmode, \ gen_rtvec (1, const0_rtx), 0)); \}/* Attempt to turn on access permissions for the stack. */#define TRANSFER_FROM_TRAMPOLINE \ \void \__enable_execute_stack (addr) \ void *addr; \{ \ long size = getpagesize (); \ long mask = ~(size-1); \ char *page = (char *) (((long) addr) & mask); \ char *end = (char *) ((((long) (addr + TRAMPOLINE_SIZE)) & mask) + size); \ \ /* 7 is PROT_READ | PROT_WRITE | PROT_EXEC */ \ if (mprotect (page, end - page, 7) < 0) \ perror ("mprotect of trampoline code"); \}/* A C expression whose value is RTL representing the value of the return address for the frame COUNT steps up from the current frame. FRAMEADDR is the frame pointer of the COUNT frame, or the frame pointer of the COUNT-1 frame if RETURN_ADDR_IN_PREVIOUS_FRAME} is defined. This definition for Alpha is broken, but is put in at the request of Mike Stump. */#define RETURN_ADDR_RTX(COUNT, FRAME) \((COUNT == 0 && alpha_sa_size () == 0 && 0 /* not right. */) \ ? gen_rtx (REG, Pmode, 26) \ : gen_rtx (MEM, Pmode, \ memory_address (Pmode, FRAME)))/* Addressing modes, and classification of registers for them. *//* #define HAVE_POST_INCREMENT *//* #define HAVE_POST_DECREMENT *//* #define HAVE_PRE_DECREMENT *//* #define HAVE_PRE_INCREMENT *//* 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. */#define REGNO_OK_FOR_INDEX_P(REGNO) 0#define REGNO_OK_FOR_BASE_P(REGNO) \((REGNO) < 32 || (unsigned) reg_renumber[REGNO] < 32 \ || (REGNO) == 63 || reg_renumber[REGNO] == 63)/* Maximum number of registers that can appear in a valid memory address. */#define MAX_REGS_PER_ADDRESS 1/* Recognize any constant value that is a valid address. For the Alpha, there are only constants none since we want to use LDA to load any symbolic addresses into registers. */#define CONSTANT_ADDRESS_P(X) \ (GET_CODE (X) == CONST_INT \ && (unsigned HOST_WIDE_INT) (INTVAL (X) + 0x8000) < 0x10000)/* Include all constant integers and constant doubles, but not floating-point, except for floating-point zero. */#define LEGITIMATE_CONSTANT_P(X) \ (GET_MODE_CLASS (GET_MODE (X)) != MODE_FLOAT \ || (X) == CONST0_RTX (GET_MODE (X)))/* 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) 0/* 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) < 32 || REGNO (X) == 63 || REGNO (X) >= FIRST_PSEUDO_REGISTER)#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. For Alpha, we have either a constant address or the sum of a register and a constant address, or just a register. For DImode, any of those forms can be surrounded with an AND that clear the low-order three bits; this is an "unaligned" access. First define the basic valid address. */#define GO_IF_LEGITIMATE_SIMPLE_ADDRESS(MODE, X, ADDR) \{ if (REG_P (X) && REG_OK_FOR_BASE_P (X)) \ goto ADDR; \ if (CONSTANT_ADDRESS_P (X)) \ goto ADDR; \ if (GET_CODE (X) == PLUS \ && REG_P (XEXP (X, 0)) \ && REG_OK_FOR_BASE_P (XEXP (X, 0)) \ && CONSTANT_ADDRESS_P (XEXP (X, 1))) \ goto ADDR; \}/* Now accept the simple address, or, for DImode only, an AND of a simple address that turns off the low three bits. */#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \{ GO_IF_LEGITIMATE_SIMPLE_ADDRESS (MODE, X, ADDR); \ if ((MODE) == DImode \ && GET_CODE (X) == AND \ && GET_CODE (XEXP (X, 1)) == CONST_INT \ && INTVAL (XEXP (X, 1)) == -8) \ GO_IF_LEGITIMATE_SIMPLE_ADDRESS (MODE, XEXP (X, 0), 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 Alpha, there are three cases we handle: (1) If the address is (plus reg const_int) and the CONST_INT is not a valid offset, compute the high part of the constant and add it to the register. Then our address is (plus temp low-part-const). (2) If the address is (const (plus FOO const_int)), find the low-order part of the CONST_INT. Then load FOO plus any high-order part of the CONST_INT into a register. Our address is (plus reg low-part-const). This is done to reduce the number of GOT entries. (3) If we have a (plus reg const), emit the load as in (2), then add the two registers, and finally generate (plus reg low-part-const) as our address. */#define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) \{ if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 0)) == REG \ && GET_CODE (XEXP (X, 1)) == CONST_INT \ && ! CONSTANT_ADDRESS_P (XEXP (X, 1))) \ { \ HOST_WIDE_INT val = INTVAL (XEXP (X, 1)); \ HOST_WIDE_INT lowpart = (val & 0xffff) - 2 * (val & 0x8000); \ HOST_WIDE_INT highpart = val - lowpart; \ rtx high = GEN_INT (highpart); \ rtx temp = expand_binop (Pmode, add_optab, XEXP (x, 0), \ high, NULL_RTX, 1, OPTAB_LIB_WIDEN); \ \ (X) = plus_constant (temp, lowpart); \ goto WIN; \ } \ else if (GET_CODE (X) == CONST \ && GET_CODE (XEXP (X, 0)) == PLUS \ && GET_CODE (XEXP (XEXP (X, 0), 1)) == CONST_INT) \ { \ HOST_WIDE_INT val = INTVAL (XEXP (XEXP (X, 0), 1)); \ HOST_WIDE_INT lowpart = (val & 0xffff) - 2 * (val & 0x8000); \ HOST_WIDE_INT highpart = val - lowpart; \ rtx high = XEXP (XEXP (X, 0), 0); \ \ if (highpart) \ high = plus_constant (high, highpart); \ \ (X) = plus_constant (force_reg (Pmode, high), lowpart); \ goto WIN; \ } \ else if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 0)) == REG \ && GET_CODE (XEXP (X, 1)) == CONST \ && GET_CODE (XEXP (XEXP (X, 1), 0)) == PLUS \ && GET_CODE (XEXP (XEXP (XEXP (X, 1), 0), 1)) == CONST_INT) \ { \ HOST_WIDE_INT val = INTVAL (XEXP (XEXP (XEXP (X, 1), 0), 1)); \ HOST_WIDE_INT lowpart = (val & 0xffff) - 2 * (val & 0x8000); \ HOST_WIDE_INT highpart = val - lowpart; \ rtx high = XEXP (XEXP (XEXP (X, 1), 0), 0); \ \ if (highpart) \ high = plus_constant (high, highpart); \ \ high = expand_binop (Pmode, add_optab, XEXP (X, 0), \ force_reg (Pmode, high), \ high, 1, OPTAB_LIB_WIDEN); \ (X) = plus_constant (high, lowpart); \ 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 Alpha this is true only for the unaligned modes. We can simplify this test since we know that the address must be valid. */#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) \{ if (GET_CODE (ADDR) == AND) goto LABEL; }/* Compute the cost of an address. For the Alpha, all valid addresses are the same cost. */#define ADDRESS_COST(X) 0/* Define this if some processing needs to be done immediately before emitting code for an insn. *//* #define FINAL_PRESCAN_INSN(INSN,OPERANDS,NOPERANDS) *//* Specify the machine mode that this machine uses for the index in the tablejump instruction. */#define CASE_VECTOR_MODE SImode/* 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. On the Alpha, the table is really GP-relative, not relative to the PC of the table, but we pretend that it is PC-relative; this should be OK, but we should try to find some better way sometime. */#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/* This flag, if defined, says the same insns that convert to a signed fixnum also convert validly to an unsigned one. We actually lie a bit here as overflow conditions are different. But they aren't being checked anyway. */#define FIXUNS_TRUNC_LIKE_FIX_TRUNC/* Max number of bytes we can move to or from memory in one reasonably fast instruction. */#define MOVE_MAX 8/* Largest number of bytes of an object that can be placed in a register. On the Alpha we have plenty of registers, so use TImode. */#define MAX_FIXED_MODE_SIZE GET_MODE_BITSIZE (TImode)/* Nonzero if access to memory by bytes is no faster than for words. Also non-zero if doing byte operations (specifically shifts) in registers is undesirable. On the Alpha, we want to not use the byte operation and instead use masking operations to access fields; these will save instructions. */#define SLOW_BYTE_ACCESS 1/* 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) SIGN_EXTEND/* Define if loading short immediate values into registers sign extends. */#define SHORT_IMMEDIATES_SIGN_EXTEND/* 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/* Define the value returned by a floating-point comparison instruction. */#define FLOAT_STORE_FLAG_VALUE 0.5/* Canonicalize a comparison from one we don't have to one we do have. */#define CANONICALIZE_COMPARISON(CODE,OP0,OP1) \ do { \ if (((CODE) == GE || (CODE) == GT || (CODE) == GEU || (CODE) == GTU) \ && (GET_CODE (OP1) == REG || (OP1) == const0_rtx)) \ { \ rtx tem = (OP0); \ (OP0) = (OP1); \ (OP1) = tem; \ (CODE) = swap_condition (CODE); \
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -