mirror of
https://github.com/RPCS3/llvm.git
synced 2024-11-25 04:39:51 +00:00
Add methods to erase basic block entry.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41052 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
6acc9e6b7b
commit
441c5ee6cf
@ -253,6 +253,11 @@ public:
|
||||
changeImmediateDominator(getNode(BB), getNode(NewBB));
|
||||
}
|
||||
|
||||
/// eraseNode - Removes a node from the domiantor tree. Block must not
|
||||
/// domiante any other blocks. Removes node from its immediate dominator's
|
||||
/// children list. Deletes dominator node associated with basic block BB.
|
||||
void eraseNode(BasicBlock *BB);
|
||||
|
||||
/// removeNode - Removes a node from the dominator tree. Block must not
|
||||
/// dominate any other blocks. Invalidates any node pointing to removed
|
||||
/// block.
|
||||
@ -370,6 +375,13 @@ public:
|
||||
Frontiers.insert(std::make_pair(BB, frontier));
|
||||
}
|
||||
|
||||
/// removeBlock - Remove basic block BB's frontier.
|
||||
void removeBlock(BasicBlock *BB) {
|
||||
assert(find(BB) != end() && "Block is not in DominanceFrontier!");
|
||||
iterator BBDF = Frontiers.find(BB);
|
||||
Frontiers.erase(BBDF);
|
||||
}
|
||||
|
||||
void addToFrontier(iterator I, BasicBlock *Node) {
|
||||
assert(I != end() && "BB is not in DominanceFrontier!");
|
||||
I->second.insert(Node);
|
||||
|
@ -559,6 +559,30 @@ static void PrintDomTree(const DomTreeNode *N, std::ostream &o,
|
||||
PrintDomTree(*I, o, Lev+1);
|
||||
}
|
||||
|
||||
/// eraseNode - Removes a node from the domiantor tree. Block must not
|
||||
/// domiante any other blocks. Removes node from its immediate dominator's
|
||||
/// children list. Deletes dominator node associated with basic block BB.
|
||||
void DominatorTreeBase::eraseNode(BasicBlock *BB) {
|
||||
DomTreeNode *Node = getNode(BB);
|
||||
assert (Node && "Removing node that isn't in dominator tree.");
|
||||
|
||||
// Remove node from immediate dominator's children list.
|
||||
DomTreeNode *IDom = Node->getIDom();
|
||||
if (IDom) {
|
||||
std::vector<DomTreeNode*>::iterator I =
|
||||
std::find(IDom->Children.begin(), IDom->Children.end(), Node);
|
||||
assert(I != IDom->Children.end() &&
|
||||
"Not in immediate dominator children set!");
|
||||
// I am no longer your child...
|
||||
IDom->Children.erase(I);
|
||||
}
|
||||
|
||||
assert (Node->getChildren().empty() && "Children list is not empty");
|
||||
|
||||
DomTreeNodes.erase(BB);
|
||||
delete Node;
|
||||
}
|
||||
|
||||
void DominatorTreeBase::print(std::ostream &o, const Module* ) const {
|
||||
o << "=============================--------------------------------\n";
|
||||
o << "Inorder Dominator Tree: ";
|
||||
|
Loading…
Reference in New Issue
Block a user