You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

580 satır
26KB

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