aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-01-30 22:15:41 +0000
committerChris Lattner <sabre@nondot.org>2004-01-30 22:15:41 +0000
commit6866e18e48f6ad9ab4a6a1946151a78b68200ec9 (patch)
tree092310a3df4cadb9560c49db2399ad8e24521b93
parent4710add9dd4b728d99539ddc8a59035649b5df6f (diff)
downloadllvm-6866e18e48f6ad9ab4a6a1946151a78b68200ec9.zip
llvm-6866e18e48f6ad9ab4a6a1946151a78b68200ec9.tar.gz
llvm-6866e18e48f6ad9ab4a6a1946151a78b68200ec9.tar.bz2
Add a new pointsToConstantMemory method to the AliasAnalysis interface
which can be implemented to improve the quality of mod-ref information. llvm-svn: 11020
-rw-r--r--llvm/include/llvm/Analysis/AliasAnalysis.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/llvm/include/llvm/Analysis/AliasAnalysis.h b/llvm/include/llvm/Analysis/AliasAnalysis.h
index b0e9b23..9b5d8ff 100644
--- a/llvm/include/llvm/Analysis/AliasAnalysis.h
+++ b/llvm/include/llvm/Analysis/AliasAnalysis.h
@@ -95,6 +95,11 @@ public:
///
virtual void getMustAliases(Value *P, std::vector<Value*> &RetVals) {}
+ /// pointsToConstantMemory - If the specified pointer is known to point into
+ /// constant global memory, return true. This allows disambiguation of store
+ /// instructions from constant pointers.
+ ///
+ virtual bool pointsToConstantMemory(const Value *P) { return false; }
//===--------------------------------------------------------------------===//
/// Simple mod/ref information...
@@ -114,7 +119,9 @@ public:
/// pointer.
///
virtual ModRefResult getModRefInfo(CallSite CS, Value *P, unsigned Size) {
- return ModRef;
+ // If P points to a constant memory location, the call definitely could not
+ // modify the memory location.
+ return pointsToConstantMemory(P) ? Ref : ModRef;
}
/// getModRefInfo - Return information about whether two call sites may refer