You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
523 lines
26 KiB
HTML
523 lines
26 KiB
HTML
4 years ago
|
<html lang="en">
|
||
|
<head>
|
||
|
<title>Tree SSA passes - GNU Compiler Collection (GCC) Internals</title>
|
||
|
<meta http-equiv="Content-Type" content="text/html">
|
||
|
<meta name="description" content="GNU Compiler Collection (GCC) Internals">
|
||
|
<meta name="generator" content="makeinfo 4.13">
|
||
|
<link title="Top" rel="start" href="index.html#Top">
|
||
|
<link rel="up" href="Passes.html#Passes" title="Passes">
|
||
|
<link rel="prev" href="Pass-manager.html#Pass-manager" title="Pass manager">
|
||
|
<link rel="next" href="RTL-passes.html#RTL-passes" title="RTL passes">
|
||
|
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
|
||
|
<!--
|
||
|
Copyright (C) 1988-2015 Free Software Foundation, Inc.
|
||
|
|
||
|
Permission is granted to copy, distribute and/or modify this document
|
||
|
under the terms of the GNU Free Documentation License, Version 1.3 or
|
||
|
any later version published by the Free Software Foundation; with the
|
||
|
Invariant Sections being ``Funding Free Software'', the Front-Cover
|
||
|
Texts being (a) (see below), and with the Back-Cover Texts being (b)
|
||
|
(see below). A copy of the license is included in the section entitled
|
||
|
``GNU Free Documentation License''.
|
||
|
|
||
|
(a) The FSF's Front-Cover Text is:
|
||
|
|
||
|
A GNU Manual
|
||
|
|
||
|
(b) The FSF's Back-Cover Text is:
|
||
|
|
||
|
You have freedom to copy and modify this GNU Manual, like GNU
|
||
|
software. Copies published by the Free Software Foundation raise
|
||
|
funds for GNU development.-->
|
||
|
<meta http-equiv="Content-Style-Type" content="text/css">
|
||
|
<style type="text/css"><!--
|
||
|
pre.display { font-family:inherit }
|
||
|
pre.format { font-family:inherit }
|
||
|
pre.smalldisplay { font-family:inherit; font-size:smaller }
|
||
|
pre.smallformat { font-family:inherit; font-size:smaller }
|
||
|
pre.smallexample { font-size:smaller }
|
||
|
pre.smalllisp { font-size:smaller }
|
||
|
span.sc { font-variant:small-caps }
|
||
|
span.roman { font-family:serif; font-weight:normal; }
|
||
|
span.sansserif { font-family:sans-serif; font-weight:normal; }
|
||
|
--></style>
|
||
|
</head>
|
||
|
<body>
|
||
|
<div class="node">
|
||
|
<a name="Tree-SSA-passes"></a>
|
||
|
<p>
|
||
|
Next: <a rel="next" accesskey="n" href="RTL-passes.html#RTL-passes">RTL passes</a>,
|
||
|
Previous: <a rel="previous" accesskey="p" href="Pass-manager.html#Pass-manager">Pass manager</a>,
|
||
|
Up: <a rel="up" accesskey="u" href="Passes.html#Passes">Passes</a>
|
||
|
<hr>
|
||
|
</div>
|
||
|
|
||
|
<h3 class="section">9.5 Tree SSA passes</h3>
|
||
|
|
||
|
<p>The following briefly describes the Tree optimization passes that are
|
||
|
run after gimplification and what source files they are located in.
|
||
|
|
||
|
<ul>
|
||
|
<li>Remove useless statements
|
||
|
|
||
|
<p>This pass is an extremely simple sweep across the gimple code in which
|
||
|
we identify obviously dead code and remove it. Here we do things like
|
||
|
simplify <code>if</code> statements with constant conditions, remove
|
||
|
exception handling constructs surrounding code that obviously cannot
|
||
|
throw, remove lexical bindings that contain no variables, and other
|
||
|
assorted simplistic cleanups. The idea is to get rid of the obvious
|
||
|
stuff quickly rather than wait until later when it's more work to get
|
||
|
rid of it. This pass is located in <samp><span class="file">tree-cfg.c</span></samp> and described by
|
||
|
<code>pass_remove_useless_stmts</code>.
|
||
|
|
||
|
<li>OpenMP lowering
|
||
|
|
||
|
<p>If OpenMP generation (<samp><span class="option">-fopenmp</span></samp>) is enabled, this pass lowers
|
||
|
OpenMP constructs into GIMPLE.
|
||
|
|
||
|
<p>Lowering of OpenMP constructs involves creating replacement
|
||
|
expressions for local variables that have been mapped using data
|
||
|
sharing clauses, exposing the control flow of most synchronization
|
||
|
directives and adding region markers to facilitate the creation of the
|
||
|
control flow graph. The pass is located in <samp><span class="file">omp-low.c</span></samp> and is
|
||
|
described by <code>pass_lower_omp</code>.
|
||
|
|
||
|
<li>OpenMP expansion
|
||
|
|
||
|
<p>If OpenMP generation (<samp><span class="option">-fopenmp</span></samp>) is enabled, this pass expands
|
||
|
parallel regions into their own functions to be invoked by the thread
|
||
|
library. The pass is located in <samp><span class="file">omp-low.c</span></samp> and is described by
|
||
|
<code>pass_expand_omp</code>.
|
||
|
|
||
|
<li>Lower control flow
|
||
|
|
||
|
<p>This pass flattens <code>if</code> statements (<code>COND_EXPR</code>)
|
||
|
and moves lexical bindings (<code>BIND_EXPR</code>) out of line. After
|
||
|
this pass, all <code>if</code> statements will have exactly two <code>goto</code>
|
||
|
statements in its <code>then</code> and <code>else</code> arms. Lexical binding
|
||
|
information for each statement will be found in <code>TREE_BLOCK</code> rather
|
||
|
than being inferred from its position under a <code>BIND_EXPR</code>. This
|
||
|
pass is found in <samp><span class="file">gimple-low.c</span></samp> and is described by
|
||
|
<code>pass_lower_cf</code>.
|
||
|
|
||
|
<li>Lower exception handling control flow
|
||
|
|
||
|
<p>This pass decomposes high-level exception handling constructs
|
||
|
(<code>TRY_FINALLY_EXPR</code> and <code>TRY_CATCH_EXPR</code>) into a form
|
||
|
that explicitly represents the control flow involved. After this
|
||
|
pass, <code>lookup_stmt_eh_region</code> will return a non-negative
|
||
|
number for any statement that may have EH control flow semantics;
|
||
|
examine <code>tree_can_throw_internal</code> or <code>tree_can_throw_external</code>
|
||
|
for exact semantics. Exact control flow may be extracted from
|
||
|
<code>foreach_reachable_handler</code>. The EH region nesting tree is defined
|
||
|
in <samp><span class="file">except.h</span></samp> and built in <samp><span class="file">except.c</span></samp>. The lowering pass
|
||
|
itself is in <samp><span class="file">tree-eh.c</span></samp> and is described by <code>pass_lower_eh</code>.
|
||
|
|
||
|
<li>Build the control flow graph
|
||
|
|
||
|
<p>This pass decomposes a function into basic blocks and creates all of
|
||
|
the edges that connect them. It is located in <samp><span class="file">tree-cfg.c</span></samp> and
|
||
|
is described by <code>pass_build_cfg</code>.
|
||
|
|
||
|
<li>Find all referenced variables
|
||
|
|
||
|
<p>This pass walks the entire function and collects an array of all
|
||
|
variables referenced in the function, <code>referenced_vars</code>. The
|
||
|
index at which a variable is found in the array is used as a UID
|
||
|
for the variable within this function. This data is needed by the
|
||
|
SSA rewriting routines. The pass is located in <samp><span class="file">tree-dfa.c</span></samp>
|
||
|
and is described by <code>pass_referenced_vars</code>.
|
||
|
|
||
|
<li>Enter static single assignment form
|
||
|
|
||
|
<p>This pass rewrites the function such that it is in SSA form. After
|
||
|
this pass, all <code>is_gimple_reg</code> variables will be referenced by
|
||
|
<code>SSA_NAME</code>, and all occurrences of other variables will be
|
||
|
annotated with <code>VDEFS</code> and <code>VUSES</code>; PHI nodes will have
|
||
|
been inserted as necessary for each basic block. This pass is
|
||
|
located in <samp><span class="file">tree-ssa.c</span></samp> and is described by <code>pass_build_ssa</code>.
|
||
|
|
||
|
<li>Warn for uninitialized variables
|
||
|
|
||
|
<p>This pass scans the function for uses of <code>SSA_NAME</code>s that
|
||
|
are fed by default definition. For non-parameter variables, such
|
||
|
uses are uninitialized. The pass is run twice, before and after
|
||
|
optimization (if turned on). In the first pass we only warn for uses that are
|
||
|
positively uninitialized; in the second pass we warn for uses that
|
||
|
are possibly uninitialized. The pass is located in <samp><span class="file">tree-ssa.c</span></samp>
|
||
|
and is defined by <code>pass_early_warn_uninitialized</code> and
|
||
|
<code>pass_late_warn_uninitialized</code>.
|
||
|
|
||
|
<li>Dead code elimination
|
||
|
|
||
|
<p>This pass scans the function for statements without side effects whose
|
||
|
result is unused. It does not do memory life analysis, so any value
|
||
|
that is stored in memory is considered used. The pass is run multiple
|
||
|
times throughout the optimization process. It is located in
|
||
|
<samp><span class="file">tree-ssa-dce.c</span></samp> and is described by <code>pass_dce</code>.
|
||
|
|
||
|
<li>Dominator optimizations
|
||
|
|
||
|
<p>This pass performs trivial dominator-based copy and constant propagation,
|
||
|
expression simplification, and jump threading. It is run multiple times
|
||
|
throughout the optimization process. It is located in <samp><span class="file">tree-ssa-dom.c</span></samp>
|
||
|
and is described by <code>pass_dominator</code>.
|
||
|
|
||
|
<li>Forward propagation of single-use variables
|
||
|
|
||
|
<p>This pass attempts to remove redundant computation by substituting
|
||
|
variables that are used once into the expression that uses them and
|
||
|
seeing if the result can be simplified. It is located in
|
||
|
<samp><span class="file">tree-ssa-forwprop.c</span></samp> and is described by <code>pass_forwprop</code>.
|
||
|
|
||
|
<li>Copy Renaming
|
||
|
|
||
|
<p>This pass attempts to change the name of compiler temporaries involved in
|
||
|
copy operations such that SSA->normal can coalesce the copy away. When compiler
|
||
|
temporaries are copies of user variables, it also renames the compiler
|
||
|
temporary to the user variable resulting in better use of user symbols. It is
|
||
|
located in <samp><span class="file">tree-ssa-copyrename.c</span></samp> and is described by
|
||
|
<code>pass_copyrename</code>.
|
||
|
|
||
|
<li>PHI node optimizations
|
||
|
|
||
|
<p>This pass recognizes forms of PHI inputs that can be represented as
|
||
|
conditional expressions and rewrites them into straight line code.
|
||
|
It is located in <samp><span class="file">tree-ssa-phiopt.c</span></samp> and is described by
|
||
|
<code>pass_phiopt</code>.
|
||
|
|
||
|
<li>May-alias optimization
|
||
|
|
||
|
<p>This pass performs a flow sensitive SSA-based points-to analysis.
|
||
|
The resulting may-alias, must-alias, and escape analysis information
|
||
|
is used to promote variables from in-memory addressable objects to
|
||
|
non-aliased variables that can be renamed into SSA form. We also
|
||
|
update the <code>VDEF</code>/<code>VUSE</code> memory tags for non-renameable
|
||
|
aggregates so that we get fewer false kills. The pass is located
|
||
|
in <samp><span class="file">tree-ssa-alias.c</span></samp> and is described by <code>pass_may_alias</code>.
|
||
|
|
||
|
<p>Interprocedural points-to information is located in
|
||
|
<samp><span class="file">tree-ssa-structalias.c</span></samp> and described by <code>pass_ipa_pta</code>.
|
||
|
|
||
|
<li>Profiling
|
||
|
|
||
|
<p>This pass instruments the function in order to collect runtime block
|
||
|
and value profiling data. Such data may be fed back into the compiler
|
||
|
on a subsequent run so as to allow optimization based on expected
|
||
|
execution frequencies. The pass is located in <samp><span class="file">tree-profile.c</span></samp> and
|
||
|
is described by <code>pass_ipa_tree_profile</code>.
|
||
|
|
||
|
<li>Static profile estimation
|
||
|
|
||
|
<p>This pass implements series of heuristics to guess propababilities
|
||
|
of branches. The resulting predictions are turned into edge profile
|
||
|
by propagating branches across the control flow graphs.
|
||
|
The pass is located in <samp><span class="file">tree-profile.c</span></samp> and is described by
|
||
|
<code>pass_profile</code>.
|
||
|
|
||
|
<li>Lower complex arithmetic
|
||
|
|
||
|
<p>This pass rewrites complex arithmetic operations into their component
|
||
|
scalar arithmetic operations. The pass is located in <samp><span class="file">tree-complex.c</span></samp>
|
||
|
and is described by <code>pass_lower_complex</code>.
|
||
|
|
||
|
<li>Scalar replacement of aggregates
|
||
|
|
||
|
<p>This pass rewrites suitable non-aliased local aggregate variables into
|
||
|
a set of scalar variables. The resulting scalar variables are
|
||
|
rewritten into SSA form, which allows subsequent optimization passes
|
||
|
to do a significantly better job with them. The pass is located in
|
||
|
<samp><span class="file">tree-sra.c</span></samp> and is described by <code>pass_sra</code>.
|
||
|
|
||
|
<li>Dead store elimination
|
||
|
|
||
|
<p>This pass eliminates stores to memory that are subsequently overwritten
|
||
|
by another store, without any intervening loads. The pass is located
|
||
|
in <samp><span class="file">tree-ssa-dse.c</span></samp> and is described by <code>pass_dse</code>.
|
||
|
|
||
|
<li>Tail recursion elimination
|
||
|
|
||
|
<p>This pass transforms tail recursion into a loop. It is located in
|
||
|
<samp><span class="file">tree-tailcall.c</span></samp> and is described by <code>pass_tail_recursion</code>.
|
||
|
|
||
|
<li>Forward store motion
|
||
|
|
||
|
<p>This pass sinks stores and assignments down the flowgraph closer to their
|
||
|
use point. The pass is located in <samp><span class="file">tree-ssa-sink.c</span></samp> and is
|
||
|
described by <code>pass_sink_code</code>.
|
||
|
|
||
|
<li>Partial redundancy elimination
|
||
|
|
||
|
<p>This pass eliminates partially redundant computations, as well as
|
||
|
performing load motion. The pass is located in <samp><span class="file">tree-ssa-pre.c</span></samp>
|
||
|
and is described by <code>pass_pre</code>.
|
||
|
|
||
|
<p>Just before partial redundancy elimination, if
|
||
|
<samp><span class="option">-funsafe-math-optimizations</span></samp> is on, GCC tries to convert
|
||
|
divisions to multiplications by the reciprocal. The pass is located
|
||
|
in <samp><span class="file">tree-ssa-math-opts.c</span></samp> and is described by
|
||
|
<code>pass_cse_reciprocal</code>.
|
||
|
|
||
|
<li>Full redundancy elimination
|
||
|
|
||
|
<p>This is a simpler form of PRE that only eliminates redundancies that
|
||
|
occur on all paths. It is located in <samp><span class="file">tree-ssa-pre.c</span></samp> and
|
||
|
described by <code>pass_fre</code>.
|
||
|
|
||
|
<li>Loop optimization
|
||
|
|
||
|
<p>The main driver of the pass is placed in <samp><span class="file">tree-ssa-loop.c</span></samp>
|
||
|
and described by <code>pass_loop</code>.
|
||
|
|
||
|
<p>The optimizations performed by this pass are:
|
||
|
|
||
|
<p>Loop invariant motion. This pass moves only invariants that
|
||
|
would be hard to handle on RTL level (function calls, operations that expand to
|
||
|
nontrivial sequences of insns). With <samp><span class="option">-funswitch-loops</span></samp> it also moves
|
||
|
operands of conditions that are invariant out of the loop, so that we can use
|
||
|
just trivial invariantness analysis in loop unswitching. The pass also includes
|
||
|
store motion. The pass is implemented in <samp><span class="file">tree-ssa-loop-im.c</span></samp>.
|
||
|
|
||
|
<p>Canonical induction variable creation. This pass creates a simple counter
|
||
|
for number of iterations of the loop and replaces the exit condition of the
|
||
|
loop using it, in case when a complicated analysis is necessary to determine
|
||
|
the number of iterations. Later optimizations then may determine the number
|
||
|
easily. The pass is implemented in <samp><span class="file">tree-ssa-loop-ivcanon.c</span></samp>.
|
||
|
|
||
|
<p>Induction variable optimizations. This pass performs standard induction
|
||
|
variable optimizations, including strength reduction, induction variable
|
||
|
merging and induction variable elimination. The pass is implemented in
|
||
|
<samp><span class="file">tree-ssa-loop-ivopts.c</span></samp>.
|
||
|
|
||
|
<p>Loop unswitching. This pass moves the conditional jumps that are invariant
|
||
|
out of the loops. To achieve this, a duplicate of the loop is created for
|
||
|
each possible outcome of conditional jump(s). The pass is implemented in
|
||
|
<samp><span class="file">tree-ssa-loop-unswitch.c</span></samp>.
|
||
|
|
||
|
<p>The optimizations also use various utility functions contained in
|
||
|
<samp><span class="file">tree-ssa-loop-manip.c</span></samp>, <samp><span class="file">cfgloop.c</span></samp>, <samp><span class="file">cfgloopanal.c</span></samp> and
|
||
|
<samp><span class="file">cfgloopmanip.c</span></samp>.
|
||
|
|
||
|
<p>Vectorization. This pass transforms loops to operate on vector types
|
||
|
instead of scalar types. Data parallelism across loop iterations is exploited
|
||
|
to group data elements from consecutive iterations into a vector and operate
|
||
|
on them in parallel. Depending on available target support the loop is
|
||
|
conceptually unrolled by a factor <code>VF</code> (vectorization factor), which is
|
||
|
the number of elements operated upon in parallel in each iteration, and the
|
||
|
<code>VF</code> copies of each scalar operation are fused to form a vector operation.
|
||
|
Additional loop transformations such as peeling and versioning may take place
|
||
|
to align the number of iterations, and to align the memory accesses in the
|
||
|
loop.
|
||
|
The pass is implemented in <samp><span class="file">tree-vectorizer.c</span></samp> (the main driver),
|
||
|
<samp><span class="file">tree-vect-loop.c</span></samp> and <samp><span class="file">tree-vect-loop-manip.c</span></samp> (loop specific parts
|
||
|
and general loop utilities), <samp><span class="file">tree-vect-slp</span></samp> (loop-aware SLP
|
||
|
functionality), <samp><span class="file">tree-vect-stmts.c</span></samp> and <samp><span class="file">tree-vect-data-refs.c</span></samp>.
|
||
|
Analysis of data references is in <samp><span class="file">tree-data-ref.c</span></samp>.
|
||
|
|
||
|
<p>SLP Vectorization. This pass performs vectorization of straight-line code. The
|
||
|
pass is implemented in <samp><span class="file">tree-vectorizer.c</span></samp> (the main driver),
|
||
|
<samp><span class="file">tree-vect-slp.c</span></samp>, <samp><span class="file">tree-vect-stmts.c</span></samp> and
|
||
|
<samp><span class="file">tree-vect-data-refs.c</span></samp>.
|
||
|
|
||
|
<p>Autoparallelization. This pass splits the loop iteration space to run
|
||
|
into several threads. The pass is implemented in <samp><span class="file">tree-parloops.c</span></samp>.
|
||
|
|
||
|
<p>Graphite is a loop transformation framework based on the polyhedral
|
||
|
model. Graphite stands for Gimple Represented as Polyhedra. The
|
||
|
internals of this infrastructure are documented in
|
||
|
<a href="http://gcc.gnu.org/wiki/Graphite">http://gcc.gnu.org/wiki/Graphite</a><!-- /@w -->. The passes working on
|
||
|
this representation are implemented in the various <samp><span class="file">graphite-*</span></samp>
|
||
|
files.
|
||
|
|
||
|
<li>Tree level if-conversion for vectorizer
|
||
|
|
||
|
<p>This pass applies if-conversion to simple loops to help vectorizer.
|
||
|
We identify if convertible loops, if-convert statements and merge
|
||
|
basic blocks in one big block. The idea is to present loop in such
|
||
|
form so that vectorizer can have one to one mapping between statements
|
||
|
and available vector operations. This pass is located in
|
||
|
<samp><span class="file">tree-if-conv.c</span></samp> and is described by <code>pass_if_conversion</code>.
|
||
|
|
||
|
<li>Conditional constant propagation
|
||
|
|
||
|
<p>This pass relaxes a lattice of values in order to identify those
|
||
|
that must be constant even in the presence of conditional branches.
|
||
|
The pass is located in <samp><span class="file">tree-ssa-ccp.c</span></samp> and is described
|
||
|
by <code>pass_ccp</code>.
|
||
|
|
||
|
<p>A related pass that works on memory loads and stores, and not just
|
||
|
register values, is located in <samp><span class="file">tree-ssa-ccp.c</span></samp> and described by
|
||
|
<code>pass_store_ccp</code>.
|
||
|
|
||
|
<li>Conditional copy propagation
|
||
|
|
||
|
<p>This is similar to constant propagation but the lattice of values is
|
||
|
the “copy-of” relation. It eliminates redundant copies from the
|
||
|
code. The pass is located in <samp><span class="file">tree-ssa-copy.c</span></samp> and described by
|
||
|
<code>pass_copy_prop</code>.
|
||
|
|
||
|
<p>A related pass that works on memory copies, and not just register
|
||
|
copies, is located in <samp><span class="file">tree-ssa-copy.c</span></samp> and described by
|
||
|
<code>pass_store_copy_prop</code>.
|
||
|
|
||
|
<li>Value range propagation
|
||
|
|
||
|
<p>This transformation is similar to constant propagation but
|
||
|
instead of propagating single constant values, it propagates
|
||
|
known value ranges. The implementation is based on Patterson's
|
||
|
range propagation algorithm (Accurate Static Branch Prediction by
|
||
|
Value Range Propagation, J. R. C. Patterson, PLDI '95). In
|
||
|
contrast to Patterson's algorithm, this implementation does not
|
||
|
propagate branch probabilities nor it uses more than a single
|
||
|
range per SSA name. This means that the current implementation
|
||
|
cannot be used for branch prediction (though adapting it would
|
||
|
not be difficult). The pass is located in <samp><span class="file">tree-vrp.c</span></samp> and is
|
||
|
described by <code>pass_vrp</code>.
|
||
|
|
||
|
<li>Folding built-in functions
|
||
|
|
||
|
<p>This pass simplifies built-in functions, as applicable, with constant
|
||
|
arguments or with inferable string lengths. It is located in
|
||
|
<samp><span class="file">tree-ssa-ccp.c</span></samp> and is described by <code>pass_fold_builtins</code>.
|
||
|
|
||
|
<li>Split critical edges
|
||
|
|
||
|
<p>This pass identifies critical edges and inserts empty basic blocks
|
||
|
such that the edge is no longer critical. The pass is located in
|
||
|
<samp><span class="file">tree-cfg.c</span></samp> and is described by <code>pass_split_crit_edges</code>.
|
||
|
|
||
|
<li>Control dependence dead code elimination
|
||
|
|
||
|
<p>This pass is a stronger form of dead code elimination that can
|
||
|
eliminate unnecessary control flow statements. It is located
|
||
|
in <samp><span class="file">tree-ssa-dce.c</span></samp> and is described by <code>pass_cd_dce</code>.
|
||
|
|
||
|
<li>Tail call elimination
|
||
|
|
||
|
<p>This pass identifies function calls that may be rewritten into
|
||
|
jumps. No code transformation is actually applied here, but the
|
||
|
data and control flow problem is solved. The code transformation
|
||
|
requires target support, and so is delayed until RTL. In the
|
||
|
meantime <code>CALL_EXPR_TAILCALL</code> is set indicating the possibility.
|
||
|
The pass is located in <samp><span class="file">tree-tailcall.c</span></samp> and is described by
|
||
|
<code>pass_tail_calls</code>. The RTL transformation is handled by
|
||
|
<code>fixup_tail_calls</code> in <samp><span class="file">calls.c</span></samp>.
|
||
|
|
||
|
<li>Warn for function return without value
|
||
|
|
||
|
<p>For non-void functions, this pass locates return statements that do
|
||
|
not specify a value and issues a warning. Such a statement may have
|
||
|
been injected by falling off the end of the function. This pass is
|
||
|
run last so that we have as much time as possible to prove that the
|
||
|
statement is not reachable. It is located in <samp><span class="file">tree-cfg.c</span></samp> and
|
||
|
is described by <code>pass_warn_function_return</code>.
|
||
|
|
||
|
<li>Leave static single assignment form
|
||
|
|
||
|
<p>This pass rewrites the function such that it is in normal form. At
|
||
|
the same time, we eliminate as many single-use temporaries as possible,
|
||
|
so the intermediate language is no longer GIMPLE, but GENERIC. The
|
||
|
pass is located in <samp><span class="file">tree-outof-ssa.c</span></samp> and is described by
|
||
|
<code>pass_del_ssa</code>.
|
||
|
|
||
|
<li>Merge PHI nodes that feed into one another
|
||
|
|
||
|
<p>This is part of the CFG cleanup passes. It attempts to join PHI nodes
|
||
|
from a forwarder CFG block into another block with PHI nodes. The
|
||
|
pass is located in <samp><span class="file">tree-cfgcleanup.c</span></samp> and is described by
|
||
|
<code>pass_merge_phi</code>.
|
||
|
|
||
|
<li>Return value optimization
|
||
|
|
||
|
<p>If a function always returns the same local variable, and that local
|
||
|
variable is an aggregate type, then the variable is replaced with the
|
||
|
return value for the function (i.e., the function's DECL_RESULT). This
|
||
|
is equivalent to the C++ named return value optimization applied to
|
||
|
GIMPLE. The pass is located in <samp><span class="file">tree-nrv.c</span></samp> and is described by
|
||
|
<code>pass_nrv</code>.
|
||
|
|
||
|
<li>Return slot optimization
|
||
|
|
||
|
<p>If a function returns a memory object and is called as <code>var =
|
||
|
foo()</code>, this pass tries to change the call so that the address of
|
||
|
<code>var</code> is sent to the caller to avoid an extra memory copy. This
|
||
|
pass is located in <code>tree-nrv.c</code> and is described by
|
||
|
<code>pass_return_slot</code>.
|
||
|
|
||
|
<li>Optimize calls to <code>__builtin_object_size</code>
|
||
|
|
||
|
<p>This is a propagation pass similar to CCP that tries to remove calls
|
||
|
to <code>__builtin_object_size</code> when the size of the object can be
|
||
|
computed at compile-time. This pass is located in
|
||
|
<samp><span class="file">tree-object-size.c</span></samp> and is described by
|
||
|
<code>pass_object_sizes</code>.
|
||
|
|
||
|
<li>Loop invariant motion
|
||
|
|
||
|
<p>This pass removes expensive loop-invariant computations out of loops.
|
||
|
The pass is located in <samp><span class="file">tree-ssa-loop.c</span></samp> and described by
|
||
|
<code>pass_lim</code>.
|
||
|
|
||
|
<li>Loop nest optimizations
|
||
|
|
||
|
<p>This is a family of loop transformations that works on loop nests. It
|
||
|
includes loop interchange, scaling, skewing and reversal and they are
|
||
|
all geared to the optimization of data locality in array traversals
|
||
|
and the removal of dependencies that hamper optimizations such as loop
|
||
|
parallelization and vectorization. The pass is located in
|
||
|
<samp><span class="file">tree-loop-linear.c</span></samp> and described by
|
||
|
<code>pass_linear_transform</code>.
|
||
|
|
||
|
<li>Removal of empty loops
|
||
|
|
||
|
<p>This pass removes loops with no code in them. The pass is located in
|
||
|
<samp><span class="file">tree-ssa-loop-ivcanon.c</span></samp> and described by
|
||
|
<code>pass_empty_loop</code>.
|
||
|
|
||
|
<li>Unrolling of small loops
|
||
|
|
||
|
<p>This pass completely unrolls loops with few iterations. The pass
|
||
|
is located in <samp><span class="file">tree-ssa-loop-ivcanon.c</span></samp> and described by
|
||
|
<code>pass_complete_unroll</code>.
|
||
|
|
||
|
<li>Predictive commoning
|
||
|
|
||
|
<p>This pass makes the code reuse the computations from the previous
|
||
|
iterations of the loops, especially loads and stores to memory.
|
||
|
It does so by storing the values of these computations to a bank
|
||
|
of temporary variables that are rotated at the end of loop. To avoid
|
||
|
the need for this rotation, the loop is then unrolled and the copies
|
||
|
of the loop body are rewritten to use the appropriate version of
|
||
|
the temporary variable. This pass is located in <samp><span class="file">tree-predcom.c</span></samp>
|
||
|
and described by <code>pass_predcom</code>.
|
||
|
|
||
|
<li>Array prefetching
|
||
|
|
||
|
<p>This pass issues prefetch instructions for array references inside
|
||
|
loops. The pass is located in <samp><span class="file">tree-ssa-loop-prefetch.c</span></samp> and
|
||
|
described by <code>pass_loop_prefetch</code>.
|
||
|
|
||
|
<li>Reassociation
|
||
|
|
||
|
<p>This pass rewrites arithmetic expressions to enable optimizations that
|
||
|
operate on them, like redundancy elimination and vectorization. The
|
||
|
pass is located in <samp><span class="file">tree-ssa-reassoc.c</span></samp> and described by
|
||
|
<code>pass_reassoc</code>.
|
||
|
|
||
|
<li>Optimization of <code>stdarg</code> functions
|
||
|
|
||
|
<p>This pass tries to avoid the saving of register arguments into the
|
||
|
stack on entry to <code>stdarg</code> functions. If the function doesn't
|
||
|
use any <code>va_start</code> macros, no registers need to be saved. If
|
||
|
<code>va_start</code> macros are used, the <code>va_list</code> variables don't
|
||
|
escape the function, it is only necessary to save registers that will
|
||
|
be used in <code>va_arg</code> macros. For instance, if <code>va_arg</code> is
|
||
|
only used with integral types in the function, floating point
|
||
|
registers don't need to be saved. This pass is located in
|
||
|
<code>tree-stdarg.c</code> and described by <code>pass_stdarg</code>.
|
||
|
|
||
|
</ul>
|
||
|
|
||
|
</body></html>
|
||
|
|