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.
`PROMOTE_PROTOTYPES'
Define this macro 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.
`PUSH_ROUNDING (NPUSHED)'
A C expression that is the number of bytes actually pushed onto the
stack when an instruction attempts to push NPUSHED bytes.
If the target machine does not have a push instruction, do not
define this macro. That directs GNU CC to use an alternate
strategy: to allocate the entire argument block and then store the
arguments into it.
On some machines, the definition
#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'
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.
Defining both `PUSH_ROUNDING' and `ACCUMULATE_OUTGOING_ARGS' is
not proper.
`REG_PARM_STACK_SPACE (FNDECL)'
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 GNU CC 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.
`MAYBE_REG_PARM_STACK_SPACE'
`FINAL_REG_PARM_STACK_SPACE (CONST_SIZE, VAR_SIZE)'
Define these macros in addition to the one above if functions might
allocate stack space for arguments even when their values are
passed in registers. These should be used when the stack space
allocated for arguments in registers is not a simple constant
independent of the function declaration.
The value of the first macro is the size, in bytes, of the area
that we should initially assume would be reserved for arguments
passed in registers.
The value of the second macro is the actual size, in bytes, of the
area that will be reserved for arguments passed in registers.
This takes two arguments: an integer representing the number of
bytes of fixed sized arguments on the stack, and a tree
representing the number of bytes of variable sized arguments on
the stack.
When these macros are defined, `REG_PARM_STACK_SPACE' will only be
called for libcall functions, the current function, or for a
function being called when it is known that such stack space must
be allocated. In each case this value can be easily computed.
When deciding whether a called function needs such stack space,
and how much space to reserve, GNU CC uses these two macros
instead of `REG_PARM_STACK_SPACE'.
`OUTGOING_REG_PARM_STACK_SPACE'
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'
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)'
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_MACHINE_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 functions, you can
do so by their names. Note that "library function" in this
context means a function used to perform arithmetic, whose name is
known specially in the compiler and was not mentioned in the C
code being compiled.
STACK-SIZE is the number of bytes of arguments passed on the
stack. If a variable number of bytes is passed, it is zero, and
argument popping will always be the responsibility of the calling
function.
On the Vax, all functions always pop their arguments, so the
definition of this macro is STACK-SIZE. On the 68000, using the
standard calling convention, no functions pop their arguments, so
the value of the macro is always 0 in this case. But an
alternative calling convention is available in which functions
that take a fixed number of arguments pop them but other functions
(such as `printf') pop nothing (the caller pops all). When this
convention is in use, FUNTYPE is examined to determine whether a
function takes a fixed number of arguments.
automatically generated byinfo2wwwversion 1.2.2.9