[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'

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@263217 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chandler Carruth 2016-03-11 10:33:22 +00:00
parent e95015f4c9
commit 18e9a2b623
38 changed files with 113 additions and 99 deletions

View File

@ -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<AAManager> {
class AAManager : public AnalysisInfoMixin<AAManager> {
public:
typedef AAResults Result;
@ -874,7 +874,7 @@ public:
}
private:
friend AnalysisBase<AAManager>;
friend AnalysisInfoMixin<AAManager>;
static char PassID;
SmallVector<void (*)(Function &F, AnalysisManager<Function> &AM,

View File

@ -31,7 +31,7 @@
namespace llvm {
class AAResults;
class AAEvaluator : public PassBase<AAEvaluator> {
class AAEvaluator : public PassInfoMixin<AAEvaluator> {
int64_t FunctionCount;
int64_t NoAliasCount, MayAliasCount, PartialAliasCount, MustAliasCount;
int64_t NoModRefCount, ModCount, RefCount, ModRefCount;

View File

@ -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<AssumptionAnalysis> {
friend AnalysisBase<AssumptionAnalysis>;
class AssumptionAnalysis : public AnalysisInfoMixin<AssumptionAnalysis> {
friend AnalysisInfoMixin<AssumptionAnalysis>;
static char PassID;
public:
@ -110,7 +110,7 @@ public:
};
/// \brief Printer pass for the \c AssumptionAnalysis results.
class AssumptionPrinterPass : public PassBase<AssumptionPrinterPass> {
class AssumptionPrinterPass : public PassInfoMixin<AssumptionPrinterPass> {
raw_ostream &OS;
public:

View File

@ -180,8 +180,8 @@ private:
};
/// Analysis pass providing a never-invalidated alias analysis result.
class BasicAA : public AnalysisBase<BasicAA> {
friend AnalysisBase<BasicAA>;
class BasicAA : public AnalysisInfoMixin<BasicAA> {
friend AnalysisInfoMixin<BasicAA>;
static char PassID;
public:

View File

@ -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<CFLAA> {
friend AnalysisBase<CFLAA>;
class CFLAA : public AnalysisInfoMixin<CFLAA> {
friend AnalysisInfoMixin<CFLAA>;
static char PassID;
public:

View File

@ -65,7 +65,7 @@ typedef OuterAnalysisManagerProxy<ModuleAnalysisManager, LazyCallGraph::SCC>
/// within this run safely.
template <typename CGSCCPassT>
class ModuleToPostOrderCGSCCPassAdaptor
: public PassBase<ModuleToPostOrderCGSCCPassAdaptor<CGSCCPassT>> {
: public PassInfoMixin<ModuleToPostOrderCGSCCPassAdaptor<CGSCCPassT>> {
public:
explicit ModuleToPostOrderCGSCCPassAdaptor(CGSCCPassT Pass)
: Pass(std::move(Pass)) {}
@ -159,7 +159,7 @@ typedef OuterAnalysisManagerProxy<CGSCCAnalysisManager, Function>
/// within this run safely.
template <typename FunctionPassT>
class CGSCCToFunctionPassAdaptor
: public PassBase<CGSCCToFunctionPassAdaptor<FunctionPassT>> {
: public PassInfoMixin<CGSCCToFunctionPassAdaptor<FunctionPassT>> {
public:
explicit CGSCCToFunctionPassAdaptor(FunctionPassT Pass)
: Pass(std::move(Pass)) {}

View File

@ -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<CallGraphAnalysis> {
friend AnalysisBase<CallGraphAnalysis>;
class CallGraphAnalysis : public AnalysisInfoMixin<CallGraphAnalysis> {
friend AnalysisInfoMixin<CallGraphAnalysis>;
static char PassID;
public:
@ -310,7 +310,7 @@ public:
};
/// \brief Printer pass for the \c CallGraphAnalysis results.
class CallGraphPrinterPass : public PassBase<CallGraphPrinterPass> {
class CallGraphPrinterPass : public PassInfoMixin<CallGraphPrinterPass> {
raw_ostream &OS;
public:

View File

@ -169,8 +169,8 @@ extern template class ForwardDominanceFrontierBase<BasicBlock>;
/// \brief Analysis pass which computes a \c DominanceFrontier.
class DominanceFrontierAnalysis
: public AnalysisBase<DominanceFrontierAnalysis> {
friend AnalysisBase<DominanceFrontierAnalysis>;
: public AnalysisInfoMixin<DominanceFrontierAnalysis> {
friend AnalysisInfoMixin<DominanceFrontierAnalysis>;
static char PassID;
public:
@ -183,7 +183,7 @@ public:
/// \brief Printer pass for the \c DominanceFrontier.
class DominanceFrontierPrinterPass
: public PassBase<DominanceFrontierPrinterPass> {
: public PassInfoMixin<DominanceFrontierPrinterPass> {
raw_ostream &OS;
public:

View File

@ -118,8 +118,8 @@ private:
};
/// Analysis pass providing a never-invalidated alias analysis result.
class GlobalsAA : public AnalysisBase<GlobalsAA> {
friend AnalysisBase<GlobalsAA>;
class GlobalsAA : public AnalysisInfoMixin<GlobalsAA> {
friend AnalysisInfoMixin<GlobalsAA>;
static char PassID;
public:

View File

@ -895,8 +895,8 @@ template <> struct GraphTraits<LazyCallGraph *> {
};
/// An analysis pass which computes the call graph for a module.
class LazyCallGraphAnalysis : public AnalysisBase<LazyCallGraphAnalysis> {
friend AnalysisBase<LazyCallGraphAnalysis>;
class LazyCallGraphAnalysis : public AnalysisInfoMixin<LazyCallGraphAnalysis> {
friend AnalysisInfoMixin<LazyCallGraphAnalysis>;
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<LazyCallGraphPrinterPass> {
class LazyCallGraphPrinterPass
: public PassInfoMixin<LazyCallGraphPrinterPass> {
raw_ostream &OS;
public:

View File

@ -787,8 +787,8 @@ template <> struct GraphTraits<Loop*> {
};
/// \brief Analysis pass that exposes the \c LoopInfo for a function.
class LoopAnalysis : public AnalysisBase<LoopAnalysis> {
friend AnalysisBase<LoopAnalysis>;
class LoopAnalysis : public AnalysisInfoMixin<LoopAnalysis> {
friend AnalysisInfoMixin<LoopAnalysis>;
static char PassID;
public:
@ -798,7 +798,7 @@ public:
};
/// \brief Printer pass for the \c LoopAnalysis results.
class LoopPrinterPass : public PassBase<LoopPrinterPass> {
class LoopPrinterPass : public PassInfoMixin<LoopPrinterPass> {
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<PrintLoopPass> {
class PrintLoopPass : public PassInfoMixin<PrintLoopPass> {
raw_ostream &OS;
std::string Banner;

View File

@ -57,7 +57,7 @@ typedef OuterAnalysisManagerProxy<FunctionAnalysisManager, Loop>
/// LoopAnalysisManager to be used within this run safely.
template <typename LoopPassT>
class FunctionToLoopPassAdaptor
: public PassBase<FunctionToLoopPassAdaptor<LoopPassT>> {
: public PassInfoMixin<FunctionToLoopPassAdaptor<LoopPassT>> {
public:
explicit FunctionToLoopPassAdaptor(LoopPassT Pass)
: Pass(std::move(Pass)) {}

View File

@ -471,8 +471,9 @@ private:
///
/// This is essentially a no-op because the results are computed entirely
/// lazily.
class MemoryDependenceAnalysis : public AnalysisBase<MemoryDependenceAnalysis> {
friend AnalysisBase<MemoryDependenceAnalysis>;
class MemoryDependenceAnalysis
: public AnalysisInfoMixin<MemoryDependenceAnalysis> {
friend AnalysisInfoMixin<MemoryDependenceAnalysis>;
static char PassID;
public:

View File

@ -61,8 +61,8 @@ public:
};
/// Analysis pass providing a never-invalidated alias analysis result.
class ObjCARCAA : public AnalysisBase<ObjCARCAA> {
friend AnalysisBase<ObjCARCAA>;
class ObjCARCAA : public AnalysisInfoMixin<ObjCARCAA> {
friend AnalysisInfoMixin<ObjCARCAA>;
static char PassID;
public:

View File

@ -38,8 +38,8 @@ struct PostDominatorTree : public DominatorTreeBase<BasicBlock> {
/// \brief Analysis pass which computes a \c PostDominatorTree.
class PostDominatorTreeAnalysis
: public AnalysisBase<PostDominatorTreeAnalysis> {
friend AnalysisBase<PostDominatorTreeAnalysis>;
: public AnalysisInfoMixin<PostDominatorTreeAnalysis> {
friend AnalysisInfoMixin<PostDominatorTreeAnalysis>;
static char PassID;
public:
@ -53,7 +53,7 @@ public:
/// \brief Printer pass for the \c PostDominatorTree.
class PostDominatorTreePrinterPass
: public PassBase<PostDominatorTreePrinterPass> {
: public PassInfoMixin<PostDominatorTreePrinterPass> {
raw_ostream &OS;
public:

View File

@ -923,8 +923,8 @@ public:
};
/// \brief Analysis pass that exposes the \c RegionInfo for a function.
class RegionInfoAnalysis : public AnalysisBase<RegionInfoAnalysis> {
friend AnalysisBase<RegionInfoAnalysis>;
class RegionInfoAnalysis : public AnalysisInfoMixin<RegionInfoAnalysis> {
friend AnalysisInfoMixin<RegionInfoAnalysis>;
static char PassID;
public:
@ -934,7 +934,7 @@ public:
};
/// \brief Printer pass for the \c RegionInfo.
class RegionInfoPrinterPass : public PassBase<RegionInfoPrinterPass> {
class RegionInfoPrinterPass : public PassInfoMixin<RegionInfoPrinterPass> {
raw_ostream &OS;
public:
@ -943,7 +943,7 @@ public:
};
/// \brief Verifier pass for the \c RegionInfo.
struct RegionInfoVerifierPass : PassBase<RegionInfoVerifierPass> {
struct RegionInfoVerifierPass : PassInfoMixin<RegionInfoVerifierPass> {
PreservedAnalyses run(Function &F, AnalysisManager<Function> *AM);
};

View File

@ -1430,8 +1430,9 @@ namespace llvm {
};
/// \brief Analysis pass that exposes the \c ScalarEvolution for a function.
class ScalarEvolutionAnalysis : public AnalysisBase<ScalarEvolutionAnalysis> {
friend AnalysisBase<ScalarEvolutionAnalysis>;
class ScalarEvolutionAnalysis
: public AnalysisInfoMixin<ScalarEvolutionAnalysis> {
friend AnalysisInfoMixin<ScalarEvolutionAnalysis>;
static char PassID;
public:
@ -1442,7 +1443,7 @@ namespace llvm {
/// \brief Printer pass for the \c ScalarEvolutionAnalysis results.
class ScalarEvolutionPrinterPass
: public PassBase<ScalarEvolutionPrinterPass> {
: public PassInfoMixin<ScalarEvolutionPrinterPass> {
raw_ostream &OS;
public:

View File

@ -38,8 +38,8 @@ private:
};
/// Analysis pass providing a never-invalidated alias analysis result.
class SCEVAA : public AnalysisBase<SCEVAA> {
friend AnalysisBase<SCEVAA>;
class SCEVAA : public AnalysisInfoMixin<SCEVAA> {
friend AnalysisInfoMixin<SCEVAA>;
static char PassID;
public:

View File

@ -47,8 +47,8 @@ private:
};
/// Analysis pass providing a never-invalidated alias analysis result.
class ScopedNoAliasAA : public AnalysisBase<ScopedNoAliasAA> {
friend AnalysisBase<ScopedNoAliasAA>;
class ScopedNoAliasAA : public AnalysisInfoMixin<ScopedNoAliasAA> {
friend AnalysisInfoMixin<ScopedNoAliasAA>;
static char PassID;
public:

View File

@ -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<TargetLibraryAnalysis> {
class TargetLibraryAnalysis : public AnalysisInfoMixin<TargetLibraryAnalysis> {
public:
typedef TargetLibraryInfo Result;
@ -292,7 +292,7 @@ public:
TargetLibraryInfo run(Function &F);
private:
friend AnalysisBase<TargetLibraryAnalysis>;
friend AnalysisInfoMixin<TargetLibraryAnalysis>;
static char PassID;
Optional<TargetLibraryInfoImpl> PresetInfoImpl;

View File

@ -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<TargetIRAnalysis> {
class TargetIRAnalysis : public AnalysisInfoMixin<TargetIRAnalysis> {
public:
typedef TargetTransformInfo Result;
@ -922,7 +922,7 @@ public:
Result run(const Function &F);
private:
friend AnalysisBase<TargetIRAnalysis>;
friend AnalysisInfoMixin<TargetIRAnalysis>;
static char PassID;
/// \brief The callback used to produce a result.

View File

@ -48,8 +48,8 @@ private:
};
/// Analysis pass providing a never-invalidated alias analysis result.
class TypeBasedAA : public AnalysisBase<TypeBasedAA> {
friend AnalysisBase<TypeBasedAA>;
class TypeBasedAA : public AnalysisInfoMixin<TypeBasedAA> {
friend AnalysisInfoMixin<TypeBasedAA>;
static char PassID;
public:

View File

@ -182,8 +182,8 @@ template <> struct GraphTraits<DominatorTree*>
};
/// \brief Analysis pass which computes a \c DominatorTree.
class DominatorTreeAnalysis : public AnalysisBase<DominatorTreeAnalysis> {
friend AnalysisBase<DominatorTreeAnalysis>;
class DominatorTreeAnalysis : public AnalysisInfoMixin<DominatorTreeAnalysis> {
friend AnalysisInfoMixin<DominatorTreeAnalysis>;
static char PassID;
public:
@ -195,7 +195,8 @@ public:
};
/// \brief Printer pass for the \c DominatorTree.
class DominatorTreePrinterPass : public PassBase<DominatorTreePrinterPass> {
class DominatorTreePrinterPass
: public PassInfoMixin<DominatorTreePrinterPass> {
raw_ostream &OS;
public:
@ -204,7 +205,7 @@ public:
};
/// \brief Verifier pass for the \c DominatorTree.
struct DominatorTreeVerifierPass : PassBase<DominatorTreeVerifierPass> {
struct DominatorTreeVerifierPass : PassInfoMixin<DominatorTreeVerifierPass> {
PreservedAnalyses run(Function &F, AnalysisManager<Function> *AM);
};

View File

@ -167,10 +167,11 @@ private:
// Forward declare the analysis manager template.
template <typename IRUnitT> 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 <typename DerivedT> struct PassBase {
template <typename DerivedT> struct PassInfoMixin {
/// Returns the name of the derived pass type.
static StringRef name() {
StringRef Name = getTypeName<DerivedT>();
@ -180,10 +181,14 @@ template <typename DerivedT> 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 <typename DerivedT> struct AnalysisBase : PassBase<DerivedT> {
/// 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 <typename DerivedT>
struct AnalysisInfoMixin : PassInfoMixin<DerivedT> {
/// 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 <typename DerivedT> struct AnalysisBase : PassBase<DerivedT> {
/// manager's invalidation routine with the PreservedAnalyses of each pass it
/// runs.
template <typename IRUnitT>
class PassManager : public PassBase<PassManager<IRUnitT>> {
class PassManager : public PassInfoMixin<PassManager<IRUnitT>> {
public:
/// \brief Construct a pass manager.
///
@ -663,7 +668,7 @@ typedef AnalysisManager<Function> FunctionAnalysisManager;
/// provides.
template <typename AnalysisManagerT, typename IRUnitT>
class InnerAnalysisManagerProxy
: public AnalysisBase<
: public AnalysisInfoMixin<
InnerAnalysisManagerProxy<AnalysisManagerT, IRUnitT>> {
public:
class Result {
@ -746,7 +751,8 @@ public:
Result run(IRUnitT &IR) { return Result(*AM); }
private:
friend AnalysisBase<InnerAnalysisManagerProxy<AnalysisManagerT, IRUnitT>>;
friend AnalysisInfoMixin<
InnerAnalysisManagerProxy<AnalysisManagerT, IRUnitT>>;
static char PassID;
AnalysisManagerT *AM;
@ -775,7 +781,7 @@ typedef InnerAnalysisManagerProxy<FunctionAnalysisManager, Module>
/// returned PreservedAnalysis set.
template <typename AnalysisManagerT, typename IRUnitT>
class OuterAnalysisManagerProxy
: public AnalysisBase<
: public AnalysisInfoMixin<
OuterAnalysisManagerProxy<AnalysisManagerT, IRUnitT>> {
public:
/// \brief Result proxy object for \c OuterAnalysisManagerProxy.
@ -818,7 +824,8 @@ public:
Result run(IRUnitT &) { return Result(*AM); }
private:
friend AnalysisBase<OuterAnalysisManagerProxy<AnalysisManagerT, IRUnitT>>;
friend AnalysisInfoMixin<
OuterAnalysisManagerProxy<AnalysisManagerT, IRUnitT>>;
static char PassID;
const AnalysisManagerT *AM;
@ -857,7 +864,7 @@ typedef OuterAnalysisManagerProxy<ModuleAnalysisManager, Function>
/// violate this principle.
template <typename FunctionPassT>
class ModuleToFunctionPassAdaptor
: public PassBase<ModuleToFunctionPassAdaptor<FunctionPassT>> {
: public PassInfoMixin<ModuleToFunctionPassAdaptor<FunctionPassT>> {
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 <typename AnalysisT>
struct RequireAnalysisPass : PassBase<RequireAnalysisPass<AnalysisT>> {
struct RequireAnalysisPass : PassInfoMixin<RequireAnalysisPass<AnalysisT>> {
/// \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<RequireAnalysisPass<AnalysisT>> {
/// This is a no-op pass which simply forces a specific analysis result to be
/// invalidated when it is run.
template <typename AnalysisT>
struct InvalidateAnalysisPass : PassBase<InvalidateAnalysisPass<AnalysisT>> {
struct InvalidateAnalysisPass
: PassInfoMixin<InvalidateAnalysisPass<AnalysisT>> {
/// \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<InvalidateAnalysisPass<AnalysisT>> {
///
/// 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<InvalidateAllAnalysesPass> {
struct InvalidateAllAnalysesPass : PassInfoMixin<InvalidateAllAnalysesPass> {
/// \brief Run this pass over some unit of IR.
template <typename IRUnitT> PreservedAnalyses run(IRUnitT &Arg) {
return PreservedAnalyses::none();

View File

@ -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<VerifierPass> {
class VerifierPass : public PassInfoMixin<VerifierPass> {
bool FatalErrors;
public:

View File

@ -21,7 +21,7 @@ namespace llvm {
/// Pass which forces specific function attributes into the IR, primarily as
/// a debugging tool.
struct ForceFunctionAttrsPass : PassBase<ForceFunctionAttrsPass> {
struct ForceFunctionAttrsPass : PassInfoMixin<ForceFunctionAttrsPass> {
PreservedAnalyses run(Module &M);
};

View File

@ -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<PostOrderFunctionAttrsPass> {
struct PostOrderFunctionAttrsPass : PassInfoMixin<PostOrderFunctionAttrsPass> {
PreservedAnalyses run(LazyCallGraph::SCC &C, CGSCCAnalysisManager *AM);
};

View File

@ -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<InferFunctionAttrsPass> {
struct InferFunctionAttrsPass : PassInfoMixin<InferFunctionAttrsPass> {
PreservedAnalyses run(Module &M, AnalysisManager<Module> *AM);
};

View File

@ -23,7 +23,7 @@
namespace llvm {
/// Pass to remove unused function declarations.
struct StripDeadPrototypesPass : PassBase<StripDeadPrototypesPass> {
struct StripDeadPrototypesPass : PassInfoMixin<StripDeadPrototypesPass> {
PreservedAnalyses run(Module &M);
};

View File

@ -24,7 +24,7 @@
namespace llvm {
class InstCombinePass : public PassBase<InstCombinePass> {
class InstCombinePass : public PassInfoMixin<InstCombinePass> {
InstCombineWorklist Worklist;
bool ExpensiveCombines;

View File

@ -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<ADCEPass> {
struct ADCEPass : PassInfoMixin<ADCEPass> {
PreservedAnalyses run(Function &F);
};
}

View File

@ -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<EarlyCSEPass> {
struct EarlyCSEPass : PassInfoMixin<EarlyCSEPass> {
/// \brief Run the pass over the function.
PreservedAnalyses run(Function &F, AnalysisManager<Function> *AM);
};

View File

@ -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<GVN> {
class GVN : public PassInfoMixin<GVN> {
public:
/// \brief Run the pass over the function.

View File

@ -21,7 +21,7 @@
namespace llvm {
struct LowerExpectIntrinsicPass : PassBase<LowerExpectIntrinsicPass> {
struct LowerExpectIntrinsicPass : PassInfoMixin<LowerExpectIntrinsicPass> {
/// \brief Run the pass over the function.
///
/// This will lower all of th expect intrinsic calls in this function into

View File

@ -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<SROA> {
class SROA : public PassInfoMixin<SROA> {
LLVMContext *C;
DominatorTree *DT;
AssumptionCache *AC;

View File

@ -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<SimplifyCFGPass> {
class SimplifyCFGPass : public PassInfoMixin<SimplifyCFGPass> {
int BonusInstThreshold;
public:

View File

@ -70,8 +70,8 @@ struct NoOpModulePass {
};
/// \brief No-op module analysis.
class NoOpModuleAnalysis : public AnalysisBase<NoOpModuleAnalysis> {
friend AnalysisBase<NoOpModuleAnalysis>;
class NoOpModuleAnalysis : public AnalysisInfoMixin<NoOpModuleAnalysis> {
friend AnalysisInfoMixin<NoOpModuleAnalysis>;
static char PassID;
public:
@ -89,8 +89,8 @@ struct NoOpCGSCCPass {
};
/// \brief No-op CGSCC analysis.
class NoOpCGSCCAnalysis : public AnalysisBase<NoOpCGSCCAnalysis> {
friend AnalysisBase<NoOpCGSCCAnalysis>;
class NoOpCGSCCAnalysis : public AnalysisInfoMixin<NoOpCGSCCAnalysis> {
friend AnalysisInfoMixin<NoOpCGSCCAnalysis>;
static char PassID;
public:
@ -106,8 +106,8 @@ struct NoOpFunctionPass {
};
/// \brief No-op function analysis.
class NoOpFunctionAnalysis : public AnalysisBase<NoOpFunctionAnalysis> {
friend AnalysisBase<NoOpFunctionAnalysis>;
class NoOpFunctionAnalysis : public AnalysisInfoMixin<NoOpFunctionAnalysis> {
friend AnalysisInfoMixin<NoOpFunctionAnalysis>;
static char PassID;
public:
@ -123,8 +123,8 @@ struct NoOpLoopPass {
};
/// \brief No-op loop analysis.
class NoOpLoopAnalysis : public AnalysisBase<NoOpLoopAnalysis> {
friend AnalysisBase<NoOpLoopAnalysis>;
class NoOpLoopAnalysis : public AnalysisInfoMixin<NoOpLoopAnalysis> {
friend AnalysisInfoMixin<NoOpLoopAnalysis>;
static char PassID;
public:

View File

@ -19,7 +19,7 @@ using namespace llvm;
namespace {
class TestFunctionAnalysis : public AnalysisBase<TestFunctionAnalysis> {
class TestFunctionAnalysis : public AnalysisInfoMixin<TestFunctionAnalysis> {
public:
struct Result {
Result(int Count) : InstructionCount(Count) {}
@ -40,7 +40,7 @@ public:
}
private:
friend AnalysisBase<TestFunctionAnalysis>;
friend AnalysisInfoMixin<TestFunctionAnalysis>;
static char PassID;
int &Runs;
@ -48,7 +48,7 @@ private:
char TestFunctionAnalysis::PassID;
class TestModuleAnalysis : public AnalysisBase<TestModuleAnalysis> {
class TestModuleAnalysis : public AnalysisInfoMixin<TestModuleAnalysis> {
public:
struct Result {
Result(int Count) : FunctionCount(Count) {}
@ -66,7 +66,7 @@ public:
}
private:
friend AnalysisBase<TestModuleAnalysis>;
friend AnalysisInfoMixin<TestModuleAnalysis>;
static char PassID;
int &Runs;
@ -74,7 +74,7 @@ private:
char TestModuleAnalysis::PassID;
struct TestModulePass : PassBase<TestModulePass> {
struct TestModulePass : PassInfoMixin<TestModulePass> {
TestModulePass(int &RunCount) : RunCount(RunCount) {}
PreservedAnalyses run(Module &M) {
@ -85,11 +85,12 @@ struct TestModulePass : PassBase<TestModulePass> {
int &RunCount;
};
struct TestPreservingModulePass : PassBase<TestPreservingModulePass> {
struct TestPreservingModulePass : PassInfoMixin<TestPreservingModulePass> {
PreservedAnalyses run(Module &M) { return PreservedAnalyses::all(); }
};
struct TestMinPreservingModulePass : PassBase<TestMinPreservingModulePass> {
struct TestMinPreservingModulePass
: PassInfoMixin<TestMinPreservingModulePass> {
PreservedAnalyses run(Module &M, ModuleAnalysisManager *AM) {
PreservedAnalyses PA;
@ -101,7 +102,7 @@ struct TestMinPreservingModulePass : PassBase<TestMinPreservingModulePass> {
}
};
struct TestFunctionPass : PassBase<TestFunctionPass> {
struct TestFunctionPass : PassInfoMixin<TestFunctionPass> {
TestFunctionPass(int &RunCount, int &AnalyzedInstrCount,
int &AnalyzedFunctionCount,
bool OnlyUseCachedResults = false)
@ -140,7 +141,8 @@ struct TestFunctionPass : PassBase<TestFunctionPass> {
// A test function pass that invalidates all function analyses for a function
// with a specific name.
struct TestInvalidationFunctionPass : PassBase<TestInvalidationFunctionPass> {
struct TestInvalidationFunctionPass
: PassInfoMixin<TestInvalidationFunctionPass> {
TestInvalidationFunctionPass(StringRef FunctionName) : Name(FunctionName) {}
PreservedAnalyses run(Function &F) {