Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

pirms 3 gadiem
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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>Loop querying (GNU Compiler Collection (GCC) Internals)</title>
  21. <meta name="description" content="Loop querying (GNU Compiler Collection (GCC) Internals)">
  22. <meta name="keywords" content="Loop querying (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="Loop-Analysis-and-Representation.html#Loop-Analysis-and-Representation" rel="up" title="Loop Analysis and Representation">
  30. <link href="Loop-manipulation.html#Loop-manipulation" rel="next" title="Loop manipulation">
  31. <link href="Loop-representation.html#Loop-representation" rel="prev" title="Loop representation">
  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="Loop-querying"></a>
  62. <div class="header">
  63. <p>
  64. Next: <a href="Loop-manipulation.html#Loop-manipulation" accesskey="n" rel="next">Loop manipulation</a>, Previous: <a href="Loop-representation.html#Loop-representation" accesskey="p" rel="prev">Loop representation</a>, Up: <a href="Loop-Analysis-and-Representation.html#Loop-Analysis-and-Representation" accesskey="u" rel="up">Loop Analysis and Representation</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="Loop-querying-1"></a>
  68. <h3 class="section">16.2 Loop querying</h3>
  69. <a name="index-Loop-querying"></a>
  70. <p>The functions to query the information about loops are declared in
  71. <samp>cfgloop.h</samp>. Some of the information can be taken directly from
  72. the structures. <code>loop_father</code> field of each basic block contains
  73. the innermost loop to that the block belongs. The most useful fields of
  74. loop structure (that are kept up-to-date at all times) are:
  75. </p>
  76. <ul>
  77. <li> <code>header</code>, <code>latch</code>: Header and latch basic blocks of the
  78. loop.
  79. </li><li> <code>num_nodes</code>: Number of basic blocks in the loop (including
  80. the basic blocks of the sub-loops).
  81. </li><li> <code>outer</code>, <code>inner</code>, <code>next</code>: The super-loop, the first
  82. sub-loop, and the sibling of the loop in the loops tree.
  83. </li></ul>
  84. <p>There are other fields in the loop structures, many of them used only by
  85. some of the passes, or not updated during CFG changes; in general, they
  86. should not be accessed directly.
  87. </p>
  88. <p>The most important functions to query loop structures are:
  89. </p>
  90. <ul>
  91. <li> <code>loop_depth</code>: The depth of the loop in the loops tree, i.e., the
  92. number of super-loops of the loop.
  93. </li><li> <code>flow_loops_dump</code>: Dumps the information about loops to a
  94. file.
  95. </li><li> <code>verify_loop_structure</code>: Checks consistency of the loop
  96. structures.
  97. </li><li> <code>loop_latch_edge</code>: Returns the latch edge of a loop.
  98. </li><li> <code>loop_preheader_edge</code>: If loops have preheaders, returns
  99. the preheader edge of a loop.
  100. </li><li> <code>flow_loop_nested_p</code>: Tests whether loop is a sub-loop of
  101. another loop.
  102. </li><li> <code>flow_bb_inside_loop_p</code>: Tests whether a basic block belongs
  103. to a loop (including its sub-loops).
  104. </li><li> <code>find_common_loop</code>: Finds the common super-loop of two loops.
  105. </li><li> <code>superloop_at_depth</code>: Returns the super-loop of a loop with
  106. the given depth.
  107. </li><li> <code>tree_num_loop_insns</code>, <code>num_loop_insns</code>: Estimates the
  108. number of insns in the loop, on GIMPLE and on RTL.
  109. </li><li> <code>loop_exit_edge_p</code>: Tests whether edge is an exit from a
  110. loop.
  111. </li><li> <code>mark_loop_exit_edges</code>: Marks all exit edges of all loops
  112. with <code>EDGE_LOOP_EXIT</code> flag.
  113. </li><li> <code>get_loop_body</code>, <code>get_loop_body_in_dom_order</code>,
  114. <code>get_loop_body_in_bfs_order</code>: Enumerates the basic blocks in the
  115. loop in depth-first search order in reversed CFG, ordered by dominance
  116. relation, and breath-first search order, respectively.
  117. </li><li> <code>single_exit</code>: Returns the single exit edge of the loop, or
  118. <code>NULL</code> if the loop has more than one exit. You can only use this
  119. function if LOOPS_HAVE_MARKED_SINGLE_EXITS property is used.
  120. </li><li> <code>get_loop_exit_edges</code>: Enumerates the exit edges of a loop.
  121. </li><li> <code>just_once_each_iteration_p</code>: Returns true if the basic block
  122. is executed exactly once during each iteration of a loop (that is, it
  123. does not belong to a sub-loop, and it dominates the latch of the loop).
  124. </li></ul>
  125. <hr>
  126. <div class="header">
  127. <p>
  128. Next: <a href="Loop-manipulation.html#Loop-manipulation" accesskey="n" rel="next">Loop manipulation</a>, Previous: <a href="Loop-representation.html#Loop-representation" accesskey="p" rel="prev">Loop representation</a>, Up: <a href="Loop-Analysis-and-Representation.html#Loop-Analysis-and-Representation" accesskey="u" rel="up">Loop Analysis and Representation</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>
  129. </div>
  130. </body>
  131. </html>