diff options
author | Devang Patel <dpatel@apple.com> | 2007-03-06 17:59:37 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2007-03-06 17:59:37 +0000 |
commit | 1699384509df0b62ef4e8e4bc38ecdb995720f20 (patch) | |
tree | fdaddff65a7bf9f2a96226c0826823591297f3e6 /llvm/lib/Analysis | |
parent | 9d9fc909528ce73287d4af1f54d6188425978e65 (diff) | |
download | bcm5719-llvm-1699384509df0b62ef4e8e4bc38ecdb995720f20.tar.gz bcm5719-llvm-1699384509df0b62ef4e8e4bc38ecdb995720f20.zip |
LPPassManager. Implement preparePassManager() hook.
llvm-svn: 34975
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r-- | llvm/lib/Analysis/LoopPass.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/LoopPass.cpp b/llvm/lib/Analysis/LoopPass.cpp index 8d613b09f42..de062baec8e 100644 --- a/llvm/lib/Analysis/LoopPass.cpp +++ b/llvm/lib/Analysis/LoopPass.cpp @@ -129,6 +129,31 @@ bool LPPassManager::runOnFunction(Function &F) { //===----------------------------------------------------------------------===// // LoopPass +// Check if this pass is suitable for the current LPPassManager, if +// available. This pass P is not suitable for a LPPassManager if P +// is not preserving higher level analysis info used by other +// LPPassManager passes. In such case, pop LPPassManager from the +// stack. This will force assignPassManager() to create new +// LPPassManger as expected. +void LoopPass::preparePassManager(PMStack &PMS) { + + // Find LPPassManager + while (!PMS.empty()) { + if (PMS.top()->getPassManagerType() > PMT_LoopPassManager) + PMS.pop(); + else; + break; + } + + LPPassManager *LPPM = dynamic_cast<LPPassManager *>(PMS.top()); + + // If this pass is destroying high level information that is used + // by other passes that are managed by LPM then do not insert + // this pass in current LPM. Use new LPPassManager. + if (LPPM && !LPPM->preserveHigherLevelAnalysis(this)) + PMS.pop(); +} + /// Assign pass manager to manage this pass. void LoopPass::assignPassManager(PMStack &PMS, PassManagerType PreferredType) { |