📄 a29k.h
字号:
involving a general register is cheap, but moving between the other types (even within a class) is two insns. */#define REGISTER_MOVE_COST(CLASS1, CLASS2) \ ((CLASS1) == GENERAL_REGS || (CLASS2) == GENERAL_REGS ? 2 : 4)/* A C expressions returning the cost of moving data of MODE from a register to or from memory. It takes extra insns on the 29k to form addresses, so we want to make this higher. In addition, we need to keep it more expensive than the most expensive register-register copy. */#define MEMORY_MOVE_COST(MODE,CLASS,IN) 6/* A C statement (sans semicolon) to update the integer variable COST based on the relationship between INSN that is dependent on DEP_INSN through the dependence LINK. The default is to make no adjustment to COST. On the a29k, ignore the cost of anti- and output-dependencies. */#define ADJUST_COST(INSN,LINK,DEP_INSN,COST) \ if (REG_NOTE_KIND (LINK) != 0) \ (COST) = 0; /* Anti or output dependence. *//* Stack layout; function entry, exit and calling. *//* Define this if pushing a word on the stack makes the stack pointer a smaller address. */#define STACK_GROWS_DOWNWARD/* Define this if the nominal address of the stack frame is at the high-address end of the local variables; that is, each additional local variable allocated goes at a more negative offset in the frame. */#define FRAME_GROWS_DOWNWARD/* Offset within stack frame to start allocating local variables at. If FRAME_GROWS_DOWNWARD, this is the offset to the END of the first local allocated. Otherwise, it is the offset to the BEGINNING of the first local allocated. */#define STARTING_FRAME_OFFSET (- current_function_pretend_args_size)/* If we generate an insn to push BYTES bytes, this says how many the stack pointer really advances by. On 29k, don't define this because there are no push insns. *//* #define PUSH_ROUNDING(BYTES) *//* Define this if the maximum size of all the outgoing args is to be accumulated and pushed during the prologue. The amount can be found in the variable current_function_outgoing_args_size. */#define ACCUMULATE_OUTGOING_ARGS/* Offset of first parameter from the argument pointer register value. */#define FIRST_PARM_OFFSET(FNDECL) (- current_function_pretend_args_size)/* Define this if stack space is still allocated for a parameter passed in a register. *//* #define REG_PARM_STACK_SPACE *//* Value is the number of bytes of arguments automatically popped when returning from a subroutine call. FUNDECL is the declaration node of the function (as a tree), FUNTYPE is the data type of the function (as a tree), or for a library call it is an identifier node for the subroutine name. SIZE is the number of bytes of arguments passed on the stack. */#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0/* Define how to find the value returned by a function. VALTYPE is the data type of the value (as a tree). If the precise function being called is known, FUNC is its FUNCTION_DECL; otherwise, FUNC is 0. On 29k the value is found in gr96. */#define FUNCTION_VALUE(VALTYPE, FUNC) \ gen_rtx (REG, TYPE_MODE (VALTYPE), R_GR (96))/* Define how to find the value returned by a library function assuming the value has mode MODE. */#define LIBCALL_VALUE(MODE) gen_rtx (REG, MODE, R_GR (96))/* 1 if N is a possible register number for a function value as seen by the caller. On 29k, gr96-gr111 are used. */#define FUNCTION_VALUE_REGNO_P(N) ((N) == R_GR (96))/* 1 if N is a possible register number for function argument passing. On 29k, these are lr2-lr17. */#define FUNCTION_ARG_REGNO_P(N) ((N) <= R_LR (17) && (N) >= R_LR (2))/* Define a data type for recording info about an argument list during the scan of that argument list. This data type should hold all necessary information about the function itself and about the args processed so far, enough to enable macros such as FUNCTION_ARG to determine where the next arg should go. On 29k, this is a single integer, which is a number of words of arguments scanned so far. Thus 16 or more means all following args should go on the stack. */#define CUMULATIVE_ARGS int/* Initialize a variable CUM of type CUMULATIVE_ARGS for a call to a function whose data type is FNTYPE. For a library call, FNTYPE is 0. */#define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) (CUM) = 0/* Same, but called for incoming args. On the 29k, we use this to set all argument registers to fixed and set the last 16 local regs, less two, (lr110-lr125) to available. Some will later be changed to call-saved by FUNCTION_INCOMING_ARG. lr126,lr127 are always fixed, they are place holders for the caller's lr0,lr1. */#define INIT_CUMULATIVE_INCOMING_ARGS(CUM,FNTYPE,IGNORE) \{ int i; \ for (i = R_AR (0) - 2; i < R_AR (16); i++) \ { \ fixed_regs[i] = call_used_regs[i] = call_fixed_regs[i] = 1; \ SET_HARD_REG_BIT (fixed_reg_set, i); \ SET_HARD_REG_BIT (call_used_reg_set, i); \ SET_HARD_REG_BIT (call_fixed_reg_set, i); \ } \ for (i = R_LR (110); i < R_LR (126); i++) \ { \ fixed_regs[i] = call_used_regs[i] = call_fixed_regs[i] = 0; \ CLEAR_HARD_REG_BIT (fixed_reg_set, i); \ CLEAR_HARD_REG_BIT (call_used_reg_set, i); \ CLEAR_HARD_REG_BIT (call_fixed_reg_set, i); \ } \ (CUM) = 0; \ }/* Define intermediate macro to compute the size (in registers) of an argument for the 29k. */#define A29K_ARG_SIZE(MODE, TYPE, NAMED) \(! (NAMED) ? 0 \ : (MODE) != BLKmode \ ? (GET_MODE_SIZE (MODE) + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD \ : (int_size_in_bytes (TYPE) + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD)/* Update the data in CUM to advance over an argument of mode MODE and data type TYPE. (TYPE is null for libcalls where that information may not be available.) */#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \ if (MUST_PASS_IN_STACK (MODE, TYPE)) \ (CUM) = 16; \ else \ (CUM) += A29K_ARG_SIZE (MODE, TYPE, NAMED)/* 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 29k the first 16 words of args are normally in registers and the rest are pushed. */#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \((CUM) < 16 && (NAMED) && ! MUST_PASS_IN_STACK (MODE, TYPE) \ ? gen_rtx(REG, (MODE), R_LR (2) + (CUM)) : 0)/* Define where a function finds its arguments. This is different from FUNCTION_ARG because of register windows. On the 29k, we hack this to call a function that sets the used registers as non-fixed and not used by calls. */#define FUNCTION_INCOMING_ARG(CUM, MODE, TYPE, NAMED) \((CUM) < 16 && (NAMED) && ! MUST_PASS_IN_STACK (MODE, TYPE) \ ? gen_rtx (REG, MODE, \ incoming_reg (CUM, A29K_ARG_SIZE (MODE, TYPE, NAMED))) \ : 0)/* This indicates that an argument is to be passed with an invisible reference (i.e., a pointer to the object is passed). On the 29k, we do this if it must be passed on the stack. */#define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED) \ (MUST_PASS_IN_STACK (MODE, TYPE))/* Specify the padding direction of arguments. On the 29k, we must pad upwards in order to be able to pass args in registers. */#define FUNCTION_ARG_PADDING(MODE, TYPE) upward/* 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) \((CUM) < 16 && 16 < (CUM) + A29K_ARG_SIZE (MODE, TYPE, NAMED) && (NAMED) \ ? 16 - (CUM) : 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) < 16) \ { \ int first_reg_offset = (CUM); \ \ if (MUST_PASS_IN_STACK (MODE, TYPE)) \ first_reg_offset += A29K_ARG_SIZE (TYPE_MODE (TYPE), TYPE, 1); \ \ if (first_reg_offset > 16) \ first_reg_offset = 16; \ \ if (! (NO_RTL) && first_reg_offset != 16) \ move_block_from_reg \ (R_AR (0) + first_reg_offset, \ gen_rtx (MEM, BLKmode, virtual_incoming_args_rtx), \ 16 - first_reg_offset, (16 - first_reg_offset) * UNITS_PER_WORD); \ PRETEND_SIZE = (16 - first_reg_offset) * UNITS_PER_WORD; \ } \}/* Define the information needed to generate branch and scc insns. This is stored from the compare operation. Note that we can't use "rtx" here since it hasn't been defined! */extern struct rtx_def *a29k_compare_op0, *a29k_compare_op1;extern int a29k_compare_fp_p;/* This macro produces the initial definition of a function name. For the 29k, we need the prolog to contain one or two words prior to the declaration of the function name. So just store away the name and write it as part of the prolog. This also computes the register names, which can't be done until after register allocation, but must be done before final_start_function is called. */extern char *a29k_function_name;#define ASM_DECLARE_FUNCTION_NAME(FILE,NAME,DECL) \ a29k_function_name = NAME; \ a29k_compute_reg_names ();/* 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)/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function, the stack pointer does not matter. The value is tested only in functions that have frame pointers. No definition is equivalent to always zero. */#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)/* Define the number of delay slots needed for the function epilogue. On the 29k, we need a slot except when we have a register stack adjustment, have a memory stack adjustment, and have no frame pointer. */#define DELAY_SLOTS_FOR_EPILOGUE \ (! (needs_regstack_p () \ && (get_frame_size () + current_function_pretend_args_size \ + current_function_outgoing_args_size) != 0 \ && ! frame_pointer_needed))/* Define whether INSN can be placed in delay slot N for the epilogue. On the 29k, we must be able to place it in a delay slot, it must not use sp if the frame pointer cannot be eliminated, and it cannot use local regs if we need to push the register stack. If this is a SET with a memory as source, it might load from a stack slot, unless the address is constant. */#define ELIGIBLE_FOR_EPILOGUE_DELAY(INSN,N) \ (get_attr_in_delay_slot (INSN) == IN_DELAY_SLOT_YES \ && ! (frame_pointer_needed \ && reg_mentioned_p (stack_pointer_rtx, PATTERN (INSN))) \ && ! (needs_regstack_p () && uses_local_reg_p (PATTERN (INSN))) \ && (GET_CODE (PATTERN (INSN)) != SET \ || GET_CODE (SET_SRC (PATTERN (INSN))) != MEM \ || ! rtx_varies_p (XEXP (SET_SRC (PATTERN (INSN)), 0))))/* Output assembler code for a block containing the constant parts of a trampoline, leaving space for the variable parts.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -