RegionInfo: Allow to set the parent region of a basic block.

llvm-svn: 116394
This commit is contained in:
Tobias Grosser 2010-10-13 05:54:07 +00:00
parent f7cfb2212c
commit 8352ce5f8d
2 changed files with 10 additions and 1 deletions

View File

@ -565,6 +565,12 @@ public:
/// region containing BB.
Region *getRegionFor(BasicBlock *BB) const;
/// @brief Set the smallest region that surrounds a basic block.
///
/// @param BB The basic block surrounded by a region.
/// @param R The smallest region that surrounds BB.
void setRegionFor(BasicBlock *BB, Region *R);
/// @brief A shortcut for getRegionFor().
///
/// @param BB The basic block.

View File

@ -659,11 +659,14 @@ Region *RegionInfo::getRegionFor(BasicBlock *BB) const {
return I != BBtoRegion.end() ? I->second : 0;
}
void RegionInfo::setRegionFor(BasicBlock *BB, Region *R) {
BBtoRegion[BB] = R;
}
Region *RegionInfo::operator[](BasicBlock *BB) const {
return getRegionFor(BB);
}
BasicBlock *RegionInfo::getMaxRegionExit(BasicBlock *BB) const {
BasicBlock *Exit = NULL;