ResultGetters.push_back(&getModuleAAResultImpl<AnalysisT>);
}
- Result run(Function &F, AnalysisManager<Function> *AM) {
- Result R(AM->getResult<TargetLibraryAnalysis>(F));
+ Result run(Function &F, AnalysisManager<Function> &AM) {
+ Result R(AM.getResult<TargetLibraryAnalysis>(F));
for (auto &Getter : ResultGetters)
- (*Getter)(F, *AM, R);
+ (*Getter)(F, AM, R);
return R;
}
static StringRef name() { return "AAEvaluator"; }
/// \brief Run the pass over the function.
- PreservedAnalyses run(Function &F, AnalysisManager<Function> *AM);
+ PreservedAnalyses run(Function &F, AnalysisManager<Function> &AM);
private:
// Allow the legacy pass to run this using an internal API.
public:
explicit AssumptionPrinterPass(raw_ostream &OS) : OS(OS) {}
- PreservedAnalyses run(Function &F, AnalysisManager<Function> *AM);
+ PreservedAnalyses run(Function &F, AnalysisManager<Function> &AM);
static StringRef name() { return "AssumptionPrinterPass"; }
};
public:
typedef BasicAAResult Result;
- BasicAAResult run(Function &F, AnalysisManager<Function> *AM);
+ BasicAAResult run(Function &F, AnalysisManager<Function> &AM);
};
/// Legacy wrapper pass to provide the BasicAAResult object.
public:
typedef CFLAAResult Result;
- CFLAAResult run(Function &F, AnalysisManager<Function> *AM);
+ CFLAAResult run(Function &F, AnalysisManager<Function> &AM);
};
/// Legacy wrapper pass to provide the CFLAAResult object.
}
/// \brief Runs the CGSCC pass across every SCC in the module.
- PreservedAnalyses run(Module &M, ModuleAnalysisManager *AM) {
- assert(AM && "We need analyses to compute the call graph!");
-
+ PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM) {
// Setup the CGSCC analysis manager from its proxy.
CGSCCAnalysisManager &CGAM =
- AM->getResult<CGSCCAnalysisManagerModuleProxy>(M).getManager();
+ AM.getResult<CGSCCAnalysisManagerModuleProxy>(M).getManager();
// Get the call graph for this module.
- LazyCallGraph &CG = AM->getResult<LazyCallGraphAnalysis>(M);
+ LazyCallGraph &CG = AM.getResult<LazyCallGraphAnalysis>(M);
PreservedAnalyses PA = PreservedAnalyses::all();
for (LazyCallGraph::RefSCC &OuterC : CG.postorder_ref_sccs())
for (LazyCallGraph::SCC &C : OuterC) {
- PreservedAnalyses PassPA = Pass.run(C, &CGAM);
+ PreservedAnalyses PassPA = Pass.run(C, CGAM);
// We know that the CGSCC pass couldn't have invalidated any other
// SCC's analyses (that's the contract of a CGSCC pass), so
}
/// \brief Runs the function pass across every function in the module.
- PreservedAnalyses run(LazyCallGraph::SCC &C, CGSCCAnalysisManager *AM) {
- FunctionAnalysisManager *FAM = nullptr;
- if (AM)
- // Setup the function analysis manager from its proxy.
- FAM = &AM->getResult<FunctionAnalysisManagerCGSCCProxy>(C).getManager();
+ PreservedAnalyses run(LazyCallGraph::SCC &C, CGSCCAnalysisManager &AM) {
+ // Setup the function analysis manager from its proxy.
+ FunctionAnalysisManager &FAM =
+ AM.getResult<FunctionAnalysisManagerCGSCCProxy>(C).getManager();
PreservedAnalyses PA = PreservedAnalyses::all();
for (LazyCallGraph::Node &N : C) {
// directly handle the function analysis manager's invalidation here.
// Also, update the preserved analyses to reflect that once invalidated
// these can again be preserved.
- if (FAM)
- PassPA = FAM->invalidate(N.getFunction(), std::move(PassPA));
+ PassPA = FAM.invalidate(N.getFunction(), std::move(PassPA));
// Then intersect the preserved set so that invalidation of module
// analyses will eventually occur when the module pass completes.
public:
explicit CallGraphPrinterPass(raw_ostream &OS) : OS(OS) {}
- PreservedAnalyses run(Module &M, AnalysisManager<Module> *AM);
+ PreservedAnalyses run(Module &M, AnalysisManager<Module> &AM);
};
/// \brief The \c ModulePass which wraps up a \c CallGraph and the logic to
typedef DominanceFrontier Result;
/// \brief Run the analysis pass over a function and produce a dominator tree.
- DominanceFrontier run(Function &F, AnalysisManager<Function> *AM);
+ DominanceFrontier run(Function &F, AnalysisManager<Function> &AM);
};
/// \brief Printer pass for the \c DominanceFrontier.
public:
explicit DominanceFrontierPrinterPass(raw_ostream &OS);
- PreservedAnalyses run(Function &F, AnalysisManager<Function> *AM);
+ PreservedAnalyses run(Function &F, AnalysisManager<Function> &AM);
};
} // End llvm namespace
public:
typedef GlobalsAAResult Result;
- GlobalsAAResult run(Module &M, AnalysisManager<Module> *AM);
+ GlobalsAAResult run(Module &M, AnalysisManager<Module> &AM);
};
/// Legacy wrapper pass to provide the GlobalsAAResult object.
public:
explicit LazyCallGraphPrinterPass(raw_ostream &OS);
- PreservedAnalyses run(Module &M, ModuleAnalysisManager *AM);
+ PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
};
}
public:
typedef LoopInfo Result;
- LoopInfo run(Function &F, AnalysisManager<Function> *AM);
+ LoopInfo run(Function &F, AnalysisManager<Function> &AM);
};
/// \brief Printer pass for the \c LoopAnalysis results.
public:
explicit LoopPrinterPass(raw_ostream &OS) : OS(OS) {}
- PreservedAnalyses run(Function &F, AnalysisManager<Function> *AM);
+ PreservedAnalyses run(Function &F, AnalysisManager<Function> &AM);
};
/// \brief The legacy pass manager's analysis pass to compute loop information.
}
/// \brief Runs the loop passes across every loop in the function.
- PreservedAnalyses run(Function &F, FunctionAnalysisManager *AM) {
- assert(AM && "We need analyses to compute the loop structure!");
-
+ PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM) {
// Setup the loop analysis manager from its proxy.
- LoopAnalysisManager *LAM =
- &AM->getResult<LoopAnalysisManagerFunctionProxy>(F).getManager();
+ LoopAnalysisManager &LAM =
+ AM.getResult<LoopAnalysisManagerFunctionProxy>(F).getManager();
// Get the loop structure for this function
- LoopInfo &LI = AM->getResult<LoopAnalysis>(F);
+ LoopInfo &LI = AM.getResult<LoopAnalysis>(F);
PreservedAnalyses PA = PreservedAnalyses::all();
// loop analysis manager's invalidation here. Also, update the
// preserved analyses to reflect that once invalidated these can again
// be preserved.
- PassPA = LAM->invalidate(*L, std::move(PassPA));
+ PassPA = LAM.invalidate(*L, std::move(PassPA));
// Then intersect the preserved set so that invalidation of module
// analyses will eventually occur when the module pass completes.
public:
typedef MemoryDependenceResults Result;
- MemoryDependenceResults run(Function &F, AnalysisManager<Function> *AM);
+ MemoryDependenceResults run(Function &F, AnalysisManager<Function> &AM);
};
/// A wrapper analysis pass for the legacy pass manager that exposes a \c
public:
typedef ObjCARCAAResult Result;
- ObjCARCAAResult run(Function &F, AnalysisManager<Function> *AM);
+ ObjCARCAAResult run(Function &F, AnalysisManager<Function> &AM);
};
/// Legacy wrapper pass to provide the ObjCARCAAResult object.
public:
explicit PostDominatorTreePrinterPass(raw_ostream &OS);
- PreservedAnalyses run(Function &F, AnalysisManager<Function> *AM);
+ PreservedAnalyses run(Function &F, AnalysisManager<Function> &AM);
};
struct PostDominatorTreeWrapperPass : public FunctionPass {
public:
typedef RegionInfo Result;
- RegionInfo run(Function &F, AnalysisManager<Function> *AM);
+ RegionInfo run(Function &F, AnalysisManager<Function> &AM);
};
/// \brief Printer pass for the \c RegionInfo.
public:
explicit RegionInfoPrinterPass(raw_ostream &OS);
- PreservedAnalyses run(Function &F, AnalysisManager<Function> *AM);
+ PreservedAnalyses run(Function &F, AnalysisManager<Function> &AM);
};
/// \brief Verifier pass for the \c RegionInfo.
struct RegionInfoVerifierPass : PassInfoMixin<RegionInfoVerifierPass> {
- PreservedAnalyses run(Function &F, AnalysisManager<Function> *AM);
+ PreservedAnalyses run(Function &F, AnalysisManager<Function> &AM);
};
template <>
public:
typedef ScalarEvolution Result;
- ScalarEvolution run(Function &F, AnalysisManager<Function> *AM);
+ ScalarEvolution run(Function &F, AnalysisManager<Function> &AM);
};
/// \brief Printer pass for the \c ScalarEvolutionAnalysis results.
public:
explicit ScalarEvolutionPrinterPass(raw_ostream &OS) : OS(OS) {}
- PreservedAnalyses run(Function &F, AnalysisManager<Function> *AM);
+ PreservedAnalyses run(Function &F, AnalysisManager<Function> &AM);
};
class ScalarEvolutionWrapperPass : public FunctionPass {
public:
typedef SCEVAAResult Result;
- SCEVAAResult run(Function &F, AnalysisManager<Function> *AM);
+ SCEVAAResult run(Function &F, AnalysisManager<Function> &AM);
};
/// Legacy wrapper pass to provide the SCEVAAResult object.
public:
typedef ScopedNoAliasAAResult Result;
- ScopedNoAliasAAResult run(Function &F, AnalysisManager<Function> *AM);
+ ScopedNoAliasAAResult run(Function &F, AnalysisManager<Function> &AM);
};
/// Legacy wrapper pass to provide the ScopedNoAliasAAResult object.
public:
typedef TypeBasedAAResult Result;
- TypeBasedAAResult run(Function &F, AnalysisManager<Function> *AM);
+ TypeBasedAAResult run(Function &F, AnalysisManager<Function> &AM);
};
/// Legacy wrapper pass to provide the TypeBasedAAResult object.
public:
explicit DominatorTreePrinterPass(raw_ostream &OS);
- PreservedAnalyses run(Function &F, AnalysisManager<Function> *AM);
+ PreservedAnalyses run(Function &F, AnalysisManager<Function> &AM);
};
/// \brief Verifier pass for the \c DominatorTree.
struct DominatorTreeVerifierPass : PassInfoMixin<DominatorTreeVerifierPass> {
- PreservedAnalyses run(Function &F, AnalysisManager<Function> *AM);
+ PreservedAnalyses run(Function &F, AnalysisManager<Function> &AM);
};
/// \brief Legacy analysis pass which computes a \c DominatorTree.
}
/// \brief Run all of the passes in this manager over the IR.
- PreservedAnalyses run(IRUnitT &IR, AnalysisManager<IRUnitT> *AM = nullptr) {
+ PreservedAnalyses run(IRUnitT &IR, AnalysisManager<IRUnitT> &AM) {
PreservedAnalyses PA = PreservedAnalyses::all();
if (DebugLogging)
PreservedAnalyses PassPA = Passes[Idx]->run(IR, AM);
- // If we have an active analysis manager at this level we want to ensure
- // we update it as each pass runs and potentially invalidates analyses.
- // We also update the preserved set of analyses based on what analyses we
- // have already handled the invalidation for here and don't need to
- // invalidate when finished.
- if (AM)
- PassPA = AM->invalidate(IR, std::move(PassPA));
+ // Update the analysis manager as each pass runs and potentially
+ // invalidates analyses. We also update the preserved set of analyses
+ // based on what analyses we have already handled the invalidation for
+ // here and don't need to invalidate when finished.
+ PassPA = AM.invalidate(IR, std::move(PassPA));
// Finally, we intersect the final preserved analyses to compute the
// aggregate preserved set for this pass manager.
if (DebugLogging)
dbgs() << "Running analysis: " << P.name() << "\n";
AnalysisResultListT &ResultList = AnalysisResultLists[&IR];
- ResultList.emplace_back(PassID, P.run(IR, this));
+ ResultList.emplace_back(PassID, P.run(IR, *this));
// P.run may have inserted elements into AnalysisResults and invalidated
// RI.
}
/// \brief Runs the function pass across every function in the module.
- PreservedAnalyses run(Module &M, ModuleAnalysisManager *AM) {
- FunctionAnalysisManager *FAM = nullptr;
- if (AM)
- // Setup the function analysis manager from its proxy.
- FAM = &AM->getResult<FunctionAnalysisManagerModuleProxy>(M).getManager();
+ PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM) {
+ // Setup the function analysis manager from its proxy.
+ FunctionAnalysisManager &FAM =
+ AM.getResult<FunctionAnalysisManagerModuleProxy>(M).getManager();
PreservedAnalyses PA = PreservedAnalyses::all();
for (Function &F : M) {
// directly handle the function analysis manager's invalidation here and
// update our preserved set to reflect that these have already been
// handled.
- if (FAM)
- PassPA = FAM->invalidate(F, std::move(PassPA));
+ PassPA = FAM.invalidate(F, std::move(PassPA));
// Then intersect the preserved set so that invalidation of module
// analyses will eventually occur when the module pass completes.
/// created, these methods can be instantiated to satisfy whatever the
/// context requires.
template <typename IRUnitT>
- PreservedAnalyses run(IRUnitT &Arg, AnalysisManager<IRUnitT> *AM) {
- if (AM)
- (void)AM->template getResult<AnalysisT>(Arg);
+ PreservedAnalyses run(IRUnitT &Arg, AnalysisManager<IRUnitT> &AM) {
+ (void)AM.template getResult<AnalysisT>(Arg);
return PreservedAnalyses::all();
}
/// created, these methods can be instantiated to satisfy whatever the
/// context requires.
template <typename IRUnitT>
- PreservedAnalyses run(IRUnitT &Arg, AnalysisManager<IRUnitT> *AM) {
- if (AM)
- // We have to directly invalidate the analysis result as we can't
- // enumerate all other analyses and use the preserved set to control it.
- (void)AM->template invalidate<AnalysisT>(Arg);
+ PreservedAnalyses run(IRUnitT &Arg, AnalysisManager<IRUnitT> &AM) {
+ // We have to directly invalidate the analysis result as we can't
+ // enumerate all other analyses and use the preserved set to control it.
+ AM.template invalidate<AnalysisT>(Arg);
return PreservedAnalyses::all();
}
/// Note that actual pass object can omit the analysis manager argument if
/// desired. Also that the analysis manager may be null if there is no
/// analysis manager in the pass pipeline.
- virtual PreservedAnalyses run(IRUnitT &IR, AnalysisManager<IRUnitT> *AM) = 0;
+ virtual PreservedAnalyses run(IRUnitT &IR, AnalysisManager<IRUnitT> &AM) = 0;
/// \brief Polymorphic method to access the name of a pass.
virtual StringRef name() = 0;
char a, b;
};
- template <typename T, ResultT (T::*)(IRUnitT &, AnalysisManager<IRUnitT> *)>
+ template <typename T, ResultT (T::*)(IRUnitT &, AnalysisManager<IRUnitT> &)>
struct Checker;
template <typename T> static SmallType f(Checker<T, &T::run> *);
return *this;
}
- PreservedAnalysesT run(IRUnitT &IR, AnalysisManager<IRUnitT> *AM) override {
+ PreservedAnalysesT run(IRUnitT &IR, AnalysisManager<IRUnitT> &AM) override {
return Pass.run(IR, AM);
}
StringRef name() override { return PassT::name(); }
return *this;
}
- PreservedAnalysesT run(IRUnitT &IR, AnalysisManager<IRUnitT> *AM) override {
+ PreservedAnalysesT run(IRUnitT &IR, AnalysisManager<IRUnitT> &) override {
return Pass.run(IR);
}
StringRef name() override { return PassT::name(); }
/// \returns A unique_ptr to the analysis result object to be queried by
/// users.
virtual std::unique_ptr<AnalysisResultConcept<IRUnitT>>
- run(IRUnitT &IR, AnalysisManager<IRUnitT> *AM) = 0;
+ run(IRUnitT &IR, AnalysisManager<IRUnitT> &AM) = 0;
/// \brief Polymorphic method to access the name of a pass.
virtual StringRef name() = 0;
///
/// The return is wrapped in an \c AnalysisResultModel.
std::unique_ptr<AnalysisResultConcept<IRUnitT>>
- run(IRUnitT &IR, AnalysisManager<IRUnitT> *AM) override {
+ run(IRUnitT &IR, AnalysisManager<IRUnitT> &AM) override {
return make_unique<ResultModelT>(Pass.run(IR, AM));
}
///
/// The return is wrapped in an \c AnalysisResultModel.
std::unique_ptr<AnalysisResultConcept<IRUnitT>>
- run(IRUnitT &IR, AnalysisManager<IRUnitT> *) override {
+ run(IRUnitT &IR, AnalysisManager<IRUnitT> &) override {
return make_unique<ResultModelT>(Pass.run(IR));
}
/// attribute. It also discovers function arguments that are not captured by
/// the function and marks them with the nocapture attribute.
struct PostOrderFunctionAttrsPass : PassInfoMixin<PostOrderFunctionAttrsPass> {
- PreservedAnalyses run(LazyCallGraph::SCC &C, CGSCCAnalysisManager *AM);
+ PreservedAnalyses run(LazyCallGraph::SCC &C, CGSCCAnalysisManager &AM);
};
/// Create a legacy pass manager instance of a pass to compute function attrs
/// A pass which infers function attributes from the names and signatures of
/// function declarations in a module.
struct InferFunctionAttrsPass : PassInfoMixin<InferFunctionAttrsPass> {
- PreservedAnalyses run(Module &M, AnalysisManager<Module> *AM);
+ PreservedAnalyses run(Module &M, AnalysisManager<Module> &AM);
};
/// Create a legacy pass manager instance of a pass to infer function
return *this;
}
- PreservedAnalyses run(Function &F, AnalysisManager<Function> *AM);
+ PreservedAnalyses run(Function &F, AnalysisManager<Function> &AM);
};
/// \brief The legacy pass manager's instcombine pass.
/// expected that a later pass of GVN will catch the interesting/hard cases.
struct EarlyCSEPass : PassInfoMixin<EarlyCSEPass> {
/// \brief Run the pass over the function.
- PreservedAnalyses run(Function &F, AnalysisManager<Function> *AM);
+ PreservedAnalyses run(Function &F, AnalysisManager<Function> &AM);
};
}
public:
/// \brief Run the pass over the function.
- PreservedAnalyses run(Function &F, AnalysisManager<Function> *AM);
+ PreservedAnalyses run(Function &F, AnalysisManager<Function> &AM);
/// This removes the specified instruction from
/// our various maps and marks it for deletion.
SROA() : C(nullptr), DT(nullptr), AC(nullptr) {}
/// \brief Run the pass over the function.
- PreservedAnalyses run(Function &F, AnalysisManager<Function> *AM);
+ PreservedAnalyses run(Function &F, AnalysisManager<Function> &AM);
private:
friend class sroa::AllocaSliceRewriter;
SimplifyCFGPass(int BonusInstThreshold);
/// \brief Run the pass over the function.
- PreservedAnalyses run(Function &F, AnalysisManager<Function> *AM);
+ PreservedAnalyses run(Function &F, AnalysisManager<Function> &AM);
};
}
&& !isa<ConstantPointerNull>(V);
}
-PreservedAnalyses AAEvaluator::run(Function &F, AnalysisManager<Function> *AM) {
- runInternal(F, AM->getResult<AAManager>(F));
+PreservedAnalyses AAEvaluator::run(Function &F, AnalysisManager<Function> &AM) {
+ runInternal(F, AM.getResult<AAManager>(F));
return PreservedAnalyses::all();
}
char AssumptionAnalysis::PassID;
PreservedAnalyses AssumptionPrinterPass::run(Function &F,
- AnalysisManager<Function> *AM) {
- AssumptionCache &AC = AM->getResult<AssumptionAnalysis>(F);
+ AnalysisManager<Function> &AM) {
+ AssumptionCache &AC = AM.getResult<AssumptionAnalysis>(F);
OS << "Cached assumptions for function: " << F.getName() << "\n";
for (auto &VH : AC.assumptions())
char BasicAA::PassID;
-BasicAAResult BasicAA::run(Function &F, AnalysisManager<Function> *AM) {
+BasicAAResult BasicAA::run(Function &F, AnalysisManager<Function> &AM) {
return BasicAAResult(F.getParent()->getDataLayout(),
- AM->getResult<TargetLibraryAnalysis>(F),
- AM->getResult<AssumptionAnalysis>(F),
- AM->getCachedResult<DominatorTreeAnalysis>(F),
- AM->getCachedResult<LoopAnalysis>(F));
+ AM.getResult<TargetLibraryAnalysis>(F),
+ AM.getResult<AssumptionAnalysis>(F),
+ AM.getCachedResult<DominatorTreeAnalysis>(F),
+ AM.getCachedResult<LoopAnalysis>(F));
}
BasicAAWrapperPass::BasicAAWrapperPass() : FunctionPass(ID) {
char CFLAA::PassID;
-CFLAAResult CFLAA::run(Function &F, AnalysisManager<Function> *AM) {
+CFLAAResult CFLAA::run(Function &F, AnalysisManager<Function> &AM) {
return CFLAAResult();
}
char CallGraphAnalysis::PassID;
PreservedAnalyses CallGraphPrinterPass::run(Module &M,
- AnalysisManager<Module> *AM) {
- AM->getResult<CallGraphAnalysis>(M).print(OS);
+ AnalysisManager<Module> &AM) {
+ AM.getResult<CallGraphAnalysis>(M).print(OS);
return PreservedAnalyses::all();
}
char DominanceFrontierAnalysis::PassID;
DominanceFrontier DominanceFrontierAnalysis::run(Function &F,
- FunctionAnalysisManager *AM) {
+ FunctionAnalysisManager &AM) {
DominanceFrontier DF;
- DF.analyze(AM->getResult<DominatorTreeAnalysis>(F));
+ DF.analyze(AM.getResult<DominatorTreeAnalysis>(F));
return DF;
}
: OS(OS) {}
PreservedAnalyses
-DominanceFrontierPrinterPass::run(Function &F, FunctionAnalysisManager *AM) {
+DominanceFrontierPrinterPass::run(Function &F, FunctionAnalysisManager &AM) {
OS << "DominanceFrontier for function: " << F.getName() << "\n";
- AM->getResult<DominanceFrontierAnalysis>(F).print(OS);
+ AM.getResult<DominanceFrontierAnalysis>(F).print(OS);
return PreservedAnalyses::all();
}
char GlobalsAA::PassID;
-GlobalsAAResult GlobalsAA::run(Module &M, AnalysisManager<Module> *AM) {
+GlobalsAAResult GlobalsAA::run(Module &M, AnalysisManager<Module> &AM) {
return GlobalsAAResult::analyzeModule(M,
- AM->getResult<TargetLibraryAnalysis>(M),
- AM->getResult<CallGraphAnalysis>(M));
+ AM.getResult<TargetLibraryAnalysis>(M),
+ AM.getResult<CallGraphAnalysis>(M));
}
char GlobalsAAWrapperPass::ID = 0;
}
PreservedAnalyses LazyCallGraphPrinterPass::run(Module &M,
- ModuleAnalysisManager *AM) {
- LazyCallGraph &G = AM->getResult<LazyCallGraphAnalysis>(M);
+ ModuleAnalysisManager &AM) {
+ LazyCallGraph &G = AM.getResult<LazyCallGraphAnalysis>(M);
OS << "Printing the call graph for module: " << M.getModuleIdentifier()
<< "\n\n";
char LoopAnalysis::PassID;
-LoopInfo LoopAnalysis::run(Function &F, AnalysisManager<Function> *AM) {
+LoopInfo LoopAnalysis::run(Function &F, AnalysisManager<Function> &AM) {
// FIXME: Currently we create a LoopInfo from scratch for every function.
// This may prove to be too wasteful due to deallocating and re-allocating
// memory each time for the underlying map and vector datastructures. At some
// objects. I don't want to add that kind of complexity until the scope of
// the problem is better understood.
LoopInfo LI;
- LI.analyze(AM->getResult<DominatorTreeAnalysis>(F));
+ LI.analyze(AM.getResult<DominatorTreeAnalysis>(F));
return LI;
}
PreservedAnalyses LoopPrinterPass::run(Function &F,
- AnalysisManager<Function> *AM) {
- AM->getResult<LoopAnalysis>(F).print(OS);
+ AnalysisManager<Function> &AM) {
+ AM.getResult<LoopAnalysis>(F).print(OS);
return PreservedAnalyses::all();
}
char MemoryDependenceAnalysis::PassID;
MemoryDependenceResults
-MemoryDependenceAnalysis::run(Function &F, AnalysisManager<Function> *AM) {
- auto &AA = AM->getResult<AAManager>(F);
- auto &AC = AM->getResult<AssumptionAnalysis>(F);
- auto &TLI = AM->getResult<TargetLibraryAnalysis>(F);
- auto *DT = AM->getCachedResult<DominatorTreeAnalysis>(F);
+MemoryDependenceAnalysis::run(Function &F, AnalysisManager<Function> &AM) {
+ auto &AA = AM.getResult<AAManager>(F);
+ auto &AC = AM.getResult<AssumptionAnalysis>(F);
+ auto &TLI = AM.getResult<TargetLibraryAnalysis>(F);
+ auto *DT = AM.getCachedResult<DominatorTreeAnalysis>(F);
return MemoryDependenceResults(AA, AC, TLI, DT);
}
return AAResultBase::getModRefInfo(CS, Loc);
}
-ObjCARCAAResult ObjCARCAA::run(Function &F, AnalysisManager<Function> *AM) {
+ObjCARCAAResult ObjCARCAA::run(Function &F, AnalysisManager<Function> &AM) {
return ObjCARCAAResult(F.getParent()->getDataLayout());
}
: OS(OS) {}
PreservedAnalyses
-PostDominatorTreePrinterPass::run(Function &F, FunctionAnalysisManager *AM) {
+PostDominatorTreePrinterPass::run(Function &F, FunctionAnalysisManager &AM) {
OS << "PostDominatorTree for function: " << F.getName() << "\n";
- AM->getResult<PostDominatorTreeAnalysis>(F).print(OS);
+ AM.getResult<PostDominatorTreeAnalysis>(F).print(OS);
return PreservedAnalyses::all();
}
char RegionInfoAnalysis::PassID;
-RegionInfo RegionInfoAnalysis::run(Function &F, AnalysisManager<Function> *AM) {
+RegionInfo RegionInfoAnalysis::run(Function &F, AnalysisManager<Function> &AM) {
RegionInfo RI;
- auto *DT = &AM->getResult<DominatorTreeAnalysis>(F);
- auto *PDT = &AM->getResult<PostDominatorTreeAnalysis>(F);
- auto *DF = &AM->getResult<DominanceFrontierAnalysis>(F);
+ auto *DT = &AM.getResult<DominatorTreeAnalysis>(F);
+ auto *PDT = &AM.getResult<PostDominatorTreeAnalysis>(F);
+ auto *DF = &AM.getResult<DominanceFrontierAnalysis>(F);
RI.recalculate(F, DT, PDT, DF);
return RI;
RegionInfoPrinterPass::RegionInfoPrinterPass(raw_ostream &OS)
: OS(OS) {}
-PreservedAnalyses
-RegionInfoPrinterPass::run(Function &F, FunctionAnalysisManager *AM) {
+PreservedAnalyses RegionInfoPrinterPass::run(Function &F,
+ FunctionAnalysisManager &AM) {
OS << "Region Tree for function: " << F.getName() << "\n";
- AM->getResult<RegionInfoAnalysis>(F).print(OS);
+ AM.getResult<RegionInfoAnalysis>(F).print(OS);
return PreservedAnalyses::all();
}
PreservedAnalyses RegionInfoVerifierPass::run(Function &F,
- AnalysisManager<Function> *AM) {
- AM->getResult<RegionInfoAnalysis>(F).verifyAnalysis();
+ AnalysisManager<Function> &AM) {
+ AM.getResult<RegionInfoAnalysis>(F).verifyAnalysis();
return PreservedAnalyses::all();
}
char ScalarEvolutionAnalysis::PassID;
ScalarEvolution ScalarEvolutionAnalysis::run(Function &F,
- AnalysisManager<Function> *AM) {
- return ScalarEvolution(F, AM->getResult<TargetLibraryAnalysis>(F),
- AM->getResult<AssumptionAnalysis>(F),
- AM->getResult<DominatorTreeAnalysis>(F),
- AM->getResult<LoopAnalysis>(F));
+ AnalysisManager<Function> &AM) {
+ return ScalarEvolution(F, AM.getResult<TargetLibraryAnalysis>(F),
+ AM.getResult<AssumptionAnalysis>(F),
+ AM.getResult<DominatorTreeAnalysis>(F),
+ AM.getResult<LoopAnalysis>(F));
}
PreservedAnalyses
-ScalarEvolutionPrinterPass::run(Function &F, AnalysisManager<Function> *AM) {
- AM->getResult<ScalarEvolutionAnalysis>(F).print(OS);
+ScalarEvolutionPrinterPass::run(Function &F, AnalysisManager<Function> &AM) {
+ AM.getResult<ScalarEvolutionAnalysis>(F).print(OS);
return PreservedAnalyses::all();
}
char SCEVAA::PassID;
-SCEVAAResult SCEVAA::run(Function &F, AnalysisManager<Function> *AM) {
- return SCEVAAResult(AM->getResult<ScalarEvolutionAnalysis>(F));
+SCEVAAResult SCEVAA::run(Function &F, AnalysisManager<Function> &AM) {
+ return SCEVAAResult(AM.getResult<ScalarEvolutionAnalysis>(F));
}
char SCEVAAWrapperPass::ID = 0;
char ScopedNoAliasAA::PassID;
ScopedNoAliasAAResult ScopedNoAliasAA::run(Function &F,
- AnalysisManager<Function> *AM) {
+ AnalysisManager<Function> &AM) {
return ScopedNoAliasAAResult();
}
char TypeBasedAA::PassID;
-TypeBasedAAResult TypeBasedAA::run(Function &F, AnalysisManager<Function> *AM) {
+TypeBasedAAResult TypeBasedAA::run(Function &F, AnalysisManager<Function> &AM) {
return TypeBasedAAResult();
}
DominatorTreePrinterPass::DominatorTreePrinterPass(raw_ostream &OS) : OS(OS) {}
PreservedAnalyses DominatorTreePrinterPass::run(Function &F,
- FunctionAnalysisManager *AM) {
+ FunctionAnalysisManager &AM) {
OS << "DominatorTree for function: " << F.getName() << "\n";
- AM->getResult<DominatorTreeAnalysis>(F).print(OS);
+ AM.getResult<DominatorTreeAnalysis>(F).print(OS);
return PreservedAnalyses::all();
}
PreservedAnalyses DominatorTreeVerifierPass::run(Function &F,
- FunctionAnalysisManager *AM) {
- AM->getResult<DominatorTreeAnalysis>(F).verifyDomTree();
+ FunctionAnalysisManager &AM) {
+ AM.getResult<DominatorTreeAnalysis>(F).verifyDomTree();
return PreservedAnalyses::all();
}
return setDoesNotRecurse(*F);
}
-PreservedAnalyses
-PostOrderFunctionAttrsPass::run(LazyCallGraph::SCC &C, CGSCCAnalysisManager *AM) {
+PreservedAnalyses PostOrderFunctionAttrsPass::run(LazyCallGraph::SCC &C,
+ CGSCCAnalysisManager &AM) {
Module &M = *C.begin()->getFunction().getParent();
const ModuleAnalysisManager &MAM =
- AM->getResult<ModuleAnalysisManagerCGSCCProxy>(C).getManager();
+ AM.getResult<ModuleAnalysisManagerCGSCCProxy>(C).getManager();
FunctionAnalysisManager &FAM =
- AM->getResult<FunctionAnalysisManagerCGSCCProxy>(C).getManager();
+ AM.getResult<FunctionAnalysisManagerCGSCCProxy>(C).getManager();
// FIXME: Need some way to make it more reasonable to assume that this is
// always cached.
}
PreservedAnalyses InferFunctionAttrsPass::run(Module &M,
- AnalysisManager<Module> *AM) {
- auto &TLI = AM->getResult<TargetLibraryAnalysis>(M);
+ AnalysisManager<Module> &AM) {
+ auto &TLI = AM.getResult<TargetLibraryAnalysis>(M);
if (!inferAllPrototypeAttributes(M, TLI))
// If we didn't infer anything, preserve all analyses.
}
PreservedAnalyses InstCombinePass::run(Function &F,
- AnalysisManager<Function> *AM) {
- auto &AC = AM->getResult<AssumptionAnalysis>(F);
- auto &DT = AM->getResult<DominatorTreeAnalysis>(F);
- auto &TLI = AM->getResult<TargetLibraryAnalysis>(F);
+ AnalysisManager<Function> &AM) {
+ auto &AC = AM.getResult<AssumptionAnalysis>(F);
+ auto &DT = AM.getResult<DominatorTreeAnalysis>(F);
+ auto &TLI = AM.getResult<TargetLibraryAnalysis>(F);
- auto *LI = AM->getCachedResult<LoopAnalysis>(F);
+ auto *LI = AM.getCachedResult<LoopAnalysis>(F);
// FIXME: The AliasAnalysis is not yet supported in the new pass manager
if (!combineInstructionsOverFunction(F, Worklist, nullptr, AC, TLI, DT,
}
PreservedAnalyses EarlyCSEPass::run(Function &F,
- AnalysisManager<Function> *AM) {
- auto &TLI = AM->getResult<TargetLibraryAnalysis>(F);
- auto &TTI = AM->getResult<TargetIRAnalysis>(F);
- auto &DT = AM->getResult<DominatorTreeAnalysis>(F);
- auto &AC = AM->getResult<AssumptionAnalysis>(F);
+ AnalysisManager<Function> &AM) {
+ auto &TLI = AM.getResult<TargetLibraryAnalysis>(F);
+ auto &TTI = AM.getResult<TargetIRAnalysis>(F);
+ auto &DT = AM.getResult<DominatorTreeAnalysis>(F);
+ auto &AC = AM.getResult<AssumptionAnalysis>(F);
EarlyCSE CSE(TLI, TTI, DT, AC);
// GVN Pass
//===----------------------------------------------------------------------===//
-PreservedAnalyses GVN::run(Function &F, AnalysisManager<Function> *AM) {
- bool Changed = runImpl(F, AM->getResult<AssumptionAnalysis>(F),
- AM->getResult<DominatorTreeAnalysis>(F),
- AM->getResult<TargetLibraryAnalysis>(F),
- AM->getResult<AAManager>(F),
- &AM->getResult<MemoryDependenceAnalysis>(F));
+PreservedAnalyses GVN::run(Function &F, AnalysisManager<Function> &AM) {
+ bool Changed = runImpl(F, AM.getResult<AssumptionAnalysis>(F),
+ AM.getResult<DominatorTreeAnalysis>(F),
+ AM.getResult<TargetLibraryAnalysis>(F),
+ AM.getResult<AAManager>(F),
+ &AM.getResult<MemoryDependenceAnalysis>(F));
return Changed ? PreservedAnalyses::none() : PreservedAnalyses::all();
}
return Changed ? PreservedAnalyses::none() : PreservedAnalyses::all();
}
-PreservedAnalyses SROA::run(Function &F, AnalysisManager<Function> *AM) {
- return runImpl(F, AM->getResult<DominatorTreeAnalysis>(F),
- AM->getResult<AssumptionAnalysis>(F));
+PreservedAnalyses SROA::run(Function &F, AnalysisManager<Function> &AM) {
+ return runImpl(F, AM.getResult<DominatorTreeAnalysis>(F),
+ AM.getResult<AssumptionAnalysis>(F));
}
/// A legacy pass for the legacy pass manager that wraps the \c SROA pass.
: BonusInstThreshold(BonusInstThreshold) {}
PreservedAnalyses SimplifyCFGPass::run(Function &F,
- AnalysisManager<Function> *AM) {
- auto &TTI = AM->getResult<TargetIRAnalysis>(F);
- auto &AC = AM->getResult<AssumptionAnalysis>(F);
+ AnalysisManager<Function> &AM) {
+ auto &TTI = AM.getResult<TargetIRAnalysis>(F);
+ auto &AC = AM.getResult<AssumptionAnalysis>(F);
if (simplifyFunctionCFG(F, TTI, &AC, BonusInstThreshold))
return PreservedAnalyses::none();
cl::PrintOptionValues();
// Now that we have all of the passes ready, run them.
- MPM.run(M, &MAM);
+ MPM.run(M, MAM);
// Declare success.
if (OK != OK_NoOutput)
TestModuleAnalysis(int &Runs) : Runs(Runs) {}
- Result run(Module &M, ModuleAnalysisManager *AM) {
+ Result run(Module &M, ModuleAnalysisManager &AM) {
++Runs;
return Result(M.size());
}
TestSCCAnalysis(int &Runs) : Runs(Runs) {}
- Result run(LazyCallGraph::SCC &C, CGSCCAnalysisManager *AM) {
+ Result run(LazyCallGraph::SCC &C, CGSCCAnalysisManager &AM) {
++Runs;
return Result(C.size());
}
TestFunctionAnalysis(int &Runs) : Runs(Runs) {}
- Result run(Function &F, FunctionAnalysisManager *AM) {
+ Result run(Function &F, FunctionAnalysisManager &AM) {
++Runs;
int Count = 0;
for (Instruction &I : instructions(F)) {
TestImmutableFunctionAnalysis(int &Runs) : Runs(Runs) {}
- Result run(Function &F, FunctionAnalysisManager *AM) {
+ Result run(Function &F, FunctionAnalysisManager &AM) {
++Runs;
return Result();
}
struct TestModulePass {
TestModulePass(int &RunCount) : RunCount(RunCount) {}
- PreservedAnalyses run(Module &M, ModuleAnalysisManager *AM) {
+ PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM) {
++RunCount;
- (void)AM->getResult<TestModuleAnalysis>(M);
+ (void)AM.getResult<TestModuleAnalysis>(M);
return PreservedAnalyses::all();
}
AnalyzedModuleFunctionCount(AnalyzedModuleFunctionCount),
OnlyUseCachedResults(OnlyUseCachedResults) {}
- PreservedAnalyses run(LazyCallGraph::SCC &C, CGSCCAnalysisManager *AM) {
+ PreservedAnalyses run(LazyCallGraph::SCC &C, CGSCCAnalysisManager &AM) {
++RunCount;
const ModuleAnalysisManager &MAM =
- AM->getResult<ModuleAnalysisManagerCGSCCProxy>(C).getManager();
+ AM.getResult<ModuleAnalysisManagerCGSCCProxy>(C).getManager();
FunctionAnalysisManager &FAM =
- AM->getResult<FunctionAnalysisManagerCGSCCProxy>(C).getManager();
+ AM.getResult<FunctionAnalysisManagerCGSCCProxy>(C).getManager();
if (TestModuleAnalysis::Result *TMA =
MAM.getCachedResult<TestModuleAnalysis>(
*C.begin()->getFunction().getParent()))
if (OnlyUseCachedResults) {
// Hack to force the use of the cached interface.
- if (TestSCCAnalysis::Result *AR =
- AM->getCachedResult<TestSCCAnalysis>(C))
+ if (TestSCCAnalysis::Result *AR = AM.getCachedResult<TestSCCAnalysis>(C))
AnalyzedSCCFunctionCount += AR->FunctionCount;
for (LazyCallGraph::Node &N : C)
if (TestFunctionAnalysis::Result *FAR =
AnalyzedInstrCount += FAR->InstructionCount;
} else {
// Typical path just runs the analysis as needed.
- TestSCCAnalysis::Result &AR = AM->getResult<TestSCCAnalysis>(C);
+ TestSCCAnalysis::Result &AR = AM.getResult<TestSCCAnalysis>(C);
AnalyzedSCCFunctionCount += AR.FunctionCount;
for (LazyCallGraph::Node &N : C) {
TestFunctionAnalysis::Result &FAR =
CGPM1.addPass(createCGSCCToFunctionPassAdaptor(std::move(FPM1)));
MPM.addPass(createModuleToPostOrderCGSCCPassAdaptor(std::move(CGPM1)));
- MPM.run(*M, &MAM);
+ MPM.run(*M, MAM);
EXPECT_EQ(1, ModulePassRunCount1);
TestLoopAnalysis(int &Runs) : Runs(Runs) {}
/// \brief Run the analysis pass over the loop and return a result.
- Result run(Loop &L, AnalysisManager<Loop> *AM) {
+ Result run(Loop &L, AnalysisManager<Loop> &AM) {
++Runs;
int Count = 0;
: VisitedLoops(VisitedLoops), AnalyzedBlockCount(AnalyzedBlockCount),
OnlyUseCachedResults(OnlyUseCachedResults) {}
- PreservedAnalyses run(Loop &L, AnalysisManager<Loop> *AM) {
+ PreservedAnalyses run(Loop &L, AnalysisManager<Loop> &AM) {
VisitedLoops.push_back(L.getName());
if (OnlyUseCachedResults) {
// Hack to force the use of the cached interface.
- if (auto *AR = AM->getCachedResult<TestLoopAnalysis>(L))
+ if (auto *AR = AM.getCachedResult<TestLoopAnalysis>(L))
AnalyzedBlockCount += AR->BlockCount;
} else {
// Typical path just runs the analysis as needed.
- auto &AR = AM->getResult<TestLoopAnalysis>(L);
+ auto &AR = AM.getResult<TestLoopAnalysis>(L);
AnalyzedBlockCount += AR.BlockCount;
}
public:
TestLoopInvalidatingPass(StringRef LoopName) : Name(LoopName) {}
- PreservedAnalyses run(Loop &L, AnalysisManager<Loop> *AM) {
+ PreservedAnalyses run(Loop &L, AnalysisManager<Loop> &AM) {
return L.getName() == Name ? PreservedAnalyses::none()
: PreservedAnalyses::all();
}
}
MPM.addPass(createModuleToFunctionPassAdaptor(std::move(FPM)));
- MPM.run(*M, &MAM);
+ MPM.run(*M, MAM);
StringRef ExpectedLoops[] = {"loop.0.0", "loop.0.1", "loop.0", "loop.g.0"};
TestFunctionAnalysis(int &Runs) : Runs(Runs) {}
/// \brief Run the analysis pass over the function and return a result.
- Result run(Function &F, FunctionAnalysisManager *AM) {
+ Result run(Function &F, FunctionAnalysisManager &AM) {
++Runs;
int Count = 0;
for (Function::iterator BBI = F.begin(), BBE = F.end(); BBI != BBE; ++BBI)
TestModuleAnalysis(int &Runs) : Runs(Runs) {}
- Result run(Module &M, ModuleAnalysisManager *AM) {
+ Result run(Module &M, ModuleAnalysisManager &AM) {
++Runs;
int Count = 0;
for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
struct TestMinPreservingModulePass
: PassInfoMixin<TestMinPreservingModulePass> {
- PreservedAnalyses run(Module &M, ModuleAnalysisManager *AM) {
+ PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM) {
PreservedAnalyses PA;
// Force running an analysis.
- (void)AM->getResult<TestModuleAnalysis>(M);
+ (void)AM.getResult<TestModuleAnalysis>(M);
PA.preserve<FunctionAnalysisManagerModuleProxy>();
return PA;
AnalyzedFunctionCount(AnalyzedFunctionCount),
OnlyUseCachedResults(OnlyUseCachedResults) {}
- PreservedAnalyses run(Function &F, FunctionAnalysisManager *AM) {
+ PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM) {
++RunCount;
const ModuleAnalysisManager &MAM =
- AM->getResult<ModuleAnalysisManagerFunctionProxy>(F).getManager();
+ AM.getResult<ModuleAnalysisManagerFunctionProxy>(F).getManager();
if (TestModuleAnalysis::Result *TMA =
MAM.getCachedResult<TestModuleAnalysis>(*F.getParent()))
AnalyzedFunctionCount += TMA->FunctionCount;
if (OnlyUseCachedResults) {
// Hack to force the use of the cached interface.
if (TestFunctionAnalysis::Result *AR =
- AM->getCachedResult<TestFunctionAnalysis>(F))
+ AM.getCachedResult<TestFunctionAnalysis>(F))
AnalyzedInstrCount += AR->InstructionCount;
} else {
// Typical path just runs the analysis as needed.
- TestFunctionAnalysis::Result &AR = AM->getResult<TestFunctionAnalysis>(F);
+ TestFunctionAnalysis::Result &AR = AM.getResult<TestFunctionAnalysis>(F);
AnalyzedInstrCount += AR.InstructionCount;
}
MPM.addPass(createModuleToFunctionPassAdaptor(std::move(FPM)));
}
- MPM.run(*M, &MAM);
+ MPM.run(*M, MAM);
// Validate module pass counters.
EXPECT_EQ(1, ModulePassRunCount);