📄 rs6000.h
字号:
/* Determine where to put an argument to a function. Value is zero to push the argument on the stack, or a hard register in which to store the argument. MODE is the argument's machine mode. TYPE is the data type of the argument (as a tree). This is null for libcalls where that information may not be available. CUM is a variable of type CUMULATIVE_ARGS which gives info about the preceding args and about the function being called. NAMED is nonzero if this argument is a named parameter (otherwise it is an extra parameter matching an ellipsis). On RS/6000 the first eight words of non-FP are normally in registers and the rest are pushed. The first 13 FP args are in registers. If this is floating-point and no prototype is specified, we use both an FP and integer register (or possibly FP reg and stack). Library functions (when TYPE is zero) always have the proper types for args, so we can pass the FP value just in one register. emit_library_function doesn't support EXPR_LIST anyway. */#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \ (! (NAMED) ? 0 \ : ((TYPE) != 0 && TREE_CODE (TYPE_SIZE (TYPE)) != INTEGER_CST) ? 0 \ : USE_FP_FOR_ARG_P (CUM, MODE, TYPE) \ ? ((CUM).nargs_prototype > 0 || (TYPE) == 0 \ ? gen_rtx (REG, MODE, (CUM).fregno) \ : ((CUM).words < 8 \ ? gen_rtx (EXPR_LIST, VOIDmode, \ gen_rtx (REG, (MODE), 3 + (CUM).words), \ gen_rtx (REG, (MODE), (CUM).fregno)) \ : gen_rtx (EXPR_LIST, VOIDmode, 0, \ gen_rtx (REG, (MODE), (CUM).fregno)))) \ : (CUM).words < 8 ? gen_rtx(REG, (MODE), 3 + (CUM).words) : 0)/* For an arg passed partly in registers and partly in memory, this is the number of registers used. For args passed entirely in registers or entirely in memory, zero. */#define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \ (! (NAMED) ? 0 \ : USE_FP_FOR_ARG_P (CUM, MODE, TYPE) && (CUM).nargs_prototype >= 0 ? 0 \ : (((CUM).words < 8 \ && 8 < ((CUM).words + RS6000_ARG_SIZE (MODE, TYPE, NAMED))) \ ? 8 - (CUM).words : 0))/* Perform any needed actions needed for a function that is receiving a variable number of arguments. CUM is as above. MODE and TYPE are the mode and type of the current parameter. PRETEND_SIZE is a variable that should be set to the amount of stack that must be pushed by the prolog to pretend that our caller pushed it. Normally, this macro will push all remaining incoming registers on the stack and set PRETEND_SIZE to the length of the registers pushed. */#define SETUP_INCOMING_VARARGS(CUM,MODE,TYPE,PRETEND_SIZE,NO_RTL) \{ if ((CUM).words < 8) \ { \ int first_reg_offset = (CUM).words; \ \ if (MUST_PASS_IN_STACK (MODE, TYPE)) \ first_reg_offset += RS6000_ARG_SIZE (TYPE_MODE (TYPE), TYPE, 1); \ \ if (first_reg_offset > 8) \ first_reg_offset = 8; \ \ if (! (NO_RTL) && first_reg_offset != 8) \ move_block_from_reg \ (3 + first_reg_offset, \ gen_rtx (MEM, BLKmode, \ plus_constant (virtual_incoming_args_rtx, \ first_reg_offset * 4)), \ 8 - first_reg_offset); \ PRETEND_SIZE = (8 - first_reg_offset) * UNITS_PER_WORD; \ } \}/* This macro generates the assembly code for function entry. FILE is a stdio stream to output the code to. SIZE is an int: how many units of temporary storage to allocate. Refer to the array `regs_ever_live' to determine which registers to save; `regs_ever_live[I]' is nonzero if register number I is ever used in the function. This macro is responsible for knowing which registers should not be saved even if used. */#define FUNCTION_PROLOGUE(FILE, SIZE) output_prolog (FILE, SIZE)/* Output assembler code to FILE to increment profiler label # LABELNO for profiling a function entry. */#define FUNCTION_PROFILER(FILE, LABELNO) \ output_function_profiler ((FILE), (LABELNO));/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function, the stack pointer does not matter. No definition is equivalent to always zero. On the RS/6000, this is non-zero because we can restore the stack from its backpointer, which we maintain. */#define EXIT_IGNORE_STACK 1/* 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. On the RS/6000, this is not code at all, but merely a data area, since that is the way all functions are called. The first word is the address of the function, the second word is the TOC pointer (r2), and the third word is the static chain value. */#define TRAMPOLINE_TEMPLATE(FILE) { fprintf (FILE, "\t.long 0, 0, 0\n"); }/* Length in units of the trampoline for entering a nested function. */#define TRAMPOLINE_SIZE 12/* 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(ADDR, FNADDR, CXT) \{ \ emit_move_insn (gen_rtx (MEM, SImode, \ memory_address (SImode, (ADDR))), \ gen_rtx (MEM, SImode, \ memory_address (SImode, (FNADDR)))); \ emit_move_insn (gen_rtx (MEM, SImode, \ memory_address (SImode, \ plus_constant ((ADDR), 4))), \ gen_rtx (MEM, SImode, \ memory_address (SImode, \ plus_constant ((FNADDR), 4)))); \ emit_move_insn (gen_rtx (MEM, SImode, \ memory_address (SImode, \ plus_constant ((ADDR), 8))), \ force_reg (SImode, (CXT))); \}/* Definitions for register eliminations. We have two registers that can be eliminated on the RS/6000. First, the frame pointer register can often be eliminated in favor of the stack pointer register. Secondly, the argument pointer register can always be eliminated; it is replaced with either the stack or frame pointer. *//* 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. */#define ELIMINABLE_REGS \{{ FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}, \ { ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \ { ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM} }/* Given FROM and TO register numbers, say whether this elimination is allowed. Frame pointer elimination is automatically handled. For the RS/6000, if frame pointer elimination is being done, we would like to convert ap into fp, not sp. */#define CAN_ELIMINATE(FROM, TO) \ ((FROM) == ARG_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM \ ? ! frame_pointer_needed \ : 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 total_stack_size = (rs6000_sa_size () + get_frame_size () \ + current_function_outgoing_args_size); \ \ total_stack_size = (total_stack_size + 7) & ~7; \ \ if ((FROM) == FRAME_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM) \ { \ if (rs6000_pushes_stack ()) \ (OFFSET) = 0; \ else \ (OFFSET) = - total_stack_size; \ } \ else if ((FROM) == ARG_POINTER_REGNUM && (TO) == FRAME_POINTER_REGNUM) \ (OFFSET) = total_stack_size; \ else if ((FROM) == ARG_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM) \ { \ if (rs6000_pushes_stack ()) \ (OFFSET) = total_stack_size; \ else \ (OFFSET) = 0; \ } \ else \ abort (); \}/* 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) \((REGNO) < FIRST_PSEUDO_REGISTER \ ? (REGNO) <= 31 || (REGNO) == 67 \ : (reg_renumber[REGNO] >= 0 \ && (reg_renumber[REGNO] <= 31 || reg_renumber[REGNO] == 67)))#define REGNO_OK_FOR_BASE_P(REGNO) \((REGNO) < FIRST_PSEUDO_REGISTER \ ? ((REGNO) > 0 && (REGNO) <= 31) || (REGNO) == 67 \ : (reg_renumber[REGNO] > 0 \ && (reg_renumber[REGNO] <= 31 || reg_renumber[REGNO] == 67)))/* Maximum number of registers that can appear in a valid memory address. */#define MAX_REGS_PER_ADDRESS 2/* Recognize any constant value that is a valid address. */#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. On the RS/6000, all integer constants are acceptable, most won't be valid for particular insns, though. Only easy FP constants are acceptable. */#define LEGITIMATE_CONSTANT_P(X) \ (GET_CODE (X) != CONST_DOUBLE || GET_MODE (X) == VOIDmode \ || easy_fp_constant (X, 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) \ (REGNO (X) <= 31 || REGNO (X) == 67 || REGNO (X) >= FIRST_PSEUDO_REGISTER)/* 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) > 0 && REG_OK_FOR_INDEX_P (X))#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. On the RS/6000, there are four valid address: a SYMBOL_REF that refers to a constant pool entry of an address (or the sum of it plus a constant), a short (16-bit signed) constant plus a register, the sum of two registers, or a register indirect, possibly with an auto-increment. For DFmode and DImode with an constant plus register, we must ensure that both words are addressable. */#define LEGITIMATE_CONSTANT_POOL_BASE_P(X) \ (GET_CODE (X) == SYMBOL_REF && CONSTANT_POOL_ADDRESS_P (X) \ && ASM_OUTPUT_SPECIAL_POOL_ENTRY_P (get_pool_constant (X)))#define LEGITIMATE_CONSTANT_POOL_ADDRESS_P(X) \ (LEGITIMATE_CONSTANT_POOL_BASE_P (X) \ || (GET_CODE (X) == CONST && GET_CODE (XEXP (X, 0)) == PLUS \ && GET_CODE (XEXP (XEXP (X, 0), 1)) == CONST_INT \ && LEGITIMATE_CONSTANT_POOL_BASE_P (XEXP (XEXP (X, 0), 0))))#define LEGITIMATE_ADDRESS_INTEGER_P(X,OFFSET) \ (GET_CODE (X) == CONST_INT \ && (unsigned) (INTVAL (X) + (OFFSET) + 0x8000) < 0x10000)#define LEGITIMATE_OFFSET_ADDRESS_P(MODE,X) \ (GET_CODE (X) == PLUS \ && GET_CODE (XEXP (X, 0)) == REG \ && REG_OK_FOR_BASE_P (XEXP (X, 0)) \ && LEGITIMATE_ADDRESS_INTEGER_P (XEXP (X, 1), 0) \ && (((MODE) != DFmode && (MODE) != DImode) \ || LEGITIMATE_ADDRESS_INTEGER_P (XEXP (X, 1), 4)))#define LEGITIMATE_INDEXED_ADDRESS_P(X) \ (GET_CODE (X) == PLUS \ && GET_CODE (XEXP (X, 0)) == REG \ && GET_CODE (XEXP (X, 1)) == REG \ && ((REG_OK_FOR_BASE_P (XEXP (X, 0)) \ && REG_OK_FOR_INDEX_P (XEXP (X, 1))) \ || (REG_OK_FOR_BASE_P (XEXP (X, 1)) \ && REG_OK_FOR_INDEX_P (XEXP (X, 0)))))#define LEGITIMATE_INDIRECT_ADDRESS_P(X) \ (GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X))#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \{ if (LEGITIMATE_INDIRECT_ADDRESS_P (X)) \ goto ADDR; \ if (GET_CODE (X) == PRE_INC \ && LEGITIMATE_INDIRECT_ADDRESS_P (XEXP (X, 0))) \ goto ADDR; \ if (GET_CODE (X) == PRE_DEC \ && LEGITIMATE_INDIRECT_ADDRESS_P (XEXP (X, 0))) \ goto ADDR; \ if (LEGITIMATE_CONSTANT_POOL_ADDRESS_P (X)) \ goto ADDR; \ if (LEGITIMATE_OFFSET_ADDRESS_P (MODE, X)) \ goto ADDR; \
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -