2.7: Note that DataTypes.h moved.
[oota-llvm.git] / docs / Passes.html
index bb1a64bd978061edb7fbd999aac2eabf56a76883..bbf6b3dc943b217bdb50e8661d94e9b68faed3d6 100644 (file)
@@ -78,33 +78,31 @@ perl -e '$/ = undef; for (split(/\n/, <>)) { s:^ *///? ?::; print "  <p>\n" if !
 <tr><td><a href="#anders-aa">-anders-aa</a></td><td>Andersen's Interprocedural Alias Analysis</td></tr>
 <tr><td><a href="#basicaa">-basicaa</a></td><td>Basic Alias Analysis (default AA impl)</td></tr>
 <tr><td><a href="#basiccg">-basiccg</a></td><td>Basic CallGraph Construction</td></tr>
-<tr><td><a href="#basicvn">-basicvn</a></td><td>Basic Value Numbering (default GVN impl)</td></tr>
-<tr><td><a href="#callgraph">-callgraph</a></td><td>Print a call graph</td></tr>
-<tr><td><a href="#callscc">-callscc</a></td><td>Print SCCs of the Call Graph</td></tr>
-<tr><td><a href="#cfgscc">-cfgscc</a></td><td>Print SCCs of each function CFG</td></tr>
 <tr><td><a href="#codegenprepare">-codegenprepare</a></td><td>Optimize for code generation</td></tr>
 <tr><td><a href="#count-aa">-count-aa</a></td><td>Count Alias Analysis Query Responses</td></tr>
 <tr><td><a href="#debug-aa">-debug-aa</a></td><td>AA use debugger</td></tr>
 <tr><td><a href="#domfrontier">-domfrontier</a></td><td>Dominance Frontier Construction</td></tr>
 <tr><td><a href="#domtree">-domtree</a></td><td>Dominator Tree Construction</td></tr>
-<tr><td><a href="#externalfnconstants">-externalfnconstants</a></td><td>Print external fn callsites passed constants</td></tr>
+<tr><td><a href="#dot-callgraph">-dot-callgraph</a></td><td>Print Call Graph to 'dot' file</td></tr>
+<tr><td><a href="#dot-cfg">-dot-cfg</a></td><td>Print CFG of function to 'dot' file</td></tr>
+<tr><td><a href="#dot-cfg-only">-dot-cfg-only</a></td><td>Print CFG of function to 'dot' file (with no function bodies)</td></tr>
 <tr><td><a href="#globalsmodref-aa">-globalsmodref-aa</a></td><td>Simple mod/ref analysis for globals</td></tr>
 <tr><td><a href="#instcount">-instcount</a></td><td>Counts the various types of Instructions</td></tr>
 <tr><td><a href="#intervals">-intervals</a></td><td>Interval Partition Construction</td></tr>
-<tr><td><a href="#load-vn">-load-vn</a></td><td>Load Value Numbering</td></tr>
 <tr><td><a href="#loops">-loops</a></td><td>Natural Loop Construction</td></tr>
 <tr><td><a href="#memdep">-memdep</a></td><td>Memory Dependence Analysis</td></tr>
 <tr><td><a href="#no-aa">-no-aa</a></td><td>No Alias Analysis (always returns 'may' alias)</td></tr>
 <tr><td><a href="#no-profile">-no-profile</a></td><td>No Profile Information</td></tr>
 <tr><td><a href="#postdomfrontier">-postdomfrontier</a></td><td>Post-Dominance Frontier Construction</td></tr>
 <tr><td><a href="#postdomtree">-postdomtree</a></td><td>Post-Dominator Tree Construction</td></tr>
-<tr><td><a href="#print">-print</a></td><td>Print function to stderr</td></tr>
 <tr><td><a href="#print-alias-sets">-print-alias-sets</a></td><td>Alias Set Printer</td></tr>
