aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/Analysis/MemoryDependenceAnalysis.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-12-07 08:50:20 +0000
committerChris Lattner <sabre@nondot.org>2008-12-07 08:50:20 +0000
commit6290f5cac23399201f8785e5ca8b305e42a1342c (patch)
tree7e1adfaada9eed3e1c5b8f5ea8155dee4f5173a9 /include/llvm/Analysis/MemoryDependenceAnalysis.h
parenta16ead8b10ab63e08c91afb852f29b32188b9afb (diff)
downloadexternal_llvm-6290f5cac23399201f8785e5ca8b305e42a1342c.zip
external_llvm-6290f5cac23399201f8785e5ca8b305e42a1342c.tar.gz
external_llvm-6290f5cac23399201f8785e5ca8b305e42a1342c.tar.bz2
add support for caching pointer dependence queries. Nothing uses this yet
so it "can't" break anything. That said, it does appear to work. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60654 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Analysis/MemoryDependenceAnalysis.h')
-rw-r--r--include/llvm/Analysis/MemoryDependenceAnalysis.h30
1 files changed, 22 insertions, 8 deletions
diff --git a/include/llvm/Analysis/MemoryDependenceAnalysis.h b/include/llvm/Analysis/MemoryDependenceAnalysis.h
index e2dd662..6a1df11 100644
--- a/include/llvm/Analysis/MemoryDependenceAnalysis.h
+++ b/include/llvm/Analysis/MemoryDependenceAnalysis.h
@@ -151,7 +151,25 @@ namespace llvm {
typedef std::pair<BasicBlock*, MemDepResult> NonLocalDepEntry;
typedef std::vector<NonLocalDepEntry> NonLocalDepInfo;
private:
-
+ /// ValueIsLoadPair - This is a pair<Value*, bool> where the bool is true if
+ /// the dependence is a read only dependence, false if read/write.
+ typedef PointerIntPair<Value*, 1, int> ValueIsLoadPair;
+
+ /// CachedNonLocalPointerInfo - This map stores the cached results of doing
+ /// a pointer lookup at the bottom of a block. Key key of this map is the
+ /// pointer+isload bit, the value is a list of <bb->result> mappings.
+ typedef DenseMap<ValueIsLoadPair, NonLocalDepInfo>CachedNonLocalPointerInfo;
+ CachedNonLocalPointerInfo NonLocalPointerDeps;
+
+ // A map from instructions to their non-local pointer dependencies.
+ // The elements of the SmallPtrSet are ValueIsLoadPair's.
+ typedef DenseMap<Instruction*,
+ SmallPtrSet<void*, 4> > ReverseNonLocalPtrDepTy;
+ ReverseNonLocalPtrDepTy ReverseNonLocalPtrDeps;
+
+
+
+
/// PerInstNLInfo - This is the instruction we keep for each cached access
/// that we have for an instruction. The pointer is an owning pointer and
/// the bool indicates whether we have any dirty bits in the set.
@@ -185,9 +203,10 @@ namespace llvm {
void releaseMemory() {
LocalDeps.clear();
NonLocalDeps.clear();
- NonLocalDeps.clear();
+ NonLocalPointerDeps.clear();
ReverseLocalDeps.clear();
ReverseNonLocalDeps.clear();
+ ReverseNonLocalPtrDeps.clear();
}
/// getAnalysisUsage - Does not modify anything. It uses Value Numbering
@@ -229,10 +248,6 @@ namespace llvm {
void removeInstruction(Instruction *InstToRemove);
private:
-
- /// getDependencyFrom - Return the instruction on which the memory location
- /// '*Pointer' depends. This starts scanning from the instruction before
- /// the position indicated by ScanIt.
MemDepResult getPointerDependencyFrom(Value *Pointer, uint64_t MemSize,
bool isLoad,
BasicBlock::iterator ScanIt,
@@ -240,12 +255,11 @@ namespace llvm {
MemDepResult getCallSiteDependencyFrom(CallSite C,
BasicBlock::iterator ScanIt,
BasicBlock *BB);
-
void getNonLocalPointerDepInternal(Value *Pointer, uint64_t Size,
bool isLoad, BasicBlock *BB,
SmallVectorImpl<NonLocalDepEntry> &Result,
SmallPtrSet<BasicBlock*, 64> &Visited);
-
+ void RemoveCachedNonLocalPointerDependencies(ValueIsLoadPair P);
/// verifyRemoved - Verify that the specified instruction does not occur
/// in our internal data structures.