2 Copyright 1988-2022 Free Software Foundation, Inc.
3 This is part of the GCC manual.
4 For copying conditions, see the copyright.rst file.
8 Eliminating Frame Pointer and Arg Pointer
9 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
11 .. prevent bad page break with this line
13 This is about eliminating the frame pointer and arg pointer.
15 .. include:: ../tm.rst.in
16 :start-after: [TARGET_FRAME_POINTER_REQUIRED]
17 :end-before: [TARGET_FRAME_POINTER_REQUIRED]
20 .. c:macro:: ELIMINABLE_REGS
22 This macro specifies a table of register pairs used to eliminate
23 unneeded registers that point into the stack frame.
25 The definition of this macro is a list of structure initializations, each
26 of which specifies an original and replacement register.
28 On some machines, the position of the argument pointer is not known until
29 the compilation is completed. In such a case, a separate hard register
30 must be used for the argument pointer. This register can be eliminated by
31 replacing it with either the frame pointer or the argument pointer,
32 depending on whether or not the frame pointer has been eliminated.
34 In this case, you might specify:
38 #define ELIMINABLE_REGS \
39 {{ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
40 {ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \
41 {FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}}
43 Note that the elimination of the argument pointer with the stack pointer is
44 specified first since that is the preferred elimination.
46 .. include:: ../tm.rst.in
47 :start-after: [TARGET_CAN_ELIMINATE]
48 :end-before: [TARGET_CAN_ELIMINATE]
51 .. c:macro:: INITIAL_ELIMINATION_OFFSET (from_reg, to_reg, offset_var)
53 This macro returns the initial difference between the specified pair
54 of registers. The value would be computed from information
55 such as the result of ``get_frame_size ()`` and the tables of
56 registers ``df_regs_ever_live_p`` and ``call_used_regs``.
58 .. include:: ../tm.rst.in
59 :start-after: [TARGET_COMPUTE_FRAME_LAYOUT]
60 :end-before: [TARGET_COMPUTE_FRAME_LAYOUT]