Insns.html 36 KB

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