<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <!-- Copyright (C) 1988-2020 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with the Invariant Sections being "Funding Free Software", the Front-Cover Texts being (a) (see below), and with the Back-Cover Texts being (b) (see below). A copy of the license is included in the section entitled "GNU Free Documentation License". (a) The FSF's Front-Cover Text is: A GNU Manual (b) The FSF's Back-Cover Text is: You have freedom to copy and modify this GNU Manual, like GNU software. Copies published by the Free Software Foundation raise funds for GNU development. --> <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ --> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>RTL Objects (GNU Compiler Collection (GCC) Internals)</title> <meta name="description" content="RTL Objects (GNU Compiler Collection (GCC) Internals)"> <meta name="keywords" content="RTL Objects (GNU Compiler Collection (GCC) Internals)"> <meta name="resource-type" content="document"> <meta name="distribution" content="global"> <meta name="Generator" content="makeinfo"> <link href="index.html#Top" rel="start" title="Top"> <link href="Option-Index.html#Option-Index" rel="index" title="Option Index"> <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents"> <link href="RTL.html#RTL" rel="up" title="RTL"> <link href="RTL-Classes.html#RTL-Classes" rel="next" title="RTL Classes"> <link href="RTL.html#RTL" rel="prev" title="RTL"> <style type="text/css"> <!-- a.summary-letter {text-decoration: none} blockquote.indentedblock {margin-right: 0em} blockquote.smallindentedblock {margin-right: 0em; font-size: smaller} blockquote.smallquotation {font-size: smaller} div.display {margin-left: 3.2em} div.example {margin-left: 3.2em} div.lisp {margin-left: 3.2em} div.smalldisplay {margin-left: 3.2em} div.smallexample {margin-left: 3.2em} div.smalllisp {margin-left: 3.2em} kbd {font-style: oblique} pre.display {font-family: inherit} pre.format {font-family: inherit} pre.menu-comment {font-family: serif} pre.menu-preformatted {font-family: serif} pre.smalldisplay {font-family: inherit; font-size: smaller} pre.smallexample {font-size: smaller} pre.smallformat {font-family: inherit; font-size: smaller} pre.smalllisp {font-size: smaller} span.nolinebreak {white-space: nowrap} span.roman {font-family: initial; font-weight: normal} span.sansserif {font-family: sans-serif; font-weight: normal} ul.no-bullet {list-style: none} --> </style> </head> <body lang="en"> <a name="RTL-Objects"></a> <div class="header"> <p> Next: <a href="RTL-Classes.html#RTL-Classes" accesskey="n" rel="next">RTL Classes</a>, Up: <a href="RTL.html#RTL" accesskey="u" rel="up">RTL</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html#Option-Index" title="Index" rel="index">Index</a>]</p> </div> <hr> <a name="RTL-Object-Types"></a> <h3 class="section">14.1 RTL Object Types</h3> <a name="index-RTL-object-types"></a> <a name="index-RTL-integers"></a> <a name="index-RTL-strings"></a> <a name="index-RTL-vectors"></a> <a name="index-RTL-expression"></a> <a name="index-RTX-_0028See-RTL_0029"></a> <p>RTL uses five kinds of objects: expressions, integers, wide integers, strings and vectors. Expressions are the most important ones. An RTL expression (“RTX”, for short) is a C structure, but it is usually referred to with a pointer; a type that is given the typedef name <code>rtx</code>. </p> <p>An integer is simply an <code>int</code>; their written form uses decimal digits. A wide integer is an integral object whose type is <code>HOST_WIDE_INT</code>; their written form uses decimal digits. </p> <p>A string is a sequence of characters. In core it is represented as a <code>char *</code> in usual C fashion, and it is written in C syntax as well. However, strings in RTL may never be null. If you write an empty string in a machine description, it is represented in core as a null pointer rather than as a pointer to a null character. In certain contexts, these null pointers instead of strings are valid. Within RTL code, strings are most commonly found inside <code>symbol_ref</code> expressions, but they appear in other contexts in the RTL expressions that make up machine descriptions. </p> <p>In a machine description, strings are normally written with double quotes, as you would in C. However, strings in machine descriptions may extend over many lines, which is invalid C, and adjacent string constants are not concatenated as they are in C. Any string constant may be surrounded with a single set of parentheses. Sometimes this makes the machine description easier to read. </p> <p>There is also a special syntax for strings, which can be useful when C code is embedded in a machine description. Wherever a string can appear, it is also valid to write a C-style brace block. The entire brace block, including the outermost pair of braces, is considered to be the string constant. Double quote characters inside the braces are not special. Therefore, if you write string constants in the C code, you need not escape each quote character with a backslash. </p> <p>A vector contains an arbitrary number of pointers to expressions. The number of elements in the vector is explicitly present in the vector. The written form of a vector consists of square brackets (‘<samp>[…]</samp>’) surrounding the elements, in sequence and with whitespace separating them. Vectors of length zero are not created; null pointers are used instead. </p> <a name="index-expression-codes"></a> <a name="index-codes_002c-RTL-expression"></a> <a name="index-GET_005fCODE"></a> <a name="index-PUT_005fCODE"></a> <p>Expressions are classified by <em>expression codes</em> (also called RTX codes). The expression code is a name defined in <samp>rtl.def</samp>, which is also (in uppercase) a C enumeration constant. The possible expression codes and their meanings are machine-independent. The code of an RTX can be extracted with the macro <code>GET_CODE (<var>x</var>)</code> and altered with <code>PUT_CODE (<var>x</var>, <var>newcode</var>)</code>. </p> <p>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 <code>subreg</code>, the first operand is to be regarded as an expression and the second operand as a polynomial integer. In an expression of code <code>plus</code>, there are two operands, both of which are to be regarded as expressions. In a <code>symbol_ref</code> expression, there is one operand, which is to be regarded as a string. </p> <p>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). </p> <p>Expression code names in the ‘<samp>md</samp>’ 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: <code>const_int</code>. </p> <a name="index-_0028nil_0029"></a> <a name="index-nil"></a> <p>In a few contexts a null pointer is valid where an expression is normally wanted. The written form of this is <code>(nil)</code>. </p> <hr> <div class="header"> <p> Next: <a href="RTL-Classes.html#RTL-Classes" accesskey="n" rel="next">RTL Classes</a>, Up: <a href="RTL.html#RTL" accesskey="u" rel="up">RTL</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html#Option-Index" title="Index" rel="index">Index</a>]</p> </div> </body> </html>