diff options
author | Owen Anderson <resistor@mac.com> | 2010-11-19 22:48:40 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2010-11-19 22:48:40 +0000 |
commit | 68c26396c07b4ad96657d4510f06f7646785278d (patch) | |
tree | bf828f97e763b600b6b484c037d1f6ebd88a7634 /lib/Transforms | |
parent | 7b6ab402fe201598dd38d9338078d74c4d0783c7 (diff) |
Document the new GVN number table structure.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119865 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r-- | lib/Transforms/Scalar/GVN.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/Transforms/Scalar/GVN.cpp b/lib/Transforms/Scalar/GVN.cpp index 2a7985bf95..6d35db4d6f 100644 --- a/lib/Transforms/Scalar/GVN.cpp +++ b/lib/Transforms/Scalar/GVN.cpp @@ -677,8 +677,13 @@ namespace { ValueTable VN; + /// NumberTable - A mapping from value numers to lists of Value*'s that + /// have that value number. Use lookupNumber to query it. DenseMap<uint32_t, std::pair<Value*, void*> > NumberTable; BumpPtrAllocator TableAllocator; + + /// insert_table - Push a new Value to the NumberTable onto the list for + /// its value number. void insert_table(uint32_t N, Value *V) { std::pair<Value*, void*>& Curr = NumberTable[N]; if (!Curr.first) { @@ -693,6 +698,8 @@ namespace { Curr.second = Node; } + /// erase_table - Scan the list of values corresponding to a given value + /// number, and remove the given value if encountered. void erase_table(uint32_t N, Value *V) { std::pair<Value*, void*>* Prev = 0; std::pair<Value*, void*>* Curr = &NumberTable[N]; @@ -1886,6 +1893,11 @@ bool GVN::processLoad(LoadInst *L, SmallVectorImpl<Instruction*> &toErase) { return false; } +// lookupNumber - In order to find a leader for a given value number at a +// specific basic block, we first obtain the list of all Values for that number, +// and then scan the list to find one whose block dominates the block in +// question. This is fast because dominator tree queries consist of only +// a few comparisons of DFS numbers. Value *GVN::lookupNumber(BasicBlock *BB, uint32_t num) { std::pair<Value*, void*> Vals = NumberTable[num]; if (!Vals.first) return 0; |