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 | bf22c73c9cf1b33d74f432754e7a208978cd72b6 (patch) | |
tree | 873549e372a6ab453cc95d692075de4461f7521c /lib/VMCore | |
parent | d2c0b28c33ccf7a219f0adfcd348615493fb8e91 (diff) | |
download | external_llvm-bf22c73c9cf1b33d74f432754e7a208978cd72b6.zip external_llvm-bf22c73c9cf1b33d74f432754e7a208978cd72b6.tar.gz external_llvm-bf22c73c9cf1b33d74f432754e7a208978cd72b6.tar.bz2 |
Allow ImmutablePass's to require other immutable passes and to be initialized
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5630 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-rw-r--r-- | lib/VMCore/PassManagerT.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/VMCore/PassManagerT.h b/lib/VMCore/PassManagerT.h index 315d9d6..123af34 100644 --- a/lib/VMCore/PassManagerT.h +++ b/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; |