diff options
author | Chris Lattner <sabre@nondot.org> | 2008-12-07 08:50:20 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-12-07 08:50:20 +0000 |
commit | e99d1775c6969d049b24c28e45c1c5d1f075775e (patch) | |
tree | 7e1adfaada9eed3e1c5b8f5ea8155dee4f5173a9 /include | |
parent | 1fb0debb488dd3f9beccc711fa1b3e776d557845 (diff) | |
download | external_llvm-e99d1775c6969d049b24c28e45c1c5d1f075775e.zip external_llvm-e99d1775c6969d049b24c28e45c1c5d1f075775e.tar.gz external_llvm-e99d1775c6969d049b24c28e45c1c5d1f075775e.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')
-rw-r--r-- | include/llvm/Analysis/MemoryDependenceAnalysis.h | 30 |
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. |