GNU Compiler Collection (GCC) Internals: Constants |
---|
Next: Regs and Memory, Previous: Machine Modes, Up: RTL [Contents][Index]
The simplest RTL expressions are those that represent constant values.
(const_int i)
This type of expression represents the integer value i. i
is customarily accessed with the macro INTVAL
as in
INTVAL (exp)
, which is equivalent to XWINT (exp, 0)
.
Constants generated for modes with fewer bits than in
HOST_WIDE_INT
must be sign extended to full width (e.g., with
gen_int_mode
). For constants for modes with more bits than in
HOST_WIDE_INT
the implied high order bits of that constant are
copies of the top bit. Note however that values are neither
inherently signed nor inherently unsigned; where necessary, signedness
is determined by the rtl operation instead.
There is only one expression object for the integer value zero; it is
the value of the variable const0_rtx
. Likewise, the only
expression for integer value one is found in const1_rtx
, the only
expression for integer value two is found in const2_rtx
, and the
only expression for integer value negative one is found in
constm1_rtx
. Any attempt to create an expression of code
const_int
and value zero, one, two or negative one will return
const0_rtx
, const1_rtx
, const2_rtx
or
constm1_rtx
as appropriate.
Similarly, there is only one object for the integer whose value is
STORE_FLAG_VALUE
. It is found in const_true_rtx
. If
STORE_FLAG_VALUE
is one, const_true_rtx
and
const1_rtx
will point to the same object. If
STORE_FLAG_VALUE
is -1, const_true_rtx
and
constm1_rtx
will point to the same object.
(const_double:m i0 i1 …)
This represents either a floating-point constant of mode m or
(on older ports that do not define
TARGET_SUPPORTS_WIDE_INT
) an integer constant too large to fit
into HOST_BITS_PER_WIDE_INT
bits but small enough to fit within
twice that number of bits. In the latter case, m will be
VOIDmode
. For integral values constants for modes with more
bits than twice the number in HOST_WIDE_INT
the implied high
order bits of that constant are copies of the top bit of
CONST_DOUBLE_HIGH
. Note however that integral values are
neither inherently signed nor inherently unsigned; where necessary,
signedness is determined by the rtl operation instead.
On more modern ports, CONST_DOUBLE
only represents floating
point values. New ports define TARGET_SUPPORTS_WIDE_INT
to
make this designation.
If m is VOIDmode
, the bits of the value are stored in
i0 and i1. i0 is customarily accessed with the macro
CONST_DOUBLE_LOW
and i1 with CONST_DOUBLE_HIGH
.
If the constant is floating point (regardless of its precision), then
the number of integers used to store the value depends on the size of
REAL_VALUE_TYPE
(see Floating Point). The integers
represent a floating point number, but not precisely in the target
machine’s or host machine’s floating point format. To convert them to
the precise bit pattern used by the target machine, use the macro
REAL_VALUE_TO_TARGET_DOUBLE
and friends (see Data Output).
(const_wide_int:m nunits elt0 …)
This contains an array of HOST_WIDE_INT
s that is large enough
to hold any constant that can be represented on the target. This form
of rtl is only used on targets that define
TARGET_SUPPORTS_WIDE_INT
to be nonzero and then
CONST_DOUBLE
s are only used to hold floating-point values. If
the target leaves TARGET_SUPPORTS_WIDE_INT
defined as 0,
CONST_WIDE_INT
s are not used and CONST_DOUBLE
s are as
they were before.
The values are stored in a compressed format. The higher-order 0s or -1s are not represented if they are just the logical sign extension of the number that is represented.
CONST_WIDE_INT_VEC (code)
Returns the entire array of HOST_WIDE_INT
s that are used to
store the value. This macro should be rarely used.
CONST_WIDE_INT_NUNITS (code)
The number of HOST_WIDE_INT
s used to represent the number.
Note that this generally is smaller than the number of
HOST_WIDE_INT
s implied by the mode size.
CONST_WIDE_INT_NUNITS (code,i)
Returns the i
th element of the array. Element 0 is contains
the low order bits of the constant.
(const_fixed:m …)
Represents a fixed-point constant of mode m.
The operand is a data structure of type struct fixed_value
and
is accessed with the macro CONST_FIXED_VALUE
. The high part of
data is accessed with CONST_FIXED_VALUE_HIGH
; the low part is
accessed with CONST_FIXED_VALUE_LOW
.
(const_vector:m [x0 x1 …])
Represents a vector constant. The square brackets stand for the vector
containing the constant elements. x0, x1 and so on are
the const_int
, const_double
or const_fixed
elements.
The number of units in a const_vector
is obtained with the macro
CONST_VECTOR_NUNITS
as in CONST_VECTOR_NUNITS (v)
.
Individual elements in a vector constant are accessed with the macro
CONST_VECTOR_ELT
as in CONST_VECTOR_ELT (v, n)
where v is the vector constant and n is the element
desired.
(const_string str)
Represents a constant string with value str. Currently this is used only for insn attributes (see Insn Attributes) since constant strings in C are placed in memory.
(symbol_ref:mode symbol)
Represents the value of an assembler label for data. symbol is a string that describes the name of the assembler label. If it starts with a ‘*’, the label is the rest of symbol not including the ‘*’. Otherwise, the label is symbol, usually prefixed with ‘_’.
The symbol_ref
contains a mode, which is usually Pmode
.
Usually that is the only mode for which a symbol is directly valid.
(label_ref:mode label)
Represents the value of an assembler label for code. It contains one
operand, an expression, which must be a code_label
or a note
of type NOTE_INSN_DELETED_LABEL
that appears in the instruction
sequence to identify the place where the label should go.
The reason for using a distinct expression type for code label references is so that jump optimization can distinguish them.
The label_ref
contains a mode, which is usually Pmode
.
Usually that is the only mode for which a label is directly valid.
(const:m exp)
Represents a constant that is the result of an assembly-time
arithmetic computation. The operand, exp, is an expression that
contains only constants (const_int
, symbol_ref
and
label_ref
expressions) combined with plus
and
minus
. However, not all combinations are valid, since the
assembler cannot do arbitrary arithmetic on relocatable symbols.
m should be Pmode
.
(high:m exp)
Represents the high-order bits of exp, usually a
symbol_ref
. The number of bits is machine-dependent and is
normally the number of bits specified in an instruction that initializes
the high order bits of a register. It is used with lo_sum
to
represent the typical two-instruction sequence used in RISC machines to
reference a global memory location.
m should be Pmode
.
The macro CONST0_RTX (mode)
refers to an expression with
value 0 in mode mode. If mode mode is of mode class
MODE_INT
, it returns const0_rtx
. If mode mode is of
mode class MODE_FLOAT
, it returns a CONST_DOUBLE
expression in mode mode. Otherwise, it returns a
CONST_VECTOR
expression in mode mode. Similarly, the macro
CONST1_RTX (mode)
refers to an expression with value 1 in
mode mode and similarly for CONST2_RTX
. The
CONST1_RTX
and CONST2_RTX
macros are undefined
for vector modes.
Next: Regs and Memory, Previous: Machine Modes, Up: RTL [Contents][Index]