You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Tree-SSA-passes.html 26KB

3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558
  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>Tree SSA passes (GNU Compiler Collection (GCC) Internals)</title>
  21. <meta name="description" content="Tree SSA passes (GNU Compiler Collection (GCC) Internals)">
  22. <meta name="keywords" content="Tree SSA passes (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="RTL-passes.html#RTL-passes" rel="next" title="RTL passes">
  31. <link href="Late-IPA-passes.html#Late-IPA-passes" rel="prev" title="Late IPA passes">
  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="Tree-SSA-passes"></a>
  62. <div class="header">
  63. <p>
  64. Next: <a href="RTL-passes.html#RTL-passes" accesskey="n" rel="next">RTL passes</a>, Previous: <a href="IPA-passes.html#IPA-passes" accesskey="p" rel="prev">IPA passes</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="Tree-SSA-passes-1"></a>
  68. <h3 class="section">9.5 Tree SSA passes</h3>
  69. <p>The following briefly describes the Tree optimization passes that are
  70. run after gimplification and what source files they are located in.
  71. </p>
  72. <ul>
  73. <li> Remove useless statements
  74. <p>This pass is an extremely simple sweep across the gimple code in which
  75. we identify obviously dead code and remove it. Here we do things like
  76. simplify <code>if</code> statements with constant conditions, remove
  77. exception handling constructs surrounding code that obviously cannot
  78. throw, remove lexical bindings that contain no variables, and other
  79. assorted simplistic cleanups. The idea is to get rid of the obvious
  80. stuff quickly rather than wait until later when it&rsquo;s more work to get
  81. rid of it. This pass is located in <samp>tree-cfg.c</samp> and described by
  82. <code>pass_remove_useless_stmts</code>.
  83. </p>
  84. </li><li> OpenMP lowering
  85. <p>If OpenMP generation (<samp>-fopenmp</samp>) is enabled, this pass lowers
  86. OpenMP constructs into GIMPLE.
  87. </p>
  88. <p>Lowering of OpenMP constructs involves creating replacement
  89. expressions for local variables that have been mapped using data
  90. sharing clauses, exposing the control flow of most synchronization
  91. directives and adding region markers to facilitate the creation of the
  92. control flow graph. The pass is located in <samp>omp-low.c</samp> and is
  93. described by <code>pass_lower_omp</code>.
  94. </p>
  95. </li><li> OpenMP expansion
  96. <p>If OpenMP generation (<samp>-fopenmp</samp>) is enabled, this pass expands
  97. parallel regions into their own functions to be invoked by the thread
  98. library. The pass is located in <samp>omp-low.c</samp> and is described by
  99. <code>pass_expand_omp</code>.
  100. </p>
  101. </li><li> Lower control flow
  102. <p>This pass flattens <code>if</code> statements (<code>COND_EXPR</code>)
  103. and moves lexical bindings (<code>BIND_EXPR</code>) out of line. After
  104. this pass, all <code>if</code> statements will have exactly two <code>goto</code>
  105. statements in its <code>then</code> and <code>else</code> arms. Lexical binding
  106. information for each statement will be found in <code>TREE_BLOCK</code> rather
  107. than being inferred from its position under a <code>BIND_EXPR</code>. This
  108. pass is found in <samp>gimple-low.c</samp> and is described by
  109. <code>pass_lower_cf</code>.
  110. </p>
  111. </li><li> Lower exception handling control flow
  112. <p>This pass decomposes high-level exception handling constructs
  113. (<code>TRY_FINALLY_EXPR</code> and <code>TRY_CATCH_EXPR</code>) into a form
  114. that explicitly represents the control flow involved. After this
  115. pass, <code>lookup_stmt_eh_region</code> will return a non-negative
  116. number for any statement that may have EH control flow semantics;
  117. examine <code>tree_can_throw_internal</code> or <code>tree_can_throw_external</code>
  118. for exact semantics. Exact control flow may be extracted from
  119. <code>foreach_reachable_handler</code>. The EH region nesting tree is defined
  120. in <samp>except.h</samp> and built in <samp>except.c</samp>. The lowering pass
  121. itself is in <samp>tree-eh.c</samp> and is described by <code>pass_lower_eh</code>.
  122. </p>
  123. </li><li> Build the control flow graph
  124. <p>This pass decomposes a function into basic blocks and creates all of
  125. the edges that connect them. It is located in <samp>tree-cfg.c</samp> and
  126. is described by <code>pass_build_cfg</code>.
  127. </p>
  128. </li><li> Find all referenced variables
  129. <p>This pass walks the entire function and collects an array of all
  130. variables referenced in the function, <code>referenced_vars</code>. The
  131. index at which a variable is found in the array is used as a UID
  132. for the variable within this function. This data is needed by the
  133. SSA rewriting routines. The pass is located in <samp>tree-dfa.c</samp>
  134. and is described by <code>pass_referenced_vars</code>.
  135. </p>
  136. </li><li> Enter static single assignment form
  137. <p>This pass rewrites the function such that it is in SSA form. After
  138. this pass, all <code>is_gimple_reg</code> variables will be referenced by
  139. <code>SSA_NAME</code>, and all occurrences of other variables will be
  140. annotated with <code>VDEFS</code> and <code>VUSES</code>; PHI nodes will have
  141. been inserted as necessary for each basic block. This pass is
  142. located in <samp>tree-ssa.c</samp> and is described by <code>pass_build_ssa</code>.
  143. </p>
  144. </li><li> Warn for uninitialized variables
  145. <p>This pass scans the function for uses of <code>SSA_NAME</code>s that
  146. are fed by default definition. For non-parameter variables, such
  147. uses are uninitialized. The pass is run twice, before and after
  148. optimization (if turned on). In the first pass we only warn for uses that are
  149. positively uninitialized; in the second pass we warn for uses that
  150. are possibly uninitialized. The pass is located in <samp>tree-ssa.c</samp>
  151. and is defined by <code>pass_early_warn_uninitialized</code> and
  152. <code>pass_late_warn_uninitialized</code>.
  153. </p>
  154. </li><li> Dead code elimination
  155. <p>This pass scans the function for statements without side effects whose
  156. result is unused. It does not do memory life analysis, so any value
  157. that is stored in memory is considered used. The pass is run multiple
  158. times throughout the optimization process. It is located in
  159. <samp>tree-ssa-dce.c</samp> and is described by <code>pass_dce</code>.
  160. </p>
  161. </li><li> Dominator optimizations
  162. <p>This pass performs trivial dominator-based copy and constant propagation,
  163. expression simplification, and jump threading. It is run multiple times
  164. throughout the optimization process. It is located in <samp>tree-ssa-dom.c</samp>
  165. and is described by <code>pass_dominator</code>.
  166. </p>
  167. </li><li> Forward propagation of single-use variables
  168. <p>This pass attempts to remove redundant computation by substituting
  169. variables that are used once into the expression that uses them and
  170. seeing if the result can be simplified. It is located in
  171. <samp>tree-ssa-forwprop.c</samp> and is described by <code>pass_forwprop</code>.
  172. </p>
  173. </li><li> Copy Renaming
  174. <p>This pass attempts to change the name of compiler temporaries involved in
  175. copy operations such that SSA-&gt;normal can coalesce the copy away. When compiler
  176. temporaries are copies of user variables, it also renames the compiler
  177. temporary to the user variable resulting in better use of user symbols. It is
  178. located in <samp>tree-ssa-copyrename.c</samp> and is described by
  179. <code>pass_copyrename</code>.
  180. </p>
  181. </li><li> PHI node optimizations
  182. <p>This pass recognizes forms of PHI inputs that can be represented as
  183. conditional expressions and rewrites them into straight line code.
  184. It is located in <samp>tree-ssa-phiopt.c</samp> and is described by
  185. <code>pass_phiopt</code>.
  186. </p>
  187. </li><li> May-alias optimization
  188. <p>This pass performs a flow sensitive SSA-based points-to analysis.
  189. The resulting may-alias, must-alias, and escape analysis information
  190. is used to promote variables from in-memory addressable objects to
  191. non-aliased variables that can be renamed into SSA form. We also
  192. update the <code>VDEF</code>/<code>VUSE</code> memory tags for non-renameable
  193. aggregates so that we get fewer false kills. The pass is located
  194. in <samp>tree-ssa-alias.c</samp> and is described by <code>pass_may_alias</code>.
  195. </p>
  196. <p>Interprocedural points-to information is located in
  197. <samp>tree-ssa-structalias.c</samp> and described by <code>pass_ipa_pta</code>.
  198. </p>
  199. </li><li> Profiling
  200. <p>This pass instruments the function in order to collect runtime block
  201. and value profiling data. Such data may be fed back into the compiler
  202. on a subsequent run so as to allow optimization based on expected
  203. execution frequencies. The pass is located in <samp>tree-profile.c</samp> and
  204. is described by <code>pass_ipa_tree_profile</code>.
  205. </p>
  206. </li><li> Static profile estimation
  207. <p>This pass implements series of heuristics to guess propababilities
  208. of branches. The resulting predictions are turned into edge profile
  209. by propagating branches across the control flow graphs.
  210. The pass is located in <samp>tree-profile.c</samp> and is described by
  211. <code>pass_profile</code>.
  212. </p>
  213. </li><li> Lower complex arithmetic
  214. <p>This pass rewrites complex arithmetic operations into their component
  215. scalar arithmetic operations. The pass is located in <samp>tree-complex.c</samp>
  216. and is described by <code>pass_lower_complex</code>.
  217. </p>
  218. </li><li> Scalar replacement of aggregates
  219. <p>This pass rewrites suitable non-aliased local aggregate variables into
  220. a set of scalar variables. The resulting scalar variables are
  221. rewritten into SSA form, which allows subsequent optimization passes
  222. to do a significantly better job with them. The pass is located in
  223. <samp>tree-sra.c</samp> and is described by <code>pass_sra</code>.
  224. </p>
  225. </li><li> Dead store elimination
  226. <p>This pass eliminates stores to memory that are subsequently overwritten
  227. by another store, without any intervening loads. The pass is located
  228. in <samp>tree-ssa-dse.c</samp> and is described by <code>pass_dse</code>.
  229. </p>
  230. </li><li> Tail recursion elimination
  231. <p>This pass transforms tail recursion into a loop. It is located in
  232. <samp>tree-tailcall.c</samp> and is described by <code>pass_tail_recursion</code>.
  233. </p>
  234. </li><li> Forward store motion
  235. <p>This pass sinks stores and assignments down the flowgraph closer to their
  236. use point. The pass is located in <samp>tree-ssa-sink.c</samp> and is
  237. described by <code>pass_sink_code</code>.
  238. </p>
  239. </li><li> Partial redundancy elimination
  240. <p>This pass eliminates partially redundant computations, as well as
  241. performing load motion. The pass is located in <samp>tree-ssa-pre.c</samp>
  242. and is described by <code>pass_pre</code>.
  243. </p>
  244. <p>Just before partial redundancy elimination, if
  245. <samp>-funsafe-math-optimizations</samp> is on, GCC tries to convert
  246. divisions to multiplications by the reciprocal. The pass is located
  247. in <samp>tree-ssa-math-opts.c</samp> and is described by
  248. <code>pass_cse_reciprocal</code>.
  249. </p>
  250. </li><li> Full redundancy elimination
  251. <p>This is a simpler form of PRE that only eliminates redundancies that
  252. occur on all paths. It is located in <samp>tree-ssa-pre.c</samp> and
  253. described by <code>pass_fre</code>.
  254. </p>
  255. </li><li> Loop optimization
  256. <p>The main driver of the pass is placed in <samp>tree-ssa-loop.c</samp>
  257. and described by <code>pass_loop</code>.
  258. </p>
  259. <p>The optimizations performed by this pass are:
  260. </p>
  261. <p>Loop invariant motion. This pass moves only invariants that
  262. would be hard to handle on RTL level (function calls, operations that expand to
  263. nontrivial sequences of insns). With <samp>-funswitch-loops</samp> it also moves
  264. operands of conditions that are invariant out of the loop, so that we can use
  265. just trivial invariantness analysis in loop unswitching. The pass also includes
  266. store motion. The pass is implemented in <samp>tree-ssa-loop-im.c</samp>.
  267. </p>
  268. <p>Canonical induction variable creation. This pass creates a simple counter
  269. for number of iterations of the loop and replaces the exit condition of the
  270. loop using it, in case when a complicated analysis is necessary to determine
  271. the number of iterations. Later optimizations then may determine the number
  272. easily. The pass is implemented in <samp>tree-ssa-loop-ivcanon.c</samp>.
  273. </p>
  274. <p>Induction variable optimizations. This pass performs standard induction
  275. variable optimizations, including strength reduction, induction variable
  276. merging and induction variable elimination. The pass is implemented in
  277. <samp>tree-ssa-loop-ivopts.c</samp>.
  278. </p>
  279. <p>Loop unswitching. This pass moves the conditional jumps that are invariant
  280. out of the loops. To achieve this, a duplicate of the loop is created for
  281. each possible outcome of conditional jump(s). The pass is implemented in
  282. <samp>tree-ssa-loop-unswitch.c</samp>.
  283. </p>
  284. <p>Loop splitting. If a loop contains a conditional statement that is
  285. always true for one part of the iteration space and false for the other
  286. this pass splits the loop into two, one dealing with one side the other
  287. only with the other, thereby removing one inner-loop conditional. The
  288. pass is implemented in <samp>tree-ssa-loop-split.c</samp>.
  289. </p>
  290. <p>The optimizations also use various utility functions contained in
  291. <samp>tree-ssa-loop-manip.c</samp>, <samp>cfgloop.c</samp>, <samp>cfgloopanal.c</samp> and
  292. <samp>cfgloopmanip.c</samp>.
  293. </p>
  294. <p>Vectorization. This pass transforms loops to operate on vector types
  295. instead of scalar types. Data parallelism across loop iterations is exploited
  296. to group data elements from consecutive iterations into a vector and operate
  297. on them in parallel. Depending on available target support the loop is
  298. conceptually unrolled by a factor <code>VF</code> (vectorization factor), which is
  299. the number of elements operated upon in parallel in each iteration, and the
  300. <code>VF</code> copies of each scalar operation are fused to form a vector operation.
  301. Additional loop transformations such as peeling and versioning may take place
  302. to align the number of iterations, and to align the memory accesses in the
  303. loop.
  304. The pass is implemented in <samp>tree-vectorizer.c</samp> (the main driver),
  305. <samp>tree-vect-loop.c</samp> and <samp>tree-vect-loop-manip.c</samp> (loop specific parts
  306. and general loop utilities), <samp>tree-vect-slp</samp> (loop-aware SLP
  307. functionality), <samp>tree-vect-stmts.c</samp> and <samp>tree-vect-data-refs.c</samp>.
  308. Analysis of data references is in <samp>tree-data-ref.c</samp>.
  309. </p>
  310. <p>SLP Vectorization. This pass performs vectorization of straight-line code. The
  311. pass is implemented in <samp>tree-vectorizer.c</samp> (the main driver),
  312. <samp>tree-vect-slp.c</samp>, <samp>tree-vect-stmts.c</samp> and
  313. <samp>tree-vect-data-refs.c</samp>.
  314. </p>
  315. <p>Autoparallelization. This pass splits the loop iteration space to run
  316. into several threads. The pass is implemented in <samp>tree-parloops.c</samp>.
  317. </p>
  318. <p>Graphite is a loop transformation framework based on the polyhedral
  319. model. Graphite stands for Gimple Represented as Polyhedra. The
  320. internals of this infrastructure are documented in
  321. <a href="http://gcc.gnu.org/wiki/Graphite">http://gcc.gnu.org/wiki/Graphite</a><!-- /@w -->. The passes working on
  322. this representation are implemented in the various <samp>graphite-*</samp>
  323. files.
  324. </p>
  325. </li><li> Tree level if-conversion for vectorizer
  326. <p>This pass applies if-conversion to simple loops to help vectorizer.
  327. We identify if convertible loops, if-convert statements and merge
  328. basic blocks in one big block. The idea is to present loop in such
  329. form so that vectorizer can have one to one mapping between statements
  330. and available vector operations. This pass is located in
  331. <samp>tree-if-conv.c</samp> and is described by <code>pass_if_conversion</code>.
  332. </p>
  333. </li><li> Conditional constant propagation
  334. <p>This pass relaxes a lattice of values in order to identify those
  335. that must be constant even in the presence of conditional branches.
  336. The pass is located in <samp>tree-ssa-ccp.c</samp> and is described
  337. by <code>pass_ccp</code>.
  338. </p>
  339. <p>A related pass that works on memory loads and stores, and not just
  340. register values, is located in <samp>tree-ssa-ccp.c</samp> and described by
  341. <code>pass_store_ccp</code>.
  342. </p>
  343. </li><li> Conditional copy propagation
  344. <p>This is similar to constant propagation but the lattice of values is
  345. the &ldquo;copy-of&rdquo; relation. It eliminates redundant copies from the
  346. code. The pass is located in <samp>tree-ssa-copy.c</samp> and described by
  347. <code>pass_copy_prop</code>.
  348. </p>
  349. <p>A related pass that works on memory copies, and not just register
  350. copies, is located in <samp>tree-ssa-copy.c</samp> and described by
  351. <code>pass_store_copy_prop</code>.
  352. </p>
  353. </li><li> Value range propagation
  354. <p>This transformation is similar to constant propagation but
  355. instead of propagating single constant values, it propagates
  356. known value ranges. The implementation is based on Patterson&rsquo;s
  357. range propagation algorithm (Accurate Static Branch Prediction by
  358. Value Range Propagation, J. R. C. Patterson, PLDI &rsquo;95). In
  359. contrast to Patterson&rsquo;s algorithm, this implementation does not
  360. propagate branch probabilities nor it uses more than a single
  361. range per SSA name. This means that the current implementation
  362. cannot be used for branch prediction (though adapting it would
  363. not be difficult). The pass is located in <samp>tree-vrp.c</samp> and is
  364. described by <code>pass_vrp</code>.
  365. </p>
  366. </li><li> Folding built-in functions
  367. <p>This pass simplifies built-in functions, as applicable, with constant
  368. arguments or with inferable string lengths. It is located in
  369. <samp>tree-ssa-ccp.c</samp> and is described by <code>pass_fold_builtins</code>.
  370. </p>
  371. </li><li> Split critical edges
  372. <p>This pass identifies critical edges and inserts empty basic blocks
  373. such that the edge is no longer critical. The pass is located in
  374. <samp>tree-cfg.c</samp> and is described by <code>pass_split_crit_edges</code>.
  375. </p>
  376. </li><li> Control dependence dead code elimination
  377. <p>This pass is a stronger form of dead code elimination that can
  378. eliminate unnecessary control flow statements. It is located
  379. in <samp>tree-ssa-dce.c</samp> and is described by <code>pass_cd_dce</code>.
  380. </p>
  381. </li><li> Tail call elimination
  382. <p>This pass identifies function calls that may be rewritten into
  383. jumps. No code transformation is actually applied here, but the
  384. data and control flow problem is solved. The code transformation
  385. requires target support, and so is delayed until RTL. In the
  386. meantime <code>CALL_EXPR_TAILCALL</code> is set indicating the possibility.
  387. The pass is located in <samp>tree-tailcall.c</samp> and is described by
  388. <code>pass_tail_calls</code>. The RTL transformation is handled by
  389. <code>fixup_tail_calls</code> in <samp>calls.c</samp>.
  390. </p>
  391. </li><li> Warn for function return without value
  392. <p>For non-void functions, this pass locates return statements that do
  393. not specify a value and issues a warning. Such a statement may have
  394. been injected by falling off the end of the function. This pass is
  395. run last so that we have as much time as possible to prove that the
  396. statement is not reachable. It is located in <samp>tree-cfg.c</samp> and
  397. is described by <code>pass_warn_function_return</code>.
  398. </p>
  399. </li><li> Leave static single assignment form
  400. <p>This pass rewrites the function such that it is in normal form. At
  401. the same time, we eliminate as many single-use temporaries as possible,
  402. so the intermediate language is no longer GIMPLE, but GENERIC. The
  403. pass is located in <samp>tree-outof-ssa.c</samp> and is described by
  404. <code>pass_del_ssa</code>.
  405. </p>
  406. </li><li> Merge PHI nodes that feed into one another
  407. <p>This is part of the CFG cleanup passes. It attempts to join PHI nodes
  408. from a forwarder CFG block into another block with PHI nodes. The
  409. pass is located in <samp>tree-cfgcleanup.c</samp> and is described by
  410. <code>pass_merge_phi</code>.
  411. </p>
  412. </li><li> Return value optimization
  413. <p>If a function always returns the same local variable, and that local
  414. variable is an aggregate type, then the variable is replaced with the
  415. return value for the function (i.e., the function&rsquo;s DECL_RESULT). This
  416. is equivalent to the C++ named return value optimization applied to
  417. GIMPLE. The pass is located in <samp>tree-nrv.c</samp> and is described by
  418. <code>pass_nrv</code>.
  419. </p>
  420. </li><li> Return slot optimization
  421. <p>If a function returns a memory object and is called as <code>var =
  422. foo()</code>, this pass tries to change the call so that the address of
  423. <code>var</code> is sent to the caller to avoid an extra memory copy. This
  424. pass is located in <code>tree-nrv.c</code> and is described by
  425. <code>pass_return_slot</code>.
  426. </p>
  427. </li><li> Optimize calls to <code>__builtin_object_size</code>
  428. <p>This is a propagation pass similar to CCP that tries to remove calls
  429. to <code>__builtin_object_size</code> when the size of the object can be
  430. computed at compile-time. This pass is located in
  431. <samp>tree-object-size.c</samp> and is described by
  432. <code>pass_object_sizes</code>.
  433. </p>
  434. </li><li> Loop invariant motion
  435. <p>This pass removes expensive loop-invariant computations out of loops.
  436. The pass is located in <samp>tree-ssa-loop.c</samp> and described by
  437. <code>pass_lim</code>.
  438. </p>
  439. </li><li> Loop nest optimizations
  440. <p>This is a family of loop transformations that works on loop nests. It
  441. includes loop interchange, scaling, skewing and reversal and they are
  442. all geared to the optimization of data locality in array traversals
  443. and the removal of dependencies that hamper optimizations such as loop
  444. parallelization and vectorization. The pass is located in
  445. <samp>tree-loop-linear.c</samp> and described by
  446. <code>pass_linear_transform</code>.
  447. </p>
  448. </li><li> Removal of empty loops
  449. <p>This pass removes loops with no code in them. The pass is located in
  450. <samp>tree-ssa-loop-ivcanon.c</samp> and described by
  451. <code>pass_empty_loop</code>.
  452. </p>
  453. </li><li> Unrolling of small loops
  454. <p>This pass completely unrolls loops with few iterations. The pass
  455. is located in <samp>tree-ssa-loop-ivcanon.c</samp> and described by
  456. <code>pass_complete_unroll</code>.
  457. </p>
  458. </li><li> Predictive commoning
  459. <p>This pass makes the code reuse the computations from the previous
  460. iterations of the loops, especially loads and stores to memory.
  461. It does so by storing the values of these computations to a bank
  462. of temporary variables that are rotated at the end of loop. To avoid
  463. the need for this rotation, the loop is then unrolled and the copies
  464. of the loop body are rewritten to use the appropriate version of
  465. the temporary variable. This pass is located in <samp>tree-predcom.c</samp>
  466. and described by <code>pass_predcom</code>.
  467. </p>
  468. </li><li> Array prefetching
  469. <p>This pass issues prefetch instructions for array references inside
  470. loops. The pass is located in <samp>tree-ssa-loop-prefetch.c</samp> and
  471. described by <code>pass_loop_prefetch</code>.
  472. </p>
  473. </li><li> Reassociation
  474. <p>This pass rewrites arithmetic expressions to enable optimizations that
  475. operate on them, like redundancy elimination and vectorization. The
  476. pass is located in <samp>tree-ssa-reassoc.c</samp> and described by
  477. <code>pass_reassoc</code>.
  478. </p>
  479. </li><li> Optimization of <code>stdarg</code> functions
  480. <p>This pass tries to avoid the saving of register arguments into the
  481. stack on entry to <code>stdarg</code> functions. If the function doesn&rsquo;t
  482. use any <code>va_start</code> macros, no registers need to be saved. If
  483. <code>va_start</code> macros are used, the <code>va_list</code> variables don&rsquo;t
  484. escape the function, it is only necessary to save registers that will
  485. be used in <code>va_arg</code> macros. For instance, if <code>va_arg</code> is
  486. only used with integral types in the function, floating point
  487. registers don&rsquo;t need to be saved. This pass is located in
  488. <code>tree-stdarg.c</code> and described by <code>pass_stdarg</code>.
  489. </p>
  490. </li></ul>
  491. <hr>
  492. <div class="header">
  493. <p>
  494. Next: <a href="RTL-passes.html#RTL-passes" accesskey="n" rel="next">RTL passes</a>, Previous: <a href="IPA-passes.html#IPA-passes" accesskey="p" rel="prev">IPA passes</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>
  495. </div>
  496. </body>
  497. </html>