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.

178 Zeilen
9.7KB

  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>GIMPLE (GNU Compiler Collection (GCC) Internals)</title>
  21. <meta name="description" content="GIMPLE (GNU Compiler Collection (GCC) Internals)">
  22. <meta name="keywords" content="GIMPLE (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="index.html#Top" rel="up" title="Top">
  30. <link href="Tuple-representation.html#Tuple-representation" rel="next" title="Tuple representation">
  31. <link href="C_002b_002b-Expressions.html#C_002b_002b-Expressions" rel="prev" title="C++ Expressions">
  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="GIMPLE"></a>
  62. <div class="header">
  63. <p>
  64. Next: <a href="Tree-SSA.html#Tree-SSA" accesskey="n" rel="next">Tree SSA</a>, Previous: <a href="GENERIC.html#GENERIC" accesskey="p" rel="prev">GENERIC</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</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="GIMPLE-1"></a>
  68. <h2 class="chapter">12 GIMPLE</h2>
  69. <a name="index-GIMPLE-2"></a>
  70. <p>GIMPLE is a three-address representation derived from GENERIC by
  71. breaking down GENERIC expressions into tuples of no more than 3
  72. operands (with some exceptions like function calls). GIMPLE was
  73. heavily influenced by the SIMPLE IL used by the McCAT compiler
  74. project at McGill University, though we have made some different
  75. choices. For one thing, SIMPLE doesn&rsquo;t support <code>goto</code>.
  76. </p>
  77. <p>Temporaries are introduced to hold intermediate values needed to
  78. compute complex expressions. Additionally, all the control
  79. structures used in GENERIC are lowered into conditional jumps,
  80. lexical scopes are removed and exception regions are converted
  81. into an on the side exception region tree.
  82. </p>
  83. <p>The compiler pass which converts GENERIC into GIMPLE is referred to as
  84. the &lsquo;<samp>gimplifier</samp>&rsquo;. The gimplifier works recursively, generating
  85. GIMPLE tuples out of the original GENERIC expressions.
  86. </p>
  87. <p>One of the early implementation strategies used for the GIMPLE
  88. representation was to use the same internal data structures used
  89. by front ends to represent parse trees. This simplified
  90. implementation because we could leverage existing functionality
  91. and interfaces. However, GIMPLE is a much more restrictive
  92. representation than abstract syntax trees (AST), therefore it
  93. does not require the full structural complexity provided by the
  94. main tree data structure.
  95. </p>
  96. <p>The GENERIC representation of a function is stored in the
  97. <code>DECL_SAVED_TREE</code> field of the associated <code>FUNCTION_DECL</code>
  98. tree node. It is converted to GIMPLE by a call to
  99. <code>gimplify_function_tree</code>.
  100. </p>
  101. <p>If a front end wants to include language-specific tree codes in the tree
  102. representation which it provides to the back end, it must provide a
  103. definition of <code>LANG_HOOKS_GIMPLIFY_EXPR</code> which knows how to
  104. convert the front end trees to GIMPLE. Usually such a hook will involve
  105. much of the same code for expanding front end trees to RTL. This function
  106. can return fully lowered GIMPLE, or it can return GENERIC trees and let the
  107. main gimplifier lower them the rest of the way; this is often simpler.
  108. GIMPLE that is not fully lowered is known as &ldquo;High GIMPLE&rdquo; and
  109. consists of the IL before the pass <code>pass_lower_cf</code>. High GIMPLE
  110. contains some container statements like lexical scopes
  111. (represented by <code>GIMPLE_BIND</code>) and nested expressions (e.g.,
  112. <code>GIMPLE_TRY</code>), while &ldquo;Low GIMPLE&rdquo; exposes all of the
  113. implicit jumps for control and exception expressions directly in
  114. the IL and EH region trees.
  115. </p>
  116. <p>The C and C++ front ends currently convert directly from front end
  117. trees to GIMPLE, and hand that off to the back end rather than first
  118. converting to GENERIC. Their gimplifier hooks know about all the
  119. <code>_STMT</code> nodes and how to convert them to GENERIC forms. There
  120. was some work done on a genericization pass which would run first, but
  121. the existence of <code>STMT_EXPR</code> meant that in order to convert all
  122. of the C statements into GENERIC equivalents would involve walking the
  123. entire tree anyway, so it was simpler to lower all the way. This
  124. might change in the future if someone writes an optimization pass
  125. which would work better with higher-level trees, but currently the
  126. optimizers all expect GIMPLE.
  127. </p>
  128. <p>You can request to dump a C-like representation of the GIMPLE form
  129. with the flag <samp>-fdump-tree-gimple</samp>.
  130. </p>
  131. <table class="menu" border="0" cellspacing="0">
  132. <tr><td align="left" valign="top">&bull; <a href="Tuple-representation.html#Tuple-representation" accesskey="1">Tuple representation</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
  133. </td></tr>
  134. <tr><td align="left" valign="top">&bull; <a href="Class-hierarchy-of-GIMPLE-statements.html#Class-hierarchy-of-GIMPLE-statements" accesskey="2">Class hierarchy of GIMPLE statements</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
  135. </td></tr>
  136. <tr><td align="left" valign="top">&bull; <a href="GIMPLE-instruction-set.html#GIMPLE-instruction-set" accesskey="3">GIMPLE instruction set</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
  137. </td></tr>
  138. <tr><td align="left" valign="top">&bull; <a href="GIMPLE-Exception-Handling.html#GIMPLE-Exception-Handling" accesskey="4">GIMPLE Exception Handling</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
  139. </td></tr>
  140. <tr><td align="left" valign="top">&bull; <a href="Temporaries.html#Temporaries" accesskey="5">Temporaries</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
  141. </td></tr>
  142. <tr><td align="left" valign="top">&bull; <a href="Operands.html#Operands" accesskey="6">Operands</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
  143. </td></tr>
  144. <tr><td align="left" valign="top">&bull; <a href="Manipulating-GIMPLE-statements.html#Manipulating-GIMPLE-statements" accesskey="7">Manipulating GIMPLE statements</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
  145. </td></tr>
  146. <tr><td align="left" valign="top">&bull; <a href="Tuple-specific-accessors.html#Tuple-specific-accessors" accesskey="8">Tuple specific accessors</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
  147. </td></tr>
  148. <tr><td align="left" valign="top">&bull; <a href="GIMPLE-sequences.html#GIMPLE-sequences" accesskey="9">GIMPLE sequences</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
  149. </td></tr>
  150. <tr><td align="left" valign="top">&bull; <a href="Sequence-iterators.html#Sequence-iterators">Sequence iterators</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
  151. </td></tr>
  152. <tr><td align="left" valign="top">&bull; <a href="Adding-a-new-GIMPLE-statement-code.html#Adding-a-new-GIMPLE-statement-code">Adding a new GIMPLE statement code</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
  153. </td></tr>
  154. <tr><td align="left" valign="top">&bull; <a href="Statement-and-operand-traversals.html#Statement-and-operand-traversals">Statement and operand traversals</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
  155. </td></tr>
  156. </table>
  157. <hr>
  158. <div class="header">
  159. <p>
  160. Next: <a href="Tree-SSA.html#Tree-SSA" accesskey="n" rel="next">Tree SSA</a>, Previous: <a href="GENERIC.html#GENERIC" accesskey="p" rel="prev">GENERIC</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</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>
  161. </div>
  162. </body>
  163. </html>