📄 mn10300.h
字号:
/* 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 0/* Offset of first parameter from the argument pointer register value. *//* Is equal to the size of the saved fp + pc, even if an fp isn't saved since the value is used before we know. */#define FIRST_PARM_OFFSET(FNDECL) 4/* Specify the registers used for certain standard purposes. The values of these macros are register numbers. *//* Register to use for pushing function arguments. */#define STACK_POINTER_REGNUM 9/* Base register for access to local variables of the function. */#define FRAME_POINTER_REGNUM 7/* Base register for access to arguments of the function. This is a fake register and will be eliminated into either the frame pointer or stack pointer. */#define ARG_POINTER_REGNUM 8/* Register in which static-chain is passed to a function. */#define STATIC_CHAIN_REGNUM 5#define ELIMINABLE_REGS \{{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \ { ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \ { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}}#define CAN_ELIMINATE(FROM, TO) 1#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \ OFFSET = initial_offset (FROM, TO)/* We can debug without frame pointers on the mn10300, so eliminate them whenever possible. */#define FRAME_POINTER_REQUIRED 0#define CAN_DEBUG_WITHOUT_FP/* A guess for the MN10300. */#define PROMOTE_PROTOTYPES 1/* 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/* We use d0/d1 for passing parameters, so allocate 8 bytes of space for a register flushback area. */#define REG_PARM_STACK_SPACE(DECL) 8#define OUTGOING_REG_PARM_STACK_SPACE#define ACCUMULATE_OUTGOING_ARGS/* So we can allocate space for return pointers once for the function instead of around every call. */#define STACK_POINTER_OFFSET 4/* 1 if N is a possible register number for function argument passing. On the MN10300, no registers are used in this way. */#define FUNCTION_ARG_REGNO_P(N) ((N) <= 1)/* 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 the MN10300, this is a single integer, which is a number of bytes of arguments scanned so far. */#define CUMULATIVE_ARGS struct cum_argstruct cum_arg {int nbytes; };/* 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. On the MN10300, the offset starts at 0. */#define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) \ ((CUM).nbytes = 0)/* 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) \ ((CUM).nbytes += ((MODE) != BLKmode \ ? (GET_MODE_SIZE (MODE) + 3) & ~3 \ : (int_size_in_bytes (TYPE) + 3) & ~3))/* Define where to put the arguments 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 the MN10300 all args are pushed. */ extern struct rtx_def *function_arg ();#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \ function_arg (&CUM, MODE, TYPE, NAMED)#define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \ function_arg_partial_nregs (&CUM, MODE, TYPE, NAMED)#define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED) \ ((TYPE) && int_size_in_bytes (TYPE) > 8) #define FUNCTION_ARG_CALLEE_COPIES(CUM, MODE, TYPE, NAMED) \ ((TYPE) && int_size_in_bytes (TYPE) > 8)/* 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. */#define FUNCTION_VALUE(VALTYPE, FUNC) \ gen_rtx (REG, TYPE_MODE (VALTYPE), POINTER_TYPE_P (VALTYPE) ? 4 : 0)/* 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, 0)/* 1 if N is a possible register number for a function value. */#define FUNCTION_VALUE_REGNO_P(N) ((N) == 0 || (N) == 4)/* Return values > 8 bytes in length in memory. */#define DEFAULT_PCC_STRUCT_RETURN 0#define RETURN_IN_MEMORY(TYPE) \ (int_size_in_bytes (TYPE) > 8 || TYPE_MODE (TYPE) == BLKmode)/* Register in which address to store a structure value is passed to a function. On the MN10300 it's passed as the first parameter. */#define STRUCT_VALUE 0/* 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/* Output assembler code to FILE to increment profiler label # LABELNO for profiling a function entry. */#define FUNCTION_PROFILER(FILE, LABELNO) ;#define TRAMPOLINE_TEMPLATE(FILE) \ do { \ fprintf (FILE, "\tadd -4,sp\n"); \ fprintf (FILE, "\t.long 0x0004fffa\n"); \ fprintf (FILE, "\tmov (0,sp),a0\n"); \ fprintf (FILE, "\tadd 4,sp\n"); \ fprintf (FILE, "\tmov (13,a0),a1\n"); \ fprintf (FILE, "\tmov (17,a0),a0\n"); \ fprintf (FILE, "\tjmp (a0)\n"); \ fprintf (FILE, "\t.long 0\n"); \ fprintf (FILE, "\t.long 0\n"); \ } while (0)/* Length in units of the trampoline for entering a nested function. */#define TRAMPOLINE_SIZE 0x1b#define TRAMPOLINE_ALIGNMENT 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. */#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \{ \ emit_move_insn (gen_rtx (MEM, SImode, plus_constant ((TRAMP), 0x14)), \ (CXT)); \ emit_move_insn (gen_rtx (MEM, SImode, plus_constant ((TRAMP), 0x18)), \ (FNADDR)); \}/* A C expression whose value is RTL representing the value of the return address for the frame COUNT steps up from the current frame. On the mn10300, the return address is not at a constant location due to the frame layout. Luckily, it is at a constant offset from the argument pointer, so we define RETURN_ADDR_RTX to return a MEM using arg_pointer_rtx. Reload will replace arg_pointer_rtx with a reference to the stack/frame pointer + an appropriate offset. */#define RETURN_ADDR_RTX(COUNT, FRAME) \ ((COUNT == 0) \ ? gen_rtx (MEM, Pmode, arg_pointer_rtx) \ : (rtx) 0)/* Emit code for a call to builtin_saveregs. We must emit USE insns which reference the 2 integer arg registers. Ordinarily they are not call used registers, but they are for _builtin_saveregs, so we must make this explicit. */extern struct rtx_def *mn10300_builtin_saveregs ();#define EXPAND_BUILTIN_SAVEREGS(ARGLIST) mn10300_builtin_saveregs (ARGLIST)/* Addressing modes, and classification of registers for them. *//* 1 if X is an rtx for a constant that is a valid address. */#define CONSTANT_ADDRESS_P(X) CONSTANT_P (X)/* Extra constraints. */ #define OK_FOR_R(OP) \ (GET_CODE (OP) == MEM \ && GET_MODE (OP) == QImode \ && (CONSTANT_ADDRESS_P (XEXP (OP, 0)) \ || (GET_CODE (XEXP (OP, 0)) == REG \ && REG_OK_FOR_BIT_BASE_P (XEXP (OP, 0)) \ && XEXP (OP, 0) != stack_pointer_rtx) \ || (GET_CODE (XEXP (OP, 0)) == PLUS \ && GET_CODE (XEXP (XEXP (OP, 0), 0)) == REG \ && REG_OK_FOR_BIT_BASE_P (XEXP (XEXP (OP, 0), 0)) \ && XEXP (XEXP (OP, 0), 0) != stack_pointer_rtx \ && GET_CODE (XEXP (XEXP (OP, 0), 1)) == CONST_INT \ && INT_8_BITS (INTVAL (XEXP (XEXP (OP, 0), 1)))))) #define EXTRA_CONSTRAINT(OP, C) \ ((C) == 'R' ? OK_FOR_R (OP) : (C) == 'S' ? GET_CODE (OP) == SYMBOL_REF : 0)/* Maximum number of registers that can appear in a valid memory address. */#define MAX_REGS_PER_ADDRESS 2/* 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) >= 0 && REGNO(X) <= 3) || REGNO (X) >= 10)/* 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) >= 4 && REGNO(X) <= 9) || REGNO (X) >= 10)#define REG_OK_FOR_BIT_BASE_P(X) \ ((REGNO (X) >= 4 && REGNO(X) <= 9))#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))/* Nonzero if X is a hard reg that can be used as a base reg. */#define REG_OK_FOR_BIT_BASE_P(X) REGNO_OK_FOR_BIT_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. The other macros defined here are used only in GO_IF_LEGITIMATE_ADDRESS, except for CONSTANT_ADDRESS_P which is actually machine-independent. On the mn10300, the value in the address register must be in the same memory space/segment as the effective address. This is problematical for reload since it does not understand that base+index != index+base in a memory reference. Note it is still possible to use reg+reg addressing modes, it's just much more difficult. For a discussion of a possible workaround and solution, see the comments in pa.c before the function record_unscaled_index_insn_codes. *//* Accept either REG or SUBREG where a register is valid. */ #define RTX_OK_FOR_BASE_P(X) \ ((REG_P (X) && REG_OK_FOR_BASE_P (X)) \ || (GET_CODE (X) == SUBREG && REG_P (SUBREG_REG (X)) \ && REG_OK_FOR_BASE_P (SUBREG_REG (X))))#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \{ \ if (CONSTANT_ADDRESS_P (X)) \ goto ADDR; \ if (RTX_OK_FOR_BASE_P (X)) \ goto ADDR; \ if (GET_CODE (X) == PLUS) \ { \ rtx base = 0, index = 0; \ if (REG_P (XEXP (X, 0)) \ && REG_OK_FOR_BASE_P (XEXP (X, 0))) \ base = XEXP (X, 0), index = XEXP (X, 1); \ if (REG_P (XEXP (X, 1)) \ && REG_OK_FOR_BASE_P (XEXP (X, 1))) \ base = XEXP (X, 1), index = XEXP (X, 0); \ if (base != 0 && index != 0) \ { \ if (GET_CODE (index) == CONST_INT) \ 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.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -