mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-28 22:20:37 +00:00
Extract the code for inserting a loop into the loop queue into
a separate function. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82946 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
9702901a1e
commit
3069b3193d
@ -111,9 +111,13 @@ public:
|
|||||||
// Delete loop from the loop queue and loop nest (LoopInfo).
|
// Delete loop from the loop queue and loop nest (LoopInfo).
|
||||||
void deleteLoopFromQueue(Loop *L);
|
void deleteLoopFromQueue(Loop *L);
|
||||||
|
|
||||||
// Insert loop into the loop nest(LoopInfo) and loop queue(LQ).
|
// Insert loop into the loop queue and add it as a child of the
|
||||||
|
// given parent.
|
||||||
void insertLoop(Loop *L, Loop *ParentLoop);
|
void insertLoop(Loop *L, Loop *ParentLoop);
|
||||||
|
|
||||||
|
// Insert a loop into the loop queue.
|
||||||
|
void insertLoopIntoQueue(Loop *L);
|
||||||
|
|
||||||
// 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.
|
||||||
|
@ -110,17 +110,21 @@ void LPPassManager::insertLoop(Loop *L, Loop *ParentLoop) {
|
|||||||
else
|
else
|
||||||
LI->addTopLevelLoop(L);
|
LI->addTopLevelLoop(L);
|
||||||
|
|
||||||
|
insertLoopIntoQueue(L);
|
||||||
|
}
|
||||||
|
|
||||||
|
void LPPassManager::insertLoopIntoQueue(Loop *L) {
|
||||||
// Insert L into loop queue
|
// Insert L into loop queue
|
||||||
if (L == CurrentLoop)
|
if (L == CurrentLoop)
|
||||||
redoLoop(L);
|
redoLoop(L);
|
||||||
else if (!ParentLoop)
|
else if (!L->getParentLoop())
|
||||||
// This is top level loop.
|
// This is top level loop.
|
||||||
LQ.push_front(L);
|
LQ.push_front(L);
|
||||||
else {
|
else {
|
||||||
// Insert L after ParentLoop
|
// Insert L after the parent loop.
|
||||||
for (std::deque<Loop *>::iterator I = LQ.begin(),
|
for (std::deque<Loop *>::iterator I = LQ.begin(),
|
||||||
E = LQ.end(); I != E; ++I) {
|
E = LQ.end(); I != E; ++I) {
|
||||||
if (*I == ParentLoop) {
|
if (*I == L->getParentLoop()) {
|
||||||
// deque does not support insert after.
|
// deque does not support insert after.
|
||||||
++I;
|
++I;
|
||||||
LQ.insert(I, 1, L);
|
LQ.insert(I, 1, L);
|
||||||
|
Loading…
Reference in New Issue
Block a user