From 0e15dc26ec9fccbde6091309434da4004d9d14ae Mon Sep 17 00:00:00 2001 From: Gordon Henriksen Date: Thu, 25 Oct 2007 10:18:27 +0000 Subject: [PATCH] Fleshing out docs/Passes.html for some analyses. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43337 91177308-0d34-0410-b5e6-96231b3b80d8 --- docs/Passes.html | 222 ++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 193 insertions(+), 29 deletions(-) diff --git a/docs/Passes.html b/docs/Passes.html index efa69fec5a2..fb1359ff858 100644 --- a/docs/Passes.html +++ b/docs/Passes.html @@ -34,6 +34,10 @@ while () { print @x, @y; EOT +This (real) one-liner can also be helpful when converting comments to HTML: + +perl -e '$/ = undef; for (split(/\n/, <>)) { s:^ *///? ?::; print "

\n" if !$on && $_ =~ /\S/; print "

\n" if $on && $_ =~ /^\s*$/; print " $_\n"; $on = ($_ =~ /\S/); } print "

\n" if $on' + -->
LLVM's Analysis and Transform Passes
@@ -46,7 +50,8 @@ EOT
-

Written by Reid Spencer

+

Written by Reid Spencer + and Gordon Henriksen

@@ -84,7 +89,6 @@ EOT -domtreeDominator Tree Construction -externalfnconstantsPrint external fn callsites passed constants -globalsmodref-aaSimple mod/ref analysis for globals --gvnGlobal Value Numbering -instcountCounts the various types of Instructions -intervalsInterval Partition Construction -load-vnLoad Value Numbering @@ -124,6 +128,7 @@ EOT -gcseGlobal Common Subexpression Elimination -globaldceDead Global Elimination -globaloptGlobal Variable Optimizer +-gvnGlobal Value Numbering -gvnpreGlobal Value Numbering/Partial Redundancy Elimination -indmemremIndirect Malloc and Free Removal -indvarsCanonicalize Induction Variables @@ -192,7 +197,13 @@ EOT Exhaustive Alias Analysis Precision Evaluator
-

Yet to be written.

+

This is a simple N^2 alias analysis accuracy evaluator. + Basically, for each function in the program, it simply queries to see how the + alias analysis implementation answers alias queries between each pair of + pointers in the function.

+ +

This is inspired and adapted from code by: Naveen Neelakantam, Francesco + Spadini, and Wojciech Stryjewski.

@@ -200,7 +211,67 @@ EOT Andersen's Interprocedural Alias Analysis
-

Yet to be written.

+

+ This is an implementation of Andersen's interprocedural alias + analysis +

+ +

+ In pointer analysis terms, this is a subset-based, flow-insensitive, + field-sensitive, and context-insensitive algorithm pointer algorithm. +

+ +

+ This algorithm is implemented as three stages: +

+ +
    +
  1. Object identification.
  2. +
  3. Inclusion constraint identification.
  4. +
  5. Offline constraint graph optimization.
  6. +
  7. Inclusion constraint solving.
  8. +
+ +

+ The object identification stage identifies all of the memory objects in the + program, which includes globals, heap allocated objects, and stack allocated + objects. +

+ +

+ The inclusion constraint identification stage finds all inclusion constraints + in the program by scanning the program, looking for pointer assignments and + other statements that effect the points-to graph. For a statement like + A = B, this statement is processed to + indicate that A can point to anything that B can point + to. Constraints can handle copies, loads, and stores, and address taking. +

+ +

+ The offline constraint graph optimization portion includes offline variable + substitution algorithms intended to computer pointer and location + equivalences. Pointer equivalences are those pointers that will have the + same points-to sets, and location equivalences are those variables that + always appear together in points-to sets. +

+ +

+ The inclusion constraint solving phase iteratively propagates the inclusion + constraints until a fixed point is reached. This is an O(n³) + algorithm. +

+ +

+ Function constraints are handled as if they were structs with X + fields. Thus, an access to argument X of function Y is + an access to node index getNode(Y) + X. + This representation allows handling of indirect calls without any issues. To + wit, an indirect call Y(a,b) is + equivalent to *(Y + 1) = a, *(Y + 2) = + b. The return node for a function F is always + located at getNode(F) + CallReturnPos. The arguments + start at getNode(F) + CallArgPos. +

@@ -208,7 +279,11 @@ EOT Basic Alias Analysis (default AA impl)
-

Yet to be written.

+

+ This is the default implementation of the Alias Analysis interface + that simply implements a few identities (two different globals cannot alias, + etc), but otherwise does no analysis. +

@@ -224,7 +299,12 @@ EOT Basic Value Numbering (default GVN impl)
-

Yet to be written.

+

+ This is the default implementation of the ValueNumbering + 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. +

@@ -232,7 +312,11 @@ EOT Print a call graph
-

Yet to be written.

+

+ This pass, only available in opt, prints + the call graph into a .dot graph. This graph can then be processed with the + "dot" tool to convert it to postscript or some other suitable format. +

@@ -240,7 +324,10 @@ EOT Print SCCs of the Call Graph
-

Yet to be written.

+

+ This pass, only available in opt, prints + the SCCs of the call graph to standard output in a human-readable form. +

@@ -248,7 +335,10 @@ EOT Print SCCs of each function CFG
-

Yet to be written.

+

+ This pass, only available in opt, prints + the SCCs of each function CFG to standard output in a human-readable form. +

@@ -256,7 +346,11 @@ EOT Optimize for code generation
-

Yet to be written.

+

+ This pass munges the code in the input function to better prepare it for + SelectionDAG-based code generation. This works around limitations in it's + basic-block-at-a-time approach. It should eventually be removed. +

@@ -264,7 +358,10 @@ EOT Count Alias Analysis Query Responses
-

Yet to be written.

+

+ A pass which can be used to count how many alias queries + are being made and how the alias analysis implementation being used responds. +

@@ -272,7 +369,16 @@ EOT AA use debugger
-

Yet to be written.

+

+ This simple pass checks alias analysis users to ensure that if they + create a new value, they do not query AA without informing it of the value. + It acts as a shim over any other AA pass you want. +

+ +

+ Yes keeping track of every value in the program is expensive, but this is + a debugging pass. +

@@ -280,7 +386,10 @@ EOT Dominance Frontier Construction
-

Yet to be written.

+

+ This pass is a simple dominator construction algorithm for finding forward + dominator frontiers. +

@@ -288,7 +397,10 @@ EOT Dominator Tree Construction
-

Yet to be written.

+

+ This pass is a simple dominator construction algorithm for finding forward + dominators. +

@@ -296,7 +408,12 @@ EOT Print external fn callsites passed constants
-

Yet to be written.

+

+ This pass, only available in opt, 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. +

@@ -304,15 +421,12 @@ EOT Simple mod/ref analysis for globals
-

Yet to be written.

-
- - - -
-

Yet to be written.

+

+ This simple pass provides alias and mod/ref information for global values + that do not have their address taken, and keeps track of whether functions + read or write memory (are "pure"). For this simple (but very common) case, + we can provide pretty accurate and useful information. +

@@ -320,7 +434,9 @@ EOT Counts the various types of Instructions
-

Yet to be written.

+

+ This pass collects the count of all instructions and reports them +

@@ -328,7 +444,15 @@ EOT Interval Partition Construction
-

Yet to be written.

+

+ This analysis calculates and represents the interval partition of a function, + or a preexisting interval partition. +

+ +

+ In this way, the interval partition may be used to reduce a flow graph down + to its degenerate single node interval partition (unless it is irreducible). +

@@ -336,7 +460,21 @@ EOT Load Value Numbering
-

Yet to be written.

+

+ 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. +

+ +

+ 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. +

@@ -344,7 +482,12 @@ EOT Natural Loop Construction
-

Yet to be written.

+

+ This analysis is used to identify natural loops and determine the loop depth + of various nodes of the CFG. Note that the loops identified may actually be + several natural loops that share the same header node... not just a single + natural loop. +

@@ -506,6 +649,7 @@ EOT Code Positioning" by Pettis and Hansen, except that it uses basic block counts instead of edge counts. This could be improved in many ways, but is very simple for now.

+

Basically we "place" the entry block, then loop over all successors in a DFO, placing the most frequently executed successor until we run out of blocks. Did we mention that this was extremely simplistic? This is @@ -644,12 +788,32 @@ if (i == j)

Yet to be written.

+ + +
+

+ This pass performs global value numbering to eliminate fully redundant + instructions. It also performs simple dead load elimination. +

+
+
-

Yet to be written.

+

+ 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. +

-- 2.34.1