Machine_002dIndependent-Predicates.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  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: Machine-Independent Predicates</title>
  20. <meta name="description" content="GNU Compiler Collection (GCC) Internals: Machine-Independent Predicates">
  21. <meta name="keywords" content="GNU Compiler Collection (GCC) Internals: Machine-Independent Predicates">
  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="Predicates.html#Predicates" rel="up" title="Predicates">
  30. <link href="Defining-Predicates.html#Defining-Predicates" rel="next" title="Defining Predicates">
  31. <link href="Predicates.html#Predicates" rel="prev" title="Predicates">
  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="Machine_002dIndependent-Predicates"></a>
  63. <div class="header">
  64. <p>
  65. Next: <a href="Defining-Predicates.html#Defining-Predicates" accesskey="n" rel="next">Defining Predicates</a>, Up: <a href="Predicates.html#Predicates" accesskey="u" rel="up">Predicates</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="Machine_002dIndependent-Predicates-1"></a>
  69. <h4 class="subsection">16.7.1 Machine-Independent Predicates</h4>
  70. <a name="index-machine_002dindependent-predicates"></a>
  71. <a name="index-generic-predicates"></a>
  72. <p>These are the generic predicates available to all back ends. They are
  73. defined in <samp>recog.c</samp>. The first category of predicates allow
  74. only constant, or <em>immediate</em>, operands.
  75. </p>
  76. <dl>
  77. <dt><a name="index-immediate_005foperand"></a>Function: <strong>immediate_operand</strong></dt>
  78. <dd><p>This predicate allows any sort of constant that fits in <var>mode</var>.
  79. It is an appropriate choice for instructions that take operands that
  80. must be constant.
  81. </p></dd></dl>
  82. <dl>
  83. <dt><a name="index-const_005fint_005foperand"></a>Function: <strong>const_int_operand</strong></dt>
  84. <dd><p>This predicate allows any <code>CONST_INT</code> expression that fits in
  85. <var>mode</var>. It is an appropriate choice for an immediate operand that
  86. does not allow a symbol or label.
  87. </p></dd></dl>
  88. <dl>
  89. <dt><a name="index-const_005fdouble_005foperand"></a>Function: <strong>const_double_operand</strong></dt>
  90. <dd><p>This predicate accepts any <code>CONST_DOUBLE</code> expression that has
  91. exactly <var>mode</var>. If <var>mode</var> is <code>VOIDmode</code>, it will also
  92. accept <code>CONST_INT</code>. It is intended for immediate floating point
  93. constants.
  94. </p></dd></dl>
  95. <p>The second category of predicates allow only some kind of machine
  96. register.
  97. </p>
  98. <dl>
  99. <dt><a name="index-register_005foperand"></a>Function: <strong>register_operand</strong></dt>
  100. <dd><p>This predicate allows any <code>REG</code> or <code>SUBREG</code> expression that
  101. is valid for <var>mode</var>. It is often suitable for arithmetic
  102. instruction operands on a RISC machine.
  103. </p></dd></dl>
  104. <dl>
  105. <dt><a name="index-pmode_005fregister_005foperand"></a>Function: <strong>pmode_register_operand</strong></dt>
  106. <dd><p>This is a slight variant on <code>register_operand</code> which works around
  107. a limitation in the machine-description reader.
  108. </p>
  109. <div class="smallexample">
  110. <pre class="smallexample">(match_operand <var>n</var> &quot;pmode_register_operand&quot; <var>constraint</var>)
  111. </pre></div>
  112. <p>means exactly what
  113. </p>
  114. <div class="smallexample">
  115. <pre class="smallexample">(match_operand:P <var>n</var> &quot;register_operand&quot; <var>constraint</var>)
  116. </pre></div>
  117. <p>would mean, if the machine-description reader accepted &lsquo;<samp>:P</samp>&rsquo;
  118. mode suffixes. Unfortunately, it cannot, because <code>Pmode</code> is an
  119. alias for some other mode, and might vary with machine-specific
  120. options. See <a href="Misc.html#Misc">Misc</a>.
  121. </p></dd></dl>
  122. <dl>
  123. <dt><a name="index-scratch_005foperand"></a>Function: <strong>scratch_operand</strong></dt>
  124. <dd><p>This predicate allows hard registers and <code>SCRATCH</code> expressions,
  125. but not pseudo-registers. It is used internally by <code>match_scratch</code>;
  126. it should not be used directly.
  127. </p></dd></dl>
  128. <p>The third category of predicates allow only some kind of memory reference.
  129. </p>
  130. <dl>
  131. <dt><a name="index-memory_005foperand"></a>Function: <strong>memory_operand</strong></dt>
  132. <dd><p>This predicate allows any valid reference to a quantity of mode
  133. <var>mode</var> in memory, as determined by the weak form of
  134. <code>GO_IF_LEGITIMATE_ADDRESS</code> (see <a href="Addressing-Modes.html#Addressing-Modes">Addressing Modes</a>).
  135. </p></dd></dl>
  136. <dl>
  137. <dt><a name="index-address_005foperand"></a>Function: <strong>address_operand</strong></dt>
  138. <dd><p>This predicate is a little unusual; it allows any operand that is a
  139. valid expression for the <em>address</em> of a quantity of mode
  140. <var>mode</var>, again determined by the weak form of
  141. <code>GO_IF_LEGITIMATE_ADDRESS</code>. To first order, if
  142. &lsquo;<samp>(mem:<var>mode</var>&nbsp;(<var>exp</var>))<!-- /@w --></samp>&rsquo; is acceptable to
  143. <code>memory_operand</code>, then <var>exp</var> is acceptable to
  144. <code>address_operand</code>. Note that <var>exp</var> does not necessarily have
  145. the mode <var>mode</var>.
  146. </p></dd></dl>
  147. <dl>
  148. <dt><a name="index-indirect_005foperand"></a>Function: <strong>indirect_operand</strong></dt>
  149. <dd><p>This is a stricter form of <code>memory_operand</code> which allows only
  150. memory references with a <code>general_operand</code> as the address
  151. expression. New uses of this predicate are discouraged, because
  152. <code>general_operand</code> is very permissive, so it&rsquo;s hard to tell what
  153. an <code>indirect_operand</code> does or does not allow. If a target has
  154. different requirements for memory operands for different instructions,
  155. it is better to define target-specific predicates which enforce the
  156. hardware&rsquo;s requirements explicitly.
  157. </p></dd></dl>
  158. <dl>
  159. <dt><a name="index-push_005foperand"></a>Function: <strong>push_operand</strong></dt>
  160. <dd><p>This predicate allows a memory reference suitable for pushing a value
  161. onto the stack. This will be a <code>MEM</code> which refers to
  162. <code>stack_pointer_rtx</code>, with a side-effect in its address expression
  163. (see <a href="Incdec.html#Incdec">Incdec</a>); which one is determined by the
  164. <code>STACK_PUSH_CODE</code> macro (see <a href="Frame-Layout.html#Frame-Layout">Frame Layout</a>).
  165. </p></dd></dl>
  166. <dl>
  167. <dt><a name="index-pop_005foperand"></a>Function: <strong>pop_operand</strong></dt>
  168. <dd><p>This predicate allows a memory reference suitable for popping a value
  169. off the stack. Again, this will be a <code>MEM</code> referring to
  170. <code>stack_pointer_rtx</code>, with a side-effect in its address
  171. expression. However, this time <code>STACK_POP_CODE</code> is expected.
  172. </p></dd></dl>
  173. <p>The fourth category of predicates allow some combination of the above
  174. operands.
  175. </p>
  176. <dl>
  177. <dt><a name="index-nonmemory_005foperand"></a>Function: <strong>nonmemory_operand</strong></dt>
  178. <dd><p>This predicate allows any immediate or register operand valid for <var>mode</var>.
  179. </p></dd></dl>
  180. <dl>
  181. <dt><a name="index-nonimmediate_005foperand"></a>Function: <strong>nonimmediate_operand</strong></dt>
  182. <dd><p>This predicate allows any register or memory operand valid for <var>mode</var>.
  183. </p></dd></dl>
  184. <dl>
  185. <dt><a name="index-general_005foperand"></a>Function: <strong>general_operand</strong></dt>
  186. <dd><p>This predicate allows any immediate, register, or memory operand
  187. valid for <var>mode</var>.
  188. </p></dd></dl>
  189. <p>Finally, there are two generic operator predicates.
  190. </p>
  191. <dl>
  192. <dt><a name="index-comparison_005foperator"></a>Function: <strong>comparison_operator</strong></dt>
  193. <dd><p>This predicate matches any expression which performs an arithmetic
  194. comparison in <var>mode</var>; that is, <code>COMPARISON_P</code> is true for the
  195. expression code.
  196. </p></dd></dl>
  197. <dl>
  198. <dt><a name="index-ordered_005fcomparison_005foperator"></a>Function: <strong>ordered_comparison_operator</strong></dt>
  199. <dd><p>This predicate matches any expression which performs an arithmetic
  200. comparison in <var>mode</var> and whose expression code is valid for integer
  201. modes; that is, the expression code will be one of <code>eq</code>, <code>ne</code>,
  202. <code>lt</code>, <code>ltu</code>, <code>le</code>, <code>leu</code>, <code>gt</code>, <code>gtu</code>,
  203. <code>ge</code>, <code>geu</code>.
  204. </p></dd></dl>
  205. <hr>
  206. <div class="header">
  207. <p>
  208. Next: <a href="Defining-Predicates.html#Defining-Predicates" accesskey="n" rel="next">Defining Predicates</a>, Up: <a href="Predicates.html#Predicates" accesskey="u" rel="up">Predicates</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>
  209. </div>
  210. </body>
  211. </html>