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, enum machine_mode
, defined in `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 `mode' which appear at the end of each machine mode
name are omitted. For example, (reg:SI 38)
is a reg
expression with machine mode SImode
. If the mode is
VOIDmode
, it is not written at all.
Here is a table of machine modes. The term "byte" below refers to an
object of BITS_PER_UNIT
bits (see section Storage Layout).
QImode
HImode
PSImode
SImode
PDImode
DImode
TImode
SFmode
DFmode
XFmode
TFmode
CCmode
cc0
(see see section Condition Code Status).
BLKmode
BLKmode
will not appear in RTL.
VOIDmode
const_int
have mode
VOIDmode
because they can be taken to have whatever mode the context
requires. In debugging dumps of RTL, VOIDmode
is expressed by
the absence of any mode.
SCmode, DCmode, XCmode, TCmode
SFmode
,
DFmode
, XFmode
, and TFmode
, respectively.
CQImode, CHImode, CSImode, CDImode, CTImode, COImode
QImode
, HImode
,
SImode
, DImode
, TImode
, and OImode
,
respectively.
The machine description defines Pmode
as a C macro which expands
into the machine mode used for addresses. Normally this is the mode
whose size is BITS_PER_WORD
, SImode
on 32-bit machines.
The only modes which a machine description must support are
QImode
, and the modes corresponding to BITS_PER_WORD
,
FLOAT_TYPE_SIZE
and DOUBLE_TYPE_SIZE
.
The compiler will attempt to use DImode
for 8-byte structures and
unions, but this can be prevented by overriding the definition of
MAX_FIXED_MODE_SIZE
. Alternatively, you can have the compiler
use TImode
for 16-byte structures and unions. Likewise, you can
arrange for the C type short int
to avoid using HImode
.
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 enum mode_class
defined in `machmode.h'. The possible
mode classes are:
MODE_INT
QImode
, HImode
,
SImode
, DImode
, and TImode
.
MODE_PARTIAL_INT
PSImode
and PDImode
.
MODE_FLOAT
SFmode
, DFmode
,
XFmode
and TFmode
.
MODE_COMPLEX_INT
MODE_COMPLEX_FLOAT
SCmode
,
DCmode
, XCmode
, and TCmode
.
MODE_FUNCTION
MODE_CC
CCmode
plus
any modes listed in the EXTRA_CC_MODES
macro. See section Defining Jump Instruction Patterns,
also see section Condition Code Status.
MODE_RANDOM
VOIDmode
and BLKmode
are in
MODE_RANDOM
.
Here are some C macros that relate to machine modes:
GET_MODE (x)
PUT_MODE (x, newmode)
NUM_MACHINE_MODES
GET_MODE_NAME (m)
GET_MODE_CLASS (m)
GET_MODE_WIDER_MODE (m)
GET_MODE_WIDER_MODE (QImode)
returns HImode
.
GET_MODE_SIZE (m)
GET_MODE_BITSIZE (m)
GET_MODE_MASK (m)
HOST_BITS_PER_INT
.
GET_MODE_ALIGNMENT (m))
GET_MODE_UNIT_SIZE (m)
GET_MODE_SIZE
except in the case of complex
modes. For them, the unit size is the size of the real or imaginary
part.
GET_MODE_NUNITS (m)
GET_MODE_SIZE
divided by GET_MODE_UNIT_SIZE
.
GET_CLASS_NARROWEST_MODE (c)
The global variables byte_mode
and word_mode
contain modes
whose classes are MODE_INT
and whose bitsizes are either
BITS_PER_UNIT
or BITS_PER_WORD
, respectively. On 32-bit
machines, these are QImode
and SImode
, respectively.
Go to the first, previous, next, last section, table of contents.