1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 11:42:57 +01:00

Make the interface to update a little more efficient

llvm-svn: 5651
This commit is contained in:
Chris Lattner 2003-02-27 20:24:17 +00:00
parent ac72aab6e7
commit db73d0ceab

View File

@ -378,24 +378,26 @@ public:
virtual void releaseMemory() { Frontiers.clear(); } virtual void releaseMemory() { Frontiers.clear(); }
// Accessor interface: // Accessor interface:
typedef DomSetMapType::iterator iterator;
typedef DomSetMapType::const_iterator const_iterator; typedef DomSetMapType::const_iterator const_iterator;
iterator begin() { return Frontiers.begin(); }
const_iterator begin() const { return Frontiers.begin(); } const_iterator begin() const { return Frontiers.begin(); }
iterator end() { return Frontiers.end(); }
const_iterator end() const { return Frontiers.end(); } const_iterator end() const { return Frontiers.end(); }
const_iterator find(BasicBlock* B) const { return Frontiers.find(B); } iterator find(BasicBlock *B) { return Frontiers.find(B); }
const_iterator find(BasicBlock *B) const { return Frontiers.find(B); }
void addBasicBlock(BasicBlock *BB, const DomSetType &frontier) { void addBasicBlock(BasicBlock *BB, const DomSetType &frontier) {
assert(find(BB) == end() && "Block already in DominanceFrontier!"); assert(find(BB) == end() && "Block already in DominanceFrontier!");
Frontiers.insert(std::make_pair(BB, frontier)); Frontiers.insert(std::make_pair(BB, frontier));
} }
void addToFrontier(BasicBlock *BB, BasicBlock *Node) { void addToFrontier(iterator I, BasicBlock *Node) {
DomSetMapType::iterator I = Frontiers.find(BB);
assert(I != end() && "BB is not in DominanceFrontier!"); assert(I != end() && "BB is not in DominanceFrontier!");
I->second.insert(Node); I->second.insert(Node);
} }
void removeFromFrontier(BasicBlock *BB, BasicBlock *Node) { void removeFromFrontier(iterator I, BasicBlock *Node) {
DomSetMapType::iterator I = Frontiers.find(BB);
assert(I != end() && "BB is not in DominanceFrontier!"); assert(I != end() && "BB is not in DominanceFrontier!");
assert(I->second.count(Node) && "Node is not in DominanceFrontier of BB"); assert(I->second.count(Node) && "Node is not in DominanceFrontier of BB");
I->second.erase(Node); I->second.erase(Node);