mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-23 02:29:18 +00:00
[PM] Use range-based for and auto to clean up some of the LoopInfo code.
No functionality changed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226555 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
a68dc11261
commit
94a37a364e
@ -503,11 +503,10 @@ public:
|
|||||||
~LoopInfoBase() { releaseMemory(); }
|
~LoopInfoBase() { releaseMemory(); }
|
||||||
|
|
||||||
void releaseMemory() {
|
void releaseMemory() {
|
||||||
for (typename std::vector<LoopT *>::iterator I =
|
BBMap.clear();
|
||||||
TopLevelLoops.begin(), E = TopLevelLoops.end(); I != E; ++I)
|
|
||||||
delete *I; // Delete all of the loops...
|
|
||||||
|
|
||||||
BBMap.clear(); // Reset internal state of analysis
|
for (auto *L : TopLevelLoops)
|
||||||
|
delete L;
|
||||||
TopLevelLoops.clear();
|
TopLevelLoops.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -576,8 +575,7 @@ public:
|
|||||||
/// list with the indicated loop.
|
/// list with the indicated loop.
|
||||||
void changeTopLevelLoop(LoopT *OldLoop,
|
void changeTopLevelLoop(LoopT *OldLoop,
|
||||||
LoopT *NewLoop) {
|
LoopT *NewLoop) {
|
||||||
typename std::vector<LoopT *>::iterator I =
|
auto I = std::find(TopLevelLoops.begin(), TopLevelLoops.end(), OldLoop);
|
||||||
std::find(TopLevelLoops.begin(), TopLevelLoops.end(), OldLoop);
|
|
||||||
assert(I != TopLevelLoops.end() && "Old loop not at top level!");
|
assert(I != TopLevelLoops.end() && "Old loop not at top level!");
|
||||||
*I = NewLoop;
|
*I = NewLoop;
|
||||||
assert(!NewLoop->ParentLoop && !OldLoop->ParentLoop &&
|
assert(!NewLoop->ParentLoop && !OldLoop->ParentLoop &&
|
||||||
@ -595,7 +593,7 @@ public:
|
|||||||
/// including all of the Loop objects it is nested in and our mapping from
|
/// including all of the Loop objects it is nested in and our mapping from
|
||||||
/// BasicBlocks to loops.
|
/// BasicBlocks to loops.
|
||||||
void removeBlock(BlockT *BB) {
|
void removeBlock(BlockT *BB) {
|
||||||
typename DenseMap<BlockT *, LoopT *>::iterator I = BBMap.find(BB);
|
auto I = BBMap.find(BB);
|
||||||
if (I != BBMap.end()) {
|
if (I != BBMap.end()) {
|
||||||
for (LoopT *L = I->second; L; L = L->getParentLoop())
|
for (LoopT *L = I->second; L; L = L->getParentLoop())
|
||||||
L->removeBlockFromLoop(BB);
|
L->removeBlockFromLoop(BB);
|
||||||
|
Loading…
Reference in New Issue
Block a user