[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

19.5 Machine Modes

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 21.4 Storage Layout).

"Bit" mode represents a single bit, for predicate registers.

"Quarter-Integer" mode represents a single byte treated as an integer.

"Half-Integer" mode represents a two-byte integer.

"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.

"Single Integer" mode represents a four-byte integer.

"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.

"Double Integer" mode represents an eight-byte integer.

"Tetra Integer" (?) mode represents a sixteen-byte integer.

"Octa Integer" (?) mode represents a thirty-two-byte integer.

"Single Floating" mode represents a single-precision (four byte) floating point number.

"Double Floating" mode represents a double-precision (eight byte) floating point number.

"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.

"Tetra Floating" mode represents a quadruple-precision (sixteen byte) floating point number.

"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 cc0 (see see section 21.13 Condition Code Status).

"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, BLKmode will not appear in RTL.

Void mode means the absence of a mode or an unspecified mode. For example, RTL expressions of code 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
These modes stand for a complex number represented as a pair of floating point values. The floating point values are in SFmode, DFmode, XFmode, and TFmode, respectively.

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 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:

Integer modes. By default these are QImode, HImode, SImode, DImode, and TImode.

The "partial integer" modes, PSImode and PDImode.

floating point modes. By default these are SFmode, DFmode, XFmode and TFmode.

Complex integer modes. (These are not currently implemented).

Complex floating point modes. By default these are SCmode, DCmode, XCmode, and TCmode.

Algol or Pascal function variables including a static chain. (These are not currently implemented).

Modes representing condition code values. These are CCmode plus any modes listed in the EXTRA_CC_MODES macro. See section 20.11 Defining Jump Instruction Patterns, also see 21.13 Condition Code Status.

This is a catchall mode class for modes which don't fit into the above classes. Currently VOIDmode and BLKmode are in MODE_RANDOM.

Here are some C macros that relate to machine modes:

Returns the machine mode of the RTX x.

PUT_MODE (x, newmode)
Alters the machine mode of the RTX x to be newmode.

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.

Returns the name of mode m as a string.

Returns the mode class of mode m.

Returns the next wider natural mode. For example, the expression GET_MODE_WIDER_MODE (QImode) returns HImode.

Returns the size in bytes of a datum of mode m.

Returns the size in bits of a datum of mode m.

Returns a bitmask containing 1 for all bits in a word that fit within mode m. This macro can only be used for modes whose bitsize is less than or equal to HOST_BITS_PER_INT.

Return the required alignment, in bits, for an object of mode m.

Returns the size in bytes of the subunits of a datum of mode m. This is the same as GET_MODE_SIZE except in the case of complex modes. For them, the unit size is the size of the real or imaginary part.

Returns the number of units contained in a mode, i.e., GET_MODE_SIZE divided by GET_MODE_UNIT_SIZE.

Returns the narrowest mode in mode class 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.

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated by Vincent Chung on June, 26 2001 using texi2html