mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-18 11:24:01 +00:00
Add Region::isTopLevelRegion().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116402 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -292,6 +292,11 @@ public:
|
|||||||
/// @return The depth of the region.
|
/// @return The depth of the region.
|
||||||
unsigned getDepth() const;
|
unsigned getDepth() const;
|
||||||
|
|
||||||
|
/// @brief Check if a Region is the TopLevel region.
|
||||||
|
///
|
||||||
|
/// The toplevel region represents the whole function.
|
||||||
|
bool isTopLevelRegion() const { return exit == NULL; };
|
||||||
|
|
||||||
/// @brief Return a new (non canonical) region, that is obtained by joining
|
/// @brief Return a new (non canonical) region, that is obtained by joining
|
||||||
/// this region with its predecessors.
|
/// this region with its predecessors.
|
||||||
///
|
///
|
||||||
|
@ -140,8 +140,7 @@ bool Region::isSimple() const {
|
|||||||
|
|
||||||
BasicBlock *entry = getEntry(), *exit = getExit();
|
BasicBlock *entry = getEntry(), *exit = getExit();
|
||||||
|
|
||||||
// TopLevelRegion
|
if (isTopLevelRegion())
|
||||||
if (!exit)
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for (pred_iterator PI = pred_begin(entry), PE = pred_end(entry); PI != PE;
|
for (pred_iterator PI = pred_begin(entry), PE = pred_end(entry); PI != PE;
|
||||||
@ -810,9 +809,10 @@ RegionInfo::getCommonRegion(SmallVectorImpl<BasicBlock*> &BBs) const {
|
|||||||
void RegionInfo::splitBlock(BasicBlock* NewBB, BasicBlock *OldBB)
|
void RegionInfo::splitBlock(BasicBlock* NewBB, BasicBlock *OldBB)
|
||||||
{
|
{
|
||||||
Region *R = getRegionFor(OldBB);
|
Region *R = getRegionFor(OldBB);
|
||||||
|
|
||||||
setRegionFor(NewBB, R);
|
setRegionFor(NewBB, R);
|
||||||
|
|
||||||
while (R->getEntry() == OldBB && R->getParent()) {
|
while (R->getEntry() == OldBB && !R->isTopLevelRegion()) {
|
||||||
R->replaceEntry(NewBB);
|
R->replaceEntry(NewBB);
|
||||||
R = R->getParent();
|
R = R->getParent();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user