From 30a073029c37b1c4fb49ad517677a9c74d1e6802 Mon Sep 17 00:00:00 2001 From: Chandler Carruth Date: Fri, 11 Mar 2016 10:33:22 +0000 Subject: [PATCH] [PM] Rename the CRTP mixin base classes for the new pass manager to clarify their purpose. Firstly, call them "...Mixin" types so it is clear that there is no type hierarchy being formed here. Secondly, use the term 'Info' to clarify that they aren't adding any interesting *semantics* to the passes or analyses, just exposing APIs used by the management layer to get information about the pass or analysis. Thanks to Manuel for helping pin down the naming confusion here and come up with effective names to address it. In case you already have some out-of-tree stuff, the following should be roughly what you want to update: perl -pi -e 's/\b(Pass|Analysis)Base\b/\1InfoMixin/g' llvm-svn: 263217 --- llvm/include/llvm/Analysis/AliasAnalysis.h | 4 +-- .../include/llvm/Analysis/AliasAnalysisEvaluator.h | 2 +- llvm/include/llvm/Analysis/AssumptionCache.h | 6 ++-- llvm/include/llvm/Analysis/BasicAliasAnalysis.h | 4 +-- llvm/include/llvm/Analysis/CFLAliasAnalysis.h | 4 +-- llvm/include/llvm/Analysis/CGSCCPassManager.h | 4 +-- llvm/include/llvm/Analysis/CallGraph.h | 6 ++-- llvm/include/llvm/Analysis/DominanceFrontier.h | 6 ++-- llvm/include/llvm/Analysis/GlobalsModRef.h | 4 +-- llvm/include/llvm/Analysis/LazyCallGraph.h | 7 +++-- llvm/include/llvm/Analysis/LoopInfo.h | 8 ++--- llvm/include/llvm/Analysis/LoopPassManager.h | 2 +- .../llvm/Analysis/MemoryDependenceAnalysis.h | 5 +-- llvm/include/llvm/Analysis/ObjCARCAliasAnalysis.h | 4 +-- llvm/include/llvm/Analysis/PostDominators.h | 6 ++-- llvm/include/llvm/Analysis/RegionInfo.h | 8 ++--- llvm/include/llvm/Analysis/ScalarEvolution.h | 7 +++-- .../llvm/Analysis/ScalarEvolutionAliasAnalysis.h | 4 +-- llvm/include/llvm/Analysis/ScopedNoAliasAA.h | 4 +-- llvm/include/llvm/Analysis/TargetLibraryInfo.h | 4 +-- llvm/include/llvm/Analysis/TargetTransformInfo.h | 4 +-- .../include/llvm/Analysis/TypeBasedAliasAnalysis.h | 4 +-- llvm/include/llvm/IR/Dominators.h | 9 +++--- llvm/include/llvm/IR/PassManager.h | 36 +++++++++++++--------- llvm/include/llvm/IR/Verifier.h | 2 +- .../llvm/Transforms/IPO/ForceFunctionAttrs.h | 2 +- llvm/include/llvm/Transforms/IPO/FunctionAttrs.h | 2 +- .../llvm/Transforms/IPO/InferFunctionAttrs.h | 2 +- .../llvm/Transforms/IPO/StripDeadPrototypes.h | 2 +- .../llvm/Transforms/InstCombine/InstCombine.h | 2 +- llvm/include/llvm/Transforms/Scalar/ADCE.h | 2 +- llvm/include/llvm/Transforms/Scalar/EarlyCSE.h | 2 +- llvm/include/llvm/Transforms/Scalar/GVN.h | 2 +- .../llvm/Transforms/Scalar/LowerExpectIntrinsic.h | 2 +- llvm/include/llvm/Transforms/Scalar/SROA.h | 2 +- llvm/include/llvm/Transforms/Scalar/SimplifyCFG.h | 2 +- llvm/lib/Passes/PassBuilder.cpp | 16 +++++----- llvm/unittests/IR/PassManagerTest.cpp | 20 ++++++------ 38 files changed, 113 insertions(+), 99 deletions(-) diff --git a/llvm/include/llvm/Analysis/AliasAnalysis.h b/llvm/include/llvm/Analysis/AliasAnalysis.h index 53c0b18..424ea0f 100644 --- a/llvm/include/llvm/Analysis/AliasAnalysis.h +++ b/llvm/include/llvm/Analysis/AliasAnalysis.h @@ -838,7 +838,7 @@ bool isIdentifiedFunctionLocal(const Value *V); /// This manager effectively wraps the AnalysisManager for registering alias /// analyses. When you register your alias analysis with this manager, it will /// ensure the analysis itself is registered with its AnalysisManager. -class AAManager : public AnalysisBase { +class AAManager : public AnalysisInfoMixin { public: typedef AAResults Result; @@ -874,7 +874,7 @@ public: } private: - friend AnalysisBase; + friend AnalysisInfoMixin; static char PassID; SmallVector &AM, diff --git a/llvm/include/llvm/Analysis/AliasAnalysisEvaluator.h b/llvm/include/llvm/Analysis/AliasAnalysisEvaluator.h index 2021fdf..2b9573e 100644 --- a/llvm/include/llvm/Analysis/AliasAnalysisEvaluator.h +++ b/llvm/include/llvm/Analysis/AliasAnalysisEvaluator.h @@ -31,7 +31,7 @@ namespace llvm { class AAResults; -class AAEvaluator : public PassBase { +class AAEvaluator : public PassInfoMixin { int64_t FunctionCount; int64_t NoAliasCount, MayAliasCount, PartialAliasCount, MustAliasCount; int64_t NoModRefCount, ModCount, RefCount, ModRefCount; diff --git a/llvm/include/llvm/Analysis/AssumptionCache.h b/llvm/include/llvm/Analysis/AssumptionCache.h index 9c2737c..f76a737 100644 --- a/llvm/include/llvm/Analysis/AssumptionCache.h +++ b/llvm/include/llvm/Analysis/AssumptionCache.h @@ -93,8 +93,8 @@ public: /// /// This analysis is intended for use with the new pass manager and will vend /// assumption caches for a given function. -class AssumptionAnalysis : public AnalysisBase { - friend AnalysisBase; +class AssumptionAnalysis : public AnalysisInfoMixin { + friend AnalysisInfoMixin; static char PassID; public: @@ -110,7 +110,7 @@ public: }; /// \brief Printer pass for the \c AssumptionAnalysis results. -class AssumptionPrinterPass : public PassBase { +class AssumptionPrinterPass : public PassInfoMixin { raw_ostream &OS; public: diff --git a/llvm/include/llvm/Analysis/BasicAliasAnalysis.h b/llvm/include/llvm/Analysis/BasicAliasAnalysis.h index bd71eae..43752c7 100644 --- a/llvm/include/llvm/Analysis/BasicAliasAnalysis.h +++ b/llvm/include/llvm/Analysis/BasicAliasAnalysis.h @@ -180,8 +180,8 @@ private: }; /// Analysis pass providing a never-invalidated alias analysis result. -class BasicAA : public AnalysisBase { - friend AnalysisBase; +class BasicAA : public AnalysisInfoMixin { + friend AnalysisInfoMixin; static char PassID; public: diff --git a/llvm/include/llvm/Analysis/CFLAliasAnalysis.h b/llvm/include/llvm/Analysis/CFLAliasAnalysis.h index 1e7c3b7..0884870 100644 --- a/llvm/include/llvm/Analysis/CFLAliasAnalysis.h +++ b/llvm/include/llvm/Analysis/CFLAliasAnalysis.h @@ -109,8 +109,8 @@ private: /// /// FIXME: We really should refactor CFL to use the analysis more heavily, and /// in particular to leverage invalidation to trigger re-computation of sets. -class CFLAA : public AnalysisBase { - friend AnalysisBase; +class CFLAA : public AnalysisInfoMixin { + friend AnalysisInfoMixin; static char PassID; public: diff --git a/llvm/include/llvm/Analysis/CGSCCPassManager.h b/llvm/include/llvm/Analysis/CGSCCPassManager.h index 4da0874..d69ee3f4 100644 --- a/llvm/include/llvm/Analysis/CGSCCPassManager.h +++ b/llvm/include/llvm/Analysis/CGSCCPassManager.h @@ -65,7 +65,7 @@ typedef OuterAnalysisManagerProxy /// within this run safely. template class ModuleToPostOrderCGSCCPassAdaptor - : public PassBase> { + : public PassInfoMixin> { public: explicit ModuleToPostOrderCGSCCPassAdaptor(CGSCCPassT Pass) : Pass(std::move(Pass)) {} @@ -159,7 +159,7 @@ typedef OuterAnalysisManagerProxy /// within this run safely. template class CGSCCToFunctionPassAdaptor - : public PassBase> { + : public PassInfoMixin> { public: explicit CGSCCToFunctionPassAdaptor(FunctionPassT Pass) : Pass(std::move(Pass)) {} diff --git a/llvm/include/llvm/Analysis/CallGraph.h b/llvm/include/llvm/Analysis/CallGraph.h index 45474f0..d4f9d25 100644 --- a/llvm/include/llvm/Analysis/CallGraph.h +++ b/llvm/include/llvm/Analysis/CallGraph.h @@ -295,8 +295,8 @@ private: /// This class implements the concept of an analysis pass used by the \c /// ModuleAnalysisManager to run an analysis over a module and cache the /// resulting data. -class CallGraphAnalysis : public AnalysisBase { - friend AnalysisBase; +class CallGraphAnalysis : public AnalysisInfoMixin { + friend AnalysisInfoMixin; static char PassID; public: @@ -310,7 +310,7 @@ public: }; /// \brief Printer pass for the \c CallGraphAnalysis results. -class CallGraphPrinterPass : public PassBase { +class CallGraphPrinterPass : public PassInfoMixin { raw_ostream &OS; public: diff --git a/llvm/include/llvm/Analysis/DominanceFrontier.h b/llvm/include/llvm/Analysis/DominanceFrontier.h index 197d365..65940e9 100644 --- a/llvm/include/llvm/Analysis/DominanceFrontier.h +++ b/llvm/include/llvm/Analysis/DominanceFrontier.h @@ -169,8 +169,8 @@ extern template class ForwardDominanceFrontierBase; /// \brief Analysis pass which computes a \c DominanceFrontier. class DominanceFrontierAnalysis - : public AnalysisBase { - friend AnalysisBase; + : public AnalysisInfoMixin { + friend AnalysisInfoMixin; static char PassID; public: @@ -183,7 +183,7 @@ public: /// \brief Printer pass for the \c DominanceFrontier. class DominanceFrontierPrinterPass - : public PassBase { + : public PassInfoMixin { raw_ostream &OS; public: diff --git a/llvm/include/llvm/Analysis/GlobalsModRef.h b/llvm/include/llvm/Analysis/GlobalsModRef.h index c8eea06..555b25d 100644 --- a/llvm/include/llvm/Analysis/GlobalsModRef.h +++ b/llvm/include/llvm/Analysis/GlobalsModRef.h @@ -118,8 +118,8 @@ private: }; /// Analysis pass providing a never-invalidated alias analysis result. -class GlobalsAA : public AnalysisBase { - friend AnalysisBase; +class GlobalsAA : public AnalysisInfoMixin { + friend AnalysisInfoMixin; static char PassID; public: diff --git a/llvm/include/llvm/Analysis/LazyCallGraph.h b/llvm/include/llvm/Analysis/LazyCallGraph.h index 89f8cf2..d904732 100644 --- a/llvm/include/llvm/Analysis/LazyCallGraph.h +++ b/llvm/include/llvm/Analysis/LazyCallGraph.h @@ -895,8 +895,8 @@ template <> struct GraphTraits { }; /// An analysis pass which computes the call graph for a module. -class LazyCallGraphAnalysis : public AnalysisBase { - friend AnalysisBase; +class LazyCallGraphAnalysis : public AnalysisInfoMixin { + friend AnalysisInfoMixin; static char PassID; public: @@ -913,7 +913,8 @@ public: /// A pass which prints the call graph to a \c raw_ostream. /// /// This is primarily useful for testing the analysis. -class LazyCallGraphPrinterPass : public PassBase { +class LazyCallGraphPrinterPass + : public PassInfoMixin { raw_ostream &OS; public: diff --git a/llvm/include/llvm/Analysis/LoopInfo.h b/llvm/include/llvm/Analysis/LoopInfo.h index 2ea8d28..de0e3a5 100644 --- a/llvm/include/llvm/Analysis/LoopInfo.h +++ b/llvm/include/llvm/Analysis/LoopInfo.h @@ -787,8 +787,8 @@ template <> struct GraphTraits { }; /// \brief Analysis pass that exposes the \c LoopInfo for a function. -class LoopAnalysis : public AnalysisBase { - friend AnalysisBase; +class LoopAnalysis : public AnalysisInfoMixin { + friend AnalysisInfoMixin; static char PassID; public: @@ -798,7 +798,7 @@ public: }; /// \brief Printer pass for the \c LoopAnalysis results. -class LoopPrinterPass : public PassBase { +class LoopPrinterPass : public PassInfoMixin { raw_ostream &OS; public: @@ -833,7 +833,7 @@ public: }; /// \brief Pass for printing a loop's contents as LLVM's text IR assembly. -class PrintLoopPass : public PassBase { +class PrintLoopPass : public PassInfoMixin { raw_ostream &OS; std::string Banner; diff --git a/llvm/include/llvm/Analysis/LoopPassManager.h b/llvm/include/llvm/Analysis/LoopPassManager.h index c3a6c4e..1b723c3 100644 --- a/llvm/include/llvm/Analysis/LoopPassManager.h +++ b/llvm/include/llvm/Analysis/LoopPassManager.h @@ -57,7 +57,7 @@ typedef OuterAnalysisManagerProxy /// LoopAnalysisManager to be used within this run safely. template class FunctionToLoopPassAdaptor - : public PassBase> { + : public PassInfoMixin> { public: explicit FunctionToLoopPassAdaptor(LoopPassT Pass) : Pass(std::move(Pass)) {} diff --git a/llvm/include/llvm/Analysis/MemoryDependenceAnalysis.h b/llvm/include/llvm/Analysis/MemoryDependenceAnalysis.h index b337650..7c8bd2f 100644 --- a/llvm/include/llvm/Analysis/MemoryDependenceAnalysis.h +++ b/llvm/include/llvm/Analysis/MemoryDependenceAnalysis.h @@ -471,8 +471,9 @@ private: /// /// This is essentially a no-op because the results are computed entirely /// lazily. -class MemoryDependenceAnalysis : public AnalysisBase { - friend AnalysisBase; +class MemoryDependenceAnalysis + : public AnalysisInfoMixin { + friend AnalysisInfoMixin; static char PassID; public: diff --git a/llvm/include/llvm/Analysis/ObjCARCAliasAnalysis.h b/llvm/include/llvm/Analysis/ObjCARCAliasAnalysis.h index 0370b638..06a2ce7 100644 --- a/llvm/include/llvm/Analysis/ObjCARCAliasAnalysis.h +++ b/llvm/include/llvm/Analysis/ObjCARCAliasAnalysis.h @@ -61,8 +61,8 @@ public: }; /// Analysis pass providing a never-invalidated alias analysis result. -class ObjCARCAA : public AnalysisBase { - friend AnalysisBase; +class ObjCARCAA : public AnalysisInfoMixin { + friend AnalysisInfoMixin; static char PassID; public: diff --git a/llvm/include/llvm/Analysis/PostDominators.h b/llvm/include/llvm/Analysis/PostDominators.h index 22d1b23..dd6e9d3 100644 --- a/llvm/include/llvm/Analysis/PostDominators.h +++ b/llvm/include/llvm/Analysis/PostDominators.h @@ -38,8 +38,8 @@ struct PostDominatorTree : public DominatorTreeBase { /// \brief Analysis pass which computes a \c PostDominatorTree. class PostDominatorTreeAnalysis - : public AnalysisBase { - friend AnalysisBase; + : public AnalysisInfoMixin { + friend AnalysisInfoMixin; static char PassID; public: @@ -53,7 +53,7 @@ public: /// \brief Printer pass for the \c PostDominatorTree. class PostDominatorTreePrinterPass - : public PassBase { + : public PassInfoMixin { raw_ostream &OS; public: diff --git a/llvm/include/llvm/Analysis/RegionInfo.h b/llvm/include/llvm/Analysis/RegionInfo.h index 3b3a75c..c3cbc9e 100644 --- a/llvm/include/llvm/Analysis/RegionInfo.h +++ b/llvm/include/llvm/Analysis/RegionInfo.h @@ -923,8 +923,8 @@ public: }; /// \brief Analysis pass that exposes the \c RegionInfo for a function. -class RegionInfoAnalysis : public AnalysisBase { - friend AnalysisBase; +class RegionInfoAnalysis : public AnalysisInfoMixin { + friend AnalysisInfoMixin; static char PassID; public: @@ -934,7 +934,7 @@ public: }; /// \brief Printer pass for the \c RegionInfo. -class RegionInfoPrinterPass : public PassBase { +class RegionInfoPrinterPass : public PassInfoMixin { raw_ostream &OS; public: @@ -943,7 +943,7 @@ public: }; /// \brief Verifier pass for the \c RegionInfo. -struct RegionInfoVerifierPass : PassBase { +struct RegionInfoVerifierPass : PassInfoMixin { PreservedAnalyses run(Function &F, AnalysisManager *AM); }; diff --git a/llvm/include/llvm/Analysis/ScalarEvolution.h b/llvm/include/llvm/Analysis/ScalarEvolution.h index 7d68c42..040b16d 100644 --- a/llvm/include/llvm/Analysis/ScalarEvolution.h +++ b/llvm/include/llvm/Analysis/ScalarEvolution.h @@ -1430,8 +1430,9 @@ namespace llvm { }; /// \brief Analysis pass that exposes the \c ScalarEvolution for a function. - class ScalarEvolutionAnalysis : public AnalysisBase { - friend AnalysisBase; + class ScalarEvolutionAnalysis + : public AnalysisInfoMixin { + friend AnalysisInfoMixin; static char PassID; public: @@ -1442,7 +1443,7 @@ namespace llvm { /// \brief Printer pass for the \c ScalarEvolutionAnalysis results. class ScalarEvolutionPrinterPass - : public PassBase { + : public PassInfoMixin { raw_ostream &OS; public: diff --git a/llvm/include/llvm/Analysis/ScalarEvolutionAliasAnalysis.h b/llvm/include/llvm/Analysis/ScalarEvolutionAliasAnalysis.h index 96ce5c6..89e4a00 100644 --- a/llvm/include/llvm/Analysis/ScalarEvolutionAliasAnalysis.h +++ b/llvm/include/llvm/Analysis/ScalarEvolutionAliasAnalysis.h @@ -38,8 +38,8 @@ private: }; /// Analysis pass providing a never-invalidated alias analysis result. -class SCEVAA : public AnalysisBase { - friend AnalysisBase; +class SCEVAA : public AnalysisInfoMixin { + friend AnalysisInfoMixin; static char PassID; public: diff --git a/llvm/include/llvm/Analysis/ScopedNoAliasAA.h b/llvm/include/llvm/Analysis/ScopedNoAliasAA.h index 08cb94b..a5cba3f 100644 --- a/llvm/include/llvm/Analysis/ScopedNoAliasAA.h +++ b/llvm/include/llvm/Analysis/ScopedNoAliasAA.h @@ -47,8 +47,8 @@ private: }; /// Analysis pass providing a never-invalidated alias analysis result. -class ScopedNoAliasAA : public AnalysisBase { - friend AnalysisBase; +class ScopedNoAliasAA : public AnalysisInfoMixin { + friend AnalysisInfoMixin; static char PassID; public: diff --git a/llvm/include/llvm/Analysis/TargetLibraryInfo.h b/llvm/include/llvm/Analysis/TargetLibraryInfo.h index d7d0878..bc4ac00 100644 --- a/llvm/include/llvm/Analysis/TargetLibraryInfo.h +++ b/llvm/include/llvm/Analysis/TargetLibraryInfo.h @@ -262,7 +262,7 @@ public: /// /// Note that this pass's result cannot be invalidated, it is immutable for the /// life of the module. -class TargetLibraryAnalysis : public AnalysisBase { +class TargetLibraryAnalysis : public AnalysisInfoMixin { public: typedef TargetLibraryInfo Result; @@ -292,7 +292,7 @@ public: TargetLibraryInfo run(Function &F); private: - friend AnalysisBase; + friend AnalysisInfoMixin; static char PassID; Optional PresetInfoImpl; diff --git a/llvm/include/llvm/Analysis/TargetTransformInfo.h b/llvm/include/llvm/Analysis/TargetTransformInfo.h index 78ea97a..d8b5d11 100644 --- a/llvm/include/llvm/Analysis/TargetTransformInfo.h +++ b/llvm/include/llvm/Analysis/TargetTransformInfo.h @@ -889,7 +889,7 @@ TargetTransformInfo::TargetTransformInfo(T Impl) /// is done in a subtarget specific way and LLVM supports compiling different /// functions targeting different subtargets in order to support runtime /// dispatch according to the observed subtarget. -class TargetIRAnalysis : public AnalysisBase { +class TargetIRAnalysis : public AnalysisInfoMixin { public: typedef TargetTransformInfo Result; @@ -922,7 +922,7 @@ public: Result run(const Function &F); private: - friend AnalysisBase; + friend AnalysisInfoMixin; static char PassID; /// \brief The callback used to produce a result. diff --git a/llvm/include/llvm/Analysis/TypeBasedAliasAnalysis.h b/llvm/include/llvm/Analysis/TypeBasedAliasAnalysis.h index 2480d94..9b49750 100644 --- a/llvm/include/llvm/Analysis/TypeBasedAliasAnalysis.h +++ b/llvm/include/llvm/Analysis/TypeBasedAliasAnalysis.h @@ -48,8 +48,8 @@ private: }; /// Analysis pass providing a never-invalidated alias analysis result. -class TypeBasedAA : public AnalysisBase { - friend AnalysisBase; +class TypeBasedAA : public AnalysisInfoMixin { + friend AnalysisInfoMixin; static char PassID; public: diff --git a/llvm/include/llvm/IR/Dominators.h b/llvm/include/llvm/IR/Dominators.h index 1cb9202..8efff1c 100644 --- a/llvm/include/llvm/IR/Dominators.h +++ b/llvm/include/llvm/IR/Dominators.h @@ -182,8 +182,8 @@ template <> struct GraphTraits }; /// \brief Analysis pass which computes a \c DominatorTree. -class DominatorTreeAnalysis : public AnalysisBase { - friend AnalysisBase; +class DominatorTreeAnalysis : public AnalysisInfoMixin { + friend AnalysisInfoMixin; static char PassID; public: @@ -195,7 +195,8 @@ public: }; /// \brief Printer pass for the \c DominatorTree. -class DominatorTreePrinterPass : public PassBase { +class DominatorTreePrinterPass + : public PassInfoMixin { raw_ostream &OS; public: @@ -204,7 +205,7 @@ public: }; /// \brief Verifier pass for the \c DominatorTree. -struct DominatorTreeVerifierPass : PassBase { +struct DominatorTreeVerifierPass : PassInfoMixin { PreservedAnalyses run(Function &F, AnalysisManager *AM); }; diff --git a/llvm/include/llvm/IR/PassManager.h b/llvm/include/llvm/IR/PassManager.h index 02dfb65..6ed6a36 100644 --- a/llvm/include/llvm/IR/PassManager.h +++ b/llvm/include/llvm/IR/PassManager.h @@ -167,10 +167,11 @@ private: // Forward declare the analysis manager template. template class AnalysisManager; -/// A CRTP mix-in base class to help define types that are valid passes. +/// A CRTP mix-in to automatically provide informational APIs needed for +/// passes. /// /// This provides some boiler plate for types that are passes. -template struct PassBase { +template struct PassInfoMixin { /// Returns the name of the derived pass type. static StringRef name() { StringRef Name = getTypeName(); @@ -180,10 +181,14 @@ template struct PassBase { } }; -/// A CRTP mix-in base class to help define types that are valid analyses. +/// A CRTP mix-in to automatically provide informational APIs needed for +/// analysis passes. /// -/// This provides some boiler plate for types that are analysis passes. -template struct AnalysisBase : PassBase { +/// This provides some boiler plate for types that are analysis passes. It +/// automatically mixes in \c PassInfoMixin and adds informational APIs +/// specifically used for analyses. +template +struct AnalysisInfoMixin : PassInfoMixin { /// Returns an opaque, unique ID for this pass type. /// /// Note that this requires the derived type provide a static member whose @@ -212,7 +217,7 @@ template struct AnalysisBase : PassBase { /// manager's invalidation routine with the PreservedAnalyses of each pass it /// runs. template -class PassManager : public PassBase> { +class PassManager : public PassInfoMixin> { public: /// \brief Construct a pass manager. /// @@ -663,7 +668,7 @@ typedef AnalysisManager FunctionAnalysisManager; /// provides. template class InnerAnalysisManagerProxy - : public AnalysisBase< + : public AnalysisInfoMixin< InnerAnalysisManagerProxy> { public: class Result { @@ -746,7 +751,8 @@ public: Result run(IRUnitT &IR) { return Result(*AM); } private: - friend AnalysisBase>; + friend AnalysisInfoMixin< + InnerAnalysisManagerProxy>; static char PassID; AnalysisManagerT *AM; @@ -775,7 +781,7 @@ typedef InnerAnalysisManagerProxy /// returned PreservedAnalysis set. template class OuterAnalysisManagerProxy - : public AnalysisBase< + : public AnalysisInfoMixin< OuterAnalysisManagerProxy> { public: /// \brief Result proxy object for \c OuterAnalysisManagerProxy. @@ -818,7 +824,8 @@ public: Result run(IRUnitT &) { return Result(*AM); } private: - friend AnalysisBase>; + friend AnalysisInfoMixin< + OuterAnalysisManagerProxy>; static char PassID; const AnalysisManagerT *AM; @@ -857,7 +864,7 @@ typedef OuterAnalysisManagerProxy /// violate this principle. template class ModuleToFunctionPassAdaptor - : public PassBase> { + : public PassInfoMixin> { public: explicit ModuleToFunctionPassAdaptor(FunctionPassT Pass) : Pass(std::move(Pass)) {} @@ -929,7 +936,7 @@ createModuleToFunctionPassAdaptor(FunctionPassT Pass) { /// This is a no-op pass which simply forces a specific analysis pass's result /// to be available when it is run. template -struct RequireAnalysisPass : PassBase> { +struct RequireAnalysisPass : PassInfoMixin> { /// \brief Run this pass over some unit of IR. /// /// This pass can be run over any unit of IR and use any analysis manager @@ -951,7 +958,8 @@ struct RequireAnalysisPass : PassBase> { /// This is a no-op pass which simply forces a specific analysis result to be /// invalidated when it is run. template -struct InvalidateAnalysisPass : PassBase> { +struct InvalidateAnalysisPass + : PassInfoMixin> { /// \brief Run this pass over some unit of IR. /// /// This pass can be run over any unit of IR and use any analysis manager @@ -973,7 +981,7 @@ struct InvalidateAnalysisPass : PassBase> { /// /// As a consequence fo not preserving any analyses, this pass will force all /// analysis passes to be re-run to produce fresh results if any are needed. -struct InvalidateAllAnalysesPass : PassBase { +struct InvalidateAllAnalysesPass : PassInfoMixin { /// \brief Run this pass over some unit of IR. template PreservedAnalyses run(IRUnitT &Arg) { return PreservedAnalyses::none(); diff --git a/llvm/include/llvm/IR/Verifier.h b/llvm/include/llvm/IR/Verifier.h index a0c75de..4b00b57 100644 --- a/llvm/include/llvm/IR/Verifier.h +++ b/llvm/include/llvm/IR/Verifier.h @@ -60,7 +60,7 @@ bool verifyModule(const Module &M, raw_ostream *OS = nullptr); /// nothing to do with \c VerifierPass. FunctionPass *createVerifierPass(bool FatalErrors = true); -class VerifierPass : public PassBase { +class VerifierPass : public PassInfoMixin { bool FatalErrors; public: diff --git a/llvm/include/llvm/Transforms/IPO/ForceFunctionAttrs.h b/llvm/include/llvm/Transforms/IPO/ForceFunctionAttrs.h index cf15f46..5a6e9b3 100644 --- a/llvm/include/llvm/Transforms/IPO/ForceFunctionAttrs.h +++ b/llvm/include/llvm/Transforms/IPO/ForceFunctionAttrs.h @@ -21,7 +21,7 @@ namespace llvm { /// Pass which forces specific function attributes into the IR, primarily as /// a debugging tool. -struct ForceFunctionAttrsPass : PassBase { +struct ForceFunctionAttrsPass : PassInfoMixin { PreservedAnalyses run(Module &M); }; diff --git a/llvm/include/llvm/Transforms/IPO/FunctionAttrs.h b/llvm/include/llvm/Transforms/IPO/FunctionAttrs.h index d4a1c3d..aab7d8b 100644 --- a/llvm/include/llvm/Transforms/IPO/FunctionAttrs.h +++ b/llvm/include/llvm/Transforms/IPO/FunctionAttrs.h @@ -29,7 +29,7 @@ namespace llvm { /// access memory, or only read memory, and give them the readnone/readonly /// attribute. It also discovers function arguments that are not captured by /// the function and marks them with the nocapture attribute. -struct PostOrderFunctionAttrsPass : PassBase { +struct PostOrderFunctionAttrsPass : PassInfoMixin { PreservedAnalyses run(LazyCallGraph::SCC &C, CGSCCAnalysisManager *AM); }; diff --git a/llvm/include/llvm/Transforms/IPO/InferFunctionAttrs.h b/llvm/include/llvm/Transforms/IPO/InferFunctionAttrs.h index ef69de8..a26205d 100644 --- a/llvm/include/llvm/Transforms/IPO/InferFunctionAttrs.h +++ b/llvm/include/llvm/Transforms/IPO/InferFunctionAttrs.h @@ -23,7 +23,7 @@ namespace llvm { /// A pass which infers function attributes from the names and signatures of /// function declarations in a module. -struct InferFunctionAttrsPass : PassBase { +struct InferFunctionAttrsPass : PassInfoMixin { PreservedAnalyses run(Module &M, AnalysisManager *AM); }; diff --git a/llvm/include/llvm/Transforms/IPO/StripDeadPrototypes.h b/llvm/include/llvm/Transforms/IPO/StripDeadPrototypes.h index 12cf00a..3dad8aa 100644 --- a/llvm/include/llvm/Transforms/IPO/StripDeadPrototypes.h +++ b/llvm/include/llvm/Transforms/IPO/StripDeadPrototypes.h @@ -23,7 +23,7 @@ namespace llvm { /// Pass to remove unused function declarations. -struct StripDeadPrototypesPass : PassBase { +struct StripDeadPrototypesPass : PassInfoMixin { PreservedAnalyses run(Module &M); }; diff --git a/llvm/include/llvm/Transforms/InstCombine/InstCombine.h b/llvm/include/llvm/Transforms/InstCombine/InstCombine.h index 7f0d936..b03017f 100644 --- a/llvm/include/llvm/Transforms/InstCombine/InstCombine.h +++ b/llvm/include/llvm/Transforms/InstCombine/InstCombine.h @@ -24,7 +24,7 @@ namespace llvm { -class InstCombinePass : public PassBase { +class InstCombinePass : public PassInfoMixin { InstCombineWorklist Worklist; bool ExpensiveCombines; diff --git a/llvm/include/llvm/Transforms/Scalar/ADCE.h b/llvm/include/llvm/Transforms/Scalar/ADCE.h index a28e93d..0cd14bd 100644 --- a/llvm/include/llvm/Transforms/Scalar/ADCE.h +++ b/llvm/include/llvm/Transforms/Scalar/ADCE.h @@ -28,7 +28,7 @@ namespace llvm { /// instructions are dead until proven otherwise. This allows it to eliminate /// dead computations that other DCE passes do not catch, particularly involving /// loop computations. -struct ADCEPass : PassBase { +struct ADCEPass : PassInfoMixin { PreservedAnalyses run(Function &F); }; } diff --git a/llvm/include/llvm/Transforms/Scalar/EarlyCSE.h b/llvm/include/llvm/Transforms/Scalar/EarlyCSE.h index 24b02c8..8d1dc32 100644 --- a/llvm/include/llvm/Transforms/Scalar/EarlyCSE.h +++ b/llvm/include/llvm/Transforms/Scalar/EarlyCSE.h @@ -26,7 +26,7 @@ namespace llvm { /// canonicalize things as it goes. It is intended to be fast and catch obvious /// cases so that instcombine and other passes are more effective. It is /// expected that a later pass of GVN will catch the interesting/hard cases. -struct EarlyCSEPass : PassBase { +struct EarlyCSEPass : PassInfoMixin { /// \brief Run the pass over the function. PreservedAnalyses run(Function &F, AnalysisManager *AM); }; diff --git a/llvm/include/llvm/Transforms/Scalar/GVN.h b/llvm/include/llvm/Transforms/Scalar/GVN.h index c6b86bf..342b3df1 100644 --- a/llvm/include/llvm/Transforms/Scalar/GVN.h +++ b/llvm/include/llvm/Transforms/Scalar/GVN.h @@ -42,7 +42,7 @@ class GVNLegacyPass; /// /// FIXME: We should have a good summary of the GVN algorithm implemented by /// this particular pass here. -class GVN : public PassBase { +class GVN : public PassInfoMixin { public: /// \brief Run the pass over the function. diff --git a/llvm/include/llvm/Transforms/Scalar/LowerExpectIntrinsic.h b/llvm/include/llvm/Transforms/Scalar/LowerExpectIntrinsic.h index c78ae31..d03e76f 100644 --- a/llvm/include/llvm/Transforms/Scalar/LowerExpectIntrinsic.h +++ b/llvm/include/llvm/Transforms/Scalar/LowerExpectIntrinsic.h @@ -21,7 +21,7 @@ namespace llvm { -struct LowerExpectIntrinsicPass : PassBase { +struct LowerExpectIntrinsicPass : PassInfoMixin { /// \brief Run the pass over the function. /// /// This will lower all of th expect intrinsic calls in this function into diff --git a/llvm/include/llvm/Transforms/Scalar/SROA.h b/llvm/include/llvm/Transforms/Scalar/SROA.h index c6fe735..9581cb7 100644 --- a/llvm/include/llvm/Transforms/Scalar/SROA.h +++ b/llvm/include/llvm/Transforms/Scalar/SROA.h @@ -51,7 +51,7 @@ class SROALegacyPass; /// onto insert and extract operations on a vector value, and convert them to /// this form. By doing so, it will enable promotion of vector aggregates to /// SSA vector values. -class SROA : public PassBase { +class SROA : public PassInfoMixin { LLVMContext *C; DominatorTree *DT; AssumptionCache *AC; diff --git a/llvm/include/llvm/Transforms/Scalar/SimplifyCFG.h b/llvm/include/llvm/Transforms/Scalar/SimplifyCFG.h index 6a102c5..514a86b 100644 --- a/llvm/include/llvm/Transforms/Scalar/SimplifyCFG.h +++ b/llvm/include/llvm/Transforms/Scalar/SimplifyCFG.h @@ -25,7 +25,7 @@ namespace llvm { /// This pass iteratively simplifies the entire CFG of a function, removing /// unnecessary control flows and bringing it into the canonical form expected /// by the rest of the mid-level optimizer. -class SimplifyCFGPass : public PassBase { +class SimplifyCFGPass : public PassInfoMixin { int BonusInstThreshold; public: diff --git a/llvm/lib/Passes/PassBuilder.cpp b/llvm/lib/Passes/PassBuilder.cpp index e436966..ad6ce72 100644 --- a/llvm/lib/Passes/PassBuilder.cpp +++ b/llvm/lib/Passes/PassBuilder.cpp @@ -70,8 +70,8 @@ struct NoOpModulePass { }; /// \brief No-op module analysis. -class NoOpModuleAnalysis : public AnalysisBase { - friend AnalysisBase; +class NoOpModuleAnalysis : public AnalysisInfoMixin { + friend AnalysisInfoMixin; static char PassID; public: @@ -89,8 +89,8 @@ struct NoOpCGSCCPass { }; /// \brief No-op CGSCC analysis. -class NoOpCGSCCAnalysis : public AnalysisBase { - friend AnalysisBase; +class NoOpCGSCCAnalysis : public AnalysisInfoMixin { + friend AnalysisInfoMixin; static char PassID; public: @@ -106,8 +106,8 @@ struct NoOpFunctionPass { }; /// \brief No-op function analysis. -class NoOpFunctionAnalysis : public AnalysisBase { - friend AnalysisBase; +class NoOpFunctionAnalysis : public AnalysisInfoMixin { + friend AnalysisInfoMixin; static char PassID; public: @@ -123,8 +123,8 @@ struct NoOpLoopPass { }; /// \brief No-op loop analysis. -class NoOpLoopAnalysis : public AnalysisBase { - friend AnalysisBase; +class NoOpLoopAnalysis : public AnalysisInfoMixin { + friend AnalysisInfoMixin; static char PassID; public: diff --git a/llvm/unittests/IR/PassManagerTest.cpp b/llvm/unittests/IR/PassManagerTest.cpp index c00748ca..68218cc 100644 --- a/llvm/unittests/IR/PassManagerTest.cpp +++ b/llvm/unittests/IR/PassManagerTest.cpp @@ -19,7 +19,7 @@ using namespace llvm; namespace { -class TestFunctionAnalysis : public AnalysisBase { +class TestFunctionAnalysis : public AnalysisInfoMixin { public: struct Result { Result(int Count) : InstructionCount(Count) {} @@ -40,7 +40,7 @@ public: } private: - friend AnalysisBase; + friend AnalysisInfoMixin; static char PassID; int &Runs; @@ -48,7 +48,7 @@ private: char TestFunctionAnalysis::PassID; -class TestModuleAnalysis : public AnalysisBase { +class TestModuleAnalysis : public AnalysisInfoMixin { public: struct Result { Result(int Count) : FunctionCount(Count) {} @@ -66,7 +66,7 @@ public: } private: - friend AnalysisBase; + friend AnalysisInfoMixin; static char PassID; int &Runs; @@ -74,7 +74,7 @@ private: char TestModuleAnalysis::PassID; -struct TestModulePass : PassBase { +struct TestModulePass : PassInfoMixin { TestModulePass(int &RunCount) : RunCount(RunCount) {} PreservedAnalyses run(Module &M) { @@ -85,11 +85,12 @@ struct TestModulePass : PassBase { int &RunCount; }; -struct TestPreservingModulePass : PassBase { +struct TestPreservingModulePass : PassInfoMixin { PreservedAnalyses run(Module &M) { return PreservedAnalyses::all(); } }; -struct TestMinPreservingModulePass : PassBase { +struct TestMinPreservingModulePass + : PassInfoMixin { PreservedAnalyses run(Module &M, ModuleAnalysisManager *AM) { PreservedAnalyses PA; @@ -101,7 +102,7 @@ struct TestMinPreservingModulePass : PassBase { } }; -struct TestFunctionPass : PassBase { +struct TestFunctionPass : PassInfoMixin { TestFunctionPass(int &RunCount, int &AnalyzedInstrCount, int &AnalyzedFunctionCount, bool OnlyUseCachedResults = false) @@ -140,7 +141,8 @@ struct TestFunctionPass : PassBase { // A test function pass that invalidates all function analyses for a function // with a specific name. -struct TestInvalidationFunctionPass : PassBase { +struct TestInvalidationFunctionPass + : PassInfoMixin { TestInvalidationFunctionPass(StringRef FunctionName) : Name(FunctionName) {} PreservedAnalyses run(Function &F) { -- 2.7.4