]> git.ipfire.org Git - thirdparty/gcc.git/blob
1e81fc774840b0016c31ef0474d9db09fa27a3c6
[thirdparty/gcc.git] /
1 ..
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.
5
6 .. _elimination:
7
8 Eliminating Frame Pointer and Arg Pointer
9 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
10
11 .. prevent bad page break with this line
12
13 This is about eliminating the frame pointer and arg pointer.
14
15 .. include:: ../tm.rst.in
16 :start-after: [TARGET_FRAME_POINTER_REQUIRED]
17 :end-before: [TARGET_FRAME_POINTER_REQUIRED]
18
19
20 .. c:macro:: ELIMINABLE_REGS
21
22 This macro specifies a table of register pairs used to eliminate
23 unneeded registers that point into the stack frame.
24
25 The definition of this macro is a list of structure initializations, each
26 of which specifies an original and replacement register.
27
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.
33
34 In this case, you might specify:
35
36 .. code-block:: c++
37
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}}
42
43 Note that the elimination of the argument pointer with the stack pointer is
44 specified first since that is the preferred elimination.
45
46 .. include:: ../tm.rst.in
47 :start-after: [TARGET_CAN_ELIMINATE]
48 :end-before: [TARGET_CAN_ELIMINATE]
49
50
51 .. c:macro:: INITIAL_ELIMINATION_OFFSET (from_reg, to_reg, offset_var)
52
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``.
57
58 .. include:: ../tm.rst.in
59 :start-after: [TARGET_COMPUTE_FRAME_LAYOUT]
60 :end-before: [TARGET_COMPUTE_FRAME_LAYOUT]