-<tr><td><a href="#print-callgraph">-print-callgraph</a></td><td>Print Call Graph to 'dot' file</td></tr>
-<tr><td><a href="#print-cfg">-print-cfg</a></td><td>Print CFG of function to 'dot' file</td></tr>
-<tr><td><a href="#print-cfg-only">-print-cfg-only</a></td><td>Print CFG of function to 'dot' file (with no function bodies)</td></tr>
-<tr><td><a href="#printm">-printm</a></td><td>Print module to stderr</td></tr>
-<tr><td><a href="#printusedtypes">-printusedtypes</a></td><td>Find Used Types</td></tr>
+<tr><td><a href="#print-callgraph">-print-callgraph</a></td><td>Print a call graph</td></tr>
+<tr><td><a href="#print-callgraph-sccs">-print-callgraph-sccs</a></td><td>Print SCCs of the Call Graph</td></tr>
+<tr><td><a href="#print-cfg-sccs">-print-cfg-sccs</a></td><td>Print SCCs of each function CFG</td></tr>
+<tr><td><a href="#print-externalfnconstants">-print-externalfnconstants</a></td><td>Print external fn callsites passed constants</td></tr>
+<tr><td><a href="#print-function">-print-function</a></td><td>Print function to stderr</td></tr>
+<tr><td><a href="#print-module">-print-module</a></td><td>Print module to stderr</td></tr>
+<tr><td><a href="#print-used-types">-print-used-types</a></td><td>Find Used Types</td></tr>
 <tr><td><a href="#profile-loader">-profile-loader</a></td><td>Load profile information from llvmprof.out</td></tr>
 <tr><td><a href="#scalar-evolution">-scalar-evolution</a></td><td>Scalar Evolution Analysis</td></tr>
 <tr><td><a href="#targetdata">-targetdata</a></td><td>Target Data Layout</td></tr>
@@ -125,11 +123,9 @@ perl -e '$/ = undef; for (split(/\n/, <>)) { s:^ *///? ?::; print "  <p>\n" if !
 <tr><td><a href="#deadtypeelim">-deadtypeelim</a></td><td>Dead Type Elimination</td></tr>
 <tr><td><a href="#die">-die</a></td><td>Dead Instruction Elimination</td></tr>
 <tr><td><a href="#dse">-dse</a></td><td>Dead Store Elimination</td></tr>
-<tr><td><a href="#gcse">-gcse</a></td><td>Global Common Subexpression Elimination</td></tr>
 <tr><td><a href="#globaldce">-globaldce</a></td><td>Dead Global Elimination</td></tr>
 <tr><td><a href="#globalopt">-globalopt</a></td><td>Global Variable Optimizer</td></tr>
 <tr><td><a href="#gvn">-gvn</a></td><td>Global Value Numbering</td></tr>
-<tr><td><a href="#gvnpre">-gvnpre</a></td><td>Global Value Numbering/Partial Redundancy Elimination</td></tr>
 <tr><td><a href="#indmemrem">-indmemrem</a></td><td>Indirect Malloc and Free Removal</td></tr>
 <tr><td><a href="#indvars">-indvars</a></td><td>Canonicalize Induction Variables</td></tr>
 <tr><td><a href="#inline">-inline</a></td><td>Function Integration/Inlining</td></tr>
@@ -161,9 +157,7 @@ perl -e '$/ = undef; for (split(/\n/, <>)) { s:^ *///? ?::; print "  <p>\n" if !
 <tr><td><a href="#mem2reg">-mem2reg</a></td><td>Promote Memory to Register</td></tr>
 <tr><td><a href="#memcpyopt">-memcpyopt</a></td><td>Optimize use of memcpy and friends</td></tr>
 <tr><td><a href="#mergereturn">-mergereturn</a></td><td>Unify function exit nodes</td></tr>
-<tr><td><a href="#predsimplify">-predsimplify</a></td><td>Predicate Simplifier</td></tr>
 <tr><td><a href="#prune-eh">-prune-eh</a></td><td>Remove unused exception handling info</td></tr>
-<tr><td><a href="#raiseallocs">-raiseallocs</a></td><td>Raise allocations from calls to instructions</td></tr>
 <tr><td><a href="#reassociate">-reassociate</a></td><td>Reassociate expressions</td></tr>
 <tr><td><a href="#reg2mem">-reg2mem</a></td><td>Demote all values to stack slots</td></tr>
 <tr><td><a href="#scalarrepl">-scalarrepl</a></td><td>Scalar Replacement of Aggregates</td></tr>
@@ -274,6 +268,12 @@ perl -e '$/ = undef; for (split(/\n/, <>)) { s:^ *///? ?::; print "  <p>\n" if !
   located at <code>getNode(<var>F</var>) + CallReturnPos</code>. The arguments 
   start at <code>getNode(<var>F</var>) + CallArgPos</code>.
   </p>
+
+  <p>
+  Please keep in mind that the current andersen's pass has many known
+  problems and bugs.  It should be considered "research quality".
+  </p>
+
 </div>
 
 <!-------------------------------------------------------------------------- -->
