GNU Info

Info Node: (gcc-295.info)Elimination

(gcc-295.info)Elimination


Next: Stack Arguments Prev: Frame Registers Up: Stack and Calling
Enter node , (file) or (file)node

Eliminating Frame Pointer and Arg Pointer
-----------------------------------------

   This is about eliminating the frame pointer and arg pointer.

`FRAME_POINTER_REQUIRED'
     A C expression which is nonzero if a function must have and use a
     frame pointer.  This expression is evaluated  in the reload pass.
     If its value is nonzero the function will have a frame pointer.

     The expression can in principle examine the current function and
     decide according to the facts, but on most machines the constant 0
     or the constant 1 suffices.  Use 0 when the machine allows code to
     be generated with no frame pointer, and doing so saves some time
     or space.  Use 1 when there is no possible advantage to avoiding a
     frame pointer.

     In certain cases, the compiler does not know how to produce valid
     code without a frame pointer.  The compiler recognizes those cases
     and automatically gives the function a frame pointer regardless of
     what `FRAME_POINTER_REQUIRED' says.  You don't need to worry about
     them.

     In a function that does not require a frame pointer, the frame
     pointer register can be allocated for ordinary usage, unless you
     mark it as a fixed register.  See `FIXED_REGISTERS' for more
     information.

`INITIAL_FRAME_POINTER_OFFSET (DEPTH-VAR)'
     A C statement to store in the variable DEPTH-VAR the difference
     between the frame pointer and the stack pointer values immediately
     after the function prologue.  The value would be computed from
     information such as the result of `get_frame_size ()' and the
     tables of registers `regs_ever_live' and `call_used_regs'.

     If `ELIMINABLE_REGS' is defined, this macro will be not be used and
     need not be defined.  Otherwise, it must be defined even if
     `FRAME_POINTER_REQUIRED' is defined to always be true; in that
     case, you may set DEPTH-VAR to anything.

`ELIMINABLE_REGS'
     If defined, this macro specifies a table of register pairs used to
     eliminate unneeded registers that point into the stack frame.  If
     it is not defined, the only elimination attempted by the compiler
     is to replace references to the frame pointer with references to
     the stack pointer.

     The definition of this macro is a list of structure
     initializations, each of which specifies an original and
     replacement register.

     On some machines, the position of the argument pointer is not
     known until the compilation is completed.  In such a case, a
     separate hard register must be used for the argument pointer.
     This register can be eliminated by replacing it with either the
     frame pointer or the argument pointer, depending on whether or not
     the frame pointer has been eliminated.

     In this case, you might specify:
          #define ELIMINABLE_REGS  \
          {{ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
           {ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \
           {FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}}

     Note that the elimination of the argument pointer with the stack
     pointer is specified first since that is the preferred elimination.

`CAN_ELIMINATE (FROM-REG, TO-REG)'
     A C expression that returns non-zero if the compiler is allowed to
     try to replace register number FROM-REG with register number
     TO-REG.  This macro need only be defined if `ELIMINABLE_REGS' is
     defined, and will usually be the constant 1, since most of the
     cases preventing register elimination are things that the compiler
     already knows about.

`INITIAL_ELIMINATION_OFFSET (FROM-REG, TO-REG, OFFSET-VAR)'
     This macro is similar to `INITIAL_FRAME_POINTER_OFFSET'.  It
     specifies the initial difference between the specified pair of
     registers.  This macro must be defined if `ELIMINABLE_REGS' is
     defined.

`LONGJMP_RESTORE_FROM_STACK'
     Define this macro if the `longjmp' function restores registers from
     the stack frames, rather than from those saved specifically by
     `setjmp'.  Certain quantities must not be kept in registers across
     a call to `setjmp' on such machines.


automatically generated by info2www version 1.2.2.9