Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

170 lines
8.0KB

  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-2020 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 6.5, http://www.gnu.org/software/texinfo/ -->
  18. <head>
  19. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  20. <title>RTL Objects (GNU Compiler Collection (GCC) Internals)</title>
  21. <meta name="description" content="RTL Objects (GNU Compiler Collection (GCC) Internals)">
  22. <meta name="keywords" content="RTL Objects (GNU Compiler Collection (GCC) Internals)">
  23. <meta name="resource-type" content="document">
  24. <meta name="distribution" content="global">
  25. <meta name="Generator" content="makeinfo">
  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.indentedblock {margin-right: 0em}
  36. blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
  37. blockquote.smallquotation {font-size: smaller}
  38. div.display {margin-left: 3.2em}
  39. div.example {margin-left: 3.2em}
  40. div.lisp {margin-left: 3.2em}
  41. div.smalldisplay {margin-left: 3.2em}
  42. div.smallexample {margin-left: 3.2em}
  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.nolinebreak {white-space: nowrap}
  54. span.roman {font-family: initial; font-weight: normal}
  55. span.sansserif {font-family: sans-serif; font-weight: normal}
  56. ul.no-bullet {list-style: none}
  57. -->
  58. </style>
  59. </head>
  60. <body lang="en">
  61. <a name="RTL-Objects"></a>
  62. <div class="header">
  63. <p>
  64. 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>
  65. </div>
  66. <hr>
  67. <a name="RTL-Object-Types"></a>
  68. <h3 class="section">14.1 RTL Object Types</h3>
  69. <a name="index-RTL-object-types"></a>
  70. <a name="index-RTL-integers"></a>
  71. <a name="index-RTL-strings"></a>
  72. <a name="index-RTL-vectors"></a>
  73. <a name="index-RTL-expression"></a>
  74. <a name="index-RTX-_0028See-RTL_0029"></a>
  75. <p>RTL uses five kinds of objects: expressions, integers, wide integers,
  76. strings and vectors. Expressions are the most important ones. An RTL
  77. expression (&ldquo;RTX&rdquo;, for short) is a C structure, but it is usually
  78. referred to with a pointer; a type that is given the typedef name
  79. <code>rtx</code>.
  80. </p>
  81. <p>An integer is simply an <code>int</code>; their written form uses decimal
  82. digits. A wide integer is an integral object whose type is
  83. <code>HOST_WIDE_INT</code>; their written form uses decimal digits.
  84. </p>
  85. <p>A string is a sequence of characters. In core it is represented as a
  86. <code>char *</code> in usual C fashion, and it is written in C syntax as well.
  87. However, strings in RTL may never be null. If you write an empty string in
  88. a machine description, it is represented in core as a null pointer rather
  89. than as a pointer to a null character. In certain contexts, these null
  90. pointers instead of strings are valid. Within RTL code, strings are most
  91. commonly found inside <code>symbol_ref</code> expressions, but they appear in
  92. other contexts in the RTL expressions that make up machine descriptions.
  93. </p>
  94. <p>In a machine description, strings are normally written with double
  95. quotes, as you would in C. However, strings in machine descriptions may
  96. extend over many lines, which is invalid C, and adjacent string
  97. constants are not concatenated as they are in C. Any string constant
  98. may be surrounded with a single set of parentheses. Sometimes this
  99. makes the machine description easier to read.
  100. </p>
  101. <p>There is also a special syntax for strings, which can be useful when C
  102. code is embedded in a machine description. Wherever a string can
  103. appear, it is also valid to write a C-style brace block. The entire
  104. brace block, including the outermost pair of braces, is considered to be
  105. the string constant. Double quote characters inside the braces are not
  106. special. Therefore, if you write string constants in the C code, you
  107. need not escape each quote character with a backslash.
  108. </p>
  109. <p>A vector contains an arbitrary number of pointers to expressions. The
  110. number of elements in the vector is explicitly present in the vector.
  111. The written form of a vector consists of square brackets
  112. (&lsquo;<samp>[&hellip;]</samp>&rsquo;) surrounding the elements, in sequence and with
  113. whitespace separating them. Vectors of length zero are not created;
  114. null pointers are used instead.
  115. </p>
  116. <a name="index-expression-codes"></a>
  117. <a name="index-codes_002c-RTL-expression"></a>
  118. <a name="index-GET_005fCODE"></a>
  119. <a name="index-PUT_005fCODE"></a>
  120. <p>Expressions are classified by <em>expression codes</em> (also called RTX
  121. codes). The expression code is a name defined in <samp>rtl.def</samp>, which is
  122. also (in uppercase) a C enumeration constant. The possible expression
  123. codes and their meanings are machine-independent. The code of an RTX can
  124. be extracted with the macro <code>GET_CODE (<var>x</var>)</code> and altered with
  125. <code>PUT_CODE (<var>x</var>, <var>newcode</var>)</code>.
  126. </p>
  127. <p>The expression code determines how many operands the expression contains,
  128. and what kinds of objects they are. In RTL, unlike Lisp, you cannot tell
  129. by looking at an operand what kind of object it is. Instead, you must know
  130. from its context&mdash;from the expression code of the containing expression.
  131. For example, in an expression of code <code>subreg</code>, the first operand is
  132. to be regarded as an expression and the second operand as a polynomial
  133. integer. In an expression of code <code>plus</code>, there are two operands,
  134. both of which are to be regarded as expressions. In a <code>symbol_ref</code>
  135. expression, there is one operand, which is to be regarded as a string.
  136. </p>
  137. <p>Expressions are written as parentheses containing the name of the
  138. expression type, its flags and machine mode if any, and then the operands
  139. of the expression (separated by spaces).
  140. </p>
  141. <p>Expression code names in the &lsquo;<samp>md</samp>&rsquo; file are written in lowercase,
  142. but when they appear in C code they are written in uppercase. In this
  143. manual, they are shown as follows: <code>const_int</code>.
  144. </p>
  145. <a name="index-_0028nil_0029"></a>
  146. <a name="index-nil"></a>
  147. <p>In a few contexts a null pointer is valid where an expression is normally
  148. wanted. The written form of this is <code>(nil)</code>.
  149. </p>
  150. <hr>
  151. <div class="header">
  152. <p>
  153. 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>
  154. </div>
  155. </body>
  156. </html>