gccint: Elimination

1 
1 18.9.5 Eliminating Frame Pointer and Arg Pointer
1 ------------------------------------------------
1 
1 This is about eliminating the frame pointer and arg pointer.
1 
1  -- Target Hook: bool TARGET_FRAME_POINTER_REQUIRED (void)
1      This target hook should return 'true' if a function must have and
1      use a frame pointer.  This target hook is called in the reload
1      pass.  If its return value is 'true' the function will have a frame
1      pointer.
1 
1      This target hook can in principle examine the current function and
1      decide according to the facts, but on most machines the constant
1      'false' or the constant 'true' suffices.  Use 'false' when the
1      machine allows code to be generated with no frame pointer, and
1      doing so saves some time or space.  Use 'true' when there is no
1      possible advantage to avoiding a frame pointer.
1 
1      In certain cases, the compiler does not know how to produce valid
1      code without a frame pointer.  The compiler recognizes those cases
1      and automatically gives the function a frame pointer regardless of
1      what 'targetm.frame_pointer_required' returns.  You don't need to
1      worry about them.
1 
1      In a function that does not require a frame pointer, the frame
1      pointer register can be allocated for ordinary usage, unless you
1      mark it as a fixed register.  See 'FIXED_REGISTERS' for more
1      information.
1 
1      Default return value is 'false'.
1 
1  -- Macro: ELIMINABLE_REGS
1      This macro specifies a table of register pairs used to eliminate
1      unneeded registers that point into the stack frame.
1 
1      The definition of this macro is a list of structure
1      initializations, each of which specifies an original and
1      replacement register.
1 
1      On some machines, the position of the argument pointer is not known
1      until the compilation is completed.  In such a case, a separate
1      hard register must be used for the argument pointer.  This register
1      can be eliminated by replacing it with either the frame pointer or
1      the argument pointer, depending on whether or not the frame pointer
1      has been eliminated.
1 
1      In this case, you might specify:
1           #define ELIMINABLE_REGS  \
1           {{ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
1            {ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \
1            {FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}}
1 
1      Note that the elimination of the argument pointer with the stack
1      pointer is specified first since that is the preferred elimination.
1 
1  -- Target Hook: bool TARGET_CAN_ELIMINATE (const int FROM_REG, const
1           int TO_REG)
1      This target hook should return 'true' if the compiler is allowed to
1      try to replace register number FROM_REG with register number
1      TO_REG.  This target hook will usually be 'true', since most of the
1      cases preventing register elimination are things that the compiler
1      already knows about.
1 
1      Default return value is 'true'.
1 
1  -- Macro: INITIAL_ELIMINATION_OFFSET (FROM-REG, TO-REG, OFFSET-VAR)
1      This macro returns the initial difference between the specified
1      pair of registers.  The value would be computed from information
1      such as the result of 'get_frame_size ()' and the tables of
1      registers 'df_regs_ever_live_p' and 'call_used_regs'.
1 
1  -- Target Hook: void TARGET_COMPUTE_FRAME_LAYOUT (void)
1      This target hook is called once each time the frame layout needs to
1      be recalculated.  The calculations can be cached by the target and
1      can then be used by 'INITIAL_ELIMINATION_OFFSET' instead of
1      re-computing the layout on every invocation of that hook.  This is
1      particularly useful for targets that have an expensive frame layout
1      function.  Implementing this callback is optional.
1