📄 rtl.texi
字号:
In @code{reg} and @code{mem} expressions, 1 means
that the value of the expression never changes.
In @code{subreg} expressions, it is 1 if the @code{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 @code{symbol_ref} expression, 1 means that this symbol addresses
something in the per-function constants pool.
In a @code{call_insn}, 1 means that this instruction is a call to a
const function.
In an RTL dump, this flag is represented as @samp{/u}.
@findex integrated
@item integrated
In some kinds of expressions, including insns, this flag means the
rtl was produced by procedure integration.
In a @code{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.
@end table
@node Machine Modes
@section Machine Modes
@cindex machine modes
@findex enum machine_mode
A machine mode describes a size of data object and the representation used
for it. In the C code, machine modes are represented by an enumeration
type, @code{enum machine_mode}, defined in @file{machmode.def}. Each RTL
expression has room for a machine mode and so do certain kinds of tree
expressions (declarations and types, to be precise).
In debugging dumps and machine descriptions, the machine mode of an RTL
expression is written after the expression code with a colon to separate
them. The letters @samp{mode} which appear at the end of each machine mode
name are omitted. For example, @code{(reg:SI 38)} is a @code{reg}
expression with machine mode @code{SImode}. If the mode is
@code{VOIDmode}, it is not written at all.
Here is a table of machine modes. The term ``byte'' below refers to an
object of @code{BITS_PER_UNIT} bits (@pxref{Storage Layout}).
@table @code
@findex BImode
@item BImode
``Bit'' mode represents a single bit, for predicate registers.
@findex QImode
@item QImode
``Quarter-Integer'' mode represents a single byte treated as an integer.
@findex HImode
@item HImode
``Half-Integer'' mode represents a two-byte integer.
@findex PSImode
@item PSImode
``Partial Single Integer'' mode represents an integer which occupies
four bytes but which doesn't really use all four. On some machines,
this is the right mode to use for pointers.
@findex SImode
@item SImode
``Single Integer'' mode represents a four-byte integer.
@findex PDImode
@item PDImode
``Partial Double Integer'' mode represents an integer which occupies
eight bytes but which doesn't really use all eight. On some machines,
this is the right mode to use for certain pointers.
@findex DImode
@item DImode
``Double Integer'' mode represents an eight-byte integer.
@findex TImode
@item TImode
``Tetra Integer'' (?) mode represents a sixteen-byte integer.
@findex OImode
@item OImode
``Octa Integer'' (?) mode represents a thirty-two-byte integer.
@findex SFmode
@item SFmode
``Single Floating'' mode represents a single-precision (four byte) floating
point number.
@findex DFmode
@item DFmode
``Double Floating'' mode represents a double-precision (eight byte) floating
point number.
@findex XFmode
@item XFmode
``Extended Floating'' mode represents a triple-precision (twelve byte)
floating point number. This mode is used for IEEE extended floating
point. On some systems not all bits within these bytes will actually
be used.
@findex TFmode
@item TFmode
``Tetra Floating'' mode represents a quadruple-precision (sixteen byte)
floating point number.
@findex CCmode
@item CCmode
``Condition Code'' mode represents the value of a condition code, which
is a machine-specific set of bits used to represent the result of a
comparison operation. Other machine-specific modes may also be used for
the condition code. These modes are not used on machines that use
@code{cc0} (see @pxref{Condition Code}).
@findex BLKmode
@item BLKmode
``Block'' mode represents values that are aggregates to which none of
the other modes apply. In RTL, only memory references can have this mode,
and only if they appear in string-move or vector instructions. On machines
which have no such instructions, @code{BLKmode} will not appear in RTL.
@findex VOIDmode
@item VOIDmode
Void mode means the absence of a mode or an unspecified mode.
For example, RTL expressions of code @code{const_int} have mode
@code{VOIDmode} because they can be taken to have whatever mode the context
requires. In debugging dumps of RTL, @code{VOIDmode} is expressed by
the absence of any mode.
@findex SCmode
@findex DCmode
@findex XCmode
@findex TCmode
@item SCmode, DCmode, XCmode, TCmode
These modes stand for a complex number represented as a pair of floating
point values. The floating point values are in @code{SFmode},
@code{DFmode}, @code{XFmode}, and @code{TFmode}, respectively.
@findex CQImode
@findex CHImode
@findex CSImode
@findex CDImode
@findex CTImode
@findex COImode
@item CQImode, CHImode, CSImode, CDImode, CTImode, COImode
These modes stand for a complex number represented as a pair of integer
values. The integer values are in @code{QImode}, @code{HImode},
@code{SImode}, @code{DImode}, @code{TImode}, and @code{OImode},
respectively.
@end table
The machine description defines @code{Pmode} as a C macro which expands
into the machine mode used for addresses. Normally this is the mode
whose size is @code{BITS_PER_WORD}, @code{SImode} on 32-bit machines.
The only modes which a machine description @i{must} support are
@code{QImode}, and the modes corresponding to @code{BITS_PER_WORD},
@code{FLOAT_TYPE_SIZE} and @code{DOUBLE_TYPE_SIZE}.
The compiler will attempt to use @code{DImode} for 8-byte structures and
unions, but this can be prevented by overriding the definition of
@code{MAX_FIXED_MODE_SIZE}. Alternatively, you can have the compiler
use @code{TImode} for 16-byte structures and unions. Likewise, you can
arrange for the C type @code{short int} to avoid using @code{HImode}.
@cindex mode classes
Very few explicit references to machine modes remain in the compiler and
these few references will soon be removed. Instead, the machine modes
are divided into mode classes. These are represented by the enumeration
type @code{enum mode_class} defined in @file{machmode.h}. The possible
mode classes are:
@table @code
@findex MODE_INT
@item MODE_INT
Integer modes. By default these are @code{QImode}, @code{HImode},
@code{SImode}, @code{DImode}, and @code{TImode}.
@findex MODE_PARTIAL_INT
@item MODE_PARTIAL_INT
The ``partial integer'' modes, @code{PSImode} and @code{PDImode}.
@findex MODE_FLOAT
@item MODE_FLOAT
floating point modes. By default these are @code{SFmode}, @code{DFmode},
@code{XFmode} and @code{TFmode}.
@findex MODE_COMPLEX_INT
@item MODE_COMPLEX_INT
Complex integer modes. (These are not currently implemented).
@findex MODE_COMPLEX_FLOAT
@item MODE_COMPLEX_FLOAT
Complex floating point modes. By default these are @code{SCmode},
@code{DCmode}, @code{XCmode}, and @code{TCmode}.
@findex MODE_FUNCTION
@item MODE_FUNCTION
Algol or Pascal function variables including a static chain.
(These are not currently implemented).
@findex MODE_CC
@item MODE_CC
Modes representing condition code values. These are @code{CCmode} plus
any modes listed in the @code{EXTRA_CC_MODES} macro. @xref{Jump Patterns},
also see @ref{Condition Code}.
@findex MODE_RANDOM
@item MODE_RANDOM
This is a catchall mode class for modes which don't fit into the above
classes. Currently @code{VOIDmode} and @code{BLKmode} are in
@code{MODE_RANDOM}.
@end table
Here are some C macros that relate to machine modes:
@table @code
@findex GET_MODE
@item GET_MODE (@var{x})
Returns the machine mode of the RTX @var{x}.
@findex PUT_MODE
@item PUT_MODE (@var{x}, @var{newmode})
Alters the machine mode of the RTX @var{x} to be @var{newmode}.
@findex NUM_MACHINE_MODES
@item NUM_MACHINE_MODES
Stands for the number of machine modes available on the target
machine. This is one greater than the largest numeric value of any
machine mode.
@findex GET_MODE_NAME
@item GET_MODE_NAME (@var{m})
Returns the name of mode @var{m} as a string.
@findex GET_MODE_CLASS
@item GET_MODE_CLASS (@var{m})
Returns the mode class of mode @var{m}.
@findex GET_MODE_WIDER_MODE
@item GET_MODE_WIDER_MODE (@var{m})
Returns the next wider natural mode. For example, the expression
@code{GET_MODE_WIDER_MODE (QImode)} returns @code{HImode}.
@findex GET_MODE_SIZE
@item GET_MODE_SIZE (@var{m})
Returns the size in bytes of a datum of mode @var{m}.
@findex GET_MODE_BITSIZE
@item GET_MODE_BITSIZE (@var{m})
Returns the size in bits of a datum of mode @var{m}.
@findex GET_MODE_MASK
@item GET_MODE_MASK (@var{m})
Returns a bitmask containing 1 for all bits in a word that fit within
mode @var{m}. This macro can only be used for modes whose bitsize is
less than or equal to @code{HOST_BITS_PER_INT}.
@findex GET_MODE_ALIGNMENT
@item GET_MODE_ALIGNMENT (@var{m})
Return the required alignment, in bits, for an object of mode @var{m}.
@findex GET_MODE_UNIT_SIZE
@item GET_MODE_UNIT_SIZE (@var{m})
Returns the size in bytes of the subunits of a datum of mode @var{m}.
This is the same as @code{GET_MODE_SIZE} except in the case of complex
modes. For them, the unit size is the size of the real or imaginary
part.
@findex GET_MODE_NUNITS
@item GET_MODE_NUNITS (@var{m})
Returns the number of units contained in a mode, i.e.,
@code{GET_MODE_SIZE} divided by @code{GET_MODE_UNIT_SIZE}.
@findex GET_CLASS_NARROWEST_MODE
@item GET_CLASS_NARROWEST_MODE (@var{c})
Returns the narrowest mode in mode class @var{c}.
@end table
@findex byte_mode
@findex word_mode
The global variables @code{byte_mode} and @code{word_mode} contain modes
whose classes are @code{MODE_INT} and whose bitsizes are either
@code{BITS_PER_UNIT} or @code{BITS_PER_WORD}, respectively. On 32-bit
machines, these are @code{QImode} and @code{SImode}, respectively.
@node Constants
@section Constant Expression Types
@cindex RTL constants
@cindex RTL constant expression types
The simplest RTL expressions are those that represent constant values.
@table @code
@findex const_int
@item (const_int @var{i})
This type of expression represents the integer value @var{i}. @var{i}
is customarily accessed with the macro @code{INTVAL} as in
@code{INTVAL (@var{exp})}, which is equivalent to @code{XWINT (@var{exp}, 0)}.
@findex const0_rtx
@findex const1_rtx
@findex const2_rtx
@findex constm1_rtx
There is only one expression object for the integer value zero; it is
the value of the variable @code{const0_rtx}. Likewise, the only
expression for integer value one is found in @code{const1_rtx}, the only
expression for integer value two is found in @code{const2_rtx}, and the
only expression for integer value negative one is found in
@code{constm1_rtx}. Any attempt to create an expression of code
@code{const_int} and value zero, one, two or negative one will return
@code{const0_rtx}, @code{const1_rtx}, @code{const2_rtx} or
@code{constm1_rtx} as appropriate.@refill
@findex const_true_rtx
Similarly, there is only one object for the integer whose value is
@code{STORE_FLAG_VALUE}. It is found in @code{const_true_rtx}. If
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -