diff options
| author | Chris Lattner <sabre@nondot.org> | 2003-02-26 19:10:57 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2003-02-26 19:10:57 +0000 |
| commit | d4ed5c67e9e7184dbf9b6eaaa8f3dc2e68ca5b21 (patch) | |
| tree | 61616b1c7994932876cb847cce6b7a253b9aad6b /llvm/lib | |
| parent | daaf2982e73b10e791a689a0c7e1e4f5705d5679 (diff) | |
| download | bcm5719-llvm-d4ed5c67e9e7184dbf9b6eaaa8f3dc2e68ca5b21.tar.gz bcm5719-llvm-d4ed5c67e9e7184dbf9b6eaaa8f3dc2e68ca5b21.zip | |
Allow ImmutablePass's to require other immutable passes and to be initialized
llvm-svn: 5630
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/VMCore/PassManagerT.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/llvm/lib/VMCore/PassManagerT.h b/llvm/lib/VMCore/PassManagerT.h index 315d9d67e4d..123af346561 100644 --- a/llvm/lib/VMCore/PassManagerT.h +++ b/llvm/lib/VMCore/PassManagerT.h @@ -530,7 +530,33 @@ public: // setAnalysisResolver(IP, this); ImmutablePasses.push_back(IP); + + // All Required analyses should be available to the pass as it initializes! + // Here we fill in the AnalysisImpls member of the pass so that it can + // successfully use the getAnalysis() method to retrieve the implementations + // it needs. + // + IP->AnalysisImpls.clear(); + IP->AnalysisImpls.reserve(AU.getRequiredSet().size()); + for (std::vector<const PassInfo *>::const_iterator + I = AU.getRequiredSet().begin(), + E = AU.getRequiredSet().end(); I != E; ++I) { + Pass *Impl = getAnalysisOrNullUp(*I); + if (Impl == 0) { + std::cerr << "Analysis '" << (*I)->getPassName() + << "' used but not available!"; + assert(0 && "Analysis used but not available!"); + } else if (PassDebugging == Details) { + if ((*I)->getPassName() != std::string(Impl->getPassName())) + std::cerr << " Interface '" << (*I)->getPassName() + << "' implemented by '" << Impl->getPassName() << "'\n"; + } + IP->AnalysisImpls.push_back(std::make_pair(*I, Impl)); + } + // Initialize the immutable pass... + IP->initializePass(); + // Add this pass to the currently available set... if (const PassInfo *PI = IP->getPassInfo()) { CurrentAnalyses[PI] = IP; |

