Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

150 Zeilen
6.8KB

  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>Substitutions (GNU Compiler Collection (GCC) Internals)</title>
  21. <meta name="description" content="Substitutions (GNU Compiler Collection (GCC) Internals)">
  22. <meta name="keywords" content="Substitutions (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="Mode-Iterators.html#Mode-Iterators" rel="up" title="Mode Iterators">
  30. <link href="Examples.html#Examples" rel="next" title="Examples">
  31. <link href="Defining-Mode-Iterators.html#Defining-Mode-Iterators" rel="prev" title="Defining Mode Iterators">
  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="Substitutions"></a>
  62. <div class="header">
  63. <p>
  64. Next: <a href="Examples.html#Examples" accesskey="n" rel="next">Examples</a>, Previous: <a href="Defining-Mode-Iterators.html#Defining-Mode-Iterators" accesskey="p" rel="prev">Defining Mode Iterators</a>, Up: <a href="Mode-Iterators.html#Mode-Iterators" accesskey="u" rel="up">Mode Iterators</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="Substitution-in-Mode-Iterators"></a>
  68. <h4 class="subsubsection">17.23.1.2 Substitution in Mode Iterators</h4>
  69. <a name="index-define_005fmode_005fattr"></a>
  70. <p>If an <samp>.md</samp> file construct uses mode iterators, each version of the
  71. construct will often need slightly different strings or modes. For
  72. example:
  73. </p>
  74. <ul>
  75. <li> When a <code>define_expand</code> defines several <code>add<var>m</var>3</code> patterns
  76. (see <a href="Standard-Names.html#Standard-Names">Standard Names</a>), each expander will need to use the
  77. appropriate mode name for <var>m</var>.
  78. </li><li> When a <code>define_insn</code> defines several instruction patterns,
  79. each instruction will often use a different assembler mnemonic.
  80. </li><li> When a <code>define_insn</code> requires operands with different modes,
  81. using an iterator for one of the operand modes usually requires a specific
  82. mode for the other operand(s).
  83. </li></ul>
  84. <p>GCC supports such variations through a system of &ldquo;mode attributes&rdquo;.
  85. There are two standard attributes: <code>mode</code>, which is the name of
  86. the mode in lower case, and <code>MODE</code>, which is the same thing in
  87. upper case. You can define other attributes using:
  88. </p>
  89. <div class="smallexample">
  90. <pre class="smallexample">(define_mode_attr <var>name</var> [(<var>mode1</var> &quot;<var>value1</var>&quot;) &hellip; (<var>moden</var> &quot;<var>valuen</var>&quot;)])
  91. </pre></div>
  92. <p>where <var>name</var> is the name of the attribute and <var>valuei</var>
  93. is the value associated with <var>modei</var>.
  94. </p>
  95. <p>When GCC replaces some <var>:iterator</var> with <var>:mode</var>, it will scan
  96. each string and mode in the pattern for sequences of the form
  97. <code>&lt;<var>iterator</var>:<var>attr</var>&gt;</code>, where <var>attr</var> is the name of a
  98. mode attribute. If the attribute is defined for <var>mode</var>, the whole
  99. <code>&lt;&hellip;&gt;</code> sequence will be replaced by the appropriate attribute
  100. value.
  101. </p>
  102. <p>For example, suppose an <samp>.md</samp> file has:
  103. </p>
  104. <div class="smallexample">
  105. <pre class="smallexample">(define_mode_iterator P [(SI &quot;Pmode == SImode&quot;) (DI &quot;Pmode == DImode&quot;)])
  106. (define_mode_attr load [(SI &quot;lw&quot;) (DI &quot;ld&quot;)])
  107. </pre></div>
  108. <p>If one of the patterns that uses <code>:P</code> contains the string
  109. <code>&quot;&lt;P:load&gt;\t%0,%1&quot;</code>, the <code>SI</code> version of that pattern
  110. will use <code>&quot;lw\t%0,%1&quot;</code> and the <code>DI</code> version will use
  111. <code>&quot;ld\t%0,%1&quot;</code>.
  112. </p>
  113. <p>Here is an example of using an attribute for a mode:
  114. </p>
  115. <div class="smallexample">
  116. <pre class="smallexample">(define_mode_iterator LONG [SI DI])
  117. (define_mode_attr SHORT [(SI &quot;HI&quot;) (DI &quot;SI&quot;)])
  118. (define_insn &hellip;
  119. (sign_extend:LONG (match_operand:&lt;LONG:SHORT&gt; &hellip;)) &hellip;)
  120. </pre></div>
  121. <p>The <code><var>iterator</var>:</code> prefix may be omitted, in which case the
  122. substitution will be attempted for every iterator expansion.
  123. </p>
  124. <hr>
  125. <div class="header">
  126. <p>
  127. Next: <a href="Examples.html#Examples" accesskey="n" rel="next">Examples</a>, Previous: <a href="Defining-Mode-Iterators.html#Defining-Mode-Iterators" accesskey="p" rel="prev">Defining Mode Iterators</a>, Up: <a href="Mode-Iterators.html#Mode-Iterators" accesskey="u" rel="up">Mode Iterators</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>
  128. </div>
  129. </body>
  130. </html>