Regs-and-Memory.html 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550
  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: Regs and Memory</title>
  20. <meta name="description" content="GNU Compiler Collection (GCC) Internals: Regs and Memory">
  21. <meta name="keywords" content="GNU Compiler Collection (GCC) Internals: Regs and Memory">
  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="Arithmetic.html#Arithmetic" rel="next" title="Arithmetic">
  31. <link href="Constants.html#Constants" rel="prev" title="Constants">
  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="Regs-and-Memory"></a>
  63. <div class="header">
  64. <p>
  65. Next: <a href="Arithmetic.html#Arithmetic" accesskey="n" rel="next">Arithmetic</a>, Previous: <a href="Constants.html#Constants" accesskey="p" rel="prev">Constants</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="Registers-and-Memory"></a>
  69. <h3 class="section">13.8 Registers and Memory</h3>
  70. <a name="index-RTL-register-expressions"></a>
  71. <a name="index-RTL-memory-expressions"></a>
  72. <p>Here are the RTL expression types for describing access to machine
  73. registers and to main memory.
  74. </p>
  75. <dl compact="compact">
  76. <dd><a name="index-reg"></a>
  77. <a name="index-hard-registers"></a>
  78. <a name="index-pseudo-registers"></a>
  79. </dd>
  80. <dt><code>(reg:<var>m</var> <var>n</var>)</code></dt>
  81. <dd><p>For small values of the integer <var>n</var> (those that are less than
  82. <code>FIRST_PSEUDO_REGISTER</code>), this stands for a reference to machine
  83. register number <var>n</var>: a <em>hard register</em>. For larger values of
  84. <var>n</var>, it stands for a temporary value or <em>pseudo register</em>.
  85. The compiler&rsquo;s strategy is to generate code assuming an unlimited
  86. number of such pseudo registers, and later convert them into hard
  87. registers or into memory references.
  88. </p>
  89. <p><var>m</var> is the machine mode of the reference. It is necessary because
  90. machines can generally refer to each register in more than one mode.
  91. For example, a register may contain a full word but there may be
  92. instructions to refer to it as a half word or as a single byte, as
  93. well as instructions to refer to it as a floating point number of
  94. various precisions.
  95. </p>
  96. <p>Even for a register that the machine can access in only one mode,
  97. the mode must always be specified.
  98. </p>
  99. <p>The symbol <code>FIRST_PSEUDO_REGISTER</code> is defined by the machine
  100. description, since the number of hard registers on the machine is an
  101. invariant characteristic of the machine. Note, however, that not
  102. all of the machine registers must be general registers. All the
  103. machine registers that can be used for storage of data are given
  104. hard register numbers, even those that can be used only in certain
  105. instructions or can hold only certain types of data.
  106. </p>
  107. <p>A hard register may be accessed in various modes throughout one
  108. function, but each pseudo register is given a natural mode
  109. and is accessed only in that mode. When it is necessary to describe
  110. an access to a pseudo register using a nonnatural mode, a <code>subreg</code>
  111. expression is used.
  112. </p>
  113. <p>A <code>reg</code> expression with a machine mode that specifies more than
  114. one word of data may actually stand for several consecutive registers.
  115. If in addition the register number specifies a hardware register, then
  116. it actually represents several consecutive hardware registers starting
  117. with the specified one.
  118. </p>
  119. <p>Each pseudo register number used in a function&rsquo;s RTL code is
  120. represented by a unique <code>reg</code> expression.
  121. </p>
  122. <a name="index-FIRST_005fVIRTUAL_005fREGISTER"></a>
  123. <a name="index-LAST_005fVIRTUAL_005fREGISTER"></a>
  124. <p>Some pseudo register numbers, those within the range of
  125. <code>FIRST_VIRTUAL_REGISTER</code> to <code>LAST_VIRTUAL_REGISTER</code> only
  126. appear during the RTL generation phase and are eliminated before the
  127. optimization phases. These represent locations in the stack frame that
  128. cannot be determined until RTL generation for the function has been
  129. completed. The following virtual register numbers are defined:
  130. </p>
  131. <dl compact="compact">
  132. <dd><a name="index-VIRTUAL_005fINCOMING_005fARGS_005fREGNUM"></a>
  133. </dd>
  134. <dt><code>VIRTUAL_INCOMING_ARGS_REGNUM</code></dt>
  135. <dd><p>This points to the first word of the incoming arguments passed on the
  136. stack. Normally these arguments are placed there by the caller, but the
  137. callee may have pushed some arguments that were previously passed in
  138. registers.
  139. </p>
  140. <a name="index-FIRST_005fPARM_005fOFFSET-and-virtual-registers"></a>
  141. <a name="index-ARG_005fPOINTER_005fREGNUM-and-virtual-registers"></a>
  142. <p>When RTL generation is complete, this virtual register is replaced
  143. by the sum of the register given by <code>ARG_POINTER_REGNUM</code> and the
  144. value of <code>FIRST_PARM_OFFSET</code>.
  145. </p>
  146. <a name="index-VIRTUAL_005fSTACK_005fVARS_005fREGNUM"></a>
  147. <a name="index-FRAME_005fGROWS_005fDOWNWARD-and-virtual-registers"></a>
  148. </dd>
  149. <dt><code>VIRTUAL_STACK_VARS_REGNUM</code></dt>
  150. <dd><p>If <code>FRAME_GROWS_DOWNWARD</code> is defined to a nonzero value, this points
  151. to immediately above the first variable on the stack. Otherwise, it points
  152. to the first variable on the stack.
  153. </p>
  154. <a name="index-STARTING_005fFRAME_005fOFFSET-and-virtual-registers"></a>
  155. <a name="index-FRAME_005fPOINTER_005fREGNUM-and-virtual-registers"></a>
  156. <p><code>VIRTUAL_STACK_VARS_REGNUM</code> is replaced with the sum of the
  157. register given by <code>FRAME_POINTER_REGNUM</code> and the value
  158. <code>STARTING_FRAME_OFFSET</code>.
  159. </p>
  160. <a name="index-VIRTUAL_005fSTACK_005fDYNAMIC_005fREGNUM"></a>
  161. </dd>
  162. <dt><code>VIRTUAL_STACK_DYNAMIC_REGNUM</code></dt>
  163. <dd><p>This points to the location of dynamically allocated memory on the stack
  164. immediately after the stack pointer has been adjusted by the amount of
  165. memory desired.
  166. </p>
  167. <a name="index-STACK_005fDYNAMIC_005fOFFSET-and-virtual-registers"></a>
  168. <a name="index-STACK_005fPOINTER_005fREGNUM-and-virtual-registers"></a>
  169. <p>This virtual register is replaced by the sum of the register given by
  170. <code>STACK_POINTER_REGNUM</code> and the value <code>STACK_DYNAMIC_OFFSET</code>.
  171. </p>
  172. <a name="index-VIRTUAL_005fOUTGOING_005fARGS_005fREGNUM"></a>
  173. </dd>
  174. <dt><code>VIRTUAL_OUTGOING_ARGS_REGNUM</code></dt>
  175. <dd><p>This points to the location in the stack at which outgoing arguments
  176. should be written when the stack is pre-pushed (arguments pushed using
  177. push insns should always use <code>STACK_POINTER_REGNUM</code>).
  178. </p>
  179. <a name="index-STACK_005fPOINTER_005fOFFSET-and-virtual-registers"></a>
  180. <p>This virtual register is replaced by the sum of the register given by
  181. <code>STACK_POINTER_REGNUM</code> and the value <code>STACK_POINTER_OFFSET</code>.
  182. </p></dd>
  183. </dl>
  184. <a name="index-subreg"></a>
  185. </dd>
  186. <dt><code>(subreg:<var>m1</var> <var>reg:m2</var> <var>bytenum</var>)</code></dt>
  187. <dd>
  188. <p><code>subreg</code> expressions are used to refer to a register in a machine
  189. mode other than its natural one, or to refer to one register of
  190. a multi-part <code>reg</code> that actually refers to several registers.
  191. </p>
  192. <p>Each pseudo register has a natural mode. If it is necessary to
  193. operate on it in a different mode, the register must be
  194. enclosed in a <code>subreg</code>.
  195. </p>
  196. <p>There are currently three supported types for the first operand of a
  197. <code>subreg</code>:
  198. </p><ul>
  199. <li> pseudo registers
  200. This is the most common case. Most <code>subreg</code>s have pseudo
  201. <code>reg</code>s as their first operand.
  202. </li><li> mem
  203. <code>subreg</code>s of <code>mem</code> were common in earlier versions of GCC and
  204. are still supported. During the reload pass these are replaced by plain
  205. <code>mem</code>s. On machines that do not do instruction scheduling, use of
  206. <code>subreg</code>s of <code>mem</code> are still used, but this is no longer
  207. recommended. Such <code>subreg</code>s are considered to be
  208. <code>register_operand</code>s rather than <code>memory_operand</code>s before and
  209. during reload. Because of this, the scheduling passes cannot properly
  210. schedule instructions with <code>subreg</code>s of <code>mem</code>, so for machines
  211. that do scheduling, <code>subreg</code>s of <code>mem</code> should never be used.
  212. To support this, the combine and recog passes have explicit code to
  213. inhibit the creation of <code>subreg</code>s of <code>mem</code> when
  214. <code>INSN_SCHEDULING</code> is defined.
  215. <p>The use of <code>subreg</code>s of <code>mem</code> after the reload pass is an area
  216. that is not well understood and should be avoided. There is still some
  217. code in the compiler to support this, but this code has possibly rotted.
  218. This use of <code>subreg</code>s is discouraged and will most likely not be
  219. supported in the future.
  220. </p>
  221. </li><li> hard registers
  222. It is seldom necessary to wrap hard registers in <code>subreg</code>s; such
  223. registers would normally reduce to a single <code>reg</code> rtx. This use of
  224. <code>subreg</code>s is discouraged and may not be supported in the future.
  225. </li></ul>
  226. <p><code>subreg</code>s of <code>subreg</code>s are not supported. Using
  227. <code>simplify_gen_subreg</code> is the recommended way to avoid this problem.
  228. </p>
  229. <p><code>subreg</code>s come in two distinct flavors, each having its own
  230. usage and rules:
  231. </p>
  232. <dl compact="compact">
  233. <dt>Paradoxical subregs</dt>
  234. <dd><p>When <var>m1</var> is strictly wider than <var>m2</var>, the <code>subreg</code>
  235. expression is called <em>paradoxical</em>. The canonical test for this
  236. class of <code>subreg</code> is:
  237. </p>
  238. <div class="smallexample">
  239. <pre class="smallexample">GET_MODE_SIZE (<var>m1</var>) &gt; GET_MODE_SIZE (<var>m2</var>)
  240. </pre></div>
  241. <p>Paradoxical <code>subreg</code>s can be used as both lvalues and rvalues.
  242. When used as an lvalue, the low-order bits of the source value
  243. are stored in <var>reg</var> and the high-order bits are discarded.
  244. When used as an rvalue, the low-order bits of the <code>subreg</code> are
  245. taken from <var>reg</var> while the high-order bits may or may not be
  246. defined.
  247. </p>
  248. <p>The high-order bits of rvalues are defined in the following circumstances:
  249. </p>
  250. <ul>
  251. <li> <code>subreg</code>s of <code>mem</code>
  252. When <var>m2</var> is smaller than a word, the macro <code>LOAD_EXTEND_OP</code>,
  253. can control how the high-order bits are defined.
  254. </li><li> <code>subreg</code> of <code>reg</code>s
  255. The upper bits are defined when <code>SUBREG_PROMOTED_VAR_P</code> is true.
  256. <code>SUBREG_PROMOTED_UNSIGNED_P</code> describes what the upper bits hold.
  257. Such subregs usually represent local variables, register variables
  258. and parameter pseudo variables that have been promoted to a wider mode.
  259. </li></ul>
  260. <p><var>bytenum</var> is always zero for a paradoxical <code>subreg</code>, even on
  261. big-endian targets.
  262. </p>
  263. <p>For example, the paradoxical <code>subreg</code>:
  264. </p>
  265. <div class="smallexample">
  266. <pre class="smallexample">(set (subreg:SI (reg:HI <var>x</var>) 0) <var>y</var>)
  267. </pre></div>
  268. <p>stores the lower 2 bytes of <var>y</var> in <var>x</var> and discards the upper
  269. 2 bytes. A subsequent:
  270. </p>
  271. <div class="smallexample">
  272. <pre class="smallexample">(set <var>z</var> (subreg:SI (reg:HI <var>x</var>) 0))
  273. </pre></div>
  274. <p>would set the lower two bytes of <var>z</var> to <var>y</var> and set the upper
  275. two bytes to an unknown value assuming <code>SUBREG_PROMOTED_VAR_P</code> is
  276. false.
  277. </p>
  278. </dd>
  279. <dt>Normal subregs</dt>
  280. <dd><p>When <var>m1</var> is at least as narrow as <var>m2</var> the <code>subreg</code>
  281. expression is called <em>normal</em>.
  282. </p>
  283. <p>Normal <code>subreg</code>s restrict consideration to certain bits of
  284. <var>reg</var>. There are two cases. If <var>m1</var> is smaller than a word,
  285. the <code>subreg</code> refers to the least-significant part (or
  286. <em>lowpart</em>) of one word of <var>reg</var>. If <var>m1</var> is word-sized or
  287. greater, the <code>subreg</code> refers to one or more complete words.
  288. </p>
  289. <p>When used as an lvalue, <code>subreg</code> is a word-based accessor.
  290. Storing to a <code>subreg</code> modifies all the words of <var>reg</var> that
  291. overlap the <code>subreg</code>, but it leaves the other words of <var>reg</var>
  292. alone.
  293. </p>
  294. <p>When storing to a normal <code>subreg</code> that is smaller than a word,
  295. the other bits of the referenced word are usually left in an undefined
  296. state. This laxity makes it easier to generate efficient code for
  297. such instructions. To represent an instruction that preserves all the
  298. bits outside of those in the <code>subreg</code>, use <code>strict_low_part</code>
  299. or <code>zero_extract</code> around the <code>subreg</code>.
  300. </p>
  301. <p><var>bytenum</var> must identify the offset of the first byte of the
  302. <code>subreg</code> from the start of <var>reg</var>, assuming that <var>reg</var> is
  303. laid out in memory order. The memory order of bytes is defined by
  304. two target macros, <code>WORDS_BIG_ENDIAN</code> and <code>BYTES_BIG_ENDIAN</code>:
  305. </p>
  306. <ul>
  307. <li> <a name="index-WORDS_005fBIG_005fENDIAN_002c-effect-on-subreg"></a>
  308. <code>WORDS_BIG_ENDIAN</code>, if set to 1, says that byte number zero is
  309. part of the most significant word; otherwise, it is part of the least
  310. significant word.
  311. </li><li> <a name="index-BYTES_005fBIG_005fENDIAN_002c-effect-on-subreg"></a>
  312. <code>BYTES_BIG_ENDIAN</code>, if set to 1, says that byte number zero is
  313. the most significant byte within a word; otherwise, it is the least
  314. significant byte within a word.
  315. </li></ul>
  316. <a name="index-FLOAT_005fWORDS_005fBIG_005fENDIAN_002c-_0028lack-of_0029-effect-on-subreg"></a>
  317. <p>On a few targets, <code>FLOAT_WORDS_BIG_ENDIAN</code> disagrees with
  318. <code>WORDS_BIG_ENDIAN</code>. However, most parts of the compiler treat
  319. floating point values as if they had the same endianness as integer
  320. values. This works because they handle them solely as a collection of
  321. integer values, with no particular numerical value. Only real.c and
  322. the runtime libraries care about <code>FLOAT_WORDS_BIG_ENDIAN</code>.
  323. </p>
  324. <p>Thus,
  325. </p>
  326. <div class="smallexample">
  327. <pre class="smallexample">(subreg:HI (reg:SI <var>x</var>) 2)
  328. </pre></div>
  329. <p>on a <code>BYTES_BIG_ENDIAN</code>, &lsquo;<samp>UNITS_PER_WORD == 4</samp>&rsquo; target is the same as
  330. </p>
  331. <div class="smallexample">
  332. <pre class="smallexample">(subreg:HI (reg:SI <var>x</var>) 0)
  333. </pre></div>
  334. <p>on a little-endian, &lsquo;<samp>UNITS_PER_WORD == 4</samp>&rsquo; target. Both
  335. <code>subreg</code>s access the lower two bytes of register <var>x</var>.
  336. </p>
  337. </dd>
  338. </dl>
  339. <p>A <code>MODE_PARTIAL_INT</code> mode behaves as if it were as wide as the
  340. corresponding <code>MODE_INT</code> mode, except that it has an unknown
  341. number of undefined bits. For example:
  342. </p>
  343. <div class="smallexample">
  344. <pre class="smallexample">(subreg:PSI (reg:SI 0) 0)
  345. </pre></div>
  346. <p>accesses the whole of &lsquo;<samp>(reg:SI 0)</samp>&rsquo;, but the exact relationship
  347. between the <code>PSImode</code> value and the <code>SImode</code> value is not
  348. defined. If we assume &lsquo;<samp>UNITS_PER_WORD &lt;= 4</samp>&rsquo;, then the following
  349. two <code>subreg</code>s:
  350. </p>
  351. <div class="smallexample">
  352. <pre class="smallexample">(subreg:PSI (reg:DI 0) 0)
  353. (subreg:PSI (reg:DI 0) 4)
  354. </pre></div>
  355. <p>represent independent 4-byte accesses to the two halves of
  356. &lsquo;<samp>(reg:DI 0)</samp>&rsquo;. Both <code>subreg</code>s have an unknown number
  357. of undefined bits.
  358. </p>
  359. <p>If &lsquo;<samp>UNITS_PER_WORD &lt;= 2</samp>&rsquo; then these two <code>subreg</code>s:
  360. </p>
  361. <div class="smallexample">
  362. <pre class="smallexample">(subreg:HI (reg:PSI 0) 0)
  363. (subreg:HI (reg:PSI 0) 2)
  364. </pre></div>
  365. <p>represent independent 2-byte accesses that together span the whole
  366. of &lsquo;<samp>(reg:PSI 0)</samp>&rsquo;. Storing to the first <code>subreg</code> does not
  367. affect the value of the second, and vice versa. &lsquo;<samp>(reg:PSI 0)</samp>&rsquo;
  368. has an unknown number of undefined bits, so the assignment:
  369. </p>
  370. <div class="smallexample">
  371. <pre class="smallexample">(set (subreg:HI (reg:PSI 0) 0) (reg:HI 4))
  372. </pre></div>
  373. <p>does not guarantee that &lsquo;<samp>(subreg:HI (reg:PSI 0) 0)</samp>&rsquo; has the
  374. value &lsquo;<samp>(reg:HI 4)</samp>&rsquo;.
  375. </p>
  376. <a name="index-CANNOT_005fCHANGE_005fMODE_005fCLASS-and-subreg-semantics"></a>
  377. <p>The rules above apply to both pseudo <var>reg</var>s and hard <var>reg</var>s.
  378. If the semantics are not correct for particular combinations of
  379. <var>m1</var>, <var>m2</var> and hard <var>reg</var>, the target-specific code
  380. must ensure that those combinations are never used. For example:
  381. </p>
  382. <div class="smallexample">
  383. <pre class="smallexample">CANNOT_CHANGE_MODE_CLASS (<var>m2</var>, <var>m1</var>, <var>class</var>)
  384. </pre></div>
  385. <p>must be true for every class <var>class</var> that includes <var>reg</var>.
  386. </p>
  387. <a name="index-SUBREG_005fREG"></a>
  388. <a name="index-SUBREG_005fBYTE"></a>
  389. <p>The first operand of a <code>subreg</code> expression is customarily accessed
  390. with the <code>SUBREG_REG</code> macro and the second operand is customarily
  391. accessed with the <code>SUBREG_BYTE</code> macro.
  392. </p>
  393. <p>It has been several years since a platform in which
  394. <code>BYTES_BIG_ENDIAN</code> not equal to <code>WORDS_BIG_ENDIAN</code> has
  395. been tested. Anyone wishing to support such a platform in the future
  396. may be confronted with code rot.
  397. </p>
  398. <a name="index-scratch"></a>
  399. <a name="index-scratch-operands"></a>
  400. </dd>
  401. <dt><code>(scratch:<var>m</var>)</code></dt>
  402. <dd><p>This represents a scratch register that will be required for the
  403. execution of a single instruction and not used subsequently. It is
  404. converted into a <code>reg</code> by either the local register allocator or
  405. the reload pass.
  406. </p>
  407. <p><code>scratch</code> is usually present inside a <code>clobber</code> operation
  408. (see <a href="Side-Effects.html#Side-Effects">Side Effects</a>).
  409. </p>
  410. <a name="index-cc0"></a>
  411. <a name="index-condition-code-register"></a>
  412. </dd>
  413. <dt><code>(cc0)</code></dt>
  414. <dd><p>This refers to the machine&rsquo;s condition code register. It has no
  415. operands and may not have a machine mode. There are two ways to use it:
  416. </p>
  417. <ul>
  418. <li> To stand for a complete set of condition code flags. This is best on
  419. most machines, where each comparison sets the entire series of flags.
  420. <p>With this technique, <code>(cc0)</code> may be validly used in only two
  421. contexts: as the destination of an assignment (in test and compare
  422. instructions) and in comparison operators comparing against zero
  423. (<code>const_int</code> with value zero; that is to say, <code>const0_rtx</code>).
  424. </p>
  425. </li><li> To stand for a single flag that is the result of a single condition.
  426. This is useful on machines that have only a single flag bit, and in
  427. which comparison instructions must specify the condition to test.
  428. <p>With this technique, <code>(cc0)</code> may be validly used in only two
  429. contexts: as the destination of an assignment (in test and compare
  430. instructions) where the source is a comparison operator, and as the
  431. first operand of <code>if_then_else</code> (in a conditional branch).
  432. </p></li></ul>
  433. <a name="index-cc0_005frtx"></a>
  434. <p>There is only one expression object of code <code>cc0</code>; it is the
  435. value of the variable <code>cc0_rtx</code>. Any attempt to create an
  436. expression of code <code>cc0</code> will return <code>cc0_rtx</code>.
  437. </p>
  438. <p>Instructions can set the condition code implicitly. On many machines,
  439. nearly all instructions set the condition code based on the value that
  440. they compute or store. It is not necessary to record these actions
  441. explicitly in the RTL because the machine description includes a
  442. prescription for recognizing the instructions that do so (by means of
  443. the macro <code>NOTICE_UPDATE_CC</code>). See <a href="Condition-Code.html#Condition-Code">Condition Code</a>. Only
  444. instructions whose sole purpose is to set the condition code, and
  445. instructions that use the condition code, need mention <code>(cc0)</code>.
  446. </p>
  447. <p>On some machines, the condition code register is given a register number
  448. and a <code>reg</code> is used instead of <code>(cc0)</code>. This is usually the
  449. preferable approach if only a small subset of instructions modify the
  450. condition code. Other machines store condition codes in general
  451. registers; in such cases a pseudo register should be used.
  452. </p>
  453. <p>Some machines, such as the SPARC and RS/6000, have two sets of
  454. arithmetic instructions, one that sets and one that does not set the
  455. condition code. This is best handled by normally generating the
  456. instruction that does not set the condition code, and making a pattern
  457. that both performs the arithmetic and sets the condition code register
  458. (which would not be <code>(cc0)</code> in this case). For examples, search
  459. for &lsquo;<samp>addcc</samp>&rsquo; and &lsquo;<samp>andcc</samp>&rsquo; in <samp>sparc.md</samp>.
  460. </p>
  461. <a name="index-pc"></a>
  462. </dd>
  463. <dt><code>(pc)</code></dt>
  464. <dd><a name="index-program-counter"></a>
  465. <p>This represents the machine&rsquo;s program counter. It has no operands and
  466. may not have a machine mode. <code>(pc)</code> may be validly used only in
  467. certain specific contexts in jump instructions.
  468. </p>
  469. <a name="index-pc_005frtx"></a>
  470. <p>There is only one expression object of code <code>pc</code>; it is the value
  471. of the variable <code>pc_rtx</code>. Any attempt to create an expression of
  472. code <code>pc</code> will return <code>pc_rtx</code>.
  473. </p>
  474. <p>All instructions that do not jump alter the program counter implicitly
  475. by incrementing it, but there is no need to mention this in the RTL.
  476. </p>
  477. <a name="index-mem"></a>
  478. </dd>
  479. <dt><code>(mem:<var>m</var> <var>addr</var> <var>alias</var>)</code></dt>
  480. <dd><p>This RTX represents a reference to main memory at an address
  481. represented by the expression <var>addr</var>. <var>m</var> specifies how large
  482. a unit of memory is accessed. <var>alias</var> specifies an alias set for the
  483. reference. In general two items are in different alias sets if they cannot
  484. reference the same memory address.
  485. </p>
  486. <p>The construct <code>(mem:BLK (scratch))</code> is considered to alias all
  487. other memories. Thus it may be used as a memory barrier in epilogue
  488. stack deallocation patterns.
  489. </p>
  490. <a name="index-concat"></a>
  491. </dd>
  492. <dt><code>(concat<var>m</var> <var>rtx</var> <var>rtx</var>)</code></dt>
  493. <dd><p>This RTX represents the concatenation of two other RTXs. This is used
  494. for complex values. It should only appear in the RTL attached to
  495. declarations and during RTL generation. It should not appear in the
  496. ordinary insn chain.
  497. </p>
  498. <a name="index-concatn"></a>
  499. </dd>
  500. <dt><code>(concatn<var>m</var> [<var>rtx</var> &hellip;])</code></dt>
  501. <dd><p>This RTX represents the concatenation of all the <var>rtx</var> to make a
  502. single value. Like <code>concat</code>, this should only appear in
  503. declarations, and not in the insn chain.
  504. </p></dd>
  505. </dl>
  506. <hr>
  507. <div class="header">
  508. <p>
  509. Next: <a href="Arithmetic.html#Arithmetic" accesskey="n" rel="next">Arithmetic</a>, Previous: <a href="Constants.html#Constants" accesskey="p" rel="prev">Constants</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>
  510. </div>
  511. </body>
  512. </html>