[llvm] r194947 - [PM] Completely remove support for explicit 'require' methods on the
Chandler Carruth
chandlerc at gmail.com
Sat Nov 16 19:18:05 PST 2013
Author: chandlerc
Date: Sat Nov 16 21:18:05 2013
New Revision: 194947
URL: http://llvm.org/viewvc/llvm-project?rev=194947&view=rev
Log:
[PM] Completely remove support for explicit 'require' methods on the
AnalysisManager. All this method did was assert something and we have
a perfectly good way to trigger that assert from the query path.
Modified:
llvm/trunk/include/llvm/IR/PassManager.h
llvm/trunk/unittests/IR/PassManagerTest.cpp
Modified: llvm/trunk/include/llvm/IR/PassManager.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/PassManager.h?rev=194947&r1=194946&r2=194947&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/PassManager.h (original)
+++ llvm/trunk/include/llvm/IR/PassManager.h Sat Nov 16 21:18:05 2013
@@ -151,6 +151,9 @@ public:
/// constructed around.
template <typename PassT>
const typename PassT::Result &getResult(Module *M) {
+ assert(ModuleAnalysisPasses.count(PassT::ID()) &&
+ "This analysis pass was not registered prior to being queried");
+
const AnalysisResultConcept<Module> &ResultConcept =
getResultImpl(PassT::ID(), M);
typedef AnalysisResultModel<Module, typename PassT::Result> ResultModelT;
@@ -163,6 +166,9 @@ public:
/// re-run the analysis to produce a valid result.
template <typename PassT>
const typename PassT::Result &getResult(Function *F) {
+ assert(FunctionAnalysisPasses.count(PassT::ID()) &&
+ "This analysis pass was not registered prior to being queried");
+
const AnalysisResultConcept<Function> &ResultConcept =
getResultImpl(PassT::ID(), F);
typedef AnalysisResultModel<Function, typename PassT::Result> ResultModelT;
@@ -180,21 +186,6 @@ public:
registerAnalysisPassImpl<PassT>(llvm_move(Pass));
}
- /// \brief Require that a particular analysis pass is provided by the manager.
- ///
- /// This allows transform passes to assert ther requirements during
- /// construction and fail fast if the analysis manager doesn't provide the
- /// needed facilities.
- ///
- /// We force the analysis manager to have these passes explicitly registered
- /// first to ensure that there is exactly one place in the code responsible
- /// for adding an analysis pass to the manager as all transforms will share
- /// a single pass within the manager and each may not be the canonical place
- /// to initialize such a pass.
- template <typename PassT> void requireAnalysisPass() {
- requireAnalysisPassImpl<PassT>();
- }
-
/// \brief Invalidate a specific analysis pass for an IR module.
///
/// Note that the analysis result can disregard invalidation.
@@ -334,22 +325,6 @@ private:
new AnalysisPassModel<PassT>(llvm_move(Pass));
}
- /// \brief Module pass specific implementation of requirement declaration.
- template <typename PassT>
- typename enable_if<is_same<typename PassT::IRUnitT, Module> >::type
- requireAnalysisPassImpl() {
- assert(ModuleAnalysisPasses.count(PassT::ID()) &&
- "This analysis pass was not registered prior to being required");
- }
-
- /// \brief Function pass specific implementation of requirement declaration.
- template <typename PassT>
- typename enable_if<is_same<typename PassT::IRUnitT, Function> >::type
- requireAnalysisPassImpl() {
- assert(FunctionAnalysisPasses.count(PassT::ID()) &&
- "This analysis pass was not registered prior to being required");
- }
-
/// \brief Map type from module analysis pass ID to pass concept pointer.
typedef DenseMap<void *, polymorphic_ptr<AnalysisPassConcept<Module> > >
Modified: llvm/trunk/unittests/IR/PassManagerTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/IR/PassManagerTest.cpp?rev=194947&r1=194946&r2=194947&view=diff
==============================================================================
--- llvm/trunk/unittests/IR/PassManagerTest.cpp (original)
+++ llvm/trunk/unittests/IR/PassManagerTest.cpp Sat Nov 16 21:18:05 2013
@@ -63,7 +63,6 @@ struct TestModulePass {
struct TestFunctionPass {
TestFunctionPass(AnalysisManager &AM, int &RunCount, int &AnalyzedInstrCount)
: AM(AM), RunCount(RunCount), AnalyzedInstrCount(AnalyzedInstrCount) {
- AM.requireAnalysisPass<TestAnalysisPass>();
}
bool run(Function *F) {
More information about the llvm-commits
mailing list