mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-17 21:25:33 +00:00
Add LPPassManager::insertLoop().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34979 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -101,9 +101,11 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Delete loop from the loop queue. This is used by Loop pass to inform
|
// Delete loop from the loop queue and loop nest (LoopInfo).
|
||||||
// Loop Pass Manager that it should skip rest of the passes for this loop.
|
|
||||||
void deleteLoopFromQueue(Loop *L);
|
void deleteLoopFromQueue(Loop *L);
|
||||||
|
|
||||||
|
// Inset loop into the loop nest(LoopInfo) and loop queue(LQ).
|
||||||
|
void insertLoop(Loop *L, Loop *ParentLoop);
|
||||||
|
|
||||||
// Reoptimize this loop. LPPassManager will re-insert this loop into the
|
// Reoptimize this loop. LPPassManager will re-insert this loop into the
|
||||||
// queue. This allows LoopPass to change loop nest for the loop. This
|
// queue. This allows LoopPass to change loop nest for the loop. This
|
||||||
|
@@ -97,10 +97,42 @@ void LPPassManager::deleteLoopFromQueue(Loop *L) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Inset loop into loop nest (LoopInfo) and loop queue (LQ).
|
||||||
|
void LPPassManager::insertLoop(Loop *L, Loop *ParentLoop) {
|
||||||
|
|
||||||
|
assert (CurrentLoop != L && "Cannot insert CurrentLoop");
|
||||||
|
|
||||||
|
// Insert into loop nest
|
||||||
|
if (ParentLoop)
|
||||||
|
ParentLoop->addChildLoop(L);
|
||||||
|
else
|
||||||
|
LI->addTopLevelLoop(L);
|
||||||
|
|
||||||
|
// Insert L into loop queue
|
||||||
|
if (L == CurrentLoop)
|
||||||
|
redoLoop(L);
|
||||||
|
else if (!ParentLoop)
|
||||||
|
// This is top level loop.
|
||||||
|
LQ.push_front(L);
|
||||||
|
else {
|
||||||
|
// Insert L after ParentLoop
|
||||||
|
for (std::deque<Loop *>::iterator I = LQ.begin(),
|
||||||
|
E = LQ.end(); I != E; ++I) {
|
||||||
|
if (*I == ParentLoop) {
|
||||||
|
// deque does not support insert after.
|
||||||
|
++I;
|
||||||
|
LQ.insert(I, 1, L);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Reoptimize this loop. LPPassManager will re-insert this loop into the
|
// Reoptimize this loop. LPPassManager will re-insert this loop into the
|
||||||
// queue. This allows LoopPass to change loop nest for the loop. This
|
// queue. This allows LoopPass to change loop nest for the loop. This
|
||||||
// utility may send LPPassManager into infinite loops so use caution.
|
// utility may send LPPassManager into infinite loops so use caution.
|
||||||
void LPPassManager::redoLoop(Loop *L) {
|
void LPPassManager::redoLoop(Loop *L) {
|
||||||
|
assert (CurrentLoop != L && "Can redo only CurrentLoop");
|
||||||
redoThisLoop = true;
|
redoThisLoop = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user