gccint: Frame Registers
1
1 18.9.4 Registers That Address the Stack Frame
1 ---------------------------------------------
1
1 This discusses registers that address the stack frame.
1
1 -- Macro: STACK_POINTER_REGNUM
1 The register number of the stack pointer register, which must also
1 be a fixed register according to 'FIXED_REGISTERS'. On most
1 machines, the hardware determines which register this is.
1
1 -- Macro: FRAME_POINTER_REGNUM
1 The register number of the frame pointer register, which is used to
1 access automatic variables in the stack frame. On some machines,
1 the hardware determines which register this is. On other machines,
1 you can choose any register you wish for this purpose.
1
1 -- Macro: HARD_FRAME_POINTER_REGNUM
1 On some machines the offset between the frame pointer and starting
1 offset of the automatic variables is not known until after register
1 allocation has been done (for example, because the saved registers
1 are between these two locations). On those machines, define
1 'FRAME_POINTER_REGNUM' the number of a special, fixed register to
1 be used internally until the offset is known, and define
1 'HARD_FRAME_POINTER_REGNUM' to be the actual hard register number
1 used for the frame pointer.
1
1 You should define this macro only in the very rare circumstances
1 when it is not possible to calculate the offset between the frame
1 pointer and the automatic variables until after register allocation
1 has been completed. When this macro is defined, you must also
1 indicate in your definition of 'ELIMINABLE_REGS' how to eliminate
1 'FRAME_POINTER_REGNUM' into either 'HARD_FRAME_POINTER_REGNUM' or
1 'STACK_POINTER_REGNUM'.
1
1 Do not define this macro if it would be the same as
1 'FRAME_POINTER_REGNUM'.
1
1 -- Macro: ARG_POINTER_REGNUM
1 The register number of the arg pointer register, which is used to
1 access the function's argument list. On some machines, this is the
1 same as the frame pointer register. On some machines, the hardware
1 determines which register this is. On other machines, you can
1 choose any register you wish for this purpose. If this is not the
1 same register as the frame pointer register, then you must mark it
1 as a fixed register according to 'FIXED_REGISTERS', or arrange to
1 be able to eliminate it (⇒Elimination).
1
1 -- Macro: HARD_FRAME_POINTER_IS_FRAME_POINTER
1 Define this to a preprocessor constant that is nonzero if
1 'hard_frame_pointer_rtx' and 'frame_pointer_rtx' should be the
1 same. The default definition is '(HARD_FRAME_POINTER_REGNUM ==
1 FRAME_POINTER_REGNUM)'; you only need to define this macro if that
1 definition is not suitable for use in preprocessor conditionals.
1
1 -- Macro: HARD_FRAME_POINTER_IS_ARG_POINTER
1 Define this to a preprocessor constant that is nonzero if
1 'hard_frame_pointer_rtx' and 'arg_pointer_rtx' should be the same.
1 The default definition is '(HARD_FRAME_POINTER_REGNUM ==
1 ARG_POINTER_REGNUM)'; you only need to define this macro if that
1 definition is not suitable for use in preprocessor conditionals.
1
1 -- Macro: RETURN_ADDRESS_POINTER_REGNUM
1 The register number of the return address pointer register, which
1 is used to access the current function's return address from the
1 stack. On some machines, the return address is not at a fixed
1 offset from the frame pointer or stack pointer or argument pointer.
1 This register can be defined to point to the return address on the
1 stack, and then be converted by 'ELIMINABLE_REGS' into either the
1 frame pointer or stack pointer.
1
1 Do not define this macro unless there is no other way to get the
1 return address from the stack.
1
1 -- Macro: STATIC_CHAIN_REGNUM
1 -- Macro: STATIC_CHAIN_INCOMING_REGNUM
1 Register numbers used for passing a function's static chain
1 pointer. If register windows are used, the register number as seen
1 by the called function is 'STATIC_CHAIN_INCOMING_REGNUM', while the
1 register number as seen by the calling function is
1 'STATIC_CHAIN_REGNUM'. If these registers are the same,
1 'STATIC_CHAIN_INCOMING_REGNUM' need not be defined.
1
1 The static chain register need not be a fixed register.
1
1 If the static chain is passed in memory, these macros should not be
1 defined; instead, the 'TARGET_STATIC_CHAIN' hook should be used.
1
1 -- Target Hook: rtx TARGET_STATIC_CHAIN (const_tree FNDECL_OR_TYPE,
1 bool INCOMING_P)
1 This hook replaces the use of 'STATIC_CHAIN_REGNUM' et al for
1 targets that may use different static chain locations for different
1 nested functions. This may be required if the target has function
1 attributes that affect the calling conventions of the function and
1 those calling conventions use different static chain locations.
1
1 The default version of this hook uses 'STATIC_CHAIN_REGNUM' et al.
1
1 If the static chain is passed in memory, this hook should be used
1 to provide rtx giving 'mem' expressions that denote where they are
1 stored. Often the 'mem' expression as seen by the caller will be
1 at an offset from the stack pointer and the 'mem' expression as
1 seen by the callee will be at an offset from the frame pointer.
1 The variables 'stack_pointer_rtx', 'frame_pointer_rtx', and
1 'arg_pointer_rtx' will have been initialized and should be used to
1 refer to those items.
1
1 -- Macro: DWARF_FRAME_REGISTERS
1 This macro specifies the maximum number of hard registers that can
1 be saved in a call frame. This is used to size data structures
1 used in DWARF2 exception handling.
1
1 Prior to GCC 3.0, this macro was needed in order to establish a
1 stable exception handling ABI in the face of adding new hard
1 registers for ISA extensions. In GCC 3.0 and later, the EH ABI is
1 insulated from changes in the number of hard registers.
1 Nevertheless, this macro can still be used to reduce the runtime
1 memory requirements of the exception handling routines, which can
1 be substantial if the ISA contains a lot of registers that are not
1 call-saved.
1
1 If this macro is not defined, it defaults to
1 'FIRST_PSEUDO_REGISTER'.
1
1 -- Macro: PRE_GCC3_DWARF_FRAME_REGISTERS
1
1 This macro is similar to 'DWARF_FRAME_REGISTERS', but is provided
1 for backward compatibility in pre GCC 3.0 compiled code.
1
1 If this macro is not defined, it defaults to
1 'DWARF_FRAME_REGISTERS'.
1
1 -- Macro: DWARF_REG_TO_UNWIND_COLUMN (REGNO)
1
1 Define this macro if the target's representation for dwarf
1 registers is different than the internal representation for unwind
1 column. Given a dwarf register, this macro should return the
1 internal unwind column number to use instead.
1
1 -- Macro: DWARF_FRAME_REGNUM (REGNO)
1
1 Define this macro if the target's representation for dwarf
1 registers used in .eh_frame or .debug_frame is different from that
1 used in other debug info sections. Given a GCC hard register
1 number, this macro should return the .eh_frame register number.
1 The default is 'DBX_REGISTER_NUMBER (REGNO)'.
1
1 -- Macro: DWARF2_FRAME_REG_OUT (REGNO, FOR_EH)
1
1 Define this macro to map register numbers held in the call frame
1 info that GCC has collected using 'DWARF_FRAME_REGNUM' to those
1 that should be output in .debug_frame ('FOR_EH' is zero) and
1 .eh_frame ('FOR_EH' is nonzero). The default is to return 'REGNO'.
1
1 -- Macro: REG_VALUE_IN_UNWIND_CONTEXT
1
1 Define this macro if the target stores register values as
1 '_Unwind_Word' type in unwind context. It should be defined if
1 target register size is larger than the size of 'void *'. The
1 default is to store register values as 'void *' type.
1
1 -- Macro: ASSUME_EXTENDED_UNWIND_CONTEXT
1
1 Define this macro to be 1 if the target always uses extended unwind
1 context with version, args_size and by_value fields. If it is
1 undefined, it will be defined to 1 when
1 'REG_VALUE_IN_UNWIND_CONTEXT' is defined and 0 otherwise.
1
1 -- Macro: DWARF_LAZY_REGISTER_VALUE (REGNO, VALUE)
1 Define this macro if the target has pseudo DWARF registers whose
1 values need to be computed lazily on demand by the unwinder (such
1 as when referenced in a CFA expression). The macro returns true if
1 REGNO is such a register and stores its value in '*VALUE' if so.
1