gccint: RTL Objects
1
1 14.1 RTL Object Types
1 =====================
1
1 RTL uses five kinds of objects: expressions, integers, wide integers,
1 strings and vectors. Expressions are the most important ones. An RTL
1 expression ("RTX", for short) is a C structure, but it is usually
1 referred to with a pointer; a type that is given the typedef name 'rtx'.
1
1 An integer is simply an 'int'; their written form uses decimal digits.
1 A wide integer is an integral object whose type is 'HOST_WIDE_INT';
1 their written form uses decimal digits.
1
1 A string is a sequence of characters. In core it is represented as a
1 'char *' in usual C fashion, and it is written in C syntax as well.
1 However, strings in RTL may never be null. If you write an empty string
1 in a machine description, it is represented in core as a null pointer
1 rather than as a pointer to a null character. In certain contexts,
1 these null pointers instead of strings are valid. Within RTL code,
1 strings are most commonly found inside 'symbol_ref' expressions, but
1 they appear in other contexts in the RTL expressions that make up
1 machine descriptions.
1
1 In a machine description, strings are normally written with double
1 quotes, as you would in C. However, strings in machine descriptions may
1 extend over many lines, which is invalid C, and adjacent string
1 constants are not concatenated as they are in C. Any string constant
1 may be surrounded with a single set of parentheses. Sometimes this
1 makes the machine description easier to read.
1
1 There is also a special syntax for strings, which can be useful when C
1 code is embedded in a machine description. Wherever a string can
1 appear, it is also valid to write a C-style brace block. The entire
1 brace block, including the outermost pair of braces, is considered to be
1 the string constant. Double quote characters inside the braces are not
1 special. Therefore, if you write string constants in the C code, you
1 need not escape each quote character with a backslash.
1
1 A vector contains an arbitrary number of pointers to expressions. The
1 number of elements in the vector is explicitly present in the vector.
1 The written form of a vector consists of square brackets ('[...]')
1 surrounding the elements, in sequence and with whitespace separating
1 them. Vectors of length zero are not created; null pointers are used
1 instead.
1
1 Expressions are classified by "expression codes" (also called RTX
1 codes). The expression code is a name defined in 'rtl.def', which is
1 also (in uppercase) a C enumeration constant. The possible expression
1 codes and their meanings are machine-independent. The code of an RTX
1 can be extracted with the macro 'GET_CODE (X)' and altered with
1 'PUT_CODE (X, NEWCODE)'.
1
1 The expression code determines how many operands the expression
1 contains, and what kinds of objects they are. In RTL, unlike Lisp, you
1 cannot tell by looking at an operand what kind of object it is.
1 Instead, you must know from its context--from the expression code of the
1 containing expression. For example, in an expression of code 'subreg',
1 the first operand is to be regarded as an expression and the second
1 operand as a polynomial integer. In an expression of code 'plus', there
1 are two operands, both of which are to be regarded as expressions. In a
1 'symbol_ref' expression, there is one operand, which is to be regarded
1 as a string.
1
1 Expressions are written as parentheses containing the name of the
1 expression type, its flags and machine mode if any, and then the
1 operands of the expression (separated by spaces).
1
1 Expression code names in the 'md' file are written in lowercase, but
1 when they appear in C code they are written in uppercase. In this
1 manual, they are shown as follows: 'const_int'.
1
1 In a few contexts a null pointer is valid where an expression is
1 normally wanted. The written form of this is '(nil)'.
1