diff --git a/llvm/include/llvm/Analysis/DominanceFrontier.h b/llvm/include/llvm/Analysis/DominanceFrontier.h index 8b3ab57ed4d07b..68ddcf753b59f7 100644 --- a/llvm/include/llvm/Analysis/DominanceFrontier.h +++ b/llvm/include/llvm/Analysis/DominanceFrontier.h @@ -85,26 +85,6 @@ class DominanceFrontierBase { iterator find(BlockT *B) { return Frontiers.find(B); } const_iterator find(BlockT *B) const { return Frontiers.find(B); } - iterator addBasicBlock(BlockT *BB, const DomSetType &frontier) { - assert(find(BB) == end() && "Block already in DominanceFrontier!"); - return Frontiers.insert(std::make_pair(BB, frontier)).first; - } - - /// removeBlock - Remove basic block BB's frontier. - void removeBlock(BlockT *BB); - - void addToFrontier(iterator I, BlockT *Node); - - void removeFromFrontier(iterator I, BlockT *Node); - - /// compareDomSet - Return false if two domsets match. Otherwise - /// return true; - bool compareDomSet(DomSetType &DS1, const DomSetType &DS2) const; - - /// compare - Return false if the other dominance frontier base matches - /// this dominance frontier base. Otherwise return true. - bool compare(DominanceFrontierBase &Other) const; - /// print - Convert to human readable form /// void print(raw_ostream &OS) const; diff --git a/llvm/include/llvm/Analysis/DominanceFrontierImpl.h b/llvm/include/llvm/Analysis/DominanceFrontierImpl.h index a9c415f4701094..e877b2c4749abe 100644 --- a/llvm/include/llvm/Analysis/DominanceFrontierImpl.h +++ b/llvm/include/llvm/Analysis/DominanceFrontierImpl.h @@ -45,84 +45,6 @@ class DFCalculateWorkObject { const DomTreeNodeT *parentNode; }; -template -void DominanceFrontierBase::removeBlock(BlockT *BB) { - assert(find(BB) != end() && "Block is not in DominanceFrontier!"); - for (iterator I = begin(), E = end(); I != E; ++I) - I->second.remove(BB); - Frontiers.erase(BB); -} - -template -void DominanceFrontierBase::addToFrontier(iterator I, - BlockT *Node) { - assert(I != end() && "BB is not in DominanceFrontier!"); - I->second.insert(Node); -} - -template -void DominanceFrontierBase::removeFromFrontier( - iterator I, BlockT *Node) { - assert(I != end() && "BB is not in DominanceFrontier!"); - assert(I->second.count(Node) && "Node is not in DominanceFrontier of BB"); - I->second.remove(Node); -} - -template -bool DominanceFrontierBase::compareDomSet( - DomSetType &DS1, const DomSetType &DS2) const { - std::set tmpSet; - for (BlockT *BB : DS2) - tmpSet.insert(BB); - - for (typename DomSetType::const_iterator I = DS1.begin(), E = DS1.end(); - I != E;) { - BlockT *Node = *I++; - - if (tmpSet.erase(Node) == 0) - // Node is in DS1 but tnot in DS2. - return true; - } - - if (!tmpSet.empty()) { - // There are nodes that are in DS2 but not in DS1. - return true; - } - - // DS1 and DS2 matches. - return false; -} - -template -bool DominanceFrontierBase::compare( - DominanceFrontierBase &Other) const { - DomSetMapType tmpFrontiers; - for (typename DomSetMapType::const_iterator I = Other.begin(), - E = Other.end(); - I != E; ++I) - tmpFrontiers.insert(std::make_pair(I->first, I->second)); - - for (typename DomSetMapType::iterator I = tmpFrontiers.begin(), - E = tmpFrontiers.end(); - I != E;) { - BlockT *Node = I->first; - const_iterator DFI = find(Node); - if (DFI == end()) - return true; - - if (compareDomSet(I->second, DFI->second)) - return true; - - ++I; - tmpFrontiers.erase(Node); - } - - if (!tmpFrontiers.empty()) - return true; - - return false; -} - template void DominanceFrontierBase::print(raw_ostream &OS) const { for (const_iterator I = begin(), E = end(); I != E; ++I) { diff --git a/llvm/include/llvm/CodeGen/MachineDominanceFrontier.h b/llvm/include/llvm/CodeGen/MachineDominanceFrontier.h index e3e679608784a4..7df060a3f5b1a9 100644 --- a/llvm/include/llvm/CodeGen/MachineDominanceFrontier.h +++ b/llvm/include/llvm/CodeGen/MachineDominanceFrontier.h @@ -73,30 +73,6 @@ class MachineDominanceFrontier : public MachineFunctionPass { return Base.find(B); } - iterator addBasicBlock(MachineBasicBlock *BB, const DomSetType &frontier) { - return Base.addBasicBlock(BB, frontier); - } - - void removeBlock(MachineBasicBlock *BB) { - return Base.removeBlock(BB); - } - - void addToFrontier(iterator I, MachineBasicBlock *Node) { - return Base.addToFrontier(I, Node); - } - - void removeFromFrontier(iterator I, MachineBasicBlock *Node) { - return Base.removeFromFrontier(I, Node); - } - - bool compareDomSet(DomSetType &DS1, const DomSetType &DS2) const { - return Base.compareDomSet(DS1, DS2); - } - - bool compare(DominanceFrontierBase &Other) const { - return Base.compare(Other); - } - bool runOnMachineFunction(MachineFunction &F) override; void releaseMemory() override;