From: Owen Anderson Date: Mon, 3 Jan 2011 21:38:41 +0000 (+0000) Subject: Stub out a new updating interface to AliasAnalysis, allowing stateful analyses to... X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=ab6acc6ecdc4585a55059e36d81481d1c26d3ff9;p=oota-llvm.git Stub out a new updating interface to AliasAnalysis, allowing stateful analyses to be informed when a pointer value has potentially become escaping. Implementations can choose to either fall back to conservative responses for that value, or may recompute their analysis to accomodate the change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122777 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/docs/AliasAnalysis.html b/docs/AliasAnalysis.html index 692349f8c29..7baa9467697 100644 --- a/docs/AliasAnalysis.html +++ b/docs/AliasAnalysis.html @@ -464,7 +464,7 @@ analysis results updated to reflect the changes made by these transformations.

-The AliasAnalysis interface exposes three methods which are used to +The AliasAnalysis interface exposes four methods which are used to communicate program changes from the clients to the analysis implementations. Various alias analysis implementations should use these methods to ensure that their internal data structures are kept up-to-date as the program changes (for @@ -505,6 +505,28 @@ value, then deleting the old value. This method cannot be overridden by alias analysis implementations. + +

The addEscapingUse method
+ +
+

The addEscapingUse method is used when the uses of a pointer +value have changed in ways that may invalidate precomputed analysis information. +Implementations may either use this callback to provide conservative responses +for points whose uses have change since analysis time, or may recompute some +or all of their internal state to continue providing accurate responses.

+ +

In general, any new use of a pointer value is considered an escaping use, +and must be reported through this callback, except for the +uses below:

+ + +
+
Efficiency Issues diff --git a/include/llvm/Analysis/AliasAnalysis.h b/include/llvm/Analysis/AliasAnalysis.h index c218e057f02..2375a07bfbd 100644 --- a/include/llvm/Analysis/AliasAnalysis.h +++ b/include/llvm/Analysis/AliasAnalysis.h @@ -469,6 +469,17 @@ public: /// virtual void copyValue(Value *From, Value *To); + /// addEscapingUse - This method should be used whenever an escaping use is + /// added to a pointer value. Analysis implementations may either return + /// conservative responses for that value in the future, or may recompute + /// some or all internal state to continue providing precise responses. + /// + /// Escaping uses are considered by anything _except_ the following: + /// - GEPs or bitcasts of the pointer + /// - Loads through the pointer + /// - Stores through (but not of) the pointer + virtual void addEscapingUse(Use &U); + /// replaceWithNewValue - This method is the obvious combination of the two /// above, and it provided as a helper to simplify client code. /// diff --git a/lib/Analysis/AliasAnalysis.cpp b/lib/Analysis/AliasAnalysis.cpp index 7a94c431dee..be02ddbaa53 100644 --- a/lib/Analysis/AliasAnalysis.cpp +++ b/lib/Analysis/AliasAnalysis.cpp @@ -65,6 +65,12 @@ void AliasAnalysis::copyValue(Value *From, Value *To) { AA->copyValue(From, To); } +void AliasAnalysis::addEscapingUse(Use &U) { + assert(AA && "AA didn't call InitializeAliasAnalysis in its run method!"); + AA->addEscapingUse(U); +} + + AliasAnalysis::ModRefResult AliasAnalysis::getModRefInfo(ImmutableCallSite CS, const Location &Loc) {