📄 m32r.h
字号:
M32R_STACK_ALIGN (current_function_outgoing_args_size)/* Offset from the stack pointer register to the first location at which outgoing arguments are placed. */#define STACK_POINTER_OFFSET 0/* Offset of first parameter from the argument pointer register value. */#define FIRST_PARM_OFFSET(FNDECL) 0/* A C expression whose value is RTL representing the address in a stack frame where the pointer to the caller's frame is stored. Assume that FRAMEADDR is an RTL expression for the address of the stack frame itself. If you don't define this macro, the default is to return the value of FRAMEADDR--that is, the stack frame address is also the address of the stack word that points to the previous frame. *//*define DYNAMIC_CHAIN_ADDRESS (FRAMEADDR)*//* A C expression whose value is RTL representing the value of the return address for the frame COUNT steps up from the current frame. FRAMEADDR is the frame pointer of the COUNT frame, or the frame pointer of the COUNT - 1 frame if `RETURN_ADDR_IN_PREVIOUS_FRAME' is defined. *//* The current return address is in r14. */#if 0 /* The default value should work. */#define RETURN_ADDR_RTX(COUNT, FRAME) \(((COUNT) == -1) \ ? gen_rtx (REG, Pmode, 14) \ : copy_to_reg (gen_rtx (MEM, Pmode, \ memory_address (Pmode, plus_constant ((FRAME), UNITS_PER_WORD)))))#endif/* Register to use for pushing function arguments. */#define STACK_POINTER_REGNUM 15/* Base register for access to local variables of the function. */#define FRAME_POINTER_REGNUM 13/* Base register for access to arguments of the function. */#define ARG_POINTER_REGNUM 16/* The register number of the return address pointer register, which is used to access the current function's return address from the stack. On some machines, the return address is not at a fixed offset from the frame pointer or stack pointer or argument pointer. This register can be defined to point to the return address on the stack, and then be converted by `ELIMINABLE_REGS' into either the frame pointer or stack pointer. Do not define this macro unless there is no other way to get the return address from the stack. *//* ??? revisit *//* #define RETURN_ADDRESS_POINTER_REGNUM *//* Register in which static-chain is passed to a function. This must not be a register used by the prologue. */#define STATIC_CHAIN_REGNUM 7/* These aren't official macros. */#define PROLOGUE_TMP_REGNUM 4#define RETURN_ADDR_REGNUM 14/* #define GP_REGNUM 12 */#define CARRY_REGNUM 17#define M32R_MAX_INT_REGS 16 #define GPR_P(REGNO) ((unsigned) (REGNO) < M32R_MAX_INT_REGS)/* Eliminating the frame and arg pointers. *//* A C expression which is nonzero if a function must have and use a frame pointer. This expression is evaluated in the reload pass. If its value is nonzero the function will have a frame pointer. */#define FRAME_POINTER_REQUIRED \(current_function_calls_alloca)#if 0/* C statement to store the difference between the frame pointer and the stack pointer values immediately after the function prologue. If `ELIMINABLE_REGS' is defined, this macro will be not be used and need not be defined. */#define INITIAL_FRAME_POINTER_OFFSET(VAR) \((VAR) = m32r_compute_frame_size (get_frame_size ()))#endif/* If defined, this macro specifies a table of register pairs used to eliminate unneeded registers that point into the stack frame. If it is not defined, the only elimination attempted by the compiler is to replace references to the frame pointer with references to the stack pointer. Note that the elimination of the argument pointer with the stack pointer is specified first since that is the preferred elimination. */#define ELIMINABLE_REGS \{{ FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM }, \ { ARG_POINTER_REGNUM, STACK_POINTER_REGNUM }, \ { ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM }} \/* A C expression that returns non-zero if the compiler is allowed to try to replace register number FROM-REG with register number TO-REG. This macro need only be defined if `ELIMINABLE_REGS' is defined, and will usually be the constant 1, since most of the cases preventing register elimination are things that the compiler already knows about. */#define CAN_ELIMINATE(FROM, TO) \((FROM) == ARG_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM \ ? ! frame_pointer_needed \ : 1)/* This macro is similar to `INITIAL_FRAME_POINTER_OFFSET'. It specifies the initial difference between the specified pair of registers. This macro must be defined if `ELIMINABLE_REGS' is defined. */#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \{ \ int size = m32r_compute_frame_size (get_frame_size ()); \ \ if ((FROM) == FRAME_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM) \ (OFFSET) = 0; \ else if ((FROM) == ARG_POINTER_REGNUM && (TO) == FRAME_POINTER_REGNUM) \ (OFFSET) = size - current_function_pretend_args_size; \ else if ((FROM) == ARG_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM) \ (OFFSET) = size - current_function_pretend_args_size; \ else \ abort (); \}/* Function argument passing. *//* When a prototype says `char' or `short', really pass an `int'. */#define PROMOTE_PROTOTYPES/* If defined, the maximum amount of space required for outgoing arguments will be computed and placed into the variable `current_function_outgoing_args_size'. No space will be pushed onto the stack for each call; instead, the function prologue should increase the stack frame size by this amount. */#define ACCUMULATE_OUTGOING_ARGS/* Define this macro if functions should assume that stack space has been allocated for arguments even when their values are passed in registers. The value of this macro is the size, in bytes, of the area reserved for arguments passed in registers for the function represented by FNDECL. This space can be allocated by the caller, or be a part of the machine-dependent stack frame: `OUTGOING_REG_PARM_STACK_SPACE' says which. */#if 0#define REG_PARM_STACK_SPACE(FNDECL) \(M32R_MAX_PARM_REGS * UNITS_PER_WORD)#endif/* 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(DECL, FUNTYPE, SIZE) 0/* Nonzero if we do not know how to pass TYPE solely in registers. */#define MUST_PASS_IN_STACK(MODE,TYPE) \ ((TYPE) != 0 \ && (TREE_CODE (TYPE_SIZE (TYPE)) != INTEGER_CST \ || TREE_ADDRESSABLE (TYPE)))/* 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. */#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)/* The number of registers used for parameter passing. Local to this file. */#define M32R_MAX_PARM_REGS 4/* 1 if N is a possible register number for function argument passing. */#define FUNCTION_ARG_REGNO_P(N) \((unsigned) (N) < M32R_MAX_PARM_REGS)/* The ROUND_ADVANCE* macros are local to this file. *//* Round SIZE up to a word boundary. */#define ROUND_ADVANCE(SIZE) \(((SIZE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)/* Round arg MODE/TYPE up to the next word boundary. */#define ROUND_ADVANCE_ARG(MODE, TYPE) \((MODE) == BLKmode \ ? ROUND_ADVANCE (int_size_in_bytes (TYPE)) \ : ROUND_ADVANCE (GET_MODE_SIZE (MODE)))/* Round CUM up to the necessary point for argument MODE/TYPE. */#if 0#define ROUND_ADVANCE_CUM(CUM, MODE, TYPE) \((((MODE) == BLKmode ? TYPE_ALIGN (TYPE) : GET_MODE_BITSIZE (MODE)) \ > BITS_PER_WORD) \ ? ((CUM) + 1 & ~1) \ : (CUM))#else#define ROUND_ADVANCE_CUM(CUM, MODE, TYPE) (CUM)#endif/* Return boolean indicating arg of type TYPE and mode MODE will be passed in a reg. This includes arguments that have to be passed by reference as the pointer to them is passed in a reg if one is available (and that is what we're given). This macro is only used in this file. */#define PASS_IN_REG_P(CUM, MODE, TYPE, NAMED) \(ROUND_ADVANCE_CUM ((CUM), (MODE), (TYPE)) < M32R_MAX_PARM_REGS)/* 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 the M32R the first M32R_MAX_PARM_REGS args are normally in registers and the rest are pushed. */#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \(PASS_IN_REG_P ((CUM), (MODE), (TYPE), (NAMED)) \ ? gen_rtx (REG, (MODE), ROUND_ADVANCE_CUM ((CUM), (MODE), (TYPE))) \ : 0)/* ??? Quick hack to try to get varargs working the normal way. */#define FUNCTION_INCOMING_ARG(CUM, MODE, TYPE, NAMED) \(((! current_function_varargs || (NAMED)) \ && PASS_IN_REG_P ((CUM), (MODE), (TYPE), (NAMED))) \ ? gen_rtx (REG, (MODE), ROUND_ADVANCE_CUM ((CUM), (MODE), (TYPE))) \ : 0)/* A C expression for the number of words, at the beginning of an argument, must be put in registers. The value must be zero for arguments that are passed entirely in registers or that are entirely pushed on the stack. On some machines, certain arguments must be passed partially in registers and partially in memory. On these machines, typically the first @var{n} words of arguments are passed in registers, and the rest on the stack. If a multi-word argument (a @code{double} or a structure) crosses that boundary, its first few words must be passed in registers and the rest must be pushed. This macro tells the compiler when this occurs, and how many of the words should go in registers. */#define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \ function_arg_partial_nregs (&CUM, (int)MODE, TYPE, NAMED)/* A C expression that indicates when an argument must be passed by reference. If nonzero for an argument, a copy of that argument is made in memory and a pointer to the argument is passed instead of the argument itself. The pointer is passed in whatever way is appropriate for passing a pointer to that type. *//* All arguments greater than 8 bytes are passed this way. */#define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED) \((TYPE) && int_size_in_bytes (TYPE) > 8)/* 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) = (ROUND_ADVANCE_CUM ((CUM), (MODE), (TYPE)) \ + ROUND_ADVANCE_ARG ((MODE), (TYPE))))/* If defined, a C expression that gives the alignment boundary, in bits, of an argument with the specified mode and type. If it is not defined, PARM_BOUNDARY is used for all arguments. */#if 0/* We assume PARM_BOUNDARY == UNITS_PER_WORD here. */#define FUNCTION_ARG_BOUNDARY(MODE, TYPE) \(((TYPE) ? TYPE_ALIGN (TYPE) : GET_MODE_BITSIZE (MODE)) <= PARM_BOUNDARY \ ? PARM_BOUNDARY \ : 2 * PARM_BOUNDARY)#endif#if 0/* If defined, is a C expression that produces the machine-specific code for a call to `__builtin_saveregs'. This code will be moved to the very beginning of the function, before any parameter access are made. The return value of this function should be an RTX that contains the value to use as the return of `__builtin_saveregs'. The argument ARGS is a `tree_list' containing the arguments that were passed to `__builtin_saveregs'. If this macro is not defined, the compiler will output an ordinary call to the library function `__builtin_saveregs'. */extern struct rtx *m32r_expand_builtin_savergs ();#define EXPAND_BUILTIN_SAVEREGS(ARGS) m32r_expand_builtin_saveregs (ARGS)#endif/* This macro offers an alternative to using `__builtin_saveregs' and defining the macro `EXPAND_BUILTIN_SAVEREGS'. Use it to store the anonymous register arguments into the stack so that all the arguments appear to have been passed consecutively on the stack. Once this is done, you can use the standard implementation of varargs that works for machines that pass all their arguments on the stack. The argument ARGS_SO_FAR is the `CUMULATIVE_ARGS' data structure, containing the values that obtain after processing of the named arguments. The arguments MODE and TYPE describe the last named argument--its machine mode and its data type as a tree node. The macro implementation should do two things: first, push onto the stack all the argument registers *not* used for the named arguments, and second, store the size of the data thus pushed into the `int'-valued variable whose name is supplied as the argument PRETEND_SIZE. The value that you store here will serve as additional offset for setting up the stack frame. If the argument NO_RTL is nonzero, it means that the arguments of the function are being analyzed for the second time. This happens for an inline function, which is not actually compiled until the end of the source file. The macro `SETUP_INCOMING_VARARGS' should not generate any instructions in this case. */#define SETUP_INCOMING_VARARGS(ARGS_SO_FAR, MODE, TYPE, PRETEND_SIZE, NO_RTL) \m32r_setup_incoming_varargs (&ARGS_SO_FAR, MODE, TYPE, &PRETEND_SIZE, NO_RTL)/* Function results. */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -