X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=docs%2FAliasAnalysis.html;h=97a813344d894dea99fa9489ee2a02136ee82f96;hb=6a65f4208f05af4cd2d76ae71c956b426d9e2373;hp=01492293eef1be8bd531f60ee6b861ed954c0b77;hpb=fcd3725747845f2718b60ac40a0bb97b761fb42e;p=oota-llvm.git diff --git a/docs/AliasAnalysis.html b/docs/AliasAnalysis.html index 01492293eef..97a813344d8 100644 --- a/docs/AliasAnalysis.html +++ b/docs/AliasAnalysis.html @@ -2,13 +2,13 @@ "http://www.w3.org/TR/html4/strict.dtd">
-- void getAnalysisUsage(AnalysisUsage &AU) const { - AliasAnalysis::getAnalysisUsage(AU); - // declare your dependencies here. - } +void getAnalysisUsage(AnalysisUsage &AU) const { + AliasAnalysis::getAnalysisUsage(AU); + // declare your dependencies here. +}+
Additionally, your must invoke the InitializeAliasAnalysis method from your analysis run method (run for a Pass, runOnFunction for a FunctionPass, or InitializePass for an ImmutablePass). For example (as part of a Pass):
+- bool run(Module &M) { - InitializeAliasAnalysis(this); - // Perform analysis here... - return false; - } +bool run(Module &M) { + InitializeAliasAnalysis(this); + // Perform analysis here... + return false; +}+
- AliasAnalysis::AliasResult alias(const Value *V1, unsigned V1Size, - const Value *V2, unsigned V2Size) { - if (...) - return NoAlias; - ... - - // Couldn't determine a must or no-alias result. - return AliasAnalysis::alias(V1, V1Size, V2, V2Size); - } +AliasAnalysis::AliasResult alias(const Value *V1, unsigned V1Size, + const Value *V2, unsigned V2Size) { + if (...) + return NoAlias; + ... + + // Couldn't determine a must or no-alias result. + return AliasAnalysis::alias(V1, V1Size, V2, V2Size); +}+
In addition to analysis queries, you must make sure to unconditionally pass LLVM update notification methods to the superclass as @@ -472,7 +485,6 @@ for each value in the program. When this method is called, they should remove any entries for the specified value, if they exist. -
Many transformations need information about alias sets that are active in some scope, rather than information about pairwise aliasing. The AliasSetTracker class is used -to efficiently build these Alias Sets from the pairwise alias analysis +href="/doxygen/classllvm_1_1AliasSetTracker.html">AliasSetTracker class +is used to efficiently build these Alias Sets from the pairwise alias analysis information provided by the AliasAnalysis interface.
First you initialize the AliasSetTracker by using the "add" methods @@ -601,7 +612,6 @@ are.
-This pass implements a simple context-sensitive mod/ref and alias analysis +for internal global variables that don't "have their address taken". If a +global does not have its address taken, the pass knows that no pointers alias +the global. This pass also keeps track of functions that it knows never access +memory or never read memory. This allows certain optimizations (e.g. GCSE) to +eliminate call instructions entirely. +
+ +The real power of this pass is that it provides context-sensitive mod/ref +information for call instructions. This allows the optimizer to know that +calls to a function do not clobber or read the value of the global, allowing +loads and stores to be eliminated.
+ +Note that this pass is somewhat limited in its scope (only support +non-address taken globals), but is very quick analysis.
+Note that -steens-aa is available in the optional "poolalloc" +module, it is not part of the LLVM core.
+Note that -ds-aa is available in the optional "poolalloc" +module, it is not part of the LLVM core.
+ @@ -821,8 +859,8 @@ pointer.
-The -load-vn pass uses alias analysis to "value
+
+ The -load-vn pass uses alias analysis to "value
number" loads and pointers values, which is used by the GCSE pass to
eliminate instructions. The -load-vn pass relies on alias information
and must-alias information. This combination of passes can make the following
@@ -840,18 +878,19 @@ calls into direct calls.
These passes are useful for evaluating the various alias analysis implementations. You can use them with commands like 'opt -anders-aa -ds-aa --aa-eval foo.bc -disable-output -stats'. +-aa-eval foo.bc -disable-output -stats'.
+The -print-alias-sets pass is exposed as part of the -analyze tool to print out the Alias Sets formed by the opt tool to print out the Alias Sets formed by the AliasSetTracker class. This is useful if you're using -the AliasSetTracker class.
+the AliasSetTracker class. To use it, use something like: + ++% opt -ds-aa -print-alias-sets -disable-output ++
The -count-aa pass is useful to see how many queries a particular -pass is making and what responses are returned by the alias analysis. An -example usage is:
+pass is making and what responses are returned by the alias analysis. As an +example, +- $ opt -basicaa -count-aa -ds-aa -count-aa -licm +% opt -basicaa -count-aa -ds-aa -count-aa -licm+
Which will print out how many queries (and what responses are returned) by -the -licm pass (of the -ds-aa pass) and how many queries are -made of the -basicaa pass by the -ds-aa pass. This can be -useful when debugging a transformation or an alias analysis implementation.
+will print out how many queries (and what responses are returned) by the +-licm pass (of the -ds-aa pass) and how many queries are made +of the -basicaa pass by the -ds-aa pass. This can be useful +when debugging a transformation or an alias analysis implementation.
If you're just looking to be a client of alias analysis information, consider +using the Memory Dependence Analysis interface instead. MemDep is a lazy, +caching layer on top of alias analysis that is able to answer the question of +what preceding memory operations a given instruction depends on, either at an +intra- or inter-block level. Because of its laziness and caching +policy, using MemDep can be a significant performance win over accessing alias +analysis directly.
+ +