Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

125 lines
5.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>Gimplification pass (GNU Compiler Collection (GCC) Internals)</title>
  21. <meta name="description" content="Gimplification pass (GNU Compiler Collection (GCC) Internals)">
  22. <meta name="keywords" content="Gimplification pass (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="Passes.html#Passes" rel="up" title="Passes">
  30. <link href="Pass-manager.html#Pass-manager" rel="next" title="Pass manager">
  31. <link href="Parsing-pass.html#Parsing-pass" rel="prev" title="Parsing pass">
  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="Gimplification-pass"></a>
  62. <div class="header">
  63. <p>
  64. Next: <a href="Pass-manager.html#Pass-manager" accesskey="n" rel="next">Pass manager</a>, Previous: <a href="Parsing-pass.html#Parsing-pass" accesskey="p" rel="prev">Parsing pass</a>, Up: <a href="Passes.html#Passes" accesskey="u" rel="up">Passes</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="Gimplification-pass-1"></a>
  68. <h3 class="section">9.2 Gimplification pass</h3>
  69. <a name="index-gimplification-1"></a>
  70. <a name="index-GIMPLE-1"></a>
  71. <p><em>Gimplification</em> is a whimsical term for the process of converting
  72. the intermediate representation of a function into the GIMPLE language
  73. (see <a href="GIMPLE.html#GIMPLE">GIMPLE</a>). The term stuck, and so words like &ldquo;gimplification&rdquo;,
  74. &ldquo;gimplify&rdquo;, &ldquo;gimplifier&rdquo; and the like are sprinkled throughout this
  75. section of code.
  76. </p>
  77. <p>While a front end may certainly choose to generate GIMPLE directly if
  78. it chooses, this can be a moderately complex process unless the
  79. intermediate language used by the front end is already fairly simple.
  80. Usually it is easier to generate GENERIC trees plus extensions
  81. and let the language-independent gimplifier do most of the work.
  82. </p>
  83. <a name="index-gimplify_005ffunction_005ftree"></a>
  84. <a name="index-gimplify_005fexpr"></a>
  85. <a name="index-lang_005fhooks_002egimplify_005fexpr"></a>
  86. <p>The main entry point to this pass is <code>gimplify_function_tree</code>
  87. located in <samp>gimplify.c</samp>. From here we process the entire
  88. function gimplifying each statement in turn. The main workhorse
  89. for this pass is <code>gimplify_expr</code>. Approximately everything
  90. passes through here at least once, and it is from here that we
  91. invoke the <code>lang_hooks.gimplify_expr</code> callback.
  92. </p>
  93. <p>The callback should examine the expression in question and return
  94. <code>GS_UNHANDLED</code> if the expression is not a language specific
  95. construct that requires attention. Otherwise it should alter the
  96. expression in some way to such that forward progress is made toward
  97. producing valid GIMPLE. If the callback is certain that the
  98. transformation is complete and the expression is valid GIMPLE, it
  99. should return <code>GS_ALL_DONE</code>. Otherwise it should return
  100. <code>GS_OK</code>, which will cause the expression to be processed again.
  101. If the callback encounters an error during the transformation (because
  102. the front end is relying on the gimplification process to finish
  103. semantic checks), it should return <code>GS_ERROR</code>.
  104. </p>
  105. <hr>
  106. <div class="header">
  107. <p>
  108. Next: <a href="Pass-manager.html#Pass-manager" accesskey="n" rel="next">Pass manager</a>, Previous: <a href="Parsing-pass.html#Parsing-pass" accesskey="p" rel="prev">Parsing pass</a>, Up: <a href="Passes.html#Passes" accesskey="u" rel="up">Passes</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>
  109. </div>
  110. </body>
  111. </html>