📄 a29k.h
字号:
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); \ 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. */extern char *a29k_function_name;#define ASM_DECLARE_FUNCTION_NAME(FILE,NAME,DECL) \ a29k_function_name = NAME;/* 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. */#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))))/* 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. We use gr121 (tav) as a temporary. */#define TRAMPOLINE_TEMPLATE(FILE) \{ \ fprintf (FILE, "\tconst %s,0\n", reg_names[R_TAV]); \ fprintf (FILE, "\tconsth %s,0\n", reg_names[R_TAV]); \ fprintf (FILE, "\tconst %s,0\n", reg_names[R_SLP]); \ fprintf (FILE, "\tjmpi %s\n", reg_names[R_TAV]); \ fprintf (FILE, "\tconsth %s,0\n", reg_names[R_SLP]); \}/* Length in units of the trampoline for entering a nested function. */#define TRAMPOLINE_SIZE 20/* 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 do this on the 29k by writing the bytes of the addresses into the trampoline one byte at a time. */#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \{ \ INITIALIZE_TRAMPOLINE_VALUE (TRAMP, FNADDR, 0, 4); \ INITIALIZE_TRAMPOLINE_VALUE (TRAMP, CXT, 8, 16); \}/* Define a sub-macro to initialize one value into the trampoline. We specify the offsets of the CONST and CONSTH instructions, respectively and copy the value a byte at a time into these instructions. */#define INITIALIZE_TRAMPOLINE_VALUE(TRAMP, VALUE, CONST, CONSTH) \{ \ rtx _addr, _temp; \ rtx _val = force_reg (SImode, VALUE); \ \ _addr = memory_address (QImode, plus_constant (TRAMP, (CONST) + 3)); \ emit_move_insn (gen_rtx (MEM, QImode, _addr), \ gen_lowpart (QImode, _val)); \ \ _temp = expand_shift (RSHIFT_EXPR, SImode, _val, \ build_int_2 (8, 0), 0, 1); \ _addr = memory_address (QImode, plus_constant (TRAMP, (CONST) + 1)); \ emit_move_insn (gen_rtx (MEM, QImode, _addr), \ gen_lowpart (QImode, _temp)); \ \ _temp = expand_shift (RSHIFT_EXPR, SImode, _temp, \ build_int_2 (8, 0), _temp, 1); \ _addr = memory_address (QImode, plus_constant (TRAMP, (CONSTH) + 3)); \ emit_move_insn (gen_rtx (MEM, QImode, _addr), \ gen_lowpart (QImode, _temp)); \ \ _temp = expand_shift (RSHIFT_EXPR, SImode, _temp, \ build_int_2 (8, 0), _temp, 1); \ _addr = memory_address (QImode, plus_constant (TRAMP, (CONSTH) + 1)); \ emit_move_insn (gen_rtx (MEM, QImode, _addr), \ gen_lowpart (QImode, _temp)); \}/* 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) 1/* Given the value returned from get_frame_size, compute the actual size of the frame we will allocate. We include the pretend and outgoing arg sizes and round to a doubleword. */#define ACTUAL_FRAME_SIZE(SIZE) \ (((SIZE) + current_function_pretend_args_size \ + current_function_outgoing_args_size + 7) & ~7)/* Define the initial offset between the frame and stack pointer. */#define INITIAL_FRAME_POINTER_OFFSET(DEPTH) \ (DEPTH) = ACTUAL_FRAME_SIZE (get_frame_size ())/* 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. None are on the 29K. */#define CONSTANT_ADDRESS_P(X) 0/* Include all constant integers and constant doubles */#define LEGITIMATE_CONSTANT_P(X) 1/* 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) 1#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 29k, a legitimate address is a register and so is a constant of less than 256. */#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \{ if (REG_P (X) && REG_OK_FOR_BASE_P (X)) \ goto ADDR; \ if (GET_CODE (X) == CONST_INT \ && (unsigned) INTVAL (X) < 0x100) \ 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 29k, we need not do anything. However, if we don't, `memory_address' will try lots of things to get a valid address, most of which will result in dead code and extra pseudos. So we make the address valid here. This is easy: The only valid addresses are an offset from a register and we know the address isn't valid. So just call either `force_operand' or `force_reg' unless this is a (plus (reg ...) (const_int 0)). */#define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) \{ if (GET_CODE (X) == PLUS && XEXP (X, 1) == const0_rtx) \ X = XEXP (x, 0); \ if (GET_CODE (X) == MULT || GET_CODE (X) == PLUS) \ X = force_operand (X, 0); \ else \ X = force_reg (Pmode, X); \ 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 29k this is never true. */#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL)/* Compute the cost of an address. For the 29k, 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 0/* 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 of from memory in one reasonably fast instruction. For the 29k, we will define movti, so put this at 4 words. */#define MOVE_MAX 16/* Largest number of bytes of an object that can be placed in a register. On the 29k we have plenty of registers, so use TImode. */#define MAX_FIXED_MODE_SIZE GET_MODE_BITSIZE (TImode)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -