RTL-Objects.html 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- Copyright (C) 1988-2017 Free Software Foundation, Inc.
  4. Permission is granted to copy, distribute and/or modify this document
  5. under the terms of the GNU Free Documentation License, Version 1.3 or
  6. any later version published by the Free Software Foundation; with the
  7. Invariant Sections being "Funding Free Software", the Front-Cover
  8. Texts being (a) (see below), and with the Back-Cover Texts being (b)
  9. (see below). A copy of the license is included in the section entitled
  10. "GNU Free Documentation License".
  11. (a) The FSF's Front-Cover Text is:
  12. A GNU Manual
  13. (b) The FSF's Back-Cover Text is:
  14. You have freedom to copy and modify this GNU Manual, like GNU
  15. software. Copies published by the Free Software Foundation raise
  16. funds for GNU development. -->
  17. <!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
  18. <head>
  19. <title>GNU Compiler Collection (GCC) Internals: RTL Objects</title>
  20. <meta name="description" content="GNU Compiler Collection (GCC) Internals: RTL Objects">
  21. <meta name="keywords" content="GNU Compiler Collection (GCC) Internals: RTL Objects">
  22. <meta name="resource-type" content="document">
  23. <meta name="distribution" content="global">
  24. <meta name="Generator" content="makeinfo">
  25. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  26. <link href="index.html#Top" rel="start" title="Top">
  27. <link href="Option-Index.html#Option-Index" rel="index" title="Option Index">
  28. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  29. <link href="RTL.html#RTL" rel="up" title="RTL">
  30. <link href="RTL-Classes.html#RTL-Classes" rel="next" title="RTL Classes">
  31. <link href="RTL.html#RTL" rel="prev" title="RTL">
  32. <style type="text/css">
  33. <!--
  34. a.summary-letter {text-decoration: none}
  35. blockquote.smallquotation {font-size: smaller}
  36. div.display {margin-left: 3.2em}
  37. div.example {margin-left: 3.2em}
  38. div.indentedblock {margin-left: 3.2em}
  39. div.lisp {margin-left: 3.2em}
  40. div.smalldisplay {margin-left: 3.2em}
  41. div.smallexample {margin-left: 3.2em}
  42. div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
  43. div.smalllisp {margin-left: 3.2em}
  44. kbd {font-style:oblique}
  45. pre.display {font-family: inherit}
  46. pre.format {font-family: inherit}
  47. pre.menu-comment {font-family: serif}
  48. pre.menu-preformatted {font-family: serif}
  49. pre.smalldisplay {font-family: inherit; font-size: smaller}
  50. pre.smallexample {font-size: smaller}
  51. pre.smallformat {font-family: inherit; font-size: smaller}
  52. pre.smalllisp {font-size: smaller}
  53. span.nocodebreak {white-space:nowrap}
  54. span.nolinebreak {white-space:nowrap}
  55. span.roman {font-family:serif; font-weight:normal}
  56. span.sansserif {font-family:sans-serif; font-weight:normal}
  57. ul.no-bullet {list-style: none}
  58. -->
  59. </style>
  60. </head>
  61. <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
  62. <a name="RTL-Objects"></a>
  63. <div class="header">
  64. <p>
  65. 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> &nbsp; [<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>
  66. </div>
  67. <hr>
  68. <a name="RTL-Object-Types"></a>
  69. <h3 class="section">13.1 RTL Object Types</h3>
  70. <a name="index-RTL-object-types"></a>
  71. <a name="index-RTL-integers"></a>
  72. <a name="index-RTL-strings"></a>
  73. <a name="index-RTL-vectors"></a>
  74. <a name="index-RTL-expression"></a>
  75. <a name="index-RTX-_0028See-RTL_0029"></a>
  76. <p>RTL uses five kinds of objects: expressions, integers, wide integers,
  77. strings and vectors. Expressions are the most important ones. An RTL
  78. expression (&ldquo;RTX&rdquo;, for short) is a C structure, but it is usually
  79. referred to with a pointer; a type that is given the typedef name
  80. <code>rtx</code>.
  81. </p>
  82. <p>An integer is simply an <code>int</code>; their written form uses decimal
  83. digits. A wide integer is an integral object whose type is
  84. <code>HOST_WIDE_INT</code>; their written form uses decimal digits.
  85. </p>
  86. <p>A string is a sequence of characters. In core it is represented as a
  87. <code>char *</code> in usual C fashion, and it is written in C syntax as well.
  88. However, strings in RTL may never be null. If you write an empty string in
  89. a machine description, it is represented in core as a null pointer rather
  90. than as a pointer to a null character. In certain contexts, these null
  91. pointers instead of strings are valid. Within RTL code, strings are most
  92. commonly found inside <code>symbol_ref</code> expressions, but they appear in
  93. other contexts in the RTL expressions that make up machine descriptions.
  94. </p>
  95. <p>In a machine description, strings are normally written with double
  96. quotes, as you would in C. However, strings in machine descriptions may
  97. extend over many lines, which is invalid C, and adjacent string
  98. constants are not concatenated as they are in C. Any string constant
  99. may be surrounded with a single set of parentheses. Sometimes this
  100. makes the machine description easier to read.
  101. </p>
  102. <p>There is also a special syntax for strings, which can be useful when C
  103. code is embedded in a machine description. Wherever a string can
  104. appear, it is also valid to write a C-style brace block. The entire
  105. brace block, including the outermost pair of braces, is considered to be
  106. the string constant. Double quote characters inside the braces are not
  107. special. Therefore, if you write string constants in the C code, you
  108. need not escape each quote character with a backslash.
  109. </p>
  110. <p>A vector contains an arbitrary number of pointers to expressions. The
  111. number of elements in the vector is explicitly present in the vector.
  112. The written form of a vector consists of square brackets
  113. (&lsquo;<samp>[&hellip;]</samp>&rsquo;) surrounding the elements, in sequence and with
  114. whitespace separating them. Vectors of length zero are not created;
  115. null pointers are used instead.
  116. </p>
  117. <a name="index-expression-codes"></a>
  118. <a name="index-codes_002c-RTL-expression"></a>
  119. <a name="index-GET_005fCODE"></a>
  120. <a name="index-PUT_005fCODE"></a>
  121. <p>Expressions are classified by <em>expression codes</em> (also called RTX
  122. codes). The expression code is a name defined in <samp>rtl.def</samp>, which is
  123. also (in uppercase) a C enumeration constant. The possible expression
  124. codes and their meanings are machine-independent. The code of an RTX can
  125. be extracted with the macro <code>GET_CODE (<var>x</var>)</code> and altered with
  126. <code>PUT_CODE (<var>x</var>, <var>newcode</var>)</code>.
  127. </p>
  128. <p>The expression code determines how many operands the expression contains,
  129. and what kinds of objects they are. In RTL, unlike Lisp, you cannot tell
  130. by looking at an operand what kind of object it is. Instead, you must know
  131. from its context&mdash;from the expression code of the containing expression.
  132. For example, in an expression of code <code>subreg</code>, the first operand is
  133. to be regarded as an expression and the second operand as an integer. In
  134. an expression of code <code>plus</code>, there are two operands, both of which
  135. are to be regarded as expressions. In a <code>symbol_ref</code> expression,
  136. there is one operand, which is to be regarded as a string.
  137. </p>
  138. <p>Expressions are written as parentheses containing the name of the
  139. expression type, its flags and machine mode if any, and then the operands
  140. of the expression (separated by spaces).
  141. </p>
  142. <p>Expression code names in the &lsquo;<samp>md</samp>&rsquo; file are written in lowercase,
  143. but when they appear in C code they are written in uppercase. In this
  144. manual, they are shown as follows: <code>const_int</code>.
  145. </p>
  146. <a name="index-_0028nil_0029"></a>
  147. <a name="index-nil"></a>
  148. <p>In a few contexts a null pointer is valid where an expression is normally
  149. wanted. The written form of this is <code>(nil)</code>.
  150. </p>
  151. <hr>
  152. <div class="header">
  153. <p>
  154. 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> &nbsp; [<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>
  155. </div>
  156. </body>
  157. </html>