aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2007-03-06 19:11:25 +0000
committerDevang Patel <dpatel@apple.com>2007-03-06 19:11:25 +0000
commitc37177eb72d13205d2ad07d32fc8a06a36e2ca9e (patch)
tree56b5065bc57ff37adb013769e3739c9e03e182c3
parenta885c06bdf87a0003c23e15b3467fc7c1d4767d9 (diff)
Use schedulePass() instead of assignPassManager() to add new LPPassManager.
This ensures that require analysis info is available. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34980 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/Analysis/LoopPass.h8
-rw-r--r--lib/Analysis/LoopPass.cpp14
2 files changed, 13 insertions, 9 deletions
diff --git a/include/llvm/Analysis/LoopPass.h b/include/llvm/Analysis/LoopPass.h
index 108e8b7a6e..07b9c572ce 100644
--- a/include/llvm/Analysis/LoopPass.h
+++ b/include/llvm/Analysis/LoopPass.h
@@ -69,12 +69,8 @@ public:
bool runOnFunction(Function &F);
/// Pass Manager itself does not invalidate any analysis info.
- void getAnalysisUsage(AnalysisUsage &Info) const {
- // LPPassManager needs LoopInfo. In the long term LoopInfo class will
- // be consumed by LPPassManager.
- Info.addRequired<LoopInfo>();
- Info.setPreservesAll();
- }
+ // LPPassManager needs LoopInfo.
+ void getAnalysisUsage(AnalysisUsage &Info) const;
virtual const char *getPassName() const {
return "Loop Pass Manager";
diff --git a/lib/Analysis/LoopPass.cpp b/lib/Analysis/LoopPass.cpp
index 0a29c5dae3..b6b862eca1 100644
--- a/lib/Analysis/LoopPass.cpp
+++ b/lib/Analysis/LoopPass.cpp
@@ -143,14 +143,22 @@ static void addLoopIntoQueue(Loop *L, std::deque<Loop *> &LQ) {
LQ.push_back(L);
}
+/// Pass Manager itself does not invalidate any analysis info.
+void LPPassManager::getAnalysisUsage(AnalysisUsage &Info) const {
+ // LPPassManager needs LoopInfo. In the long term LoopInfo class will
+ // become part of LPPassManager.
+ Info.addRequired<LoopInfo>();
+ Info.setPreservesAll();
+}
+
/// run - Execute all of the passes scheduled for execution. Keep track of
/// whether any of the passes modifies the function, and if so, return true.
bool LPPassManager::runOnFunction(Function &F) {
- LoopInfo &LI = getAnalysis<LoopInfo>();
+ LI = &getAnalysis<LoopInfo>();
bool Changed = false;
// Populate Loop Queue
- for (LoopInfo::iterator I = LI.begin(), E = LI.end(); I != E; ++I)
+ for (LoopInfo::iterator I = LI->begin(), E = LI->end(); I != E; ++I)
addLoopIntoQueue(*I, LQ);
// Initialization
@@ -279,7 +287,7 @@ void LoopPass::assignPassManager(PMStack &PMS,
// [3] Assign manager to manage this new manager. This may create
// and push new managers into PMS
Pass *P = dynamic_cast<Pass *>(LPPM);
- P->assignPassManager(PMS);
+ TPM->schedulePass(P);
// [4] Push new manager into PMS
PMS.push(LPPM);