aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2007-09-23 21:31:44 +0000
committerOwen Anderson <resistor@mac.com>2007-09-23 21:31:44 +0000
commitd20c824b201b1408d7ea7a4e2d601aee14db5cec (patch)
tree32d27a02df3a1cdae2c7164770979e6bf9668a00 /include
parentc557a9c00a579417ed7125ee2c998d29572b5144 (diff)
downloadexternal_llvm-d20c824b201b1408d7ea7a4e2d601aee14db5cec.zip
external_llvm-d20c824b201b1408d7ea7a4e2d601aee14db5cec.tar.gz
external_llvm-d20c824b201b1408d7ea7a4e2d601aee14db5cec.tar.bz2
Factor the dominator tree calculation details out into DominatorCalculation.h. This
change is not useful in and of itself, but it lays the groundwork for combining the dominator and postdominator implementations. Also, factor a few methods that are common to DominatorTree and PostDominatorTree into DominatorTreeBase. Again, this will make merging the two calculation methods simpler in the future. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42248 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/Analysis/Dominators.h24
-rw-r--r--include/llvm/Analysis/PostDominators.h6
2 files changed, 14 insertions, 16 deletions
diff --git a/include/llvm/Analysis/Dominators.h b/include/llvm/Analysis/Dominators.h
index 76998fb..eec87d4 100644
--- a/include/llvm/Analysis/Dominators.h
+++ b/include/llvm/Analysis/Dominators.h
@@ -129,6 +129,7 @@ protected:
// Info - Collection of information used during the computation of idoms.
DenseMap<BasicBlock*, InfoRec> Info;
+ unsigned DFSPass(BasicBlock *V, unsigned N);
public:
DominatorTreeBase(intptr_t ID, bool isPostDom)
@@ -278,6 +279,13 @@ protected:
/// updateDFSNumbers - Assign In and Out numbers to the nodes while walking
/// dominator tree in dfs order.
void updateDFSNumbers();
+
+ DomTreeNode *getNodeForBlock(BasicBlock *BB);
+
+ inline BasicBlock *getIDom(BasicBlock *BB) const {
+ DenseMap<BasicBlock*, BasicBlock*>::const_iterator I = IDoms.find(BB);
+ return I != IDoms.end() ? I->second : 0;
+ }
};
//===-------------------------------------
@@ -304,17 +312,13 @@ public:
/// BB is split and now it has one successor. Update dominator tree to
/// reflect this change.
void splitBlock(BasicBlock *BB);
+
private:
- void calculate(Function& F);
- DomTreeNode *getNodeForBlock(BasicBlock *BB);
- unsigned DFSPass(BasicBlock *V, unsigned N);
- void Compress(BasicBlock *V);
- BasicBlock *Eval(BasicBlock *v);
- void Link(BasicBlock *V, BasicBlock *W, InfoRec &WInfo);
- inline BasicBlock *getIDom(BasicBlock *BB) const {
- DenseMap<BasicBlock*, BasicBlock*>::const_iterator I = IDoms.find(BB);
- return I != IDoms.end() ? I->second : 0;
- }
+ friend void DTcalculate(DominatorTree& DT, Function& F);
+ friend void DTCompress(DominatorTree& DT, BasicBlock *VIn);
+ friend BasicBlock *DTEval(DominatorTree& DT, BasicBlock *v);
+ friend void DTLink(DominatorTree& DT, BasicBlock *V,
+ BasicBlock *W, InfoRec &WInfo);
};
//===-------------------------------------
diff --git a/include/llvm/Analysis/PostDominators.h b/include/llvm/Analysis/PostDominators.h
index 8dfeafe..2ee6efb 100644
--- a/include/llvm/Analysis/PostDominators.h
+++ b/include/llvm/Analysis/PostDominators.h
@@ -38,16 +38,10 @@ struct PostDominatorTree : public DominatorTreeBase {
}
private:
void calculate(Function &F);
- DomTreeNode *getNodeForBlock(BasicBlock *BB);
unsigned DFSPass(BasicBlock *V, unsigned N);
void Compress(BasicBlock *V, InfoRec &VInfo);
BasicBlock *Eval(BasicBlock *V);
void Link(BasicBlock *V, BasicBlock *W, InfoRec &WInfo);
-
- inline BasicBlock *getIDom(BasicBlock *BB) const {
- DenseMap<BasicBlock*, BasicBlock*>::const_iterator I = IDoms.find(BB);
- return I != IDoms.end() ? I->second : 0;
- }
};