[llvm-commits] CVS: llvm/include/llvm/Analysis/Dominators.h
Chris Lattner
sabre at nondot.org
Mon Oct 2 22:25:10 PDT 2006
Changes in directory llvm/include/llvm/Analysis:
Dominators.h updated: 1.60 -> 1.61
---
Log message:
Move DominatorTree to immediately follow DominatorTreeBase
---
Diffs of the changes: (+56 -56)
Dominators.h | 112 +++++++++++++++++++++++++++++------------------------------
1 files changed, 56 insertions(+), 56 deletions(-)
Index: llvm/include/llvm/Analysis/Dominators.h
diff -u llvm/include/llvm/Analysis/Dominators.h:1.60 llvm/include/llvm/Analysis/Dominators.h:1.61
--- llvm/include/llvm/Analysis/Dominators.h:1.60 Mon Sep 11 19:18:28 2006
+++ llvm/include/llvm/Analysis/Dominators.h Tue Oct 3 00:24:56 2006
@@ -412,6 +412,62 @@
virtual void print(std::ostream &OS, const Module* = 0) const;
};
+//===-------------------------------------
+/// DominatorTree Class - Concrete subclass of DominatorTreeBase that is used to
+/// compute a normal dominator tree.
+///
+class DominatorTree : public DominatorTreeBase {
+public:
+ DominatorTree() : DominatorTreeBase(false) {}
+
+ BasicBlock *getRoot() const {
+ assert(Roots.size() == 1 && "Should always have entry node!");
+ return Roots[0];
+ }
+
+ virtual bool runOnFunction(Function &F) {
+ reset(); // Reset from the last time we were run...
+ ImmediateDominators &ID = getAnalysis<ImmediateDominators>();
+ Roots = ID.getRoots();
+ calculate(ID);
+ return false;
+ }
+
+ virtual void getAnalysisUsage(AnalysisUsage &AU) const {
+ AU.setPreservesAll();
+ AU.addRequired<ImmediateDominators>();
+ }
+private:
+ void calculate(const ImmediateDominators &ID);
+ Node *getNodeForBlock(BasicBlock *BB);
+};
+
+//===-------------------------------------
+/// DominatorTree GraphTraits specialization so the DominatorTree can be
+/// iterable by generic graph iterators.
+///
+template <> struct GraphTraits<DominatorTree::Node*> {
+ typedef DominatorTree::Node NodeType;
+ typedef NodeType::iterator ChildIteratorType;
+
+ static NodeType *getEntryNode(NodeType *N) {
+ return N;
+ }
+ static inline ChildIteratorType child_begin(NodeType* N) {
+ return N->begin();
+ }
+ static inline ChildIteratorType child_end(NodeType* N) {
+ return N->end();
+ }
+};
+
+template <> struct GraphTraits<DominatorTree*>
+ : public GraphTraits<DominatorTree::Node*> {
+ static NodeType *getEntryNode(DominatorTree *DT) {
+ return DT->getRootNode();
+ }
+};
+
//===-------------------------------------
/// ET-Forest Class - Class used to construct forwards and backwards
@@ -535,62 +591,6 @@
ETNode *getNodeForBlock(BasicBlock *BB);
};
-//===-------------------------------------
-/// DominatorTree Class - Concrete subclass of DominatorTreeBase that is used to
-/// compute a normal dominator tree.
-///
-class DominatorTree : public DominatorTreeBase {
-public:
- DominatorTree() : DominatorTreeBase(false) {}
-
- BasicBlock *getRoot() const {
- assert(Roots.size() == 1 && "Should always have entry node!");
- return Roots[0];
- }
-
- virtual bool runOnFunction(Function &F) {
- reset(); // Reset from the last time we were run...
- ImmediateDominators &ID = getAnalysis<ImmediateDominators>();
- Roots = ID.getRoots();
- calculate(ID);
- return false;
- }
-
- virtual void getAnalysisUsage(AnalysisUsage &AU) const {
- AU.setPreservesAll();
- AU.addRequired<ImmediateDominators>();
- }
-private:
- void calculate(const ImmediateDominators &ID);
- Node *getNodeForBlock(BasicBlock *BB);
-};
-
-//===-------------------------------------
-/// DominatorTree GraphTraits specialization so the DominatorTree can be
-/// iterable by generic graph iterators.
-///
-template <> struct GraphTraits<DominatorTree::Node*> {
- typedef DominatorTree::Node NodeType;
- typedef NodeType::iterator ChildIteratorType;
-
- static NodeType *getEntryNode(NodeType *N) {
- return N;
- }
- static inline ChildIteratorType child_begin(NodeType* N) {
- return N->begin();
- }
- static inline ChildIteratorType child_end(NodeType* N) {
- return N->end();
- }
-};
-
-template <> struct GraphTraits<DominatorTree*>
- : public GraphTraits<DominatorTree::Node*> {
- static NodeType *getEntryNode(DominatorTree *DT) {
- return DT->getRootNode();
- }
-};
-
//===----------------------------------------------------------------------===//
/// DominanceFrontierBase - Common base class for computing forward and inverse
/// dominance frontiers for a function.
More information about the llvm-commits
mailing list