[Contents]   [Back]   [Prev]   [Up]   [Next]   [Forward]  


Registers That Address the Stack Frame

This discusses registers that address the stack frame.

STACK_POINTER_REGNUM
The register number of the stack pointer register, which must also be a fixed register according to FIXED_REGISTERS. On most machines, the hardware determines which register this is.
FRAME_POINTER_REGNUM
The register number of the frame pointer register, which is used to access automatic variables in the stack frame. On some machines, the hardware determines which register this is. On other machines, you can choose any register you wish for this purpose.
HARD_FRAME_POINTER_REGNUM
On some machines the offset between the frame pointer and starting offset of the automatic variables is not known until after register allocation has been done (for example, because the saved registers are between these two locations). On those machines, define FRAME_POINTER_REGNUM the number of a special, fixed register to be used internally until the offset is known, and define HARD_FRAME_POINTER_REGNUM to be the actual hard register number used for the frame pointer. You should define this macro only in the very rare circumstances when it is not possible to calculate the offset between the frame pointer and the automatic variables until after register allocation has been completed. When this macro is defined, you must also indicate in your definition of ELIMINABLE_REGS how to eliminate FRAME_POINTER_REGNUM into either HARD_FRAME_POINTER_REGNUM or STACK_POINTER_REGNUM. Do not define this macro if it would be the same as FRAME_POINTER_REGNUM.
ARG_POINTER_REGNUM
The register number of the arg pointer register, which is used to access the function's argument list. On some machines, this is the same as the frame pointer register. On some machines, the hardware determines which register this is. On other machines, you can choose any register you wish for this purpose. If this is not the same register as the frame pointer register, then you must mark it as a fixed register according to FIXED_REGISTERS, or arrange to be able to eliminate it (see section Eliminating Frame Pointer and Arg Pointer).
RETURN_ADDRESS_POINTER_REGNUM
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.
STATIC_CHAIN_REGNUM
STATIC_CHAIN_INCOMING_REGNUM
Register numbers used for passing a function's static chain pointer. If register windows are used, the register number as seen by the called function is STATIC_CHAIN_INCOMING_REGNUM, while the register number as seen by the calling function is STATIC_CHAIN_REGNUM. If these registers are the same, STATIC_CHAIN_INCOMING_REGNUM need not be defined. The static chain register need not be a fixed register. If the static chain is passed in memory, these macros should not be defined; instead, the next two macros should be defined.
STATIC_CHAIN
STATIC_CHAIN_INCOMING
If the static chain is passed in memory, these macros provide rtx giving mem expressions that denote where they are stored. STATIC_CHAIN and STATIC_CHAIN_INCOMING give the locations as seen by the calling and called functions, respectively. Often the former will be at an offset from the stack pointer and the latter at an offset from the frame pointer. The variables stack_pointer_rtx, frame_pointer_rtx, and arg_pointer_rtx will have been initialized prior to the use of these macros and should be used to refer to those items. If the static chain is passed in a register, the two previous macros should be defined instead.


[Contents]   [Back]   [Prev]   [Up]   [Next]   [Forward]