]> git.ipfire.org Git - thirdparty/gcc.git/blob
f2c85db45fab2a9ec30c8003e57a05ec2bbd5ba0
[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 .. index:: shrink-wrapping separate components
7
8 .. _shrink-wrapping-separate-components:
9
10 Shrink-wrapping separate components
11 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12
13 The prologue may perform a variety of target dependent tasks such as
14 saving callee-saved registers, saving the return address, aligning the
15 stack, creating a stack frame, initializing the PIC register, setting
16 up the static chain, etc.
17
18 On some targets some of these tasks may be independent of others and
19 thus may be shrink-wrapped separately. These independent tasks are
20 referred to as components and are handled generically by the target
21 independent parts of GCC.
22
23 Using the following hooks those prologue or epilogue components can be
24 shrink-wrapped separately, so that the initialization (and possibly
25 teardown) those components do is not done as frequently on execution
26 paths where this would unnecessary.
27
28 What exactly those components are is up to the target code; the generic
29 code treats them abstractly, as a bit in an ``sbitmap``. These
30 ``sbitmap`` s are allocated by the ``shrink_wrap.get_separate_components``
31 and ``shrink_wrap.components_for_bb`` hooks, and deallocated by the
32 generic code.
33
34 .. function:: sbitmap TARGET_SHRINK_WRAP_GET_SEPARATE_COMPONENTS (void)
35
36 .. hook-start:TARGET_SHRINK_WRAP_GET_SEPARATE_COMPONENTS
37
38 This hook should return an ``sbitmap`` with the bits set for those
39 components that can be separately shrink-wrapped in the current function.
40 Return ``NULL`` if the current function should not get any separate
41 shrink-wrapping.
42 Don't define this hook if it would always return ``NULL``.
43 If it is defined, the other hooks in this group have to be defined as well.
44
45 .. hook-end
46
47 .. function:: sbitmap TARGET_SHRINK_WRAP_COMPONENTS_FOR_BB (basic_block)
48
49 .. hook-start:TARGET_SHRINK_WRAP_COMPONENTS_FOR_BB
50
51 This hook should return an ``sbitmap`` with the bits set for those
52 components where either the prologue component has to be executed before
53 the ``basic_block``, or the epilogue component after it, or both.
54
55 .. hook-end
56
57 .. function:: void TARGET_SHRINK_WRAP_DISQUALIFY_COMPONENTS (sbitmap components, edge e, sbitmap edge_components, bool is_prologue)
58
59 .. hook-start:TARGET_SHRINK_WRAP_DISQUALIFY_COMPONENTS
60
61 This hook should clear the bits in the :samp:`{components}` bitmap for those
62 components in :samp:`{edge_components}` that the target cannot handle on edge
63 :samp:`{e}`, where :samp:`{is_prologue}` says if this is for a prologue or an
64 epilogue instead.
65
66 .. hook-end
67
68 .. function:: void TARGET_SHRINK_WRAP_EMIT_PROLOGUE_COMPONENTS (sbitmap)
69
70 .. hook-start:TARGET_SHRINK_WRAP_EMIT_PROLOGUE_COMPONENTS
71
72 Emit prologue insns for the components indicated by the parameter.
73
74 .. hook-end
75
76 .. function:: void TARGET_SHRINK_WRAP_EMIT_EPILOGUE_COMPONENTS (sbitmap)
77
78 .. hook-start:TARGET_SHRINK_WRAP_EMIT_EPILOGUE_COMPONENTS
79
80 Emit epilogue insns for the components indicated by the parameter.
81
82 .. hook-end
83
84 .. function:: void TARGET_SHRINK_WRAP_SET_HANDLED_COMPONENTS (sbitmap)
85
86 .. hook-start:TARGET_SHRINK_WRAP_SET_HANDLED_COMPONENTS
87
88 Mark the components in the parameter as handled, so that the
89 ``prologue`` and ``epilogue`` named patterns know to ignore those
90 components. The target code should not hang on to the ``sbitmap``, it
91 will be deleted after this call.
92
93 .. hook-end