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.
6 .. index:: flags in RTL expression
10 Flags in an RTL Expression
11 **************************
13 RTL expressions contain several flags (one-bit bit-fields)
14 that are used in certain types of expression. Most often they
15 are accessed with the following macros, which expand into lvalues.
17 .. index:: CROSSING_JUMP_P, jump_insn and /j
19 :samp:`CROSSING_JUMP_P ({x})`
20 Nonzero in a ``jump_insn`` if it crosses between hot and cold sections,
21 which could potentially be very far apart in the executable. The presence
22 of this flag indicates to other optimizations that this branching instruction
23 should not be 'collapsed' into a simpler branching construct. It is used
24 when the optimization to partition basic blocks into hot and cold sections
27 .. index:: CONSTANT_POOL_ADDRESS_P, symbol_ref and /u, unchanging, in symbol_ref
29 :samp:`CONSTANT_POOL_ADDRESS_P ({x})`
30 Nonzero in a ``symbol_ref`` if it refers to part of the current
31 function's constant pool. For most targets these addresses are in a
32 ``.rodata`` section entirely separate from the function, but for
33 some targets the addresses are close to the beginning of the function.
34 In either case GCC assumes these addresses can be addressed directly,
35 perhaps with the help of base registers.
36 Stored in the ``unchanging`` field and printed as :samp:`/u`.
38 .. index:: INSN_ANNULLED_BRANCH_P, jump_insn and /u, call_insn and /u, insn and /u, unchanging, in jump_insn, call_insn and insn
40 :samp:`INSN_ANNULLED_BRANCH_P ({x})`
41 In a ``jump_insn``, ``call_insn``, or ``insn`` indicates
42 that the branch is an annulling one. See the discussion under
43 ``sequence`` below. Stored in the ``unchanging`` field and
44 printed as :samp:`/u`.
46 .. index:: INSN_DELETED_P, insn and /v, call_insn and /v, jump_insn and /v, code_label and /v, jump_table_data and /v, barrier and /v, note and /v, volatil, in insn, call_insn, jump_insn, code_label, jump_table_data, barrier, and note
48 :samp:`INSN_DELETED_P ({x})`
49 In an ``insn``, ``call_insn``, ``jump_insn``, ``code_label``,
50 ``jump_table_data``, ``barrier``, or ``note``,
51 nonzero if the insn has been deleted. Stored in the
52 ``volatil`` field and printed as :samp:`/v`.
54 .. index:: INSN_FROM_TARGET_P, insn and /s, jump_insn and /s, call_insn and /s, in_struct, in insn and jump_insn and call_insn
56 :samp:`INSN_FROM_TARGET_P ({x})`
57 In an ``insn`` or ``jump_insn`` or ``call_insn`` in a delay
58 slot of a branch, indicates that the insn
59 is from the target of the branch. If the branch insn has
60 ``INSN_ANNULLED_BRANCH_P`` set, this insn will only be executed if
61 the branch is taken. For annulled branches with
62 ``INSN_FROM_TARGET_P`` clear, the insn will be executed only if the
63 branch is not taken. When ``INSN_ANNULLED_BRANCH_P`` is not set,
64 this insn will always be executed. Stored in the ``in_struct``
65 field and printed as :samp:`/s`.
67 .. index:: LABEL_PRESERVE_P, code_label and /i, note and /i, in_struct, in code_label and note
69 :samp:`LABEL_PRESERVE_P ({x})`
70 In a ``code_label`` or ``note``, indicates that the label is referenced by
71 code or data not visible to the RTL of a given function.
72 Labels referenced by a non-local goto will have this bit set. Stored
73 in the ``in_struct`` field and printed as :samp:`/s`.
75 .. index:: LABEL_REF_NONLOCAL_P, label_ref and /v, reg_label and /v, volatil, in label_ref and reg_label
77 :samp:`LABEL_REF_NONLOCAL_P ({x})`
78 In ``label_ref`` and ``reg_label`` expressions, nonzero if this is
79 a reference to a non-local label.
80 Stored in the ``volatil`` field and printed as :samp:`/v`.
82 .. index:: MEM_KEEP_ALIAS_SET_P, mem and /j, jump, in mem
84 :samp:`MEM_KEEP_ALIAS_SET_P ({x})`
85 In ``mem`` expressions, 1 if we should keep the alias set for this
86 mem unchanged when we access a component. Set to 1, for example, when we
87 are already in a non-addressable component of an aggregate.
88 Stored in the ``jump`` field and printed as :samp:`/j`.
90 .. index:: MEM_VOLATILE_P, mem and /v, asm_input and /v, asm_operands and /v, volatil, in mem, asm_operands, and asm_input
92 :samp:`MEM_VOLATILE_P ({x})`
93 In ``mem``, ``asm_operands``, and ``asm_input`` expressions,
94 nonzero for volatile memory references.
95 Stored in the ``volatil`` field and printed as :samp:`/v`.
97 .. index:: MEM_NOTRAP_P, mem and /c, call, in mem
99 :samp:`MEM_NOTRAP_P ({x})`
100 In ``mem``, nonzero for memory references that will not trap.
101 Stored in the ``call`` field and printed as :samp:`/c`.
103 .. index:: MEM_POINTER, mem and /f, frame_related, in mem
105 :samp:`MEM_POINTER ({x})`
106 Nonzero in a ``mem`` if the memory reference holds a pointer.
107 Stored in the ``frame_related`` field and printed as :samp:`/f`.
109 .. index:: MEM_READONLY_P, mem and /u, unchanging, in mem
111 :samp:`MEM_READONLY_P ({x})`
112 Nonzero in a ``mem``, if the memory is statically allocated and read-only.
114 Read-only in this context means never modified during the lifetime of the
115 program, not necessarily in ROM or in write-disabled pages. A common
116 example of the later is a shared library's global offset table. This
117 table is initialized by the runtime loader, so the memory is technically
118 writable, but after control is transferred from the runtime loader to the
119 application, this memory will never be subsequently modified.
121 Stored in the ``unchanging`` field and printed as :samp:`/u`.
123 .. index:: PREFETCH_SCHEDULE_BARRIER_P, prefetch and /v, volatile, in prefetch
125 :samp:`PREFETCH_SCHEDULE_BARRIER_P ({x})`
126 In a ``prefetch``, indicates that the prefetch is a scheduling barrier.
127 No other INSNs will be moved over it.
128 Stored in the ``volatil`` field and printed as :samp:`/v`.
130 .. index:: REG_FUNCTION_VALUE_P, reg and /i, return_val, in reg
132 :samp:`REG_FUNCTION_VALUE_P ({x})`
133 Nonzero in a ``reg`` if it is the place in which this function's
134 value is going to be returned. (This happens only in a hard
135 register.) Stored in the ``return_val`` field and printed as
138 .. index:: REG_POINTER, reg and /f, frame_related, in reg
140 :samp:`REG_POINTER ({x})`
141 Nonzero in a ``reg`` if the register holds a pointer. Stored in the
142 ``frame_related`` field and printed as :samp:`/f`.
144 .. index:: REG_USERVAR_P, reg and /v, volatil, in reg
146 :samp:`REG_USERVAR_P ({x})`
147 In a ``reg``, nonzero if it corresponds to a variable present in
148 the user's source code. Zero for temporaries generated internally by
149 the compiler. Stored in the ``volatil`` field and printed as
152 The same hard register may be used also for collecting the values of
153 functions called by this one, but ``REG_FUNCTION_VALUE_P`` is zero
156 .. index:: RTL_CONST_CALL_P, call_insn and /u, unchanging, in call_insn
158 :samp:`RTL_CONST_CALL_P ({x})`
159 In a ``call_insn`` indicates that the insn represents a call to a
160 const function. Stored in the ``unchanging`` field and printed as
163 .. index:: RTL_PURE_CALL_P, call_insn and /i, return_val, in call_insn
165 :samp:`RTL_PURE_CALL_P ({x})`
166 In a ``call_insn`` indicates that the insn represents a call to a
167 pure function. Stored in the ``return_val`` field and printed as
170 .. index:: RTL_CONST_OR_PURE_CALL_P, call_insn and /u or /i
172 :samp:`RTL_CONST_OR_PURE_CALL_P ({x})`
173 In a ``call_insn``, true if ``RTL_CONST_CALL_P`` or
174 ``RTL_PURE_CALL_P`` is true.
176 .. index:: RTL_LOOPING_CONST_OR_PURE_CALL_P, call_insn and /c, call, in call_insn
178 :samp:`RTL_LOOPING_CONST_OR_PURE_CALL_P ({x})`
179 In a ``call_insn`` indicates that the insn represents a possibly
180 infinite looping call to a const or pure function. Stored in the
181 ``call`` field and printed as :samp:`/c`. Only true if one of
182 ``RTL_CONST_CALL_P`` or ``RTL_PURE_CALL_P`` is true.
184 .. index:: RTX_FRAME_RELATED_P, insn and /f, call_insn and /f, jump_insn and /f, barrier and /f, set and /f, frame_related, in insn, call_insn, jump_insn, barrier, and set
186 :samp:`RTX_FRAME_RELATED_P ({x})`
187 Nonzero in an ``insn``, ``call_insn``, ``jump_insn``,
188 ``barrier``, or ``set`` which is part of a function prologue
189 and sets the stack pointer, sets the frame pointer, or saves a register.
190 This flag should also be set on an instruction that sets up a temporary
191 register to use in place of the frame pointer.
192 Stored in the ``frame_related`` field and printed as :samp:`/f`.
194 In particular, on RISC targets where there are limits on the sizes of
195 immediate constants, it is sometimes impossible to reach the register
196 save area directly from the stack pointer. In that case, a temporary
197 register is used that is near enough to the register save area, and the
198 Canonical Frame Address, i.e., DWARF2's logical frame pointer, register
199 must (temporarily) be changed to be this temporary register. So, the
200 instruction that sets this temporary register must be marked as
201 ``RTX_FRAME_RELATED_P``.
203 If the marked instruction is overly complex (defined in terms of what
204 ``dwarf2out_frame_debug_expr`` can handle), you will also have to
205 create a ``REG_FRAME_RELATED_EXPR`` note and attach it to the
206 instruction. This note should contain a simple expression of the
207 computation performed by this instruction, i.e., one that
208 ``dwarf2out_frame_debug_expr`` can handle.
210 This flag is required for exception handling support on targets with RTL
213 .. index:: SCHED_GROUP_P, insn and /s, call_insn and /s, jump_insn and /s, jump_table_data and /s, in_struct, in insn, call_insn, jump_insn and jump_table_data
215 :samp:`SCHED_GROUP_P ({x})`
216 During instruction scheduling, in an ``insn``, ``call_insn``,
217 ``jump_insn`` or ``jump_table_data``, indicates that the
218 previous insn must be scheduled together with this insn. This is used to
219 ensure that certain groups of instructions will not be split up by the
220 instruction scheduling pass, for example, ``use`` insns before
221 a ``call_insn`` may not be separated from the ``call_insn``.
222 Stored in the ``in_struct`` field and printed as :samp:`/s`.
224 .. index:: SET_IS_RETURN_P, insn and /j, jump, in insn
226 :samp:`SET_IS_RETURN_P ({x})`
227 For a ``set``, nonzero if it is for a return.
228 Stored in the ``jump`` field and printed as :samp:`/j`.
230 .. index:: SIBLING_CALL_P, call_insn and /j, jump, in call_insn
232 :samp:`SIBLING_CALL_P ({x})`
233 For a ``call_insn``, nonzero if the insn is a sibling call.
234 Stored in the ``jump`` field and printed as :samp:`/j`.
236 .. index:: STRING_POOL_ADDRESS_P, symbol_ref and /f, frame_related, in symbol_ref
238 :samp:`STRING_POOL_ADDRESS_P ({x})`
239 For a ``symbol_ref`` expression, nonzero if it addresses this function's
240 string constant pool.
241 Stored in the ``frame_related`` field and printed as :samp:`/f`.
243 .. index:: SUBREG_PROMOTED_UNSIGNED_P, subreg and /u and /v, unchanging, in subreg, volatil, in subreg
245 :samp:`SUBREG_PROMOTED_UNSIGNED_P ({x})`
246 Returns a value greater then zero for a ``subreg`` that has
247 ``SUBREG_PROMOTED_VAR_P`` nonzero if the object being referenced is kept
248 zero-extended, zero if it is kept sign-extended, and less then zero if it is
249 extended some other way via the ``ptr_extend`` instruction.
250 Stored in the ``unchanging``
251 field and ``volatil`` field, printed as :samp:`/u` and :samp:`/v`.
252 This macro may only be used to get the value it may not be used to change
253 the value. Use ``SUBREG_PROMOTED_UNSIGNED_SET`` to change the value.
255 .. index:: SUBREG_PROMOTED_UNSIGNED_SET, subreg and /u, unchanging, in subreg, volatil, in subreg
257 :samp:`SUBREG_PROMOTED_UNSIGNED_SET ({x})`
258 Set the ``unchanging`` and ``volatil`` fields in a ``subreg``
259 to reflect zero, sign, or other extension. If ``volatil`` is
260 zero, then ``unchanging`` as nonzero means zero extension and as
261 zero means sign extension. If ``volatil`` is nonzero then some
262 other type of extension was done via the ``ptr_extend`` instruction.
264 .. index:: SUBREG_PROMOTED_VAR_P, subreg and /s, in_struct, in subreg
266 :samp:`SUBREG_PROMOTED_VAR_P ({x})`
267 Nonzero in a ``subreg`` if it was made when accessing an object that
268 was promoted to a wider mode in accord with the ``PROMOTED_MODE`` machine
269 description macro (see :ref:`storage-layout`). In this case, the mode of
270 the ``subreg`` is the declared mode of the object and the mode of
271 ``SUBREG_REG`` is the mode of the register that holds the object.
272 Promoted variables are always either sign- or zero-extended to the wider
273 mode on every assignment. Stored in the ``in_struct`` field and
274 printed as :samp:`/s`.
276 .. index:: SYMBOL_REF_USED, used, in symbol_ref
278 :samp:`SYMBOL_REF_USED ({x})`
279 In a ``symbol_ref``, indicates that :samp:`{x}` has been used. This is
280 normally only used to ensure that :samp:`{x}` is only declared external
281 once. Stored in the ``used`` field.
283 .. index:: SYMBOL_REF_WEAK, symbol_ref and /i, return_val, in symbol_ref
285 :samp:`SYMBOL_REF_WEAK ({x})`
286 In a ``symbol_ref``, indicates that :samp:`{x}` has been declared weak.
287 Stored in the ``return_val`` field and printed as :samp:`/i`.
289 .. index:: SYMBOL_REF_FLAG, symbol_ref and /v, volatil, in symbol_ref
291 :samp:`SYMBOL_REF_FLAG ({x})`
292 In a ``symbol_ref``, this is used as a flag for machine-specific purposes.
293 Stored in the ``volatil`` field and printed as :samp:`/v`.
295 Most uses of ``SYMBOL_REF_FLAG`` are historic and may be subsumed
296 by ``SYMBOL_REF_FLAGS``. Certainly use of ``SYMBOL_REF_FLAGS``
297 is mandatory if the target requires more than one bit of storage.
299 These are the fields to which the above macros refer:
301 .. index:: call, /c in RTL dump
304 In a ``mem``, 1 means that the memory reference will not trap.
306 In a ``call``, 1 means that this pure or const call may possibly
309 In an RTL dump, this flag is represented as :samp:`/c`.
311 .. index:: frame_related, /f in RTL dump
314 In an ``insn`` or ``set`` expression, 1 means that it is part of
315 a function prologue and sets the stack pointer, sets the frame pointer,
316 saves a register, or sets up a temporary register to use in place of the
319 In ``reg`` expressions, 1 means that the register holds a pointer.
321 In ``mem`` expressions, 1 means that the memory reference holds a pointer.
323 In ``symbol_ref`` expressions, 1 means that the reference addresses
324 this function's string constant pool.
326 In an RTL dump, this flag is represented as :samp:`/f`.
328 .. index:: in_struct, /s in RTL dump
331 In ``reg`` expressions, it is 1 if the register has its entire life
332 contained within the test expression of some loop.
334 In ``subreg`` expressions, 1 means that the ``subreg`` is accessing
335 an object that has had its mode promoted from a wider mode.
337 In ``label_ref`` expressions, 1 means that the referenced label is
338 outside the innermost loop containing the insn in which the ``label_ref``
341 In ``code_label`` expressions, it is 1 if the label may never be deleted.
342 This is used for labels which are the target of non-local gotos. Such a
343 label that would have been deleted is replaced with a ``note`` of type
344 ``NOTE_INSN_DELETED_LABEL``.
346 In an ``insn`` during dead-code elimination, 1 means that the insn is
349 In an ``insn`` or ``jump_insn`` during reorg for an insn in the
350 delay slot of a branch,
351 1 means that this insn is from the target of the branch.
353 In an ``insn`` during instruction scheduling, 1 means that this insn
354 must be scheduled as part of a group together with the previous insn.
356 In an RTL dump, this flag is represented as :samp:`/s`.
358 .. index:: return_val, /i in RTL dump
361 In ``reg`` expressions, 1 means the register contains
362 the value to be returned by the current function. On
363 machines that pass parameters in registers, the same register number
364 may be used for parameters as well, but this flag is not set on such
367 In ``symbol_ref`` expressions, 1 means the referenced symbol is weak.
369 In ``call`` expressions, 1 means the call is pure.
371 In an RTL dump, this flag is represented as :samp:`/i`.
373 .. index:: jump, /j in RTL dump
376 In a ``mem`` expression, 1 means we should keep the alias set for this
377 mem unchanged when we access a component.
379 In a ``set``, 1 means it is for a return.
381 In a ``call_insn``, 1 means it is a sibling call.
383 In a ``jump_insn``, 1 means it is a crossing jump.
385 In an RTL dump, this flag is represented as :samp:`/j`.
387 .. index:: unchanging, /u in RTL dump
390 In ``reg`` and ``mem`` expressions, 1 means
391 that the value of the expression never changes.
393 In ``subreg`` expressions, it is 1 if the ``subreg`` references an
394 unsigned object whose mode has been promoted to a wider mode.
396 In an ``insn`` or ``jump_insn`` in the delay slot of a branch
397 instruction, 1 means an annulling branch should be used.
399 In a ``symbol_ref`` expression, 1 means that this symbol addresses
400 something in the per-function constant pool.
402 In a ``call_insn`` 1 means that this instruction is a call to a const
405 In an RTL dump, this flag is represented as :samp:`/u`.
410 This flag is used directly (without an access macro) at the end of RTL
411 generation for a function, to count the number of times an expression
412 appears in insns. Expressions that appear more than once are copied,
413 according to the rules for shared structure (see :ref:`sharing`).
415 For a ``reg``, it is used directly (without an access macro) by the
416 leaf register renumbering code to ensure that each register is only
419 In a ``symbol_ref``, it indicates that an external declaration for
420 the symbol has already been written.
422 .. index:: volatil, /v in RTL dump
426 .. index:: volatile memory references
428 In a ``mem``, ``asm_operands``, or ``asm_input``
429 expression, it is 1 if the memory
430 reference is volatile. Volatile memory references may not be deleted,
431 reordered or combined.
433 In a ``symbol_ref`` expression, it is used for machine-specific
436 In a ``reg`` expression, it is 1 if the value is a user-level variable.
437 0 indicates an internal compiler temporary.
439 In an ``insn``, 1 means the insn has been deleted.
441 In ``label_ref`` and ``reg_label`` expressions, 1 means a reference
442 to a non-local label.
444 In ``prefetch`` expressions, 1 means that the containing insn is a
447 In an RTL dump, this flag is represented as :samp:`/v`.