Go to the first, previous, next, last section, table of contents.


Basic Stack Layout

Here is the basic stack layout.

STACK_GROWS_DOWNWARD
Define this macro if pushing a word onto the stack moves the stack pointer to a smaller address. When we say, "define this macro if ...," it means that the compiler checks this macro only with #ifdef so the precise definition used does not matter.
FRAME_GROWS_DOWNWARD
Define this macro if the addresses of local variable slots are at negative offsets from the frame pointer.
ARGS_GROW_DOWNWARD
Define this macro if successive arguments to a function occupy decreasing addresses on the stack.
STARTING_FRAME_OFFSET
Offset from the frame pointer to the first local variable slot to be allocated. If FRAME_GROWS_DOWNWARD, find the next slot's offset by subtracting the first slot's length from STARTING_FRAME_OFFSET. Otherwise, it is found by adding the length of the first slot to the value STARTING_FRAME_OFFSET.
STACK_POINTER_OFFSET
Offset from the stack pointer register to the first location at which outgoing arguments are placed. If not specified, the default value of zero is used. This is the proper value for most machines. If ARGS_GROW_DOWNWARD, this is the offset to the location above the first location at which outgoing arguments are placed.
FIRST_PARM_OFFSET (fundecl)
Offset from the argument pointer register to the first argument's address. On some machines it may depend on the data type of the function. If ARGS_GROW_DOWNWARD, this is the offset to the location above the first argument's address.
STACK_DYNAMIC_OFFSET (fundecl)
Offset from the stack pointer register to an item dynamically allocated on the stack, e.g., by alloca. The default value for this macro is STACK_POINTER_OFFSET plus the length of the outgoing arguments. The default is correct for most machines. See `function.c' for details.
DYNAMIC_CHAIN_ADDRESS (frameaddr)
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.
SETUP_FRAME_ADDRESSES ()
If defined, a C expression that produces the machine-specific code to setup the stack so that arbitrary frames can be accessed. For example, on the Sparc, we must flush all of the register windows to the stack before we can access arbitrary stack frames. This macro will seldom need to be defined.
RETURN_ADDR_RTX (count, 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, after the prologue. 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.
RETURN_ADDR_IN_PREVIOUS_FRAME
Define this if the return address of a particular stack frame is accessed from the frame pointer of the previous stack frame.
INCOMING_RETURN_ADDR_RTX
A C expression whose value is RTL representing the location of the incoming return address at the beginning of any function, before the prologue. This RTL is either a REG, indicating that the return value is saved in `REG', or a MEM representing a location in the stack. You only need to define this macro if you want to support call frame debugging information like that provided by DWARF 2.
INCOMING_FRAME_SP_OFFSET
A C expression whose value is an integer giving the offset, in bytes, from the value of the stack pointer register to the top of the stack frame at the beginning of any function, before the prologue. The top of the frame is defined to be the value of the stack pointer in the previous frame, just before the call instruction. You only need to define this macro if you want to support call frame debugging information like that provided by DWARF 2.


Go to the first, previous, next, last section, table of contents.