@@ -296,58 +296,6 @@ perl -e '$/ = undef; for (split(/\n/, <>)) { s:^ *///? ?::; print "  <p>\n" if !
   <p>Yet to be written.</p>
 </div>
 
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="basicvn">Basic Value Numbering (default Value Numbering impl)</a>
-</div>
-<div class="doc_text">
-  <p>
-  This is the default implementation of the <code>ValueNumbering</code>
-  interface.  It walks the SSA def-use chains to trivially identify
-  lexically identical expressions.  This does not require any ahead of time
-  analysis, so it is a very fast default implementation.
-  </p>
-  <p>
-  The ValueNumbering analysis passes are mostly deprecated. They are only used
-  by the <a href="#gcse">Global Common Subexpression Elimination pass</a>, which
-  is deprecated by the <a href="#gvn">Global Value Numbering pass</a> (which
-  does its value numbering on its own).
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="callgraph">Print a call graph</a>
-</div>
-<div class="doc_text">
-  <p>
-  This pass, only available in <code>opt</code>, prints the call graph to
-  standard output in a human-readable form.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="callscc">Print SCCs of the Call Graph</a>
-</div>
-<div class="doc_text">
-  <p>
-  This pass, only available in <code>opt</code>, prints the SCCs of the call
-  graph to standard output in a human-readable form.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="cfgscc">Print SCCs of each function CFG</a>
-</div>
-<div class="doc_text">
-  <p>
-  This pass, only available in <code>opt</code>, prints the SCCs of each
-  function CFG to standard output in a human-readable form.
-  </p>
-</div>
-
 <!-------------------------------------------------------------------------- -->
 <div class="doc_subsection">
   <a name="codegenprepare">Optimize for code generation</a>
@@ -412,14 +360,38 @@ perl -e '$/ = undef; for (split(/\n/, <>)) { s:^ *///? ?::; print "  <p>\n" if !
 
 <!-------------------------------------------------------------------------- -->
 <div class="doc_subsection">
-  <a name="externalfnconstants">Print external fn callsites passed constants</a>
+  <a name="dot-callgraph">Print Call Graph to 'dot' file</a>
 </div>
 <div class="doc_text">
   <p>
-  This pass, only available in <code>opt</code>, prints out call sites to
-  external functions that are called with constant arguments.  This can be
-  useful when looking for standard library functions we should constant fold
-  or handle in alias analyses.
+  This pass, only available in <code>opt</code>, prints the call graph into a
+  <code>.dot</code> graph.  This graph can then be processed with the "dot" tool
+  to convert it to postscript or some other suitable format.
+  </p>
+</div>
+
+<!-------------------------------------------------------------------------- -->
+<div class="doc_subsection">
+  <a name="dot-cfg">Print CFG of function to 'dot' file</a>
+</div>
+<div class="doc_text">
+  <p>
+  This pass, only available in <code>opt</code>, prints the control flow graph
+  into a <code>.dot</code> graph.  This graph can then be processed with the
+  "dot" tool to convert it to postscript or some other suitable format.
+  </p>
+</div>
+
+<!-------------------------------------------------------------------------- -->
+<div class="doc_subsection">
+  <a name="dot-cfg-only">Print CFG of function to 'dot' file (with no function bodies)</a>
+</div>
+<div class="doc_text">
+  <p>
+  This pass, only available in <code>opt</code>, prints the control flow graph
+  into a <code>.dot</code> graph, omitting the function bodies.  This graph can
+  then be processed with the "dot" tool to convert it to postscript or some
+  other suitable format.
   </p>
 </div>
 
@@ -462,28 +434,6 @@ perl -e '$/ = undef; for (split(/\n/, <>)) { s:^ *///? ?::; print "  <p>\n" if !
   </p>
 </div>
 
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="load-vn">Load Value Numbering</a>
-</div>
-<div class="doc_text">
-  <p>
-  This pass value numbers load and call instructions.  To do this, it finds
-  lexically identical load instructions, and uses alias analysis to determine
-  which loads are guaranteed to produce the same value.  To value number call
-  instructions, it looks for calls to functions that do not write to memory
-  which do not have intervening instructions that clobber the memory that is
-  read from.
-  </p>
-  
-  <p>
-  This pass builds off of another value numbering pass to implement value
-  numbering for non-load and non-call instructions.  It uses Alias Analysis so
-  that it can disambiguate the load instructions.  The more powerful these base
-  analyses are, the more powerful the resultant value numbering will be.
-  </p>
-</div>
-
 <!-------------------------------------------------------------------------- -->
 <div class="doc_subsection">
   <a name="loops">Natural Loop Construction</a>
@@ -557,64 +507,73 @@ perl -e '$/ = undef; for (split(/\n/, <>)) { s:^ *///? ?::; print "  <p>\n" if !
 
 <!-------------------------------------------------------------------------- -->
 <div class="doc_subsection">
