選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

302 行
11KB

  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 Classes (GNU Compiler Collection (GCC) Internals)</title>
  21. <meta name="description" content="RTL Classes (GNU Compiler Collection (GCC) Internals)">
  22. <meta name="keywords" content="RTL Classes (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="Accessors.html#Accessors" rel="next" title="Accessors">
  31. <link href="RTL-Objects.html#RTL-Objects" rel="prev" title="RTL Objects">
  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-Classes"></a>
  62. <div class="header">
  63. <p>
  64. Next: <a href="Accessors.html#Accessors" accesskey="n" rel="next">Accessors</a>, Previous: <a href="RTL-Objects.html#RTL-Objects" accesskey="p" rel="prev">RTL Objects</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-Classes-and-Formats"></a>
  68. <h3 class="section">14.2 RTL Classes and Formats</h3>
  69. <a name="index-RTL-classes"></a>
  70. <a name="index-classes-of-RTX-codes"></a>
  71. <a name="index-RTX-codes_002c-classes-of"></a>
  72. <a name="index-GET_005fRTX_005fCLASS"></a>
  73. <p>The various expression codes are divided into several <em>classes</em>,
  74. which are represented by single characters. You can determine the class
  75. of an RTX code with the macro <code>GET_RTX_CLASS (<var>code</var>)</code>.
  76. Currently, <samp>rtl.def</samp> defines these classes:
  77. </p>
  78. <dl compact="compact">
  79. <dt><code>RTX_OBJ</code></dt>
  80. <dd><p>An RTX code that represents an actual object, such as a register
  81. (<code>REG</code>) or a memory location (<code>MEM</code>, <code>SYMBOL_REF</code>).
  82. <code>LO_SUM</code>) is also included; instead, <code>SUBREG</code> and
  83. <code>STRICT_LOW_PART</code> are not in this class, but in class
  84. <code>RTX_EXTRA</code>.
  85. </p>
  86. </dd>
  87. <dt><code>RTX_CONST_OBJ</code></dt>
  88. <dd><p>An RTX code that represents a constant object. <code>HIGH</code> is also
  89. included in this class.
  90. </p>
  91. </dd>
  92. <dt><code>RTX_COMPARE</code></dt>
  93. <dd><p>An RTX code for a non-symmetric comparison, such as <code>GEU</code> or
  94. <code>LT</code>.
  95. </p>
  96. </dd>
  97. <dt><code>RTX_COMM_COMPARE</code></dt>
  98. <dd><p>An RTX code for a symmetric (commutative) comparison, such as <code>EQ</code>
  99. or <code>ORDERED</code>.
  100. </p>
  101. </dd>
  102. <dt><code>RTX_UNARY</code></dt>
  103. <dd><p>An RTX code for a unary arithmetic operation, such as <code>NEG</code>,
  104. <code>NOT</code>, or <code>ABS</code>. This category also includes value extension
  105. (sign or zero) and conversions between integer and floating point.
  106. </p>
  107. </dd>
  108. <dt><code>RTX_COMM_ARITH</code></dt>
  109. <dd><p>An RTX code for a commutative binary operation, such as <code>PLUS</code> or
  110. <code>AND</code>. <code>NE</code> and <code>EQ</code> are comparisons, so they have class
  111. <code>RTX_COMM_COMPARE</code>.
  112. </p>
  113. </dd>
  114. <dt><code>RTX_BIN_ARITH</code></dt>
  115. <dd><p>An RTX code for a non-commutative binary operation, such as <code>MINUS</code>,
  116. <code>DIV</code>, or <code>ASHIFTRT</code>.
  117. </p>
  118. </dd>
  119. <dt><code>RTX_BITFIELD_OPS</code></dt>
  120. <dd><p>An RTX code for a bit-field operation. Currently only
  121. <code>ZERO_EXTRACT</code> and <code>SIGN_EXTRACT</code>. These have three inputs
  122. and are lvalues (so they can be used for insertion as well).
  123. See <a href="Bit_002dFields.html#Bit_002dFields">Bit-Fields</a>.
  124. </p>
  125. </dd>
  126. <dt><code>RTX_TERNARY</code></dt>
  127. <dd><p>An RTX code for other three input operations. Currently only
  128. <code>IF_THEN_ELSE</code>, <code>VEC_MERGE</code>, <code>SIGN_EXTRACT</code>,
  129. <code>ZERO_EXTRACT</code>, and <code>FMA</code>.
  130. </p>
  131. </dd>
  132. <dt><code>RTX_INSN</code></dt>
  133. <dd><p>An RTX code for an entire instruction: <code>INSN</code>, <code>JUMP_INSN</code>, and
  134. <code>CALL_INSN</code>. See <a href="Insns.html#Insns">Insns</a>.
  135. </p>
  136. </dd>
  137. <dt><code>RTX_MATCH</code></dt>
  138. <dd><p>An RTX code for something that matches in insns, such as
  139. <code>MATCH_DUP</code>. These only occur in machine descriptions.
  140. </p>
  141. </dd>
  142. <dt><code>RTX_AUTOINC</code></dt>
  143. <dd><p>An RTX code for an auto-increment addressing mode, such as
  144. <code>POST_INC</code>. &lsquo;<samp>XEXP (<var>x</var>, 0)</samp>&rsquo; gives the auto-modified
  145. register.
  146. </p>
  147. </dd>
  148. <dt><code>RTX_EXTRA</code></dt>
  149. <dd><p>All other RTX codes. This category includes the remaining codes used
  150. only in machine descriptions (<code>DEFINE_*</code>, etc.). It also includes
  151. all the codes describing side effects (<code>SET</code>, <code>USE</code>,
  152. <code>CLOBBER</code>, etc.) and the non-insns that may appear on an insn
  153. chain, such as <code>NOTE</code>, <code>BARRIER</code>, and <code>CODE_LABEL</code>.
  154. <code>SUBREG</code> is also part of this class.
  155. </p></dd>
  156. </dl>
  157. <a name="index-RTL-format"></a>
  158. <p>For each expression code, <samp>rtl.def</samp> specifies the number of
  159. contained objects and their kinds using a sequence of characters
  160. called the <em>format</em> of the expression code. For example,
  161. the format of <code>subreg</code> is &lsquo;<samp>ep</samp>&rsquo;.
  162. </p>
  163. <a name="index-RTL-format-characters"></a>
  164. <p>These are the most commonly used format characters:
  165. </p>
  166. <dl compact="compact">
  167. <dt><code>e</code></dt>
  168. <dd><p>An expression (actually a pointer to an expression).
  169. </p>
  170. </dd>
  171. <dt><code>i</code></dt>
  172. <dd><p>An integer.
  173. </p>
  174. </dd>
  175. <dt><code>w</code></dt>
  176. <dd><p>A wide integer.
  177. </p>
  178. </dd>
  179. <dt><code>s</code></dt>
  180. <dd><p>A string.
  181. </p>
  182. </dd>
  183. <dt><code>E</code></dt>
  184. <dd><p>A vector of expressions.
  185. </p></dd>
  186. </dl>
  187. <p>A few other format characters are used occasionally:
  188. </p>
  189. <dl compact="compact">
  190. <dt><code>u</code></dt>
  191. <dd><p>&lsquo;<samp>u</samp>&rsquo; is equivalent to &lsquo;<samp>e</samp>&rsquo; except that it is printed differently
  192. in debugging dumps. It is used for pointers to insns.
  193. </p>
  194. </dd>
  195. <dt><code>n</code></dt>
  196. <dd><p>&lsquo;<samp>n</samp>&rsquo; is equivalent to &lsquo;<samp>i</samp>&rsquo; except that it is printed differently
  197. in debugging dumps. It is used for the line number or code number of a
  198. <code>note</code> insn.
  199. </p>
  200. </dd>
  201. <dt><code>S</code></dt>
  202. <dd><p>&lsquo;<samp>S</samp>&rsquo; indicates a string which is optional. In the RTL objects in
  203. core, &lsquo;<samp>S</samp>&rsquo; is equivalent to &lsquo;<samp>s</samp>&rsquo;, but when the object is read,
  204. from an &lsquo;<samp>md</samp>&rsquo; file, the string value of this operand may be omitted.
  205. An omitted string is taken to be the null string.
  206. </p>
  207. </dd>
  208. <dt><code>V</code></dt>
  209. <dd><p>&lsquo;<samp>V</samp>&rsquo; indicates a vector which is optional. In the RTL objects in
  210. core, &lsquo;<samp>V</samp>&rsquo; is equivalent to &lsquo;<samp>E</samp>&rsquo;, but when the object is read
  211. from an &lsquo;<samp>md</samp>&rsquo; file, the vector value of this operand may be omitted.
  212. An omitted vector is effectively the same as a vector of no elements.
  213. </p>
  214. </dd>
  215. <dt><code>B</code></dt>
  216. <dd><p>&lsquo;<samp>B</samp>&rsquo; indicates a pointer to basic block structure.
  217. </p>
  218. </dd>
  219. <dt><code>p</code></dt>
  220. <dd><p>A polynomial integer. At present this is used only for <code>SUBREG_BYTE</code>.
  221. </p>
  222. </dd>
  223. <dt><code>0</code></dt>
  224. <dd><p>&lsquo;<samp>0</samp>&rsquo; means a slot whose contents do not fit any normal category.
  225. &lsquo;<samp>0</samp>&rsquo; slots are not printed at all in dumps, and are often used in
  226. special ways by small parts of the compiler.
  227. </p></dd>
  228. </dl>
  229. <p>There are macros to get the number of operands and the format
  230. of an expression code:
  231. </p>
  232. <dl compact="compact">
  233. <dd><a name="index-GET_005fRTX_005fLENGTH"></a>
  234. </dd>
  235. <dt><code>GET_RTX_LENGTH (<var>code</var>)</code></dt>
  236. <dd><p>Number of operands of an RTX of code <var>code</var>.
  237. </p>
  238. <a name="index-GET_005fRTX_005fFORMAT"></a>
  239. </dd>
  240. <dt><code>GET_RTX_FORMAT (<var>code</var>)</code></dt>
  241. <dd><p>The format of an RTX of code <var>code</var>, as a C string.
  242. </p></dd>
  243. </dl>
  244. <p>Some classes of RTX codes always have the same format. For example, it
  245. is safe to assume that all comparison operations have format <code>ee</code>.
  246. </p>
  247. <dl compact="compact">
  248. <dt><code>RTX_UNARY</code></dt>
  249. <dd><p>All codes of this class have format <code>e</code>.
  250. </p>
  251. </dd>
  252. <dt><code>RTX_BIN_ARITH</code></dt>
  253. <dt><code>RTX_COMM_ARITH</code></dt>
  254. <dt><code>RTX_COMM_COMPARE</code></dt>
  255. <dt><code>RTX_COMPARE</code></dt>
  256. <dd><p>All codes of these classes have format <code>ee</code>.
  257. </p>
  258. </dd>
  259. <dt><code>RTX_BITFIELD_OPS</code></dt>
  260. <dt><code>RTX_TERNARY</code></dt>
  261. <dd><p>All codes of these classes have format <code>eee</code>.
  262. </p>
  263. </dd>
  264. <dt><code>RTX_INSN</code></dt>
  265. <dd><p>All codes of this class have formats that begin with <code>iuueiee</code>.
  266. See <a href="Insns.html#Insns">Insns</a>. Note that not all RTL objects linked onto an insn chain
  267. are of class <code>RTX_INSN</code>.
  268. </p>
  269. </dd>
  270. <dt><code>RTX_CONST_OBJ</code></dt>
  271. <dt><code>RTX_OBJ</code></dt>
  272. <dt><code>RTX_MATCH</code></dt>
  273. <dt><code>RTX_EXTRA</code></dt>
  274. <dd><p>You can make no assumptions about the format of these codes.
  275. </p></dd>
  276. </dl>
  277. <hr>
  278. <div class="header">
  279. <p>
  280. Next: <a href="Accessors.html#Accessors" accesskey="n" rel="next">Accessors</a>, Previous: <a href="RTL-Objects.html#RTL-Objects" accesskey="p" rel="prev">RTL Objects</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>
  281. </div>
  282. </body>
  283. </html>