Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

186 lines
8.2KB

  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>Incdec (GNU Compiler Collection (GCC) Internals)</title>
  21. <meta name="description" content="Incdec (GNU Compiler Collection (GCC) Internals)">
  22. <meta name="keywords" content="Incdec (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="Assembler.html#Assembler" rel="next" title="Assembler">
  31. <link href="Side-Effects.html#Side-Effects" rel="prev" title="Side Effects">
  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="Incdec"></a>
  62. <div class="header">
  63. <p>
  64. Next: <a href="Assembler.html#Assembler" accesskey="n" rel="next">Assembler</a>, Previous: <a href="Side-Effects.html#Side-Effects" accesskey="p" rel="prev">Side Effects</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="Embedded-Side_002dEffects-on-Addresses"></a>
  68. <h3 class="section">14.16 Embedded Side-Effects on Addresses</h3>
  69. <a name="index-RTL-preincrement"></a>
  70. <a name="index-RTL-postincrement"></a>
  71. <a name="index-RTL-predecrement"></a>
  72. <a name="index-RTL-postdecrement"></a>
  73. <p>Six special side-effect expression codes appear as memory addresses.
  74. </p>
  75. <dl compact="compact">
  76. <dd><a name="index-pre_005fdec"></a>
  77. </dd>
  78. <dt><code>(pre_dec:<var>m</var> <var>x</var>)</code></dt>
  79. <dd><p>Represents the side effect of decrementing <var>x</var> by a standard
  80. amount and represents also the value that <var>x</var> has after being
  81. decremented. <var>x</var> must be a <code>reg</code> or <code>mem</code>, but most
  82. machines allow only a <code>reg</code>. <var>m</var> must be the machine mode
  83. for pointers on the machine in use. The amount <var>x</var> is decremented
  84. by is the length in bytes of the machine mode of the containing memory
  85. reference of which this expression serves as the address. Here is an
  86. example of its use:
  87. </p>
  88. <div class="smallexample">
  89. <pre class="smallexample">(mem:DF (pre_dec:SI (reg:SI 39)))
  90. </pre></div>
  91. <p>This says to decrement pseudo register 39 by the length of a <code>DFmode</code>
  92. value and use the result to address a <code>DFmode</code> value.
  93. </p>
  94. <a name="index-pre_005finc"></a>
  95. </dd>
  96. <dt><code>(pre_inc:<var>m</var> <var>x</var>)</code></dt>
  97. <dd><p>Similar, but specifies incrementing <var>x</var> instead of decrementing it.
  98. </p>
  99. <a name="index-post_005fdec"></a>
  100. </dd>
  101. <dt><code>(post_dec:<var>m</var> <var>x</var>)</code></dt>
  102. <dd><p>Represents the same side effect as <code>pre_dec</code> but a different
  103. value. The value represented here is the value <var>x</var> has <i>before</i>
  104. being decremented.
  105. </p>
  106. <a name="index-post_005finc"></a>
  107. </dd>
  108. <dt><code>(post_inc:<var>m</var> <var>x</var>)</code></dt>
  109. <dd><p>Similar, but specifies incrementing <var>x</var> instead of decrementing it.
  110. </p>
  111. <a name="index-post_005fmodify"></a>
  112. </dd>
  113. <dt><code>(post_modify:<var>m</var> <var>x</var> <var>y</var>)</code></dt>
  114. <dd>
  115. <p>Represents the side effect of setting <var>x</var> to <var>y</var> and
  116. represents <var>x</var> before <var>x</var> is modified. <var>x</var> must be a
  117. <code>reg</code> or <code>mem</code>, but most machines allow only a <code>reg</code>.
  118. <var>m</var> must be the machine mode for pointers on the machine in use.
  119. </p>
  120. <p>The expression <var>y</var> must be one of three forms:
  121. <code>(plus:<var>m</var> <var>x</var> <var>z</var>)</code>,
  122. <code>(minus:<var>m</var> <var>x</var> <var>z</var>)</code>, or
  123. <code>(plus:<var>m</var> <var>x</var> <var>i</var>)</code>,
  124. where <var>z</var> is an index register and <var>i</var> is a constant.
  125. </p>
  126. <p>Here is an example of its use:
  127. </p>
  128. <div class="smallexample">
  129. <pre class="smallexample">(mem:SF (post_modify:SI (reg:SI 42) (plus (reg:SI 42)
  130. (reg:SI 48))))
  131. </pre></div>
  132. <p>This says to modify pseudo register 42 by adding the contents of pseudo
  133. register 48 to it, after the use of what ever 42 points to.
  134. </p>
  135. <a name="index-pre_005fmodify"></a>
  136. </dd>
  137. <dt><code>(pre_modify:<var>m</var> <var>x</var> <var>expr</var>)</code></dt>
  138. <dd><p>Similar except side effects happen before the use.
  139. </p></dd>
  140. </dl>
  141. <p>These embedded side effect expressions must be used with care. Instruction
  142. patterns may not use them. Until the &lsquo;<samp>flow</samp>&rsquo; pass of the compiler,
  143. they may occur only to represent pushes onto the stack. The &lsquo;<samp>flow</samp>&rsquo;
  144. pass finds cases where registers are incremented or decremented in one
  145. instruction and used as an address shortly before or after; these cases are
  146. then transformed to use pre- or post-increment or -decrement.
  147. </p>
  148. <p>If a register used as the operand of these expressions is used in
  149. another address in an insn, the original value of the register is used.
  150. Uses of the register outside of an address are not permitted within the
  151. same insn as a use in an embedded side effect expression because such
  152. insns behave differently on different machines and hence must be treated
  153. as ambiguous and disallowed.
  154. </p>
  155. <p>An instruction that can be represented with an embedded side effect
  156. could also be represented using <code>parallel</code> containing an additional
  157. <code>set</code> to describe how the address register is altered. This is not
  158. done because machines that allow these operations at all typically
  159. allow them wherever a memory address is called for. Describing them as
  160. additional parallel stores would require doubling the number of entries
  161. in the machine description.
  162. </p>
  163. <hr>
  164. <div class="header">
  165. <p>
  166. Next: <a href="Assembler.html#Assembler" accesskey="n" rel="next">Assembler</a>, Previous: <a href="Side-Effects.html#Side-Effects" accesskey="p" rel="prev">Side Effects</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>
  167. </div>
  168. </body>
  169. </html>