-  <a name="print">Print function to stderr</a>
+  <a name="print-alias-sets">Alias Set Printer</a>
+</div>
+<div class="doc_text">
+  <p>Yet to be written.</p>
+</div>
+
+<!-------------------------------------------------------------------------- -->
+<div class="doc_subsection">
+  <a name="print-callgraph">Print a call graph</a>
 </div>
 <div class="doc_text">
   <p>
-  The <code>PrintFunctionPass</code> class is designed to be pipelined with
-  other <code>FunctionPass</code>es, and prints out the functions of the module
-  as they are processed.
+  This pass, only available in <code>opt</code>, prints the call graph to
+  standard output in a human-readable form.
   </p>
 </div>
 
 <!-------------------------------------------------------------------------- -->
 <div class="doc_subsection">
-  <a name="print-alias-sets">Alias Set Printer</a>
+  <a name="print-callgraph-sccs">Print SCCs of the Call Graph</a>
 </div>
 <div class="doc_text">
-  <p>Yet to be written.</p>
+  <p>
+  This pass, only available in <code>opt</code>, prints the SCCs of the call
+  graph to standard output in a human-readable form.
+  </p>
 </div>
 
 <!-------------------------------------------------------------------------- -->
 <div class="doc_subsection">
-  <a name="print-callgraph">Print Call Graph to 'dot' file</a>
+  <a name="print-cfg-sccs">Print SCCs of each function CFG</a>
 </div>
 <div class="doc_text">
   <p>
-  This pass, only available in <code>opt</code>, prints the call graph into a
-  <code>.dot</code> graph.  This graph can then be processed with the "dot" tool
-  to convert it to postscript or some other suitable format.
+  This pass, only available in <code>opt</code>, prints the SCCs of each
+  function CFG to standard output in a human-readable form.
   </p>
 </div>
 
 <!-------------------------------------------------------------------------- -->
 <div class="doc_subsection">
-  <a name="print-cfg">Print CFG of function to 'dot' file</a>
+  <a name="print-externalfnconstants">Print external fn callsites passed constants</a>
 </div>
 <div class="doc_text">
   <p>
-  This pass, only available in <code>opt</code>, prints the control flow graph
-  into a <code>.dot</code> graph.  This graph can then be processed with the
-  "dot" tool to convert it to postscript or some other suitable format.
+  This pass, only available in <code>opt</code>, prints out call sites to
+  external functions that are called with constant arguments.  This can be
+  useful when looking for standard library functions we should constant fold
+  or handle in alias analyses.
   </p>
 </div>
 
 <!-------------------------------------------------------------------------- -->
 <div class="doc_subsection">
-  <a name="print-cfg-only">Print CFG of function to 'dot' file (with no function bodies)</a>
+  <a name="print-function">Print function to stderr</a>
 </div>
 <div class="doc_text">
   <p>
-  This pass, only available in <code>opt</code>, prints the control flow graph
-  into a <code>.dot</code> graph, omitting the function bodies.  This graph can
-  then be processed with the "dot" tool to convert it to postscript or some
-  other suitable format.
+  The <code>PrintFunctionPass</code> class is designed to be pipelined with
+  other <code>FunctionPass</code>es, and prints out the functions of the module
+  as they are processed.
   </p>
 </div>
 
 <!-------------------------------------------------------------------------- -->
 <div class="doc_subsection">
-  <a name="printm">Print module to stderr</a>
+  <a name="print-module">Print module to stderr</a>
 </div>
 <div class="doc_text">
   <p>
@@ -624,7 +583,7 @@ perl -e '$/ = undef; for (split(/\n/, <>)) { s:^ *///? ?::; print "  <p>\n" if !
 
 <!-------------------------------------------------------------------------- -->
 <div class="doc_subsection">
-  <a name="printusedtypes">Find Used Types</a>
+  <a name="print-used-types">Find Used Types</a>
 </div>
 <div class="doc_text">
   <p>
@@ -857,23 +816,6 @@ perl -e '$/ = undef; for (split(/\n/, <>)) { s:^ *///? ?::; print "  <p>\n" if !
   </p>
 </div>
 
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="gcse">Global Common Subexpression Elimination</a>
-</div>
-<div class="doc_text">
-  <p>
-  This pass is designed to be a very quick global transformation that
-  eliminates global common subexpressions from a function.  It does this by
-  using an existing value numbering analysis pass to identify the common
-  subexpressions, eliminating them when possible.
-  </p>
-  <p>
-  This pass is deprecated by the <a href="#gvn">Global Value Numbering pass</a>
-  (which does a better job with its own value numbering).
-  </p>
-</div>
-
 <!-------------------------------------------------------------------------- -->
 <div class="doc_subsection">
   <a name="globaldce">Dead Global Elimination</a>
