Next: Machine Modes, Previous: Special Accessors, Up: RTL
12.5 Flags in an RTL Expression
RTL expressions contain several flags (one-bit bit-fields) that are used in certain types of expression. Most often they are accessed with the following macros, which expand into lvalues.
CONSTANT_POOL_ADDRESS_P (x)- Nonzero in a
symbol_refif it refers to part of the current function's constant pool. For most targets these addresses are in a.rodatasection entirely separate from the function, but for some targets the addresses are close to the beginning of the function. In either case GCC assumes these addresses can be addressed directly, perhaps with the help of base registers. Stored in theunchangingfield and printed as `/u'. CONST_OR_PURE_CALL_P (x)- In a
call_insn,note, or anexpr_listfor notes, indicates that the insn represents a call to a const or pure function. Stored in theunchangingfield and printed as `/u'. INSN_ANNULLED_BRANCH_P (x)- In a
jump_insn,call_insn, orinsnindicates that the branch is an annulling one. See the discussion undersequencebelow. Stored in theunchangingfield and printed as `/u'. INSN_DELETED_P (x)- In an
insn,call_insn,jump_insn,code_label,barrier, ornote, nonzero if the insn has been deleted. Stored in thevolatilfield and printed as `/v'. INSN_FROM_TARGET_P (x)- In an
insnorjump_insnorcall_insnin a delay slot of a branch, indicates that the insn is from the target of the branch. If the branch insn hasINSN_ANNULLED_BRANCH_Pset, this insn will only be executed if the branch is taken. For annulled branches withINSN_FROM_TARGET_Pclear, the insn will be executed only if the branch is not taken. WhenINSN_ANNULLED_BRANCH_Pis not set, this insn will always be executed. Stored in thein_structfield and printed as `/s'. LABEL_PRESERVE_P (x)- In a
code_labelornote, indicates that the label is referenced by code or data not visible to the RTL of a given function. Labels referenced by a non-local goto will have this bit set. Stored in thein_structfield and printed as `/s'. LABEL_REF_NONLOCAL_P (x)- In
label_refandreg_labelexpressions, nonzero if this is a reference to a non-local label. Stored in thevolatilfield and printed as `/v'. MEM_IN_STRUCT_P (x)- In
memexpressions, nonzero for reference to an entire structure, union or array, or to a component of one. Zero for references to a scalar variable or through a pointer to a scalar. If both this flag andMEM_SCALAR_Pare clear, then we don't know whether thismemis in a structure or not. Both flags should never be simultaneously set. Stored in thein_structfield and printed as `/s'. MEM_KEEP_ALIAS_SET_P (x)- In
memexpressions, 1 if we should keep the alias set for this mem unchanged when we access a component. Set to 1, for example, when we are already in a non-addressable component of an aggregate. Stored in thejumpfield and printed as `/j'. MEM_SCALAR_P (x)- In
memexpressions, nonzero for reference to a scalar known not to be a member of a structure, union, or array. Zero for such references and for indirections through pointers, even pointers pointing to scalar types. If both this flag andMEM_IN_STRUCT_Pare clear, then we don't know whether thismemis in a structure or not. Both flags should never be simultaneously set. Stored in theframe_relatedfield and printed as `/f'. MEM_VOLATILE_P (x)- In
mem,asm_operands, andasm_inputexpressions, nonzero for volatile memory references. Stored in thevolatilfield and printed as `/v'. MEM_NOTRAP_P (x)- In
mem, nonzero for memory references that will not trap. Stored in thecallfield and printed as `/c'. REG_FUNCTION_VALUE_P (x)- Nonzero in a
regif it is the place in which this function's value is going to be returned. (This happens only in a hard register.) Stored in theintegratedfield and printed as `/i'. REG_POINTER (x)- Nonzero in a
regif the register holds a pointer. Stored in theframe_relatedfield and printed as `/f'. REG_USERVAR_P (x)- In a
reg, nonzero if it corresponds to a variable present in the user's source code. Zero for temporaries generated internally by the compiler. Stored in thevolatilfield and printed as `/v'.The same hard register may be used also for collecting the values of functions called by this one, but
REG_FUNCTION_VALUE_Pis zero in this kind of use. RTX_FRAME_RELATED_P (x)- Nonzero in an
insn,call_insn,jump_insn,barrier, orsetwhich is part of a function prologue and sets the stack pointer, sets the frame pointer, or saves a register. This flag should also be set on an instruction that sets up a temporary register to use in place of the frame pointer. Stored in theframe_relatedfield and printed as `/f'.In particular, on RISC targets where there are limits on the sizes of immediate constants, it is sometimes impossible to reach the register save area directly from the stack pointer. In that case, a temporary register is used that is near enough to the register save area, and the Canonical Frame Address, i.e., DWARF2's logical frame pointer, register must (temporarily) be changed to be this temporary register. So, the instruction that sets this temporary register must be marked as
RTX_FRAME_RELATED_P.If the marked instruction is overly complex (defined in terms of what
dwarf2out_frame_debug_exprcan handle), you will also have to create aREG_FRAME_RELATED_EXPRnote and attach it to the instruction. This note should contain a simple expression of the computation performed by this instruction, i.e., one thatdwarf2out_frame_debug_exprcan handle.This flag is required for exception handling support on targets with RTL prologues.
code_label,insn_list,const, ornoteif it resulted from an in-line function call. Stored in theintegratedfield and printed as `/i'. MEM_READONLY_P (x)- Nonzero in a
mem, if the memory is statically allocated and read-only.Read-only in this context means never modified during the lifetime of the program, not necessarily in ROM or in write-disabled pages. A common example of the later is a shared library's global offset table. This table is initialized by the runtime loader, so the memory is technically writable, but after control is transfered from the runtime loader to the application, this memory will never be subsequently modified.
Stored in the
unchangingfield and printed as `/u'. SCHED_GROUP_P (x)- During instruction scheduling, in an
insn,call_insnorjump_insn, indicates that the previous insn must be scheduled together with this insn. This is used to ensure that certain groups of instructions will not be split up by the instruction scheduling pass, for example,useinsns before acall_insnmay not be separated from thecall_insn. Stored in thein_structfield and printed as `/s'. SET_IS_RETURN_P (x)- For a
set, nonzero if it is for a return. Stored in thejumpfield and printed as `/j'. SIBLING_CALL_P (x)- For a
call_insn, nonzero if the insn is a sibling call. Stored in thejumpfield and printed as `/j'. STRING_POOL_ADDRESS_P (x)- For a
symbol_refexpression, nonzero if it addresses this function's string constant pool. Stored in theframe_relatedfield and printed as `/f'. SUBREG_PROMOTED_UNSIGNED_P (x)- Returns a value greater then zero for a
subregthat hasSUBREG_PROMOTED_VAR_Pnonzero if the object being referenced is kept zero-extended, zero if it is kept sign-extended, and less then zero if it is extended some other way via theptr_extendinstruction. Stored in theunchangingfield andvolatilfield, printed as `/u' and `/v'. This macro may only be used to get the value it may not be used to change the value. UseSUBREG_PROMOTED_UNSIGNED_SETto change the value. SUBREG_PROMOTED_UNSIGNED_SET (x)- Set the
unchangingandvolatilfields in asubregto reflect zero, sign, or other extension. Ifvolatilis zero, thenunchangingas nonzero means zero extension and as zero means sign extension. Ifvolatilis nonzero then some other type of extension was done via theptr_extendinstruction. SUBREG_PROMOTED_VAR_P (x)- Nonzero in a
subregif it was made when accessing an object that was promoted to a wider mode in accord with thePROMOTED_MODEmachine description macro (see Storage Layout). In this case, the mode of thesubregis the declared mode of the object and the mode ofSUBREG_REGis the mode of the register that holds the object. Promoted variables are always either sign- or zero-extended to the wider mode on every assignment. Stored in thein_structfield and printed as `/s'. SYMBOL_REF_USED (x)- In a
symbol_ref, indicates that x has been used. This is normally only used to ensure that x is only declared external once. Stored in theusedfield. SYMBOL_REF_WEAK (x)- In a
symbol_ref, indicates that x has been declared weak. Stored in theintegratedfield and printed as `/i'. SYMBOL_REF_FLAG (x)- In a
symbol_ref, this is used as a flag for machine-specific purposes. Stored in thevolatilfield and printed as `/v'.Most uses of
SYMBOL_REF_FLAGare historic and may be subsumed bySYMBOL_REF_FLAGS. Certainly use ofSYMBOL_REF_FLAGSis mandatory if the target requires more than one bit of storage.
These are the fields to which the above macros refer:
call- In a
mem, 1 means that the memory reference will not trap.In an RTL dump, this flag is represented as `/c'.
frame_related- In an
insnorsetexpression, 1 means that it is part of a function prologue and sets the stack pointer, sets the frame pointer, saves a register, or sets up a temporary register to use in place of the frame pointer.In
regexpressions, 1 means that the register holds a pointer.In
symbol_refexpressions, 1 means that the reference addresses this function's string constant pool.In
memexpressions, 1 means that the reference is to a scalar.In an RTL dump, this flag is represented as `/f'.
in_struct- In
memexpressions, it is 1 if the memory datum referred to is all or part of a structure or array; 0 if it is (or might be) a scalar variable. A reference through a C pointer has 0 because the pointer might point to a scalar variable. This information allows the compiler to determine something about possible cases of aliasing.In
regexpressions, it is 1 if the register has its entire life contained within the test expression of some loop.In
subregexpressions, 1 means that thesubregis accessing an object that has had its mode promoted from a wider mode.In
label_refexpressions, 1 means that the referenced label is outside the innermost loop containing the insn in which thelabel_refwas found.In
code_labelexpressions, it is 1 if the label may never be deleted. This is used for labels which are the target of non-local gotos. Such a label that would have been deleted is replaced with anoteof typeNOTE_INSN_DELETED_LABEL.In an
insnduring dead-code elimination, 1 means that the insn is dead code.In an
insnorjump_insnduring reorg for an insn in the delay slot of a branch, 1 means that this insn is from the target of the branch.In an
insnduring instruction scheduling, 1 means that this insn must be scheduled as part of a group together with the previous insn.In an RTL dump, this flag is represented as `/s'.
integrated- In an
insn,insn_list, orconst, 1 means the RTL was produced by procedure integration.In
regexpressions, 1 means the register contains the value to be returned by the current function. On machines that pass parameters in registers, the same register number may be used for parameters as well, but this flag is not set on such uses.In
symbol_refexpressions, 1 means the referenced symbol is weak.In an RTL dump, this flag is represented as `/i'.
jump- In a
memexpression, 1 means we should keep the alias set for this mem unchanged when we access a component.In a
set, 1 means it is for a return.In a
call_insn, 1 means it is a sibling call.In an RTL dump, this flag is represented as `/j'.
unchanging- In
regandmemexpressions, 1 means that the value of the expression never changes.In
subregexpressions, it is 1 if thesubregreferences an unsigned object whose mode has been promoted to a wider mode.In an
insnorjump_insnin the delay slot of a branch instruction, 1 means an annulling branch should be used.In a
symbol_refexpression, 1 means that this symbol addresses something in the per-function constant pool.In a
call_insn,note, or anexpr_listof notes, 1 means that this instruction is a call to a const or pure function.In an RTL dump, this flag is represented as `/u'.
used- This flag is used directly (without an access macro) at the end of RTL
generation for a function, to count the number of times an expression
appears in insns. Expressions that appear more than once are copied,
according to the rules for shared structure (see Sharing).
For a
reg, it is used directly (without an access macro) by the leaf register renumbering code to ensure that each register is only renumbered once.In a
symbol_ref, it indicates that an external declaration for the symbol has already been written. volatil- In a
mem,asm_operands, orasm_inputexpression, it is 1 if the memory reference is volatile. Volatile memory references may not be deleted, reordered or combined.In a
symbol_refexpression, it is used for machine-specific purposes.In a
regexpression, it is 1 if the value is a user-level variable. 0 indicates an internal compiler temporary.In an
insn, 1 means the insn has been deleted.In
label_refandreg_labelexpressions, 1 means a reference to a non-local label.In an RTL dump, this flag is represented as `/v'.