PREV UP NEXT Using and Porting GNU CC

14.3: Flags in an RTL Expression

RTL expressions contain several flags (one-bit bitfields) that are used in certain types of expression. Most often they are accessed with the following macros:

MEM_VOLATILE_P (x)
In mem expressions, nonzero for volatile memory references. Stored in the volatil field and printed as `/v'.
MEM_IN_STRUCT_P (x)
In mem expressions, 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. Stored in the in_struct field and printed as `/s'.
REG_LOOP_TEST_P
In reg expressions, nonzero if this register's entire life is contained in the exit test code for some loop. Stored in the in_struct field and printed as `/s'.
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 the volatil field and printed as `/v'.
REG_FUNCTION_VALUE_P (x)
Nonzero in a reg if it is the place in which this function's value is going to be returned. (This happens only in a hard register.) Stored in the integrated field and printed as `/i'.

The same hard register may be used also for collecting the values of functions called by this one, but REG_FUNCTION_VALUE_P is zero in this kind of use.

SUBREG_PROMOTED_VAR_P
Nonzero in a subreg if it was made when accessing an object that was promoted to a wider mode in accord with the PROMOTED_MODE machine description macro (see Storage Layout). In this case, the mode of the subreg is the declared mode of the object and the mode of SUBREG_REG is 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 the in_struct field and printed as `/s'.
SUBREG_PROMOTED_UNSIGNED_P
Nonzero in a subreg that has SUBREG_PROMOTED_VAR_P nonzero if the object being referenced is kept zero-extended and zero if it is kept sign-extended. Stored in the unchanging field and printed as `/u'.
RTX_UNCHANGING_P (x)
Nonzero in a reg or mem if the value is not changed. (This flag is not set for memory references via pointers to constants. Such pointers only guarantee that the object will not be changed explicitly by the current function. The object might be changed by other functions or by aliasing.) Stored in the unchanging field and printed as `/u'.
RTX_INTEGRATED_P (insn)
Nonzero in an insn if it resulted from an in-line function call. Stored in the integrated field and printed as `/i'. This may be deleted; nothing currently depends on it.
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 the used field.
SYMBOL_REF_FLAG (x)
In a symbol_ref, this is used as a flag for machine-specific purposes. Stored in the volatil field and printed as `/v'.
LABEL_OUTSIDE_LOOP_P
In label_ref expressions, nonzero if this is a reference to a label that is outside the innermost loop containing the reference to the label. Stored in the in_struct field and printed as `/s'.
INSN_DELETED_P (insn)
In an insn, nonzero if the insn has been deleted. Stored in the volatil field and printed as `/v'.
INSN_ANNULLED_BRANCH_P (insn)
In an insn in the delay slot of a branch insn, indicates that an annulling branch should be used. See the discussion under sequence below. Stored in the unchanging field and printed as `/u'.
INSN_FROM_TARGET_P (insn)
In an insn in a delay slot of a branch, indicates that the insn is from the target of the branch. If the branch insn has INSN_ANNULLED_BRANCH_P set, this insn should only be executed if the branch is taken. For annulled branches with this bit clear, the insn should be executed only if the branch is not taken. Stored in the in_struct field and printed as `/s'.
CONSTANT_POOL_ADDRESS_P (x)
Nonzero in a symbol_ref if it refers to part of the current function's ``constants pool''. These are addresses close to the beginning of the function, and GNU CC assumes they can be addressed directly (perhaps with the help of base registers). Stored in the unchanging field and printed as `/u'.
CONST_CALL_P (x)
In a call_insn, indicates that the insn represents a call to a const function. Stored in the unchanging field and printed as `/u'.
LABEL_PRESERVE_P (x)
In a code_label, indicates that the label can never be deleted. Labels referenced by a non-local goto will have this bit set. Stored in the in_struct field and printed as `/s'.
SCHED_GROUP_P (insn)
During instruction scheduling, in an 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, use insns before a call_insn may not be separated from the call_insn. Stored in the in_struct field and printed as `/s'.

These are the fields which the above macros refer to:

used
Normally, this flag is used only momentarily, 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).

In a symbol_ref, it indicates that an external declaration for the symbol has already been written.

In a reg, it is used by the leaf register renumbering code to ensure that each register is only renumbered once.

volatil
This flag is used in mem, symbol_ref and reg expressions and in insns. In RTL dump files, it is printed as `/v'.

In a mem expression, it is 1 if the memory reference is volatile. Volatile memory references may not be deleted, reordered or combined.

In a symbol_ref expression, it is used for machine-specific purposes.

In a reg expression, 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_struct
In mem expressions, 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 an insn in the delay slot of a branch, 1 means that this insn is from the target of the branch.

During instruction scheduling, in an insn, 1 means that this insn must be scheduled as part of a group together with the previous insn.

In reg expressions, it is 1 if the register has its entire life contained within the test expression of some loop.

In subreg expressions, 1 means that the subreg is accessing an object that has had its mode promoted from a wider mode.

In label_ref expressions, 1 means that the referenced label is outside the innermost loop containing the insn in which the label_ref was found.

In code_label expressions, it is 1 if the label may never be deleted. This is used for labels which are the target of non-local gotos.

In an RTL dump, this flag is represented as `/s'.

unchanging
In reg and mem expressions, 1 means that the value of the expression never changes.

In subreg expressions, it is 1 if the subreg references an unsigned object whose mode has been promoted to a wider mode.

In an insn, 1 means that this is an annulling branch.

In a symbol_ref expression, 1 means that this symbol addresses something in the per-function constants pool.

In a call_insn, 1 means that this instruction is a call to a const function.

In an RTL dump, this flag is represented as `/u'.

integrated
In some kinds of expressions, including insns, this flag means the rtl was produced by procedure integration.

In a reg expression, this flag indicates the register containing 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.