]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/doc/gccint/rtl-representation/access-to-special-operands.rst
sphinx: add missing trailing newline
[thirdparty/gcc.git] / gcc / doc / gccint / rtl-representation / access-to-special-operands.rst
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:: access to special operands
7
8 .. _special-accessors:
9
10 Access to Special Operands
11 **************************
12
13 Some RTL nodes have special annotations associated with them.
14
15 ``MEM``
16
17 .. index:: MEM_ALIAS_SET
18
19 :samp:`MEM_ALIAS_SET ({x})`
20 If 0, :samp:`{x}` is not in any alias set, and may alias anything. Otherwise,
21 :samp:`{x}` can only alias ``MEM`` s in a conflicting alias set. This value
22 is set in a language-dependent manner in the front-end, and should not be
23 altered in the back-end. In some front-ends, these numbers may correspond
24 in some way to types, or other language-level entities, but they need not,
25 and the back-end makes no such assumptions.
26 These set numbers are tested with ``alias_sets_conflict_p``.
27
28 .. index:: MEM_EXPR
29
30 :samp:`MEM_EXPR ({x})`
31 If this register is known to hold the value of some user-level
32 declaration, this is that tree node. It may also be a
33 ``COMPONENT_REF``, in which case this is some field reference,
34 and ``TREE_OPERAND (x, 0)`` contains the declaration,
35 or another ``COMPONENT_REF``, or null if there is no compile-time
36 object associated with the reference.
37
38 .. index:: MEM_OFFSET_KNOWN_P
39
40 :samp:`MEM_OFFSET_KNOWN_P ({x})`
41 True if the offset of the memory reference from ``MEM_EXPR`` is known.
42 :samp:`MEM_OFFSET ({x})` provides the offset if so.
43
44 .. index:: MEM_OFFSET
45
46 :samp:`MEM_OFFSET ({x})`
47 The offset from the start of ``MEM_EXPR``. The value is only valid if
48 :samp:`MEM_OFFSET_KNOWN_P ({x})` is true.
49
50 .. index:: MEM_SIZE_KNOWN_P
51
52 :samp:`MEM_SIZE_KNOWN_P ({x})`
53 True if the size of the memory reference is known.
54 :samp:`MEM_SIZE ({x})` provides its size if so.
55
56 .. index:: MEM_SIZE
57
58 :samp:`MEM_SIZE ({x})`
59 The size in bytes of the memory reference.
60 This is mostly relevant for ``BLKmode`` references as otherwise
61 the size is implied by the mode. The value is only valid if
62 :samp:`MEM_SIZE_KNOWN_P ({x})` is true.
63
64 .. index:: MEM_ALIGN
65
66 :samp:`MEM_ALIGN ({x})`
67 The known alignment in bits of the memory reference.
68
69 .. index:: MEM_ADDR_SPACE
70
71 :samp:`MEM_ADDR_SPACE ({x})`
72 The address space of the memory reference. This will commonly be zero
73 for the generic address space.
74
75 ``REG``
76
77 .. index:: ORIGINAL_REGNO
78
79 :samp:`ORIGINAL_REGNO ({x})`
80 This field holds the number the register 'originally' had; for a
81 pseudo register turned into a hard reg this will hold the old pseudo
82 register number.
83
84 .. index:: REG_EXPR
85
86 :samp:`REG_EXPR ({x})`
87 If this register is known to hold the value of some user-level
88 declaration, this is that tree node.
89
90 .. index:: REG_OFFSET
91
92 :samp:`REG_OFFSET ({x})`
93 If this register is known to hold the value of some user-level
94 declaration, this is the offset into that logical storage.
95
96 .. envvar:: SYMBOL_REF
97
98 .. index:: SYMBOL_REF_DECL
99
100 :samp:`SYMBOL_REF_DECL ({x})`
101 If the ``symbol_ref`` :samp:`{x}` was created for a ``VAR_DECL`` or
102 a ``FUNCTION_DECL``, that tree is recorded here. If this value is
103 null, then :samp:`{x}` was created by back end code generation routines,
104 and there is no associated front end symbol table entry.
105
106 ``SYMBOL_REF_DECL`` may also point to a tree of class ``'c'``,
107 that is, some sort of constant. In this case, the ``symbol_ref``
108 is an entry in the per-file constant pool; again, there is no associated
109 front end symbol table entry.
110
111 .. index:: SYMBOL_REF_CONSTANT
112
113 :samp:`SYMBOL_REF_CONSTANT ({x})`
114 If :samp:`CONSTANT_POOL_ADDRESS_P ({x})` is true, this is the constant
115 pool entry for :samp:`{x}`. It is null otherwise.
116
117 .. index:: SYMBOL_REF_DATA
118
119 :samp:`SYMBOL_REF_DATA ({x})`
120 A field of opaque type used to store ``SYMBOL_REF_DECL`` or
121 ``SYMBOL_REF_CONSTANT``.
122
123 .. index:: SYMBOL_REF_FLAGS
124
125 :samp:`SYMBOL_REF_FLAGS ({x})`
126 In a ``symbol_ref``, this is used to communicate various predicates
127 about the symbol. Some of these are common enough to be computed by
128 common code, some are specific to the target. The common bits are:
129
130 .. index:: SYMBOL_REF_FUNCTION_P, SYMBOL_FLAG_FUNCTION
131
132 .. envvar:: SYMBOL_FLAG_FUNCTION
133
134 Set if the symbol refers to a function.
135
136 .. envvar:: SYMBOL_FLAG_LOCAL
137
138 Set if the symbol is local to this 'module'.
139 See ``TARGET_BINDS_LOCAL_P``.
140
141 .. envvar:: SYMBOL_FLAG_EXTERNAL
142
143 Set if this symbol is not defined in this translation unit.
144 Note that this is not the inverse of ``SYMBOL_FLAG_LOCAL``.
145
146 .. envvar:: SYMBOL_FLAG_SMALL
147
148 Set if the symbol is located in the small data section.
149 See ``TARGET_IN_SMALL_DATA_P``.
150
151 :samp:`SYMBOL_REF_TLS_MODEL ({x})`
152 This is a multi-bit field accessor that returns the ``tls_model``
153 to be used for a thread-local storage symbol. It returns zero for
154 non-thread-local symbols.
155
156 .. index:: SYMBOL_REF_HAS_BLOCK_INFO_P, SYMBOL_FLAG_HAS_BLOCK_INFO
157
158 .. envvar:: SYMBOL_FLAG_HAS_BLOCK_INFO
159
160 Set if the symbol has ``SYMBOL_REF_BLOCK`` and
161 ``SYMBOL_REF_BLOCK_OFFSET`` fields.
162
163 .. index:: -fsection-anchors
164
165 .. envvar:: SYMBOL_FLAG_ANCHOR
166
167 Set if the symbol is used as a section anchor. 'Section anchors'
168 are symbols that have a known position within an ``object_block``
169 and that can be used to access nearby members of that block.
170 They are used to implement :option:`-fsection-anchors`.
171
172 If this flag is set, then ``SYMBOL_FLAG_HAS_BLOCK_INFO`` will be too.
173
174 Bits beginning with ``SYMBOL_FLAG_MACH_DEP`` are available for
175 the target's use.
176
177 :samp:`SYMBOL_REF_BLOCK ({x})`
178 If :samp:`SYMBOL_REF_HAS_BLOCK_INFO_P ({x})`, this is the
179 :samp:`object_block` structure to which the symbol belongs,
180 or ``NULL`` if it has not been assigned a block.
181
182 .. index:: SYMBOL_REF_BLOCK_OFFSET
183
184 :samp:`SYMBOL_REF_BLOCK_OFFSET ({x})`
185 If :samp:`SYMBOL_REF_HAS_BLOCK_INFO_P ({x})`, this is the offset of :samp:`{x}`
186 from the first object in :samp:`SYMBOL_REF_BLOCK ({x})`. The value is
187 negative if :samp:`{x}` has not yet been assigned to a block, or it has not
188 been given an offset within that block.