Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

800 lines
38KB

  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>Insns (GNU Compiler Collection (GCC) Internals)</title>
  21. <meta name="description" content="Insns (GNU Compiler Collection (GCC) Internals)">
  22. <meta name="keywords" content="Insns (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="Calls.html#Calls" rel="next" title="Calls">
  31. <link href="Debug-Information.html#Debug-Information" rel="prev" title="Debug Information">
  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="Insns"></a>
  62. <div class="header">
  63. <p>
  64. Next: <a href="Calls.html#Calls" accesskey="n" rel="next">Calls</a>, Previous: <a href="Debug-Information.html#Debug-Information" accesskey="p" rel="prev">Debug Information</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="Insns-1"></a>
  68. <h3 class="section">14.19 Insns</h3>
  69. <a name="index-insns"></a>
  70. <p>The RTL representation of the code for a function is a doubly-linked
  71. chain of objects called <em>insns</em>. Insns are expressions with
  72. special codes that are used for no other purpose. Some insns are
  73. actual instructions; others represent dispatch tables for <code>switch</code>
  74. statements; others represent labels to jump to or various sorts of
  75. declarative information.
  76. </p>
  77. <p>In addition to its own specific data, each insn must have a unique
  78. id-number that distinguishes it from all other insns in the current
  79. function (after delayed branch scheduling, copies of an insn with the
  80. same id-number may be present in multiple places in a function, but
  81. these copies will always be identical and will only appear inside a
  82. <code>sequence</code>), and chain pointers to the preceding and following
  83. insns. These three fields occupy the same position in every insn,
  84. independent of the expression code of the insn. They could be accessed
  85. with <code>XEXP</code> and <code>XINT</code>, but instead three special macros are
  86. always used:
  87. </p>
  88. <dl compact="compact">
  89. <dd><a name="index-INSN_005fUID"></a>
  90. </dd>
  91. <dt><code>INSN_UID (<var>i</var>)</code></dt>
  92. <dd><p>Accesses the unique id of insn <var>i</var>.
  93. </p>
  94. <a name="index-PREV_005fINSN"></a>
  95. </dd>
  96. <dt><code>PREV_INSN (<var>i</var>)</code></dt>
  97. <dd><p>Accesses the chain pointer to the insn preceding <var>i</var>.
  98. If <var>i</var> is the first insn, this is a null pointer.
  99. </p>
  100. <a name="index-NEXT_005fINSN"></a>
  101. </dd>
  102. <dt><code>NEXT_INSN (<var>i</var>)</code></dt>
  103. <dd><p>Accesses the chain pointer to the insn following <var>i</var>.
  104. If <var>i</var> is the last insn, this is a null pointer.
  105. </p></dd>
  106. </dl>
  107. <a name="index-get_005finsns"></a>
  108. <a name="index-get_005flast_005finsn"></a>
  109. <p>The first insn in the chain is obtained by calling <code>get_insns</code>; the
  110. last insn is the result of calling <code>get_last_insn</code>. Within the
  111. chain delimited by these insns, the <code>NEXT_INSN</code> and
  112. <code>PREV_INSN</code> pointers must always correspond: if <var>insn</var> is not
  113. the first insn,
  114. </p>
  115. <div class="smallexample">
  116. <pre class="smallexample">NEXT_INSN (PREV_INSN (<var>insn</var>)) == <var>insn</var>
  117. </pre></div>
  118. <p>is always true and if <var>insn</var> is not the last insn,
  119. </p>
  120. <div class="smallexample">
  121. <pre class="smallexample">PREV_INSN (NEXT_INSN (<var>insn</var>)) == <var>insn</var>
  122. </pre></div>
  123. <p>is always true.
  124. </p>
  125. <p>After delay slot scheduling, some of the insns in the chain might be
  126. <code>sequence</code> expressions, which contain a vector of insns. The value
  127. of <code>NEXT_INSN</code> in all but the last of these insns is the next insn
  128. in the vector; the value of <code>NEXT_INSN</code> of the last insn in the vector
  129. is the same as the value of <code>NEXT_INSN</code> for the <code>sequence</code> in
  130. which it is contained. Similar rules apply for <code>PREV_INSN</code>.
  131. </p>
  132. <p>This means that the above invariants are not necessarily true for insns
  133. inside <code>sequence</code> expressions. Specifically, if <var>insn</var> is the
  134. first insn in a <code>sequence</code>, <code>NEXT_INSN (PREV_INSN (<var>insn</var>))</code>
  135. is the insn containing the <code>sequence</code> expression, as is the value
  136. of <code>PREV_INSN (NEXT_INSN (<var>insn</var>))</code> if <var>insn</var> is the last
  137. insn in the <code>sequence</code> expression. You can use these expressions
  138. to find the containing <code>sequence</code> expression.
  139. </p>
  140. <p>Every insn has one of the following expression codes:
  141. </p>
  142. <dl compact="compact">
  143. <dd><a name="index-insn"></a>
  144. </dd>
  145. <dt><code>insn</code></dt>
  146. <dd><p>The expression code <code>insn</code> is used for instructions that do not jump
  147. and do not do function calls. <code>sequence</code> expressions are always
  148. contained in insns with code <code>insn</code> even if one of those insns
  149. should jump or do function calls.
  150. </p>
  151. <p>Insns with code <code>insn</code> have four additional fields beyond the three
  152. mandatory ones listed above. These four are described in a table below.
  153. </p>
  154. <a name="index-jump_005finsn"></a>
  155. </dd>
  156. <dt><code>jump_insn</code></dt>
  157. <dd><p>The expression code <code>jump_insn</code> is used for instructions that may
  158. jump (or, more generally, may contain <code>label_ref</code> expressions to
  159. which <code>pc</code> can be set in that instruction). If there is an
  160. instruction to return from the current function, it is recorded as a
  161. <code>jump_insn</code>.
  162. </p>
  163. <a name="index-JUMP_005fLABEL"></a>
  164. <p><code>jump_insn</code> insns have the same extra fields as <code>insn</code> insns,
  165. accessed in the same way and in addition contain a field
  166. <code>JUMP_LABEL</code> which is defined once jump optimization has completed.
  167. </p>
  168. <p>For simple conditional and unconditional jumps, this field contains
  169. the <code>code_label</code> to which this insn will (possibly conditionally)
  170. branch. In a more complex jump, <code>JUMP_LABEL</code> records one of the
  171. labels that the insn refers to; other jump target labels are recorded
  172. as <code>REG_LABEL_TARGET</code> notes. The exception is <code>addr_vec</code>
  173. and <code>addr_diff_vec</code>, where <code>JUMP_LABEL</code> is <code>NULL_RTX</code>
  174. and the only way to find the labels is to scan the entire body of the
  175. insn.
  176. </p>
  177. <p>Return insns count as jumps, but their <code>JUMP_LABEL</code> is <code>RETURN</code>
  178. or <code>SIMPLE_RETURN</code>.
  179. </p>
  180. <a name="index-call_005finsn"></a>
  181. </dd>
  182. <dt><code>call_insn</code></dt>
  183. <dd><p>The expression code <code>call_insn</code> is used for instructions that may do
  184. function calls. It is important to distinguish these instructions because
  185. they imply that certain registers and memory locations may be altered
  186. unpredictably.
  187. </p>
  188. <a name="index-CALL_005fINSN_005fFUNCTION_005fUSAGE"></a>
  189. <p><code>call_insn</code> insns have the same extra fields as <code>insn</code> insns,
  190. accessed in the same way and in addition contain a field
  191. <code>CALL_INSN_FUNCTION_USAGE</code>, which contains a list (chain of
  192. <code>expr_list</code> expressions) containing <code>use</code>, <code>clobber</code> and
  193. sometimes <code>set</code> expressions that denote hard registers and
  194. <code>mem</code>s used or clobbered by the called function.
  195. </p>
  196. <p>A <code>mem</code> generally points to a stack slot in which arguments passed
  197. to the libcall by reference (see <a href="Register-Arguments.html#Register-Arguments">TARGET_PASS_BY_REFERENCE</a>) are stored. If the argument is
  198. caller-copied (see <a href="Register-Arguments.html#Register-Arguments">TARGET_CALLEE_COPIES</a>),
  199. the stack slot will be mentioned in <code>clobber</code> and <code>use</code>
  200. entries; if it&rsquo;s callee-copied, only a <code>use</code> will appear, and the
  201. <code>mem</code> may point to addresses that are not stack slots.
  202. </p>
  203. <p>Registers occurring inside a <code>clobber</code> in this list augment
  204. registers specified in <code>CALL_USED_REGISTERS</code> (see <a href="Register-Basics.html#Register-Basics">Register Basics</a>).
  205. </p>
  206. <p>If the list contains a <code>set</code> involving two registers, it indicates
  207. that the function returns one of its arguments. Such a <code>set</code> may
  208. look like a no-op if the same register holds the argument and the return
  209. value.
  210. </p>
  211. <a name="index-code_005flabel"></a>
  212. <a name="index-CODE_005fLABEL_005fNUMBER"></a>
  213. </dd>
  214. <dt><code>code_label</code></dt>
  215. <dd><p>A <code>code_label</code> insn represents a label that a jump insn can jump
  216. to. It contains two special fields of data in addition to the three
  217. standard ones. <code>CODE_LABEL_NUMBER</code> is used to hold the <em>label
  218. number</em>, a number that identifies this label uniquely among all the
  219. labels in the compilation (not just in the current function).
  220. Ultimately, the label is represented in the assembler output as an
  221. assembler label, usually of the form &lsquo;<samp>L<var>n</var></samp>&rsquo; where <var>n</var> is
  222. the label number.
  223. </p>
  224. <p>When a <code>code_label</code> appears in an RTL expression, it normally
  225. appears within a <code>label_ref</code> which represents the address of
  226. the label, as a number.
  227. </p>
  228. <p>Besides as a <code>code_label</code>, a label can also be represented as a
  229. <code>note</code> of type <code>NOTE_INSN_DELETED_LABEL</code>.
  230. </p>
  231. <a name="index-LABEL_005fNUSES"></a>
  232. <p>The field <code>LABEL_NUSES</code> is only defined once the jump optimization
  233. phase is completed. It contains the number of times this label is
  234. referenced in the current function.
  235. </p>
  236. <a name="index-LABEL_005fKIND"></a>
  237. <a name="index-SET_005fLABEL_005fKIND"></a>
  238. <a name="index-LABEL_005fALT_005fENTRY_005fP"></a>
  239. <a name="index-alternate-entry-points"></a>
  240. <p>The field <code>LABEL_KIND</code> differentiates four different types of
  241. labels: <code>LABEL_NORMAL</code>, <code>LABEL_STATIC_ENTRY</code>,
  242. <code>LABEL_GLOBAL_ENTRY</code>, and <code>LABEL_WEAK_ENTRY</code>. The only labels
  243. that do not have type <code>LABEL_NORMAL</code> are <em>alternate entry
  244. points</em> to the current function. These may be static (visible only in
  245. the containing translation unit), global (exposed to all translation
  246. units), or weak (global, but can be overridden by another symbol with the
  247. same name).
  248. </p>
  249. <p>Much of the compiler treats all four kinds of label identically. Some
  250. of it needs to know whether or not a label is an alternate entry point;
  251. for this purpose, the macro <code>LABEL_ALT_ENTRY_P</code> is provided. It is
  252. equivalent to testing whether &lsquo;<samp>LABEL_KIND (label) == LABEL_NORMAL</samp>&rsquo;.
  253. The only place that cares about the distinction between static, global,
  254. and weak alternate entry points, besides the front-end code that creates
  255. them, is the function <code>output_alternate_entry_point</code>, in
  256. <samp>final.c</samp>.
  257. </p>
  258. <p>To set the kind of a label, use the <code>SET_LABEL_KIND</code> macro.
  259. </p>
  260. <a name="index-jump_005ftable_005fdata"></a>
  261. </dd>
  262. <dt><code>jump_table_data</code></dt>
  263. <dd><p>A <code>jump_table_data</code> insn is a placeholder for the jump-table data
  264. of a <code>casesi</code> or <code>tablejump</code> insn. They are placed after
  265. a <code>tablejump_p</code> insn. A <code>jump_table_data</code> insn is not part o
  266. a basic blockm but it is associated with the basic block that ends with
  267. the <code>tablejump_p</code> insn. The <code>PATTERN</code> of a <code>jump_table_data</code>
  268. is always either an <code>addr_vec</code> or an <code>addr_diff_vec</code>, and a
  269. <code>jump_table_data</code> insn is always preceded by a <code>code_label</code>.
  270. The <code>tablejump_p</code> insn refers to that <code>code_label</code> via its
  271. <code>JUMP_LABEL</code>.
  272. </p>
  273. <a name="index-barrier"></a>
  274. </dd>
  275. <dt><code>barrier</code></dt>
  276. <dd><p>Barriers are placed in the instruction stream when control cannot flow
  277. past them. They are placed after unconditional jump instructions to
  278. indicate that the jumps are unconditional and after calls to
  279. <code>volatile</code> functions, which do not return (e.g., <code>exit</code>).
  280. They contain no information beyond the three standard fields.
  281. </p>
  282. <a name="index-note"></a>
  283. <a name="index-NOTE_005fLINE_005fNUMBER"></a>
  284. <a name="index-NOTE_005fSOURCE_005fFILE"></a>
  285. </dd>
  286. <dt><code>note</code></dt>
  287. <dd><p><code>note</code> insns are used to represent additional debugging and
  288. declarative information. They contain two nonstandard fields, an
  289. integer which is accessed with the macro <code>NOTE_LINE_NUMBER</code> and a
  290. string accessed with <code>NOTE_SOURCE_FILE</code>.
  291. </p>
  292. <p>If <code>NOTE_LINE_NUMBER</code> is positive, the note represents the
  293. position of a source line and <code>NOTE_SOURCE_FILE</code> is the source file name
  294. that the line came from. These notes control generation of line
  295. number data in the assembler output.
  296. </p>
  297. <p>Otherwise, <code>NOTE_LINE_NUMBER</code> is not really a line number but a
  298. code with one of the following values (and <code>NOTE_SOURCE_FILE</code>
  299. must contain a null pointer):
  300. </p>
  301. <dl compact="compact">
  302. <dd><a name="index-NOTE_005fINSN_005fDELETED"></a>
  303. </dd>
  304. <dt><code>NOTE_INSN_DELETED</code></dt>
  305. <dd><p>Such a note is completely ignorable. Some passes of the compiler
  306. delete insns by altering them into notes of this kind.
  307. </p>
  308. <a name="index-NOTE_005fINSN_005fDELETED_005fLABEL"></a>
  309. </dd>
  310. <dt><code>NOTE_INSN_DELETED_LABEL</code></dt>
  311. <dd><p>This marks what used to be a <code>code_label</code>, but was not used for other
  312. purposes than taking its address and was transformed to mark that no
  313. code jumps to it.
  314. </p>
  315. <a name="index-NOTE_005fINSN_005fBLOCK_005fBEG"></a>
  316. <a name="index-NOTE_005fINSN_005fBLOCK_005fEND"></a>
  317. </dd>
  318. <dt><code>NOTE_INSN_BLOCK_BEG</code></dt>
  319. <dt><code>NOTE_INSN_BLOCK_END</code></dt>
  320. <dd><p>These types of notes indicate the position of the beginning and end
  321. of a level of scoping of variable names. They control the output
  322. of debugging information.
  323. </p>
  324. <a name="index-NOTE_005fINSN_005fEH_005fREGION_005fBEG"></a>
  325. <a name="index-NOTE_005fINSN_005fEH_005fREGION_005fEND"></a>
  326. </dd>
  327. <dt><code>NOTE_INSN_EH_REGION_BEG</code></dt>
  328. <dt><code>NOTE_INSN_EH_REGION_END</code></dt>
  329. <dd><p>These types of notes indicate the position of the beginning and end of a
  330. level of scoping for exception handling. <code>NOTE_EH_HANDLER</code>
  331. identifies which region is associated with these notes.
  332. </p>
  333. <a name="index-NOTE_005fINSN_005fFUNCTION_005fBEG"></a>
  334. </dd>
  335. <dt><code>NOTE_INSN_FUNCTION_BEG</code></dt>
  336. <dd><p>Appears at the start of the function body, after the function
  337. prologue.
  338. </p>
  339. <a name="index-NOTE_005fINSN_005fVAR_005fLOCATION"></a>
  340. <a name="index-NOTE_005fVAR_005fLOCATION"></a>
  341. </dd>
  342. <dt><code>NOTE_INSN_VAR_LOCATION</code></dt>
  343. <dd><p>This note is used to generate variable location debugging information.
  344. It indicates that the user variable in its <code>VAR_LOCATION</code> operand
  345. is at the location given in the RTL expression, or holds a value that
  346. can be computed by evaluating the RTL expression from that static
  347. point in the program up to the next such note for the same user
  348. variable.
  349. </p>
  350. <a name="index-NOTE_005fINSN_005fBEGIN_005fSTMT"></a>
  351. </dd>
  352. <dt><code>NOTE_INSN_BEGIN_STMT</code></dt>
  353. <dd><p>This note is used to generate <code>is_stmt</code> markers in line number
  354. debuggign information. It indicates the beginning of a user
  355. statement.
  356. </p>
  357. <a name="index-NOTE_005fINSN_005fINLINE_005fENTRY"></a>
  358. </dd>
  359. <dt><code>NOTE_INSN_INLINE_ENTRY</code></dt>
  360. <dd><p>This note is used to generate <code>entry_pc</code> for inlined subroutines in
  361. debugging information. It indicates an inspection point at which all
  362. arguments for the inlined function have been bound, and before its first
  363. statement.
  364. </p>
  365. </dd>
  366. </dl>
  367. <p>These codes are printed symbolically when they appear in debugging dumps.
  368. </p>
  369. <a name="index-debug_005finsn"></a>
  370. <a name="index-INSN_005fVAR_005fLOCATION"></a>
  371. </dd>
  372. <dt><code>debug_insn</code></dt>
  373. <dd><p>The expression code <code>debug_insn</code> is used for pseudo-instructions
  374. that hold debugging information for variable tracking at assignments
  375. (see <samp>-fvar-tracking-assignments</samp> option). They are the RTL
  376. representation of <code>GIMPLE_DEBUG</code> statements
  377. (<a href="GIMPLE_005fDEBUG.html#GIMPLE_005fDEBUG"><code>GIMPLE_DEBUG</code></a>), with a <code>VAR_LOCATION</code> operand that
  378. binds a user variable tree to an RTL representation of the
  379. <code>value</code> in the corresponding statement. A <code>DEBUG_EXPR</code> in
  380. it stands for the value bound to the corresponding
  381. <code>DEBUG_EXPR_DECL</code>.
  382. </p>
  383. <p><code>GIMPLE_DEBUG_BEGIN_STMT</code> and <code>GIMPLE_DEBUG_INLINE_ENTRY</code> are
  384. expanded to RTL as a <code>DEBUG_INSN</code> with a <code>DEBUG_MARKER</code>
  385. <code>PATTERN</code>; the difference is the RTL mode: the former&rsquo;s
  386. <code>DEBUG_MARKER</code> is <code>VOIDmode</code>, whereas the latter is
  387. <code>BLKmode</code>; information about the inlined function can be taken from
  388. the lexical block encoded in the <code>INSN_LOCATION</code>. These
  389. <code>DEBUG_INSN</code>s, that do not carry <code>VAR_LOCATION</code> information,
  390. just <code>DEBUG_MARKER</code>s, can be detected by testing
  391. <code>DEBUG_MARKER_INSN_P</code>, whereas those that do can be recognized as
  392. <code>DEBUG_BIND_INSN_P</code>.
  393. </p>
  394. <p>Throughout optimization passes, <code>DEBUG_INSN</code>s are not reordered
  395. with respect to each other, particularly during scheduling. Binding
  396. information is kept in pseudo-instruction form, so that, unlike notes,
  397. it gets the same treatment and adjustments that regular instructions
  398. would. It is the variable tracking pass that turns these
  399. pseudo-instructions into <code>NOTE_INSN_VAR_LOCATION</code>,
  400. <code>NOTE_INSN_BEGIN_STMT</code> and <code>NOTE_INSN_INLINE_ENTRY</code> notes,
  401. analyzing control flow, value equivalences and changes to registers and
  402. memory referenced in value expressions, propagating the values of debug
  403. temporaries and determining expressions that can be used to compute the
  404. value of each user variable at as many points (ranges, actually) in the
  405. program as possible.
  406. </p>
  407. <p>Unlike <code>NOTE_INSN_VAR_LOCATION</code>, the value expression in an
  408. <code>INSN_VAR_LOCATION</code> denotes a value at that specific point in the
  409. program, rather than an expression that can be evaluated at any later
  410. point before an overriding <code>VAR_LOCATION</code> is encountered. E.g.,
  411. if a user variable is bound to a <code>REG</code> and then a subsequent insn
  412. modifies the <code>REG</code>, the note location would keep mapping the user
  413. variable to the register across the insn, whereas the insn location
  414. would keep the variable bound to the value, so that the variable
  415. tracking pass would emit another location note for the variable at the
  416. point in which the register is modified.
  417. </p>
  418. </dd>
  419. </dl>
  420. <a name="index-TImode_002c-in-insn"></a>
  421. <a name="index-HImode_002c-in-insn"></a>
  422. <a name="index-QImode_002c-in-insn"></a>
  423. <p>The machine mode of an insn is normally <code>VOIDmode</code>, but some
  424. phases use the mode for various purposes.
  425. </p>
  426. <p>The common subexpression elimination pass sets the mode of an insn to
  427. <code>QImode</code> when it is the first insn in a block that has already
  428. been processed.
  429. </p>
  430. <p>The second Haifa scheduling pass, for targets that can multiple issue,
  431. sets the mode of an insn to <code>TImode</code> when it is believed that the
  432. instruction begins an issue group. That is, when the instruction
  433. cannot issue simultaneously with the previous. This may be relied on
  434. by later passes, in particular machine-dependent reorg.
  435. </p>
  436. <p>Here is a table of the extra fields of <code>insn</code>, <code>jump_insn</code>
  437. and <code>call_insn</code> insns:
  438. </p>
  439. <dl compact="compact">
  440. <dd><a name="index-PATTERN"></a>
  441. </dd>
  442. <dt><code>PATTERN (<var>i</var>)</code></dt>
  443. <dd><p>An expression for the side effect performed by this insn. This must
  444. be one of the following codes: <code>set</code>, <code>call</code>, <code>use</code>,
  445. <code>clobber</code>, <code>return</code>, <code>simple_return</code>, <code>asm_input</code>,
  446. <code>asm_output</code>, <code>addr_vec</code>, <code>addr_diff_vec</code>,
  447. <code>trap_if</code>, <code>unspec</code>, <code>unspec_volatile</code>,
  448. <code>parallel</code>, <code>cond_exec</code>, or <code>sequence</code>. If it is a
  449. <code>parallel</code>, each element of the <code>parallel</code> must be one these
  450. codes, except that <code>parallel</code> expressions cannot be nested and
  451. <code>addr_vec</code> and <code>addr_diff_vec</code> are not permitted inside a
  452. <code>parallel</code> expression.
  453. </p>
  454. <a name="index-INSN_005fCODE"></a>
  455. </dd>
  456. <dt><code>INSN_CODE (<var>i</var>)</code></dt>
  457. <dd><p>An integer that says which pattern in the machine description matches
  458. this insn, or -1 if the matching has not yet been attempted.
  459. </p>
  460. <p>Such matching is never attempted and this field remains -1 on an insn
  461. whose pattern consists of a single <code>use</code>, <code>clobber</code>,
  462. <code>asm_input</code>, <code>addr_vec</code> or <code>addr_diff_vec</code> expression.
  463. </p>
  464. <a name="index-asm_005fnoperands"></a>
  465. <p>Matching is also never attempted on insns that result from an <code>asm</code>
  466. statement. These contain at least one <code>asm_operands</code> expression.
  467. The function <code>asm_noperands</code> returns a non-negative value for
  468. such insns.
  469. </p>
  470. <p>In the debugging output, this field is printed as a number followed by
  471. a symbolic representation that locates the pattern in the <samp>md</samp>
  472. file as some small positive or negative offset from a named pattern.
  473. </p>
  474. <a name="index-LOG_005fLINKS"></a>
  475. </dd>
  476. <dt><code>LOG_LINKS (<var>i</var>)</code></dt>
  477. <dd><p>A list (chain of <code>insn_list</code> expressions) giving information about
  478. dependencies between instructions within a basic block. Neither a jump
  479. nor a label may come between the related insns. These are only used by
  480. the schedulers and by combine. This is a deprecated data structure.
  481. Def-use and use-def chains are now preferred.
  482. </p>
  483. <a name="index-REG_005fNOTES"></a>
  484. </dd>
  485. <dt><code>REG_NOTES (<var>i</var>)</code></dt>
  486. <dd><p>A list (chain of <code>expr_list</code>, <code>insn_list</code> and <code>int_list</code>
  487. expressions) giving miscellaneous information about the insn. It is often
  488. information pertaining to the registers used in this insn.
  489. </p></dd>
  490. </dl>
  491. <p>The <code>LOG_LINKS</code> field of an insn is a chain of <code>insn_list</code>
  492. expressions. Each of these has two operands: the first is an insn,
  493. and the second is another <code>insn_list</code> expression (the next one in
  494. the chain). The last <code>insn_list</code> in the chain has a null pointer
  495. as second operand. The significant thing about the chain is which
  496. insns appear in it (as first operands of <code>insn_list</code>
  497. expressions). Their order is not significant.
  498. </p>
  499. <p>This list is originally set up by the flow analysis pass; it is a null
  500. pointer until then. Flow only adds links for those data dependencies
  501. which can be used for instruction combination. For each insn, the flow
  502. analysis pass adds a link to insns which store into registers values
  503. that are used for the first time in this insn.
  504. </p>
  505. <p>The <code>REG_NOTES</code> field of an insn is a chain similar to the
  506. <code>LOG_LINKS</code> field but it includes <code>expr_list</code> and <code>int_list</code>
  507. expressions in addition to <code>insn_list</code> expressions. There are several
  508. kinds of register notes, which are distinguished by the machine mode, which
  509. in a register note is really understood as being an <code>enum reg_note</code>.
  510. The first operand <var>op</var> of the note is data whose meaning depends on
  511. the kind of note.
  512. </p>
  513. <a name="index-REG_005fNOTE_005fKIND"></a>
  514. <a name="index-PUT_005fREG_005fNOTE_005fKIND"></a>
  515. <p>The macro <code>REG_NOTE_KIND (<var>x</var>)</code> returns the kind of
  516. register note. Its counterpart, the macro <code>PUT_REG_NOTE_KIND
  517. (<var>x</var>, <var>newkind</var>)</code> sets the register note type of <var>x</var> to be
  518. <var>newkind</var>.
  519. </p>
  520. <p>Register notes are of three classes: They may say something about an
  521. input to an insn, they may say something about an output of an insn, or
  522. they may create a linkage between two insns. There are also a set
  523. of values that are only used in <code>LOG_LINKS</code>.
  524. </p>
  525. <p>These register notes annotate inputs to an insn:
  526. </p>
  527. <dl compact="compact">
  528. <dd><a name="index-REG_005fDEAD"></a>
  529. </dd>
  530. <dt><code>REG_DEAD</code></dt>
  531. <dd><p>The value in <var>op</var> dies in this insn; that is to say, altering the
  532. value immediately after this insn would not affect the future behavior
  533. of the program.
  534. </p>
  535. <p>It does not follow that the register <var>op</var> has no useful value after
  536. this insn since <var>op</var> is not necessarily modified by this insn.
  537. Rather, no subsequent instruction uses the contents of <var>op</var>.
  538. </p>
  539. <a name="index-REG_005fUNUSED"></a>
  540. </dd>
  541. <dt><code>REG_UNUSED</code></dt>
  542. <dd><p>The register <var>op</var> being set by this insn will not be used in a
  543. subsequent insn. This differs from a <code>REG_DEAD</code> note, which
  544. indicates that the value in an input will not be used subsequently.
  545. These two notes are independent; both may be present for the same
  546. register.
  547. </p>
  548. <a name="index-REG_005fINC"></a>
  549. </dd>
  550. <dt><code>REG_INC</code></dt>
  551. <dd><p>The register <var>op</var> is incremented (or decremented; at this level
  552. there is no distinction) by an embedded side effect inside this insn.
  553. This means it appears in a <code>post_inc</code>, <code>pre_inc</code>,
  554. <code>post_dec</code> or <code>pre_dec</code> expression.
  555. </p>
  556. <a name="index-REG_005fNONNEG"></a>
  557. </dd>
  558. <dt><code>REG_NONNEG</code></dt>
  559. <dd><p>The register <var>op</var> is known to have a nonnegative value when this
  560. insn is reached. This is used by special looping instructions
  561. that terminate when the register goes negative.
  562. </p>
  563. <p>The <code>REG_NONNEG</code> note is added only to &lsquo;<samp>doloop_end</samp>&rsquo;
  564. insns, if its pattern uses a <code>ge</code> condition.
  565. </p>
  566. <a name="index-REG_005fLABEL_005fOPERAND"></a>
  567. </dd>
  568. <dt><code>REG_LABEL_OPERAND</code></dt>
  569. <dd><p>This insn uses <var>op</var>, a <code>code_label</code> or a <code>note</code> of type
  570. <code>NOTE_INSN_DELETED_LABEL</code>, but is not a <code>jump_insn</code>, or it
  571. is a <code>jump_insn</code> that refers to the operand as an ordinary
  572. operand. The label may still eventually be a jump target, but if so
  573. in an indirect jump in a subsequent insn. The presence of this note
  574. allows jump optimization to be aware that <var>op</var> is, in fact, being
  575. used, and flow optimization to build an accurate flow graph.
  576. </p>
  577. <a name="index-REG_005fLABEL_005fTARGET"></a>
  578. </dd>
  579. <dt><code>REG_LABEL_TARGET</code></dt>
  580. <dd><p>This insn is a <code>jump_insn</code> but not an <code>addr_vec</code> or
  581. <code>addr_diff_vec</code>. It uses <var>op</var>, a <code>code_label</code> as a
  582. direct or indirect jump target. Its purpose is similar to that of
  583. <code>REG_LABEL_OPERAND</code>. This note is only present if the insn has
  584. multiple targets; the last label in the insn (in the highest numbered
  585. insn-field) goes into the <code>JUMP_LABEL</code> field and does not have a
  586. <code>REG_LABEL_TARGET</code> note. See <a href="#Insns">JUMP_LABEL</a>.
  587. </p>
  588. <a name="index-REG_005fSETJMP"></a>
  589. </dd>
  590. <dt><code>REG_SETJMP</code></dt>
  591. <dd><p>Appears attached to each <code>CALL_INSN</code> to <code>setjmp</code> or a
  592. related function.
  593. </p></dd>
  594. </dl>
  595. <p>The following notes describe attributes of outputs of an insn:
  596. </p>
  597. <dl compact="compact">
  598. <dd><a name="index-REG_005fEQUIV"></a>
  599. <a name="index-REG_005fEQUAL"></a>
  600. </dd>
  601. <dt><code>REG_EQUIV</code></dt>
  602. <dt><code>REG_EQUAL</code></dt>
  603. <dd><p>This note is only valid on an insn that sets only one register and
  604. indicates that that register will be equal to <var>op</var> at run time; the
  605. scope of this equivalence differs between the two types of notes. The
  606. value which the insn explicitly copies into the register may look
  607. different from <var>op</var>, but they will be equal at run time. If the
  608. output of the single <code>set</code> is a <code>strict_low_part</code> or
  609. <code>zero_extract</code> expression, the note refers to the register that
  610. is contained in its first operand.
  611. </p>
  612. <p>For <code>REG_EQUIV</code>, the register is equivalent to <var>op</var> throughout
  613. the entire function, and could validly be replaced in all its
  614. occurrences by <var>op</var>. (&ldquo;Validly&rdquo; here refers to the data flow of
  615. the program; simple replacement may make some insns invalid.) For
  616. example, when a constant is loaded into a register that is never
  617. assigned any other value, this kind of note is used.
  618. </p>
  619. <p>When a parameter is copied into a pseudo-register at entry to a function,
  620. a note of this kind records that the register is equivalent to the stack
  621. slot where the parameter was passed. Although in this case the register
  622. may be set by other insns, it is still valid to replace the register
  623. by the stack slot throughout the function.
  624. </p>
  625. <p>A <code>REG_EQUIV</code> note is also used on an instruction which copies a
  626. register parameter into a pseudo-register at entry to a function, if
  627. there is a stack slot where that parameter could be stored. Although
  628. other insns may set the pseudo-register, it is valid for the compiler to
  629. replace the pseudo-register by stack slot throughout the function,
  630. provided the compiler ensures that the stack slot is properly
  631. initialized by making the replacement in the initial copy instruction as
  632. well. This is used on machines for which the calling convention
  633. allocates stack space for register parameters. See
  634. <code>REG_PARM_STACK_SPACE</code> in <a href="Stack-Arguments.html#Stack-Arguments">Stack Arguments</a>.
  635. </p>
  636. <p>In the case of <code>REG_EQUAL</code>, the register that is set by this insn
  637. will be equal to <var>op</var> at run time at the end of this insn but not
  638. necessarily elsewhere in the function. In this case, <var>op</var>
  639. is typically an arithmetic expression. For example, when a sequence of
  640. insns such as a library call is used to perform an arithmetic operation,
  641. this kind of note is attached to the insn that produces or copies the
  642. final value.
  643. </p>
  644. <p>These two notes are used in different ways by the compiler passes.
  645. <code>REG_EQUAL</code> is used by passes prior to register allocation (such as
  646. common subexpression elimination and loop optimization) to tell them how
  647. to think of that value. <code>REG_EQUIV</code> notes are used by register
  648. allocation to indicate that there is an available substitute expression
  649. (either a constant or a <code>mem</code> expression for the location of a
  650. parameter on the stack) that may be used in place of a register if
  651. insufficient registers are available.
  652. </p>
  653. <p>Except for stack homes for parameters, which are indicated by a
  654. <code>REG_EQUIV</code> note and are not useful to the early optimization
  655. passes and pseudo registers that are equivalent to a memory location
  656. throughout their entire life, which is not detected until later in
  657. the compilation, all equivalences are initially indicated by an attached
  658. <code>REG_EQUAL</code> note. In the early stages of register allocation, a
  659. <code>REG_EQUAL</code> note is changed into a <code>REG_EQUIV</code> note if
  660. <var>op</var> is a constant and the insn represents the only set of its
  661. destination register.
  662. </p>
  663. <p>Thus, compiler passes prior to register allocation need only check for
  664. <code>REG_EQUAL</code> notes and passes subsequent to register allocation
  665. need only check for <code>REG_EQUIV</code> notes.
  666. </p></dd>
  667. </dl>
  668. <p>These notes describe linkages between insns. They occur in pairs: one
  669. insn has one of a pair of notes that points to a second insn, which has
  670. the inverse note pointing back to the first insn.
  671. </p>
  672. <dl compact="compact">
  673. <dd><a name="index-REG_005fCC_005fSETTER"></a>
  674. <a name="index-REG_005fCC_005fUSER"></a>
  675. </dd>
  676. <dt><code>REG_CC_SETTER</code></dt>
  677. <dt><code>REG_CC_USER</code></dt>
  678. <dd><p>On machines that use <code>cc0</code>, the insns which set and use <code>cc0</code>
  679. set and use <code>cc0</code> are adjacent. However, when branch delay slot
  680. filling is done, this may no longer be true. In this case a
  681. <code>REG_CC_USER</code> note will be placed on the insn setting <code>cc0</code> to
  682. point to the insn using <code>cc0</code> and a <code>REG_CC_SETTER</code> note will
  683. be placed on the insn using <code>cc0</code> to point to the insn setting
  684. <code>cc0</code>.
  685. </p></dd>
  686. </dl>
  687. <p>These values are only used in the <code>LOG_LINKS</code> field, and indicate
  688. the type of dependency that each link represents. Links which indicate
  689. a data dependence (a read after write dependence) do not use any code,
  690. they simply have mode <code>VOIDmode</code>, and are printed without any
  691. descriptive text.
  692. </p>
  693. <dl compact="compact">
  694. <dd><a name="index-REG_005fDEP_005fTRUE"></a>
  695. </dd>
  696. <dt><code>REG_DEP_TRUE</code></dt>
  697. <dd><p>This indicates a true dependence (a read after write dependence).
  698. </p>
  699. <a name="index-REG_005fDEP_005fOUTPUT"></a>
  700. </dd>
  701. <dt><code>REG_DEP_OUTPUT</code></dt>
  702. <dd><p>This indicates an output dependence (a write after write dependence).
  703. </p>
  704. <a name="index-REG_005fDEP_005fANTI"></a>
  705. </dd>
  706. <dt><code>REG_DEP_ANTI</code></dt>
  707. <dd><p>This indicates an anti dependence (a write after read dependence).
  708. </p>
  709. </dd>
  710. </dl>
  711. <p>These notes describe information gathered from gcov profile data. They
  712. are stored in the <code>REG_NOTES</code> field of an insn.
  713. </p>
  714. <dl compact="compact">
  715. <dd><a name="index-REG_005fBR_005fPROB"></a>
  716. </dd>
  717. <dt><code>REG_BR_PROB</code></dt>
  718. <dd><p>This is used to specify the ratio of branches to non-branches of a
  719. branch insn according to the profile data. The note is represented
  720. as an <code>int_list</code> expression whose integer value is an encoding
  721. of <code>profile_probability</code> type. <code>profile_probability</code> provide
  722. member function <code>from_reg_br_prob_note</code> and <code>to_reg_br_prob_note</code>
  723. to extract and store the probability into the RTL encoding.
  724. </p>
  725. <a name="index-REG_005fBR_005fPRED"></a>
  726. </dd>
  727. <dt><code>REG_BR_PRED</code></dt>
  728. <dd><p>These notes are found in JUMP insns after delayed branch scheduling
  729. has taken place. They indicate both the direction and the likelihood
  730. of the JUMP. The format is a bitmask of ATTR_FLAG_* values.
  731. </p>
  732. <a name="index-REG_005fFRAME_005fRELATED_005fEXPR"></a>
  733. </dd>
  734. <dt><code>REG_FRAME_RELATED_EXPR</code></dt>
  735. <dd><p>This is used on an RTX_FRAME_RELATED_P insn wherein the attached expression
  736. is used in place of the actual insn pattern. This is done in cases where
  737. the pattern is either complex or misleading.
  738. </p></dd>
  739. </dl>
  740. <p>The note <code>REG_CALL_NOCF_CHECK</code> is used in conjunction with the
  741. <samp>-fcf-protection=branch</samp> option. The note is set if a
  742. <code>nocf_check</code> attribute is specified for a function type or a
  743. pointer to function type. The note is stored in the <code>REG_NOTES</code>
  744. field of an insn.
  745. </p>
  746. <dl compact="compact">
  747. <dd><a name="index-REG_005fCALL_005fNOCF_005fCHECK"></a>
  748. </dd>
  749. <dt><code>REG_CALL_NOCF_CHECK</code></dt>
  750. <dd><p>Users have control through the <code>nocf_check</code> attribute to identify
  751. which calls to a function should be skipped from control-flow instrumentation
  752. when the option <samp>-fcf-protection=branch</samp> is specified. The compiler
  753. puts a <code>REG_CALL_NOCF_CHECK</code> note on each <code>CALL_INSN</code> instruction
  754. that has a function type marked with a <code>nocf_check</code> attribute.
  755. </p></dd>
  756. </dl>
  757. <p>For convenience, the machine mode in an <code>insn_list</code> or
  758. <code>expr_list</code> is printed using these symbolic codes in debugging dumps.
  759. </p>
  760. <a name="index-insn_005flist"></a>
  761. <a name="index-expr_005flist"></a>
  762. <p>The only difference between the expression codes <code>insn_list</code> and
  763. <code>expr_list</code> is that the first operand of an <code>insn_list</code> is
  764. assumed to be an insn and is printed in debugging dumps as the insn&rsquo;s
  765. unique id; the first operand of an <code>expr_list</code> is printed in the
  766. ordinary way as an expression.
  767. </p>
  768. <hr>
  769. <div class="header">
  770. <p>
  771. Next: <a href="Calls.html#Calls" accesskey="n" rel="next">Calls</a>, Previous: <a href="Debug-Information.html#Debug-Information" accesskey="p" rel="prev">Debug Information</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>
  772. </div>
  773. </body>
  774. </html>