📄 alpha.h
字号:
/* This macro generates the assembly code for function exit, on machines that need it. If FUNCTION_EPILOGUE is not defined then individual return instructions are generated for each return statement. Args are same as for FUNCTION_PROLOGUE. The function epilogue should not depend on the current stack pointer! It should use the frame pointer only. This is mandatory because of alloca; we also take advantage of it to omit stack adjustments before returning. */#define FUNCTION_EPILOGUE(FILE, SIZE) output_epilog (FILE, SIZE)/* Output assembler code for a block containing the constant parts of a trampoline, leaving space for the variable parts. The trampoline should set the static chain pointer to value placed into the trampoline and should branch to the specified routine. Note that $27 has been set to the address of the trampoline, so we can use it for addressability of the two data items. Trampolines are always aligned to FUNCTION_BOUNDARY, which is 64 bits. */#define TRAMPOLINE_TEMPLATE(FILE) \{ \ fprintf (FILE, "\tldq $1,24($27)\n"); \ fprintf (FILE, "\tldq $27,16($27)\n"); \ fprintf (FILE, "\tjmp $31,($27),0\n"); \ fprintf (FILE, "\tnop\n"); \ fprintf (FILE, "\t.quad 0,0\n"); \}/* Section in which to place the trampoline. On Alpha, instructions may only be placed in a text segment. */#define TRAMPOLINE_SECTION text_section/* Length in units of the trampoline for entering a nested function. */#define TRAMPOLINE_SIZE 32/* 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. We assume here that a function will be called many more times than its address is taken (e.g., it might be passed to qsort), so we take the trouble to initialize the "hint" field in the JMP insn. Note that the hint field is PC (new) + 4 * bits 13:0. */#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \{ \ rtx _temp, _temp1, _addr; \ \ _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"); \}/* 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))/* 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) >= 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. We also allow a SYMBOL_REF that is the name of the current function as valid address. This is for CALL_INSNs. It cannot be used in any other context. 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. */extern char *current_function_name;#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); \ if ((MODE) == Pmode && GET_CODE (X) == SYMBOL_REF \ && ! strcmp (XSTR (X, 0), current_function_name)) \ goto 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, 0, 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, 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. *//* #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 normal loads of shorter-than-word items from memory clears the rest of the bits in the register. *//* #define BYTE_LOADS_ZERO_EXTEND *//* Define if normal loads of shorter-than-word items from memory sign-extends the rest of the bits in the register. */#define BYTE_LOADS_SIGN_EXTEND/* We aren't doing ANYTHING about debugging for now. *//* #define SDB_DEBUGGING_INFO *//* Do not break .stabs pseudos into continuations. */#define DBX_CONTIN_LENGTH 0/* Don't try to use the `x' type-cross-reference character in DBX data. Also has the consequence of putting each struct, union or enum into a separate .stabs, containing only cross-refs to the others. */#define DBX_NO_XREFS/* 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/* 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 DImode/* Mode of a function address in a call instruction (for indexing purposes). */#define FUNCTION_MODE Pmode/* Define this if addresses of constant functions shouldn't be put through pseudo regs where they can be cse'd. Desirable on machines where ordinary constants are expensive but a CALL with constant address is cheap.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -