Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

147 lines
7.1KB

  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>Statement and operand traversals (GNU Compiler Collection (GCC) Internals)</title>
  21. <meta name="description" content="Statement and operand traversals (GNU Compiler Collection (GCC) Internals)">
  22. <meta name="keywords" content="Statement and operand traversals (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="GIMPLE.html#GIMPLE" rel="up" title="GIMPLE">
  30. <link href="Tree-SSA.html#Tree-SSA" rel="next" title="Tree SSA">
  31. <link href="Adding-a-new-GIMPLE-statement-code.html#Adding-a-new-GIMPLE-statement-code" rel="prev" title="Adding a new GIMPLE statement code">
  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="Statement-and-operand-traversals"></a>
  62. <div class="header">
  63. <p>
  64. Previous: <a href="Adding-a-new-GIMPLE-statement-code.html#Adding-a-new-GIMPLE-statement-code" accesskey="p" rel="prev">Adding a new GIMPLE statement code</a>, Up: <a href="GIMPLE.html#GIMPLE" accesskey="u" rel="up">GIMPLE</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="Statement-and-operand-traversals-1"></a>
  68. <h3 class="section">12.12 Statement and operand traversals</h3>
  69. <a name="index-Statement-and-operand-traversals"></a>
  70. <p>There are two functions available for walking statements and
  71. sequences: <code>walk_gimple_stmt</code> and <code>walk_gimple_seq</code>,
  72. accordingly, and a third function for walking the operands in a
  73. statement: <code>walk_gimple_op</code>.
  74. </p>
  75. <dl>
  76. <dt><a name="index-walk_005fgimple_005fstmt"></a>GIMPLE function: <em>tree</em> <strong>walk_gimple_stmt</strong> <em>(gimple_stmt_iterator *gsi, walk_stmt_fn callback_stmt, walk_tree_fn callback_op, struct walk_stmt_info *wi)</em></dt>
  77. <dd><p>This function is used to walk the current statement in <code>GSI</code>,
  78. optionally using traversal state stored in <code>WI</code>. If <code>WI</code> is <code>NULL</code>, no
  79. state is kept during the traversal.
  80. </p>
  81. <p>The callback <code>CALLBACK_STMT</code> is called. If <code>CALLBACK_STMT</code> returns
  82. true, it means that the callback function has handled all the
  83. operands of the statement and it is not necessary to walk its
  84. operands.
  85. </p>
  86. <p>If <code>CALLBACK_STMT</code> is <code>NULL</code> or it returns false, <code>CALLBACK_OP</code> is
  87. called on each operand of the statement via <code>walk_gimple_op</code>. If
  88. <code>walk_gimple_op</code> returns non-<code>NULL</code> for any operand, the remaining
  89. operands are not scanned.
  90. </p>
  91. <p>The return value is that returned by the last call to
  92. <code>walk_gimple_op</code>, or <code>NULL_TREE</code> if no <code>CALLBACK_OP</code> is specified.
  93. </p></dd></dl>
  94. <dl>
  95. <dt><a name="index-walk_005fgimple_005fop"></a>GIMPLE function: <em>tree</em> <strong>walk_gimple_op</strong> <em>(gimple stmt, walk_tree_fn callback_op, struct walk_stmt_info *wi)</em></dt>
  96. <dd><p>Use this function to walk the operands of statement <code>STMT</code>. Every
  97. operand is walked via <code>walk_tree</code> with optional state information
  98. in <code>WI</code>.
  99. </p>
  100. <p><code>CALLBACK_OP</code> is called on each operand of <code>STMT</code> via <code>walk_tree</code>.
  101. Additional parameters to <code>walk_tree</code> must be stored in <code>WI</code>. For
  102. each operand <code>OP</code>, <code>walk_tree</code> is called as:
  103. </p>
  104. <div class="smallexample">
  105. <pre class="smallexample">walk_tree (&amp;<code>OP</code>, <code>CALLBACK_OP</code>, <code>WI</code>, <code>PSET</code>)
  106. </pre></div>
  107. <p>If <code>CALLBACK_OP</code> returns non-<code>NULL</code> for an operand, the remaining
  108. operands are not scanned. The return value is that returned by
  109. the last call to <code>walk_tree</code>, or <code>NULL_TREE</code> if no <code>CALLBACK_OP</code> is
  110. specified.
  111. </p></dd></dl>
  112. <dl>
  113. <dt><a name="index-walk_005fgimple_005fseq"></a>GIMPLE function: <em>tree</em> <strong>walk_gimple_seq</strong> <em>(gimple_seq seq, walk_stmt_fn callback_stmt, walk_tree_fn callback_op, struct walk_stmt_info *wi)</em></dt>
  114. <dd><p>This function walks all the statements in the sequence <code>SEQ</code>
  115. calling <code>walk_gimple_stmt</code> on each one. <code>WI</code> is as in
  116. <code>walk_gimple_stmt</code>. If <code>walk_gimple_stmt</code> returns non-<code>NULL</code>, the walk
  117. is stopped and the value returned. Otherwise, all the statements
  118. are walked and <code>NULL_TREE</code> returned.
  119. </p></dd></dl>
  120. <hr>
  121. <div class="header">
  122. <p>
  123. Previous: <a href="Adding-a-new-GIMPLE-statement-code.html#Adding-a-new-GIMPLE-statement-code" accesskey="p" rel="prev">Adding a new GIMPLE statement code</a>, Up: <a href="GIMPLE.html#GIMPLE" accesskey="u" rel="up">GIMPLE</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>
  124. </div>
  125. </body>
  126. </html>