[llvm-commits] CVS: llvm/lib/VMCore/Dominators.cpp
Chris Lattner
lattner at cs.uiuc.edu
Thu Sep 26 11:15:04 PDT 2002
Changes in directory llvm/lib/VMCore:
Dominators.cpp updated: 1.38 -> 1.39
---
Log message:
- Add methods to ImmediateDominators & DominatorTree to allow updates
- Make DominatorTree::Node not inherit from std::vector
---
Diffs of the changes:
Index: llvm/lib/VMCore/Dominators.cpp
diff -u llvm/lib/VMCore/Dominators.cpp:1.38 llvm/lib/VMCore/Dominators.cpp:1.39
--- llvm/lib/VMCore/Dominators.cpp:1.38 Thu Aug 22 15:39:29 2002
+++ llvm/lib/VMCore/Dominators.cpp Thu Sep 26 11:14:41 2002
@@ -186,6 +186,23 @@
Nodes.clear();
}
+void DominatorTreeBase::Node2::setIDom(Node2 *NewIDom) {
+ assert(IDom && "No immediate dominator?");
+ if (IDom != NewIDom) {
+ std::vector<Node*>::iterator I =
+ std::find(IDom->Children.begin(), IDom->Children.end(), this);
+ assert(I != IDom->Children.end() &&
+ "Not in immediate dominator children set!");
+ // I am no longer your child...
+ IDom->Children.erase(I);
+
+ // Switch to new dominator
+ IDom = NewIDom;
+ IDom->Children.push_back(this);
+ }
+}
+
+
void DominatorTree::calculate(const DominatorSet &DS) {
Nodes[Root] = new Node(Root, 0); // Add a node for the root...
More information about the llvm-commits
mailing list