選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

140 行
6.9KB

  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>Define Subst (GNU Compiler Collection (GCC) Internals)</title>
  21. <meta name="description" content="Define Subst (GNU Compiler Collection (GCC) Internals)">
  22. <meta name="keywords" content="Define Subst (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="Machine-Desc.html#Machine-Desc" rel="up" title="Machine Desc">
  30. <link href="Define-Subst-Example.html#Define-Subst-Example" rel="next" title="Define Subst Example">
  31. <link href="Conditional-Execution.html#Conditional-Execution" rel="prev" title="Conditional Execution">
  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="Define-Subst"></a>
  62. <div class="header">
  63. <p>
  64. Next: <a href="Constant-Definitions.html#Constant-Definitions" accesskey="n" rel="next">Constant Definitions</a>, Previous: <a href="Conditional-Execution.html#Conditional-Execution" accesskey="p" rel="prev">Conditional Execution</a>, Up: <a href="Machine-Desc.html#Machine-Desc" accesskey="u" rel="up">Machine Desc</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="RTL-Templates-Transformations"></a>
  68. <h3 class="section">17.21 RTL Templates Transformations</h3>
  69. <a name="index-define_005fsubst"></a>
  70. <p>For some hardware architectures there are common cases when the RTL
  71. templates for the instructions can be derived from the other RTL
  72. templates using simple transformations. E.g., <samp>i386.md</samp> contains
  73. an RTL template for the ordinary <code>sub</code> instruction&mdash;
  74. <code>*subsi_1</code>, and for the <code>sub</code> instruction with subsequent
  75. zero-extension&mdash;<code>*subsi_1_zext</code>. Such cases can be easily
  76. implemented by a single meta-template capable of generating a modified
  77. case based on the initial one:
  78. </p>
  79. <a name="index-define_005fsubst-4"></a>
  80. <div class="smallexample">
  81. <pre class="smallexample">(define_subst &quot;<var>name</var>&quot;
  82. [<var>input-template</var>]
  83. &quot;<var>condition</var>&quot;
  84. [<var>output-template</var>])
  85. </pre></div>
  86. <p><var>input-template</var> is a pattern describing the source RTL template,
  87. which will be transformed.
  88. </p>
  89. <p><var>condition</var> is a C expression that is conjunct with the condition
  90. from the input-template to generate a condition to be used in the
  91. output-template.
  92. </p>
  93. <p><var>output-template</var> is a pattern that will be used in the resulting
  94. template.
  95. </p>
  96. <p><code>define_subst</code> mechanism is tightly coupled with the notion of the
  97. subst attribute (see <a href="Subst-Iterators.html#Subst-Iterators">Subst Iterators</a>). The use of
  98. <code>define_subst</code> is triggered by a reference to a subst attribute in
  99. the transforming RTL template. This reference initiates duplication of
  100. the source RTL template and substitution of the attributes with their
  101. values. The source RTL template is left unchanged, while the copy is
  102. transformed by <code>define_subst</code>. This transformation can fail in the
  103. case when the source RTL template is not matched against the
  104. input-template of the <code>define_subst</code>. In such case the copy is
  105. deleted.
  106. </p>
  107. <p><code>define_subst</code> can be used only in <code>define_insn</code> and
  108. <code>define_expand</code>, it cannot be used in other expressions (e.g. in
  109. <code>define_insn_and_split</code>).
  110. </p>
  111. <table class="menu" border="0" cellspacing="0">
  112. <tr><td align="left" valign="top">&bull; <a href="Define-Subst-Example.html#Define-Subst-Example" accesskey="1">Define Subst Example</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Example of <code>define_subst</code> work.
  113. </td></tr>
  114. <tr><td align="left" valign="top">&bull; <a href="Define-Subst-Pattern-Matching.html#Define-Subst-Pattern-Matching" accesskey="2">Define Subst Pattern Matching</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Process of template comparison.
  115. </td></tr>
  116. <tr><td align="left" valign="top">&bull; <a href="Define-Subst-Output-Template.html#Define-Subst-Output-Template" accesskey="3">Define Subst Output Template</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Generation of output template.
  117. </td></tr>
  118. </table>
  119. <hr>
  120. <div class="header">
  121. <p>
  122. Next: <a href="Constant-Definitions.html#Constant-Definitions" accesskey="n" rel="next">Constant Definitions</a>, Previous: <a href="Conditional-Execution.html#Conditional-Execution" accesskey="p" rel="prev">Conditional Execution</a>, Up: <a href="Machine-Desc.html#Machine-Desc" accesskey="u" rel="up">Machine Desc</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>
  123. </div>
  124. </body>
  125. </html>