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.

242 lines
11KB

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