diff options
author | Devang Patel <dpatel@apple.com> | 2007-02-23 00:10:16 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2007-02-23 00:10:16 +0000 |
commit | 4e335c6c71143acfa561d5d1ce89e71567c1fa12 (patch) | |
tree | bc318cce3e9a8ecb91f8ec07d38655944813896a | |
parent | 1bce7816704672c924f9ec9675692f3814874c64 (diff) | |
download | bcm5719-llvm-4e335c6c71143acfa561d5d1ce89e71567c1fa12.tar.gz bcm5719-llvm-4e335c6c71143acfa561d5d1ce89e71567c1fa12.zip |
Add LPPassManager interface that LoopPass can use to skip
rest of the passes in the queue for a loop.
llvm-svn: 34508
-rw-r--r-- | llvm/include/llvm/Analysis/LoopPass.h | 7 | ||||
-rw-r--r-- | llvm/lib/Analysis/LoopPass.cpp | 13 |
2 files changed, 19 insertions, 1 deletions
diff --git a/llvm/include/llvm/Analysis/LoopPass.h b/llvm/include/llvm/Analysis/LoopPass.h index f0b522034d9..046da6f13d8 100644 --- a/llvm/include/llvm/Analysis/LoopPass.h +++ b/llvm/include/llvm/Analysis/LoopPass.h @@ -81,8 +81,13 @@ public: return PMT_LoopPassManager; } - private: +public: + // Delete loop from the loop queue. This is used by Loop pass to inform + // Loop Pass Manager that it should skip rest of the passes for this loop. + void deleteLoopFromQueue(Loop *L); +private: LoopQueue *LQ; + bool skipThisLoop; }; diff --git a/llvm/lib/Analysis/LoopPass.cpp b/llvm/lib/Analysis/LoopPass.cpp index 95a18e5b00d..22d542b05ba 100644 --- a/llvm/lib/Analysis/LoopPass.cpp +++ b/llvm/lib/Analysis/LoopPass.cpp @@ -57,6 +57,13 @@ LPPassManager::~LPPassManager() { delete LQ; } +/// Delete loop from the loop queue. This is used by Loop pass to inform +/// Loop Pass Manager that it should skip rest of the passes for this loop. +void LPPassManager::deleteLoopFromQueue(Loop *L) { + // Do not pop loop from LQ here. It will be done by runOnFunction while loop. + skipThisLoop = true; +} + // Recurse through all subloops and all loops into LQ. static void addLoopIntoQueue(Loop *L, LoopQueue *LQ) { for (Loop::iterator I = L->begin(), E = L->end(); I != E; ++I) @@ -81,6 +88,8 @@ bool LPPassManager::runOnFunction(Function &F) { while (!LQ->empty()) { Loop *L = LQ->top(); + skipThisLoop = false; + // Run all passes on current SCC for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) { @@ -107,6 +116,10 @@ bool LPPassManager::runOnFunction(Function &F) { removeNotPreservedAnalysis(P); recordAvailableAnalysis(P); removeDeadPasses(P, Msg2); + + if (skipThisLoop) + // Do not run other passes on this loop. + break; } // Pop the loop from queue after running all passes. |