Chapter 13: Target Description Macros and Functions 299
On some machines, the position of the argument pointer is not known until the compilation is completed. In such a case, a separate hard register must be used for the argument pointer. This register can be eliminated by replacing it with either the frame pointer or the argument pointer, depending on whether or not the frame pointer has been eliminated.
In this case, you might specify:
#define ELIMINABLE_REGS \
{{ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
{ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \
{FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}}
Note that the elimination of the argument pointer with the stack pointer is specified first since that is the preferred elimination.
CAN_ELIMINATE
(
from-reg
,
to-reg
) [Macro]
A C expression that returns nonzero 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.
INITIAL_ELIMINATION_OFFSET
(
from-reg
,
to-reg
,
offset-var
) [Macro]
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.
13.9.6 Passing Function Arguments on the Stack
The macros in this section control how arguments are passed on the stack. See the following section for other macros that control passing certain arguments in registers.
bool TARGET_PROMOTE_PROTOTYPES
(tree
fntype
) [Target Hook]
This target hook returns true if an argument declared in a prototype as an integral type smaller than int should actually be passed as an int. In addition to avoiding errors in certain cases of mismatch, it also makes for better code on certain machines.
The default is to not promote prototypes.
PUSH_ARGS
[Macro]
A C expression. If nonzero, push insns will be used to pass outgoing arguments. If the target machine does not have a push instruction, set it to zero. That directs GCC to use an alternate strategy: to allocate the entire argument block and then store the arguments into it. When PUSH_ARGS is nonzero, PUSH_ROUNDING must be defined too.
PUSH_ARGS_REVERSED
[Macro]
A C expression. If nonzero, function arguments will be evaluated from last to first, rather than from first to last. If this macro is not defined, it defaults to PUSH_ARGS on targets where the stack and args grow in opposite directions, and 0 otherwise.
PUSH_ROUNDING
(
npushed
) [Macro]
A C expression that is the number of bytes actually pushed onto the stack when an instruction attempts to push npushed bytes.
On some machines, the definition
300 GNU Compiler Collection (GCC) Internals
#define PUSH_ROUNDING(BYTES) (BYTES) will suffice. But on other machines, instructions that appear to push one byte actually push two bytes in an attempt to maintain alignment. Then the definition should be
#define PUSH_ROUNDING(BYTES) (((BYTES) + 1) & ~1)
ACCUMULATE_OUTGOING_ARGS
[Macro]
A C expression. If nonzero, 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.
Setting both PUSH_ARGS and ACCUMULATE_OUTGOING_ARGS is not proper.
REG_PARM_STACK_SPACE
(
fndecl
) [Macro]
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, which can be zero if GCC is calling a library function.
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.
OUTGOING_REG_PARM_STACK_SPACE
[Macro]
Define this if it is the responsibility of the caller to allocate the area reserved for arguments passed in registers.
If ACCUMULATE_OUTGOING_ARGS is defined, this macro controls whether the space for these arguments counts in the value of current_function_outgoing_args_size.
STACK_PARMS_IN_REG_PARM_AREA
[Macro]
Define this macro if REG_PARM_STACK_SPACE is defined, but the stack parameters don’t skip the area specified by it.
Normally, when a parameter is not passed in registers, it is placed on the stack beyond the REG_PARM_STACK_SPACE area. Defining this macro suppresses this behavior and causes the parameter to be passed on the stack in its natural location.
RETURN_POPS_ARGS
(
fundecl
,
funtype
,
stack-size
) [Macro]
A C expression that should indicate the number of bytes of its own arguments that a function pops on returning, or 0 if the function pops no arguments and the caller must therefore pop them all after the function returns.
fundecl is a C variable whose value is a tree node that describes the function in question. Normally it is a node of type FUNCTION_DECL that describes the declaration of the function. From this you can obtain the DECL_ATTRIBUTES of the function.
funtype is a C variable whose value is a tree node that describes the function in question. Normally it is a node of type FUNCTION_TYPE that describes the data type of the function. From this it is possible to obtain the data types of the value and arguments (if known).
When a call to a library function is being considered, fundecl will contain an identifier node for the library function. Thus, if you need to distinguish among various library