@@ -906,35 +848,11 @@ perl -e '$/ = undef; for (split(/\n/, <>)) { s:^ *///? ?::; print "  <p>\n" if !
 </div>
 <div class="doc_text">
   <p>
-  This pass performs global value numbering to eliminate fully redundant
-  instructions.  It also performs simple dead load elimination.
-  </p>
-  <p>
-  Note that this pass does the value numbering itself, it does not use the
-  ValueNumbering analysis passes.
+  This pass performs global value numbering to eliminate fully and partially
+  redundant instructions.  It also performs redundant load elimination.
   </p>
 </div>
 
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="gvnpre">Global Value Numbering/Partial Redundancy Elimination</a>
-</div>
-<div class="doc_text">
-  <p>
-  This pass performs a hybrid of global value numbering and partial redundancy
-  elimination, known as GVN-PRE.  It performs partial redundancy elimination on
-  values, rather than lexical expressions, allowing a more comprehensive view 
-  the optimization.  It replaces redundant values with uses of earlier 
-  occurences of the same value.  While this is beneficial in that it eliminates
-  unneeded computation, it also increases register pressure by creating large
-  live ranges, and should be used with caution on platforms that are very 
-  sensitive to register pressure.
-  </p>
-  <p>
-  Note that this pass does the value numbering itself, it does not use the
-  ValueNumbering analysis passes.
-  </p>
-</div>
 
 <!-------------------------------------------------------------------------- -->
 <div class="doc_subsection">
@@ -1570,28 +1488,6 @@ if (X &lt; 3) {</pre>
   </p>
 </div>
 
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="predsimplify">Predicate Simplifier</a>
-</div>
-<div class="doc_text">
-  <p>
-  Path-sensitive optimizer. In a branch where <tt>x == y</tt>, replace uses of
-  <tt>x</tt> with <tt>y</tt>. Permits further optimization, such as the 
-  elimination of the unreachable call:
-  </p>
-  
-<blockquote><pre
->void test(int *p, int *q)
-{
-  if (p != q)
-    return;
-
-  if (*p != *q)
-    foo(); // unreachable
-}</pre></blockquote>
-</div>
-
 <!-------------------------------------------------------------------------- -->
 <div class="doc_subsection">
   <a name="prune-eh">Remove unused exception handling info</a>
@@ -1605,17 +1501,6 @@ if (X &lt; 3) {</pre>
   </p>
 </div>
 
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="raiseallocs">Raise allocations from calls to instructions</a>
-</div>
-<div class="doc_text">
-  <p>
-  Converts <tt>@malloc</tt> and <tt>@free</tt> calls to <tt>malloc</tt> and
-  <tt>free</tt> instructions.
-  </p>
-</div>
-
 <!-------------------------------------------------------------------------- -->
 <div class="doc_subsection">
   <a name="reassociate">Reassociate expressions</a>
@@ -1647,7 +1532,7 @@ if (X &lt; 3) {</pre>
   <p>
   This file demotes all registers to memory references.  It is intented to be
   the inverse of <a href="#mem2reg"><tt>-mem2reg</tt></a>.  By converting to
-  <tt>load</tt> instructions, the only values live accross basic blocks are
+  <tt>load</tt> instructions, the only values live across basic blocks are
   <tt>alloca</tt> instructions and <tt>load</tt> instructions before
   <tt>phi</tt> nodes. It is intended that this should make CFG hacking much 
   easier. To make later hacking easier, the entry block is split into two, such
@@ -1902,8 +1787,8 @@ if (X &lt; 3) {</pre>
         integrals f.e.</li>
     <li>All of the constants in a switch statement are of the correct type.</li>
     <li>The code is in valid SSA form.</li>
-    <li>It should be illegal to put a label into any other type (like a
-        structure) or to return one. [except constant arrays!]</li>
+    <li>It is illegal to put a label into any other type (like a structure) or 
+        to return one.</li>
     <li>Only phi nodes can be self referential: <tt>%x = add i32 %x, %x</tt> is
         invalid.</li>
     <li>PHI nodes must have an entry for each predecessor, with no extras.</li>
@@ -1957,9 +1842,9 @@ if (X &lt; 3) {</pre>
 <hr>
 <address>
   <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
-  src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"></a>
+  src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS"></a>
   <a href="http://validator.w3.org/check/referer"><img
-  src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"></a>
+  src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
 
   <a href="mailto:rspencer@x10sys.com">Reid Spencer</a><br>
   <a href="http://llvm.org">LLVM Compiler Infrastructure</a><br>