Anuncio
Anuncio
110 GNU Compiler Collection (GCC) Internals
The expression code determines how many operands the expression contains, and what kinds of objects they are. In RTL, unlike Lisp, you cannot tell by looking at an operand what kind of object it is. Instead, you must know from its context—from the expression code of the containing expression. For example, in an expression of code subreg, the first operand is to be regarded as an expression and the second operand as an integer. In an expression of code plus, there are two operands, both of which are to be regarded as expressions. In a symbol_ref expression, there is one operand, which is to be regarded as a string.
Expressions are written as parentheses containing the name of the expression type, its flags and machine mode if any, and then the operands of the expression (separated by spaces).
Expression code names in the ‘md’ file are written in lowercase, but when they appear in C code they are written in uppercase. In this manual, they are shown as follows: const_int.
In a few contexts a null pointer is valid where an expression is normally wanted. The written form of this is (nil).
10.2 RTL Classes and Formats
The various expression codes are divided into several classes, which are represented by single characters. You can determine the class of an RTX code with the macro GET_RTX_CLASS
(code )
. Currently, ‘rtx.def’ defines these classes:
RTX_OBJ
An RTX code that represents an actual object, such as a register (REG) or a memory location (MEM, SYMBOL_REF). LO_SUM) is also included; instead, SUBREG and STRICT_LOW_PART are not in this class, but in class x.
RTX_CONST_OBJ
An RTX code that represents a constant object. HIGH is also included in this class.
RTX_COMPARE
An RTX code for a non-symmetric comparison, such as GEU or LT.
RTX_COMM_COMPARE
An RTX code for a symmetric (commutative) comparison, such as EQ or
ORDERED
.
RTX_UNARY
An RTX code for a unary arithmetic operation, such as NEG, NOT, or ABS. This category also includes value extension (sign or zero) and conversions between integer and floating point.
RTX_COMM_ARITH
An RTX code for a commutative binary operation, such as PLUS or AND. NE and EQ are comparisons, so they have class <.
RTX_BIN_ARITH
An RTX code for a non-commutative binary operation, such as MINUS, DIV, or
ASHIFTRT
.
Chapter 10: RTL Representation 111
RTX_BITFIELD_OPS
An RTX code for a bit-field operation. Currently only ZERO_EXTRACT and
SIGN_EXTRACT
. These have three inputs and are lvalues (so they can be used for insertion as well). See Section 10.11 [Bit-Fields], page 135.
RTX_TERNARY
An RTX code for other three input operations. Currently only IF_THEN_ELSE and VEC_MERGE.
RTX_INSN
An RTX code for an entire instruction: INSN, JUMP_INSN, and CALL_INSN. See
Section 10.18 [Insns], page 144.
RTX_MATCH
An RTX code for something that matches in insns, such as MATCH_DUP. These only occur in machine descriptions.
RTX_AUTOINC
An RTX code for an auto-increment addressing mode, such as POST_INC.
RTX_EXTRA
All other RTX codes. This category includes the remaining codes used only in machine descriptions (DEFINE_*, etc.). It also includes all the codes describing side effects (SET, USE, CLOBBER, etc.) and the non-insns that may appear on an insn chain, such as NOTE, BARRIER, and CODE_LABEL. SUBREG is also part of this class.
For each expression code, ‘rtl.def’ specifies the number of contained objects and their kinds using a sequence of characters called the format of the expression code. For example, the format of subreg is ‘ei’.
These are the most commonly used format characters: e i w s
E
An expression (actually a pointer to an expression).
An integer.
A wide integer.
A string.
A vector of expressions.
A few other format characters are used occasionally: u n
S
‘u’ is equivalent to ‘e’ except that it is printed differently in debugging dumps.
It is used for pointers to insns.
‘n’ is equivalent to ‘i’ except that it is printed differently in debugging dumps.
It is used for the line number or code number of a note insn.
‘S’ indicates a string which is optional. In the RTL objects in core, ‘S’ is equivalent to ‘s’, but when the object is read, from an ‘md’ file, the string value of this operand may be omitted. An omitted string is taken to be the null string.
Descargar
Anuncio