[llvm] r262004 - [PM] Introduce CRTP mixin base classes to help define passes and
Chandler Carruth via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 26 03:44:46 PST 2016
Author: chandlerc
Date: Fri Feb 26 05:44:45 2016
New Revision: 262004
URL: http://llvm.org/viewvc/llvm-project?rev=262004&view=rev
Log:
[PM] Introduce CRTP mixin base classes to help define passes and
analyses in the new pass manager.
These just handle really basic stuff: turning a type name into a string
statically that is nice to print in logs, and getting a static unique ID
for each analysis.
Sadly, the format of passes in anonymous namespaces makes using their
names in tests really annoying so I've customized the names of the no-op
passes to keep tests sane to read.
This is the first of a few simplifying refactorings for the new pass
manager that should reduce boilerplate and confusion.
Modified:
llvm/trunk/include/llvm/Analysis/AliasAnalysis.h
llvm/trunk/include/llvm/Analysis/AliasAnalysisEvaluator.h
llvm/trunk/include/llvm/Analysis/AssumptionCache.h
llvm/trunk/include/llvm/Analysis/BasicAliasAnalysis.h
llvm/trunk/include/llvm/Analysis/CFLAliasAnalysis.h
llvm/trunk/include/llvm/Analysis/CGSCCPassManager.h
llvm/trunk/include/llvm/Analysis/CallGraph.h
llvm/trunk/include/llvm/Analysis/DominanceFrontier.h
llvm/trunk/include/llvm/Analysis/GlobalsModRef.h
llvm/trunk/include/llvm/Analysis/LazyCallGraph.h
llvm/trunk/include/llvm/Analysis/LoopInfo.h
llvm/trunk/include/llvm/Analysis/LoopPassManager.h
llvm/trunk/include/llvm/Analysis/ObjCARCAliasAnalysis.h
llvm/trunk/include/llvm/Analysis/PostDominators.h
llvm/trunk/include/llvm/Analysis/RegionInfo.h
llvm/trunk/include/llvm/Analysis/ScalarEvolution.h
llvm/trunk/include/llvm/Analysis/ScalarEvolutionAliasAnalysis.h
llvm/trunk/include/llvm/Analysis/ScopedNoAliasAA.h
llvm/trunk/include/llvm/Analysis/TargetLibraryInfo.h
llvm/trunk/include/llvm/Analysis/TargetTransformInfo.h
llvm/trunk/include/llvm/Analysis/TypeBasedAliasAnalysis.h
llvm/trunk/include/llvm/IR/Dominators.h
llvm/trunk/include/llvm/IR/PassManager.h
llvm/trunk/include/llvm/IR/Verifier.h
llvm/trunk/include/llvm/Transforms/IPO/ForceFunctionAttrs.h
llvm/trunk/include/llvm/Transforms/IPO/FunctionAttrs.h
llvm/trunk/include/llvm/Transforms/IPO/InferFunctionAttrs.h
llvm/trunk/include/llvm/Transforms/IPO/StripDeadPrototypes.h
llvm/trunk/include/llvm/Transforms/InstCombine/InstCombine.h
llvm/trunk/include/llvm/Transforms/Scalar/ADCE.h
llvm/trunk/include/llvm/Transforms/Scalar/EarlyCSE.h
llvm/trunk/include/llvm/Transforms/Scalar/LowerExpectIntrinsic.h
llvm/trunk/include/llvm/Transforms/Scalar/SROA.h
llvm/trunk/include/llvm/Transforms/Scalar/SimplifyCFG.h
llvm/trunk/lib/Analysis/AliasAnalysis.cpp
llvm/trunk/lib/Analysis/AssumptionCache.cpp
llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp
llvm/trunk/lib/Analysis/CFLAliasAnalysis.cpp
llvm/trunk/lib/Analysis/CGSCCPassManager.cpp
llvm/trunk/lib/Analysis/CallGraph.cpp
llvm/trunk/lib/Analysis/DominanceFrontier.cpp
llvm/trunk/lib/Analysis/GlobalsModRef.cpp
llvm/trunk/lib/Analysis/LazyCallGraph.cpp
llvm/trunk/lib/Analysis/LoopInfo.cpp
llvm/trunk/lib/Analysis/LoopPassManager.cpp
llvm/trunk/lib/Analysis/ObjCARCAliasAnalysis.cpp
llvm/trunk/lib/Analysis/PostDominators.cpp
llvm/trunk/lib/Analysis/RegionInfo.cpp
llvm/trunk/lib/Analysis/ScalarEvolution.cpp
llvm/trunk/lib/Analysis/ScalarEvolutionAliasAnalysis.cpp
llvm/trunk/lib/Analysis/ScopedNoAliasAA.cpp
llvm/trunk/lib/Analysis/TargetLibraryInfo.cpp
llvm/trunk/lib/Analysis/TargetTransformInfo.cpp
llvm/trunk/lib/Analysis/TypeBasedAliasAnalysis.cpp
llvm/trunk/lib/IR/Dominators.cpp
llvm/trunk/lib/IR/PassManager.cpp
llvm/trunk/lib/Passes/PassBuilder.cpp
llvm/trunk/test/Other/new-pass-manager.ll
llvm/trunk/unittests/IR/PassManagerTest.cpp
Modified: llvm/trunk/include/llvm/Analysis/AliasAnalysis.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/AliasAnalysis.h?rev=262004&r1=262003&r2=262004&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/AliasAnalysis.h (original)
+++ llvm/trunk/include/llvm/Analysis/AliasAnalysis.h Fri Feb 26 05:44:45 2016
@@ -979,16 +979,10 @@ bool isIdentifiedFunctionLocal(const Val
/// 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 {
+class AAManager : public AnalysisBase<AAManager> {
public:
typedef AAResults Result;
- /// \brief Opaque, unique identifier for this analysis pass.
- static void *ID() { return (void *)&PassID; }
-
- /// \brief Provide access to a name for this pass.
- static StringRef name() { return "AAManager"; }
-
// This type hase value semantics. We have to spell these out because MSVC
// won't synthesize them.
AAManager() {}
@@ -1018,8 +1012,6 @@ public:
}
private:
- static char PassID;
-
SmallVector<void (*)(Function &F, AnalysisManager<Function> &AM,
AAResults &AAResults),
4> FunctionResultGetters;
Modified: llvm/trunk/include/llvm/Analysis/AliasAnalysisEvaluator.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/AliasAnalysisEvaluator.h?rev=262004&r1=262003&r2=262004&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/AliasAnalysisEvaluator.h (original)
+++ llvm/trunk/include/llvm/Analysis/AliasAnalysisEvaluator.h Fri Feb 26 05:44:45 2016
@@ -26,7 +26,7 @@
namespace llvm {
class AAResults;
-class AAEvaluator {
+class AAEvaluator : public PassBase<AAEvaluator> {
int64_t FunctionCount;
int64_t NoAliasCount, MayAliasCount, PartialAliasCount, MustAliasCount;
int64_t NoModRefCount, ModCount, RefCount, ModRefCount;
Modified: llvm/trunk/include/llvm/Analysis/AssumptionCache.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/AssumptionCache.h?rev=262004&r1=262003&r2=262004&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/AssumptionCache.h (original)
+++ llvm/trunk/include/llvm/Analysis/AssumptionCache.h Fri Feb 26 05:44:45 2016
@@ -93,18 +93,9 @@ public:
///
/// This analysis is intended for use with the new pass manager and will vend
/// assumption caches for a given function.
-class AssumptionAnalysis {
- static char PassID;
-
-public:
+struct AssumptionAnalysis : AnalysisBase<AssumptionAnalysis> {
typedef AssumptionCache Result;
- /// \brief Opaque, unique identifier for this analysis pass.
- static void *ID() { return (void *)&PassID; }
-
- /// \brief Provide a name for the analysis for debugging and logging.
- static StringRef name() { return "AssumptionAnalysis"; }
-
AssumptionAnalysis() {}
AssumptionAnalysis(const AssumptionAnalysis &Arg) {}
AssumptionAnalysis(AssumptionAnalysis &&Arg) {}
@@ -115,7 +106,7 @@ public:
};
/// \brief Printer pass for the \c AssumptionAnalysis results.
-class AssumptionPrinterPass {
+class AssumptionPrinterPass : public PassBase<AssumptionPrinterPass> {
raw_ostream &OS;
public:
Modified: llvm/trunk/include/llvm/Analysis/BasicAliasAnalysis.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/BasicAliasAnalysis.h?rev=262004&r1=262003&r2=262004&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/BasicAliasAnalysis.h (original)
+++ llvm/trunk/include/llvm/Analysis/BasicAliasAnalysis.h Fri Feb 26 05:44:45 2016
@@ -178,20 +178,10 @@ private:
};
/// Analysis pass providing a never-invalidated alias analysis result.
-class BasicAA {
-public:
+struct BasicAA : AnalysisBase<BasicAA> {
typedef BasicAAResult Result;
- /// \brief Opaque, unique identifier for this analysis pass.
- static void *ID() { return (void *)&PassID; }
-
- /// \brief Provide access to a name for this pass for debugging purposes.
- static StringRef name() { return "BasicAA"; }
-
BasicAAResult run(Function &F, AnalysisManager<Function> *AM);
-
-private:
- static char PassID;
};
/// Legacy wrapper pass to provide the BasicAAResult object.
Modified: llvm/trunk/include/llvm/Analysis/CFLAliasAnalysis.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/CFLAliasAnalysis.h?rev=262004&r1=262003&r2=262004&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/CFLAliasAnalysis.h (original)
+++ llvm/trunk/include/llvm/Analysis/CFLAliasAnalysis.h Fri Feb 26 05:44:45 2016
@@ -109,20 +109,10 @@ 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:
+struct CFLAA : AnalysisBase<CFLAA> {
typedef CFLAAResult Result;
- /// \brief Opaque, unique identifier for this analysis pass.
- static void *ID() { return (void *)&PassID; }
-
CFLAAResult run(Function &F, AnalysisManager<Function> *AM);
-
- /// \brief Provide access to a name for this pass for debugging purposes.
- static StringRef name() { return "CFLAA"; }
-
-private:
- static char PassID;
};
/// Legacy wrapper pass to provide the CFLAAResult object.
Modified: llvm/trunk/include/llvm/Analysis/CGSCCPassManager.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/CGSCCPassManager.h?rev=262004&r1=262003&r2=262004&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/CGSCCPassManager.h (original)
+++ llvm/trunk/include/llvm/Analysis/CGSCCPassManager.h Fri Feb 26 05:44:45 2016
@@ -52,7 +52,8 @@ typedef AnalysisManager<LazyCallGraph::S
///
/// Note that the proxy's result is a move-only object and represents ownership
/// of the validity of the analyses in the \c CGSCCAnalysisManager it provides.
-class CGSCCAnalysisManagerModuleProxy {
+class CGSCCAnalysisManagerModuleProxy
+ : public AnalysisBase<CGSCCAnalysisManagerModuleProxy> {
public:
class Result {
public:
@@ -92,10 +93,6 @@ public:
CGSCCAnalysisManager *CGAM;
};
- static void *ID() { return (void *)&PassID; }
-
- static StringRef name() { return "CGSCCAnalysisManagerModuleProxy"; }
-
explicit CGSCCAnalysisManagerModuleProxy(CGSCCAnalysisManager &CGAM)
: CGAM(&CGAM) {}
// We have to explicitly define all the special member functions because MSVC
@@ -122,8 +119,6 @@ public:
Result run(Module &M);
private:
- static char PassID;
-
CGSCCAnalysisManager *CGAM;
};
@@ -139,7 +134,8 @@ private:
/// This proxy *doesn't* manage the invalidation in any way. That is handled by
/// the recursive return path of each layer of the pass manager and the
/// returned PreservedAnalysis set.
-class ModuleAnalysisManagerCGSCCProxy {
+class ModuleAnalysisManagerCGSCCProxy
+ : public AnalysisBase<ModuleAnalysisManagerCGSCCProxy> {
public:
/// \brief Result proxy object for \c ModuleAnalysisManagerCGSCCProxy.
class Result {
@@ -163,10 +159,6 @@ public:
const ModuleAnalysisManager *MAM;
};
- static void *ID() { return (void *)&PassID; }
-
- static StringRef name() { return "ModuleAnalysisManagerCGSCCProxy"; }
-
ModuleAnalysisManagerCGSCCProxy(const ModuleAnalysisManager &MAM)
: MAM(&MAM) {}
// We have to explicitly define all the special member functions because MSVC
@@ -187,8 +179,6 @@ public:
Result run(LazyCallGraph::SCC &) { return Result(*MAM); }
private:
- static char PassID;
-
const ModuleAnalysisManager *MAM;
};
@@ -201,7 +191,9 @@ private:
/// \c CGSCCAnalysisManagerModuleProxy analysis prior to running the CGSCC
/// pass over the module to enable a \c FunctionAnalysisManager to be used
/// within this run safely.
-template <typename CGSCCPassT> class ModuleToPostOrderCGSCCPassAdaptor {
+template <typename CGSCCPassT>
+class ModuleToPostOrderCGSCCPassAdaptor
+ : public PassBase<ModuleToPostOrderCGSCCPassAdaptor<CGSCCPassT>> {
public:
explicit ModuleToPostOrderCGSCCPassAdaptor(CGSCCPassT Pass)
: Pass(std::move(Pass)) {}
@@ -262,8 +254,6 @@ public:
return PA;
}
- static StringRef name() { return "ModuleToPostOrderCGSCCPassAdaptor"; }
-
private:
CGSCCPassT Pass;
};
@@ -288,7 +278,8 @@ createModuleToPostOrderCGSCCPassAdaptor(
/// Note that the proxy's result is a move-only object and represents ownership
/// of the validity of the analyses in the \c FunctionAnalysisManager it
/// provides.
-class FunctionAnalysisManagerCGSCCProxy {
+class FunctionAnalysisManagerCGSCCProxy
+ : public AnalysisBase<FunctionAnalysisManagerCGSCCProxy> {
public:
class Result {
public:
@@ -328,10 +319,6 @@ public:
FunctionAnalysisManager *FAM;
};
- static void *ID() { return (void *)&PassID; }
-
- static StringRef name() { return "FunctionAnalysisManagerCGSCCProxy"; }
-
explicit FunctionAnalysisManagerCGSCCProxy(FunctionAnalysisManager &FAM)
: FAM(&FAM) {}
// We have to explicitly define all the special member functions because MSVC
@@ -359,8 +346,6 @@ public:
Result run(LazyCallGraph::SCC &C);
private:
- static char PassID;
-
FunctionAnalysisManager *FAM;
};
@@ -376,7 +361,8 @@ private:
/// This proxy *doesn't* manage the invalidation in any way. That is handled by
/// the recursive return path of each layer of the pass manager and the
/// returned PreservedAnalysis set.
-class CGSCCAnalysisManagerFunctionProxy {
+class CGSCCAnalysisManagerFunctionProxy
+ : public AnalysisBase<CGSCCAnalysisManagerFunctionProxy> {
public:
/// \brief Result proxy object for \c CGSCCAnalysisManagerFunctionProxy.
class Result {
@@ -400,10 +386,6 @@ public:
const CGSCCAnalysisManager *CGAM;
};
- static void *ID() { return (void *)&PassID; }
-
- static StringRef name() { return "CGSCCAnalysisManagerFunctionProxy"; }
-
CGSCCAnalysisManagerFunctionProxy(const CGSCCAnalysisManager &CGAM)
: CGAM(&CGAM) {}
// We have to explicitly define all the special member functions because MSVC
@@ -425,8 +407,6 @@ public:
Result run(Function &) { return Result(*CGAM); }
private:
- static char PassID;
-
const CGSCCAnalysisManager *CGAM;
};
@@ -438,7 +418,9 @@ private:
/// \c FunctionAnalysisManagerCGSCCProxy analysis prior to running the function
/// pass over the SCC to enable a \c FunctionAnalysisManager to be used
/// within this run safely.
-template <typename FunctionPassT> class CGSCCToFunctionPassAdaptor {
+template <typename FunctionPassT>
+class CGSCCToFunctionPassAdaptor
+ : public PassBase<CGSCCToFunctionPassAdaptor<FunctionPassT>> {
public:
explicit CGSCCToFunctionPassAdaptor(FunctionPassT Pass)
: Pass(std::move(Pass)) {}
@@ -492,8 +474,6 @@ public:
return PA;
}
- static StringRef name() { return "CGSCCToFunctionPassAdaptor"; }
-
private:
FunctionPassT Pass;
};
Modified: llvm/trunk/include/llvm/Analysis/CallGraph.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/CallGraph.h?rev=262004&r1=262003&r2=262004&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/CallGraph.h (original)
+++ llvm/trunk/include/llvm/Analysis/CallGraph.h Fri Feb 26 05:44:45 2016
@@ -57,6 +57,7 @@
#include "llvm/IR/CallSite.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/Intrinsics.h"
+#include "llvm/IR/PassManager.h"
#include "llvm/IR/ValueHandle.h"
#include "llvm/Pass.h"
#include <map>
@@ -294,20 +295,15 @@ 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 {
+struct CallGraphAnalysis : AnalysisBase<CallGraphAnalysis> {
public:
/// \brief A formulaic typedef to inform clients of the result type.
typedef CallGraph Result;
- static void *ID() { return (void *)&PassID; }
-
/// \brief Compute the \c CallGraph for the module \c M.
///
/// The real work here is done in the \c CallGraph constructor.
CallGraph run(Module *M) { return CallGraph(*M); }
-
-private:
- static char PassID;
};
/// \brief The \c ModulePass which wraps up a \c CallGraph and the logic to
Modified: llvm/trunk/include/llvm/Analysis/DominanceFrontier.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/DominanceFrontier.h?rev=262004&r1=262003&r2=262004&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/DominanceFrontier.h (original)
+++ llvm/trunk/include/llvm/Analysis/DominanceFrontier.h Fri Feb 26 05:44:45 2016
@@ -168,33 +168,22 @@ extern template class DominanceFrontierB
extern template class ForwardDominanceFrontierBase<BasicBlock>;
/// \brief Analysis pass which computes a \c DominanceFrontier.
-class DominanceFrontierAnalysis {
-public:
+struct DominanceFrontierAnalysis : AnalysisBase<DominanceFrontierAnalysis> {
/// \brief Provide the result typedef for this analysis pass.
typedef DominanceFrontier Result;
- /// \brief Opaque, unique identifier for this analysis pass.
- static void *ID() { return (void *)&PassID; }
-
/// \brief Run the analysis pass over a function and produce a dominator tree.
DominanceFrontier run(Function &F, AnalysisManager<Function> *AM);
-
- /// \brief Provide access to a name for this pass for debugging purposes.
- static StringRef name() { return "DominanceFrontierAnalysis"; }
-
-private:
- static char PassID;
};
/// \brief Printer pass for the \c DominanceFrontier.
-class DominanceFrontierPrinterPass {
+class DominanceFrontierPrinterPass
+ : public PassBase<DominanceFrontierPrinterPass> {
raw_ostream &OS;
public:
explicit DominanceFrontierPrinterPass(raw_ostream &OS);
PreservedAnalyses run(Function &F, AnalysisManager<Function> *AM);
-
- static StringRef name() { return "DominanceFrontierAnalysis"; }
};
} // End llvm namespace
Modified: llvm/trunk/include/llvm/Analysis/GlobalsModRef.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/GlobalsModRef.h?rev=262004&r1=262003&r2=262004&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/GlobalsModRef.h (original)
+++ llvm/trunk/include/llvm/Analysis/GlobalsModRef.h Fri Feb 26 05:44:45 2016
@@ -116,20 +116,10 @@ private:
};
/// Analysis pass providing a never-invalidated alias analysis result.
-class GlobalsAA {
-public:
+struct GlobalsAA : AnalysisBase<GlobalsAA> {
typedef GlobalsAAResult Result;
- /// \brief Opaque, unique identifier for this analysis pass.
- static void *ID() { return (void *)&PassID; }
-
GlobalsAAResult run(Module &M, AnalysisManager<Module> *AM);
-
- /// \brief Provide access to a name for this pass for debugging purposes.
- static StringRef name() { return "GlobalsAA"; }
-
-private:
- static char PassID;
};
/// Legacy wrapper pass to provide the GlobalsAAResult object.
Modified: llvm/trunk/include/llvm/Analysis/LazyCallGraph.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/LazyCallGraph.h?rev=262004&r1=262003&r2=262004&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/LazyCallGraph.h (original)
+++ llvm/trunk/include/llvm/Analysis/LazyCallGraph.h Fri Feb 26 05:44:45 2016
@@ -895,37 +895,27 @@ template <> struct GraphTraits<LazyCallG
};
/// An analysis pass which computes the call graph for a module.
-class LazyCallGraphAnalysis {
-public:
+struct LazyCallGraphAnalysis : AnalysisBase<LazyCallGraphAnalysis> {
/// Inform generic clients of the result type.
typedef LazyCallGraph Result;
- static void *ID() { return (void *)&PassID; }
-
- static StringRef name() { return "Lazy CallGraph Analysis"; }
-
/// Compute the \c LazyCallGraph for the module \c M.
///
/// This just builds the set of entry points to the call graph. The rest is
/// built lazily as it is walked.
LazyCallGraph run(Module &M) { return LazyCallGraph(M); }
-
-private:
- static char PassID;
};
/// A pass which prints the call graph to a \c raw_ostream.
///
/// This is primarily useful for testing the analysis.
-class LazyCallGraphPrinterPass {
+class LazyCallGraphPrinterPass : public PassBase<LazyCallGraphPrinterPass> {
raw_ostream &OS;
public:
explicit LazyCallGraphPrinterPass(raw_ostream &OS);
PreservedAnalyses run(Module &M, ModuleAnalysisManager *AM);
-
- static StringRef name() { return "LazyCallGraphPrinterPass"; }
};
}
Modified: llvm/trunk/include/llvm/Analysis/LoopInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/LoopInfo.h?rev=262004&r1=262003&r2=262004&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/LoopInfo.h (original)
+++ llvm/trunk/include/llvm/Analysis/LoopInfo.h Fri Feb 26 05:44:45 2016
@@ -787,30 +787,19 @@ template <> struct GraphTraits<Loop*> {
};
/// \brief Analysis pass that exposes the \c LoopInfo for a function.
-class LoopAnalysis {
- static char PassID;
-
-public:
+struct LoopAnalysis : AnalysisBase<LoopAnalysis> {
typedef LoopInfo Result;
- /// \brief Opaque, unique identifier for this analysis pass.
- static void *ID() { return (void *)&PassID; }
-
- /// \brief Provide a name for the analysis for debugging and logging.
- static StringRef name() { return "LoopAnalysis"; }
-
LoopInfo run(Function &F, AnalysisManager<Function> *AM);
};
/// \brief Printer pass for the \c LoopAnalysis results.
-class LoopPrinterPass {
+class LoopPrinterPass : public PassBase<LoopPrinterPass> {
raw_ostream &OS;
public:
explicit LoopPrinterPass(raw_ostream &OS) : OS(OS) {}
PreservedAnalyses run(Function &F, AnalysisManager<Function> *AM);
-
- static StringRef name() { return "LoopPrinterPass"; }
};
/// \brief The legacy pass manager's analysis pass to compute loop information.
@@ -840,7 +829,7 @@ public:
};
/// \brief Pass for printing a loop's contents as LLVM's text IR assembly.
-class PrintLoopPass {
+class PrintLoopPass : public PassBase<PrintLoopPass> {
raw_ostream &OS;
std::string Banner;
@@ -849,7 +838,6 @@ public:
PrintLoopPass(raw_ostream &OS, const std::string &Banner = "");
PreservedAnalyses run(Loop &L);
- static StringRef name() { return "PrintLoopPass"; }
};
} // End llvm namespace
Modified: llvm/trunk/include/llvm/Analysis/LoopPassManager.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/LoopPassManager.h?rev=262004&r1=262003&r2=262004&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/LoopPassManager.h (original)
+++ llvm/trunk/include/llvm/Analysis/LoopPassManager.h Fri Feb 26 05:44:45 2016
@@ -44,7 +44,8 @@ typedef AnalysisManager<Loop> LoopAnalys
/// never use a loop analysis manager from within (transitively) a function
/// pass manager unless your parent function pass has received a proxy result
/// object for it.
-class LoopAnalysisManagerFunctionProxy {
+class LoopAnalysisManagerFunctionProxy
+ : public AnalysisBase<LoopAnalysisManagerFunctionProxy> {
public:
class Result {
public:
@@ -77,10 +78,6 @@ public:
LoopAnalysisManager *LAM;
};
- static void *ID() { return (void *)&PassID; }
-
- static StringRef name() { return "LoopAnalysisManagerFunctionProxy"; }
-
explicit LoopAnalysisManagerFunctionProxy(LoopAnalysisManager &LAM)
: LAM(&LAM) {}
// We have to explicitly define all the special member functions because MSVC
@@ -107,8 +104,6 @@ public:
Result run(Function &F);
private:
- static char PassID;
-
LoopAnalysisManager *LAM;
};
@@ -124,7 +119,8 @@ private:
/// This proxy *doesn't* manage the invalidation in any way. That is handled by
/// the recursive return path of each layer of the pass manager and the
/// returned PreservedAnalysis set.
-class FunctionAnalysisManagerLoopProxy {
+class FunctionAnalysisManagerLoopProxy
+ : public AnalysisBase<FunctionAnalysisManagerLoopProxy> {
public:
/// \brief Result proxy object for \c FunctionAnalysisManagerLoopProxy.
class Result {
@@ -148,10 +144,6 @@ public:
const FunctionAnalysisManager *FAM;
};
- static void *ID() { return (void *)&PassID; }
-
- static StringRef name() { return "FunctionAnalysisManagerLoopProxy"; }
-
FunctionAnalysisManagerLoopProxy(const FunctionAnalysisManager &FAM)
: FAM(&FAM) {}
// We have to explicitly define all the special member functions because MSVC
@@ -172,8 +164,6 @@ public:
Result run(Loop &) { return Result(*FAM); }
private:
- static char PassID;
-
const FunctionAnalysisManager *FAM;
};
@@ -184,7 +174,9 @@ private:
/// FunctionAnalysisManager it will run the \c LoopAnalysisManagerFunctionProxy
/// analysis prior to running the loop passes over the function to enable a \c
/// LoopAnalysisManager to be used within this run safely.
-template <typename LoopPassT> class FunctionToLoopPassAdaptor {
+template <typename LoopPassT>
+class FunctionToLoopPassAdaptor
+ : public PassBase<FunctionToLoopPassAdaptor<LoopPassT>> {
public:
explicit FunctionToLoopPassAdaptor(LoopPassT Pass)
: Pass(std::move(Pass)) {}
@@ -250,8 +242,6 @@ public:
return PA;
}
- static StringRef name() { return "FunctionToLoopPassAdaptor"; }
-
private:
LoopPassT Pass;
};
Modified: llvm/trunk/include/llvm/Analysis/ObjCARCAliasAnalysis.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/ObjCARCAliasAnalysis.h?rev=262004&r1=262003&r2=262004&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/ObjCARCAliasAnalysis.h (original)
+++ llvm/trunk/include/llvm/Analysis/ObjCARCAliasAnalysis.h Fri Feb 26 05:44:45 2016
@@ -63,20 +63,10 @@ public:
};
/// Analysis pass providing a never-invalidated alias analysis result.
-class ObjCARCAA {
-public:
+struct ObjCARCAA : AnalysisBase<ObjCARCAA> {
typedef ObjCARCAAResult Result;
- /// \brief Opaque, unique identifier for this analysis pass.
- static void *ID() { return (void *)&PassID; }
-
ObjCARCAAResult run(Function &F, AnalysisManager<Function> *AM);
-
- /// \brief Provide access to a name for this pass for debugging purposes.
- static StringRef name() { return "ObjCARCAA"; }
-
-private:
- static char PassID;
};
/// Legacy wrapper pass to provide the ObjCARCAAResult object.
Modified: llvm/trunk/include/llvm/Analysis/PostDominators.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/PostDominators.h?rev=262004&r1=262003&r2=262004&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/PostDominators.h (original)
+++ llvm/trunk/include/llvm/Analysis/PostDominators.h Fri Feb 26 05:44:45 2016
@@ -37,34 +37,23 @@ struct PostDominatorTree : public Domina
};
/// \brief Analysis pass which computes a \c PostDominatorTree.
-class PostDominatorTreeAnalysis {
-public:
+struct PostDominatorTreeAnalysis : AnalysisBase<PostDominatorTreeAnalysis> {
/// \brief Provide the result typedef for this analysis pass.
typedef PostDominatorTree Result;
- /// \brief Opaque, unique identifier for this analysis pass.
- static void *ID() { return (void *)&PassID; }
-
/// \brief Run the analysis pass over a function and produce a post dominator
/// tree.
PostDominatorTree run(Function &F);
-
- /// \brief Provide access to a name for this pass for debugging purposes.
- static StringRef name() { return "PostDominatorTreeAnalysis"; }
-
-private:
- static char PassID;
};
/// \brief Printer pass for the \c PostDominatorTree.
-class PostDominatorTreePrinterPass {
+class PostDominatorTreePrinterPass
+ : public PassBase<PostDominatorTreePrinterPass> {
raw_ostream &OS;
public:
explicit PostDominatorTreePrinterPass(raw_ostream &OS);
PreservedAnalyses run(Function &F, AnalysisManager<Function> *AM);
-
- static StringRef name() { return "PostDominatorTreePrinterPass"; }
};
struct PostDominatorTreeWrapperPass : public FunctionPass {
Modified: llvm/trunk/include/llvm/Analysis/RegionInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/RegionInfo.h?rev=262004&r1=262003&r2=262004&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/RegionInfo.h (original)
+++ llvm/trunk/include/llvm/Analysis/RegionInfo.h Fri Feb 26 05:44:45 2016
@@ -923,37 +923,24 @@ public:
};
/// \brief Analysis pass that exposes the \c RegionInfo for a function.
-class RegionInfoAnalysis {
- static char PassID;
-
-public:
+struct RegionInfoAnalysis : AnalysisBase<RegionInfoAnalysis> {
typedef RegionInfo Result;
- /// \brief Opaque, unique identifier for this analysis pass.
- static void *ID() { return (void *)&PassID; }
-
- /// \brief Provide a name for the analysis for debugging and logging.
- static StringRef name() { return "RegionInfoAnalysis"; }
-
RegionInfo run(Function &F, AnalysisManager<Function> *AM);
};
/// \brief Printer pass for the \c RegionInfo.
-class RegionInfoPrinterPass {
+class RegionInfoPrinterPass : public PassBase<RegionInfoPrinterPass> {
raw_ostream &OS;
public:
explicit RegionInfoPrinterPass(raw_ostream &OS);
PreservedAnalyses run(Function &F, AnalysisManager<Function> *AM);
-
- static StringRef name() { return "RegionInfoPrinterPass"; }
};
/// \brief Verifier pass for the \c RegionInfo.
-struct RegionInfoVerifierPass {
+struct RegionInfoVerifierPass : PassBase<RegionInfoVerifierPass> {
PreservedAnalyses run(Function &F, AnalysisManager<Function> *AM);
-
- static StringRef name() { return "RegionInfoVerifierPass"; }
};
template <>
Modified: llvm/trunk/include/llvm/Analysis/ScalarEvolution.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/ScalarEvolution.h?rev=262004&r1=262003&r2=262004&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/ScalarEvolution.h (original)
+++ llvm/trunk/include/llvm/Analysis/ScalarEvolution.h Fri Feb 26 05:44:45 2016
@@ -1415,30 +1415,20 @@ namespace llvm {
};
/// \brief Analysis pass that exposes the \c ScalarEvolution for a function.
- class ScalarEvolutionAnalysis {
- static char PassID;
-
- public:
+ struct ScalarEvolutionAnalysis : AnalysisBase<ScalarEvolutionAnalysis> {
typedef ScalarEvolution Result;
- /// \brief Opaque, unique identifier for this analysis pass.
- static void *ID() { return (void *)&PassID; }
-
- /// \brief Provide a name for the analysis for debugging and logging.
- static StringRef name() { return "ScalarEvolutionAnalysis"; }
-
ScalarEvolution run(Function &F, AnalysisManager<Function> *AM);
};
/// \brief Printer pass for the \c ScalarEvolutionAnalysis results.
- class ScalarEvolutionPrinterPass {
+ class ScalarEvolutionPrinterPass
+ : public PassBase<ScalarEvolutionPrinterPass> {
raw_ostream &OS;
public:
explicit ScalarEvolutionPrinterPass(raw_ostream &OS) : OS(OS) {}
PreservedAnalyses run(Function &F, AnalysisManager<Function> *AM);
-
- static StringRef name() { return "ScalarEvolutionPrinterPass"; }
};
class ScalarEvolutionWrapperPass : public FunctionPass {
Modified: llvm/trunk/include/llvm/Analysis/ScalarEvolutionAliasAnalysis.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/ScalarEvolutionAliasAnalysis.h?rev=262004&r1=262003&r2=262004&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/ScalarEvolutionAliasAnalysis.h (original)
+++ llvm/trunk/include/llvm/Analysis/ScalarEvolutionAliasAnalysis.h Fri Feb 26 05:44:45 2016
@@ -39,20 +39,10 @@ private:
};
/// Analysis pass providing a never-invalidated alias analysis result.
-class SCEVAA {
-public:
+struct SCEVAA : AnalysisBase<SCEVAA> {
typedef SCEVAAResult Result;
- /// \brief Opaque, unique identifier for this analysis pass.
- static void *ID() { return (void *)&PassID; }
-
SCEVAAResult run(Function &F, AnalysisManager<Function> *AM);
-
- /// \brief Provide access to a name for this pass for debugging purposes.
- static StringRef name() { return "SCEVAA"; }
-
-private:
- static char PassID;
};
/// Legacy wrapper pass to provide the SCEVAAResult object.
Modified: llvm/trunk/include/llvm/Analysis/ScopedNoAliasAA.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/ScopedNoAliasAA.h?rev=262004&r1=262003&r2=262004&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/ScopedNoAliasAA.h (original)
+++ llvm/trunk/include/llvm/Analysis/ScopedNoAliasAA.h Fri Feb 26 05:44:45 2016
@@ -48,20 +48,10 @@ private:
};
/// Analysis pass providing a never-invalidated alias analysis result.
-class ScopedNoAliasAA {
-public:
+struct ScopedNoAliasAA : AnalysisBase<ScopedNoAliasAA> {
typedef ScopedNoAliasAAResult Result;
- /// \brief Opaque, unique identifier for this analysis pass.
- static void *ID() { return (void *)&PassID; }
-
ScopedNoAliasAAResult run(Function &F, AnalysisManager<Function> *AM);
-
- /// \brief Provide access to a name for this pass for debugging purposes.
- static StringRef name() { return "ScopedNoAliasAA"; }
-
-private:
- static char PassID;
};
/// Legacy wrapper pass to provide the ScopedNoAliasAAResult object.
Modified: llvm/trunk/include/llvm/Analysis/TargetLibraryInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/TargetLibraryInfo.h?rev=262004&r1=262003&r2=262004&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/TargetLibraryInfo.h (original)
+++ llvm/trunk/include/llvm/Analysis/TargetLibraryInfo.h Fri Feb 26 05:44:45 2016
@@ -16,6 +16,7 @@
#include "llvm/ADT/Triple.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/Module.h"
+#include "llvm/IR/PassManager.h"
#include "llvm/Pass.h"
namespace llvm {
@@ -27,7 +28,6 @@ struct VecDesc {
const char *VectorFnName;
unsigned VectorizationFactor;
};
-class PreservedAnalyses;
namespace LibFunc {
enum Func {
@@ -262,13 +262,10 @@ public:
///
/// Note that this pass's result cannot be invalidated, it is immutable for the
/// life of the module.
-class TargetLibraryAnalysis {
+class TargetLibraryAnalysis : public AnalysisBase<TargetLibraryAnalysis> {
public:
typedef TargetLibraryInfo Result;
- /// \brief Opaque, unique identifier for this analysis pass.
- static void *ID() { return (void *)&PassID; }
-
/// \brief Default construct the library analysis.
///
/// This will use the module's triple to construct the library info for that
@@ -294,12 +291,7 @@ public:
TargetLibraryInfo run(Module &M);
TargetLibraryInfo run(Function &F);
- /// \brief Provide access to a name for this pass for debugging purposes.
- static StringRef name() { return "TargetLibraryAnalysis"; }
-
private:
- static char PassID;
-
Optional<TargetLibraryInfoImpl> PresetInfoImpl;
StringMap<std::unique_ptr<TargetLibraryInfoImpl>> Impls;
Modified: llvm/trunk/include/llvm/Analysis/TargetTransformInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/TargetTransformInfo.h?rev=262004&r1=262003&r2=262004&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/TargetTransformInfo.h (original)
+++ llvm/trunk/include/llvm/Analysis/TargetTransformInfo.h Fri Feb 26 05:44:45 2016
@@ -25,6 +25,7 @@
#include "llvm/ADT/Optional.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/Intrinsics.h"
+#include "llvm/IR/PassManager.h"
#include "llvm/Pass.h"
#include "llvm/Support/DataTypes.h"
#include <functional>
@@ -34,7 +35,6 @@ namespace llvm {
class Function;
class GlobalValue;
class Loop;
-class PreservedAnalyses;
class Type;
class User;
class Value;
@@ -889,16 +889,10 @@ TargetTransformInfo::TargetTransformInfo
/// 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 {
+class TargetIRAnalysis : public AnalysisBase<TargetIRAnalysis> {
public:
typedef TargetTransformInfo Result;
- /// \brief Opaque, unique identifier for this analysis pass.
- static void *ID() { return (void *)&PassID; }
-
- /// \brief Provide access to a name for this pass for debugging purposes.
- static StringRef name() { return "TargetIRAnalysis"; }
-
/// \brief Default construct a target IR analysis.
///
/// This will use the module's datalayout to construct a baseline
@@ -928,8 +922,6 @@ public:
Result run(const Function &F);
private:
- static char PassID;
-
/// \brief The callback used to produce a result.
///
/// We use a completely opaque callback so that targets can provide whatever
Modified: llvm/trunk/include/llvm/Analysis/TypeBasedAliasAnalysis.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/TypeBasedAliasAnalysis.h?rev=262004&r1=262003&r2=262004&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/TypeBasedAliasAnalysis.h (original)
+++ llvm/trunk/include/llvm/Analysis/TypeBasedAliasAnalysis.h Fri Feb 26 05:44:45 2016
@@ -49,20 +49,10 @@ private:
};
/// Analysis pass providing a never-invalidated alias analysis result.
-class TypeBasedAA {
-public:
+struct TypeBasedAA : AnalysisBase<TypeBasedAA> {
typedef TypeBasedAAResult Result;
- /// \brief Opaque, unique identifier for this analysis pass.
- static void *ID() { return (void *)&PassID; }
-
TypeBasedAAResult run(Function &F, AnalysisManager<Function> *AM);
-
- /// \brief Provide access to a name for this pass for debugging purposes.
- static StringRef name() { return "TypeBasedAA"; }
-
-private:
- static char PassID;
};
/// Legacy wrapper pass to provide the TypeBasedAAResult object.
Modified: llvm/trunk/include/llvm/IR/Dominators.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/Dominators.h?rev=262004&r1=262003&r2=262004&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/Dominators.h (original)
+++ llvm/trunk/include/llvm/IR/Dominators.h Fri Feb 26 05:44:45 2016
@@ -182,40 +182,26 @@ template <> struct GraphTraits<Dominator
};
/// \brief Analysis pass which computes a \c DominatorTree.
-class DominatorTreeAnalysis {
-public:
+struct DominatorTreeAnalysis : AnalysisBase<DominatorTreeAnalysis> {
/// \brief Provide the result typedef for this analysis pass.
typedef DominatorTree Result;
- /// \brief Opaque, unique identifier for this analysis pass.
- static void *ID() { return (void *)&PassID; }
-
/// \brief Run the analysis pass over a function and produce a dominator tree.
DominatorTree run(Function &F);
-
- /// \brief Provide access to a name for this pass for debugging purposes.
- static StringRef name() { return "DominatorTreeAnalysis"; }
-
-private:
- static char PassID;
};
/// \brief Printer pass for the \c DominatorTree.
-class DominatorTreePrinterPass {
+class DominatorTreePrinterPass : public PassBase<DominatorTreePrinterPass> {
raw_ostream &OS;
public:
explicit DominatorTreePrinterPass(raw_ostream &OS);
PreservedAnalyses run(Function &F, AnalysisManager<Function> *AM);
-
- static StringRef name() { return "DominatorTreePrinterPass"; }
};
/// \brief Verifier pass for the \c DominatorTree.
-struct DominatorTreeVerifierPass {
+struct DominatorTreeVerifierPass : PassBase<DominatorTreeVerifierPass> {
PreservedAnalyses run(Function &F, AnalysisManager<Function> *AM);
-
- static StringRef name() { return "DominatorTreeVerifierPass"; }
};
/// \brief Legacy analysis pass which computes a \c DominatorTree.
Modified: llvm/trunk/include/llvm/IR/PassManager.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/PassManager.h?rev=262004&r1=262003&r2=262004&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/PassManager.h (original)
+++ llvm/trunk/include/llvm/IR/PassManager.h Fri Feb 26 05:44:45 2016
@@ -167,6 +167,33 @@ 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.
+///
+/// This provides some boiler plate for types that are passes.
+template <typename DerivedT> struct PassBase {
+ /// Returns the name of the derived pass type.
+ static StringRef name() {
+ StringRef Name = getTypeName<DerivedT>();
+ if (Name.startswith("llvm::"))
+ Name = Name.drop_front(strlen("llvm::"));
+ return Name;
+ }
+};
+
+/// A CRTP mix-in base class to help define types that are valid analyses.
+///
+/// This provides some boiler plate for types that are analysis passes.
+template <typename DerivedT> class AnalysisBase : public PassBase<DerivedT> {
+ static char PassID;
+
+public:
+ /// Returns an opaque, unique ID for this pass type.
+ static void *ID() { return (void *)&PassID; }
+};
+
+/// Private static data to provide unique ID.
+template <typename DerivedT> char AnalysisBase<DerivedT>::PassID;
+
/// \brief Manages a sequence of passes over units of IR.
///
/// A pass manager contains a sequence of passes to run over units of IR. It is
@@ -178,7 +205,8 @@ template <typename IRUnitT> class Analys
/// that analysis manager to each pass it runs, as well as calling the analysis
/// manager's invalidation routine with the PreservedAnalyses of each pass it
/// runs.
-template <typename IRUnitT> class PassManager {
+template <typename IRUnitT>
+class PassManager : public PassBase<PassManager<IRUnitT>> {
public:
/// \brief Construct a pass manager.
///
@@ -623,14 +651,11 @@ typedef AnalysisManager<Function> Functi
/// Note that the proxy's result is a move-only object and represents ownership
/// of the validity of the analyses in the \c FunctionAnalysisManager it
/// provides.
-class FunctionAnalysisManagerModuleProxy {
+class FunctionAnalysisManagerModuleProxy
+ : public AnalysisBase<FunctionAnalysisManagerModuleProxy> {
public:
class Result;
- static void *ID() { return (void *)&PassID; }
-
- static StringRef name() { return "FunctionAnalysisManagerModuleProxy"; }
-
explicit FunctionAnalysisManagerModuleProxy(FunctionAnalysisManager &FAM)
: FAM(&FAM) {}
// We have to explicitly define all the special member functions because MSVC
@@ -658,8 +683,6 @@ public:
Result run(Module &M);
private:
- static char PassID;
-
FunctionAnalysisManager *FAM;
};
@@ -717,7 +740,8 @@ private:
/// This proxy *doesn't* manage the invalidation in any way. That is handled by
/// the recursive return path of each layer of the pass manager and the
/// returned PreservedAnalysis set.
-class ModuleAnalysisManagerFunctionProxy {
+class ModuleAnalysisManagerFunctionProxy
+ : public AnalysisBase<ModuleAnalysisManagerFunctionProxy> {
public:
/// \brief Result proxy object for \c ModuleAnalysisManagerFunctionProxy.
class Result {
@@ -741,10 +765,6 @@ public:
const ModuleAnalysisManager *MAM;
};
- static void *ID() { return (void *)&PassID; }
-
- static StringRef name() { return "ModuleAnalysisManagerFunctionProxy"; }
-
ModuleAnalysisManagerFunctionProxy(const ModuleAnalysisManager &MAM)
: MAM(&MAM) {}
// We have to explicitly define all the special member functions because MSVC
@@ -766,8 +786,6 @@ public:
Result run(Function &) { return Result(*MAM); }
private:
- static char PassID;
-
const ModuleAnalysisManager *MAM;
};
@@ -793,7 +811,9 @@ private:
/// module.
/// FIXME: Make the above true for all of LLVM's actual passes, some still
/// violate this principle.
-template <typename FunctionPassT> class ModuleToFunctionPassAdaptor {
+template <typename FunctionPassT>
+class ModuleToFunctionPassAdaptor
+ : public PassBase<ModuleToFunctionPassAdaptor<FunctionPassT>> {
public:
explicit ModuleToFunctionPassAdaptor(FunctionPassT Pass)
: Pass(std::move(Pass)) {}
@@ -848,8 +868,6 @@ public:
return PA;
}
- static StringRef name() { return "ModuleToFunctionPassAdaptor"; }
-
private:
FunctionPassT Pass;
};
@@ -866,7 +884,8 @@ createModuleToFunctionPassAdaptor(Functi
///
/// 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 {
+template <typename AnalysisT>
+struct RequireAnalysisPass : PassBase<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
@@ -880,8 +899,6 @@ template <typename AnalysisT> struct Req
return PreservedAnalyses::all();
}
-
- static StringRef name() { return "RequireAnalysisPass"; }
};
/// \brief A template utility pass to force an analysis result to be
@@ -889,7 +906,8 @@ template <typename AnalysisT> struct Req
///
/// 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 {
+template <typename AnalysisT>
+struct InvalidateAnalysisPass : PassBase<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
@@ -905,21 +923,17 @@ template <typename AnalysisT> struct Inv
return PreservedAnalyses::all();
}
-
- static StringRef name() { return "InvalidateAnalysisPass"; }
};
/// \brief A utility pass that does nothing but preserves no analyses.
///
/// 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 {
+struct InvalidateAllAnalysesPass : PassBase<InvalidateAllAnalysesPass> {
/// \brief Run this pass over some unit of IR.
template <typename IRUnitT> PreservedAnalyses run(IRUnitT &Arg) {
return PreservedAnalyses::none();
}
-
- static StringRef name() { return "InvalidateAllAnalysesPass"; }
};
}
Modified: llvm/trunk/include/llvm/IR/Verifier.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/Verifier.h?rev=262004&r1=262003&r2=262004&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/Verifier.h (original)
+++ llvm/trunk/include/llvm/IR/Verifier.h Fri Feb 26 05:44:45 2016
@@ -22,6 +22,7 @@
#define LLVM_IR_VERIFIER_H
#include "llvm/ADT/StringRef.h"
+#include "llvm/IR/PassManager.h"
#include <string>
namespace llvm {
@@ -30,7 +31,6 @@ class Function;
class FunctionPass;
class ModulePass;
class Module;
-class PreservedAnalyses;
class raw_ostream;
/// \brief Check a function for errors, useful for use when debugging a
@@ -60,7 +60,7 @@ bool verifyModule(const Module &M, raw_o
/// nothing to do with \c VerifierPass.
FunctionPass *createVerifierPass(bool FatalErrors = true);
-class VerifierPass {
+class VerifierPass : public PassBase<VerifierPass> {
bool FatalErrors;
public:
@@ -68,8 +68,6 @@ public:
PreservedAnalyses run(Module &M);
PreservedAnalyses run(Function &F);
-
- static StringRef name() { return "VerifierPass"; }
};
} // End llvm namespace
Modified: llvm/trunk/include/llvm/Transforms/IPO/ForceFunctionAttrs.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/IPO/ForceFunctionAttrs.h?rev=262004&r1=262003&r2=262004&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/IPO/ForceFunctionAttrs.h (original)
+++ llvm/trunk/include/llvm/Transforms/IPO/ForceFunctionAttrs.h Fri Feb 26 05:44:45 2016
@@ -21,9 +21,7 @@ namespace llvm {
/// Pass which forces specific function attributes into the IR, primarily as
/// a debugging tool.
-class ForceFunctionAttrsPass {
-public:
- static StringRef name() { return "ForceFunctionAttrsPass"; }
+struct ForceFunctionAttrsPass : PassBase<ForceFunctionAttrsPass> {
PreservedAnalyses run(Module &M);
};
Modified: llvm/trunk/include/llvm/Transforms/IPO/FunctionAttrs.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/IPO/FunctionAttrs.h?rev=262004&r1=262003&r2=262004&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/IPO/FunctionAttrs.h (original)
+++ llvm/trunk/include/llvm/Transforms/IPO/FunctionAttrs.h Fri Feb 26 05:44:45 2016
@@ -29,10 +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.
-class PostOrderFunctionAttrsPass {
-public:
- static StringRef name() { return "PostOrderFunctionAttrsPass"; }
-
+struct PostOrderFunctionAttrsPass : PassBase<PostOrderFunctionAttrsPass> {
PreservedAnalyses run(LazyCallGraph::SCC &C, CGSCCAnalysisManager *AM);
};
Modified: llvm/trunk/include/llvm/Transforms/IPO/InferFunctionAttrs.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/IPO/InferFunctionAttrs.h?rev=262004&r1=262003&r2=262004&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/IPO/InferFunctionAttrs.h (original)
+++ llvm/trunk/include/llvm/Transforms/IPO/InferFunctionAttrs.h Fri Feb 26 05:44:45 2016
@@ -23,9 +23,7 @@ namespace llvm {
/// A pass which infers function attributes from the names and signatures of
/// function declarations in a module.
-class InferFunctionAttrsPass {
-public:
- static StringRef name() { return "InferFunctionAttrsPass"; }
+struct InferFunctionAttrsPass : PassBase<InferFunctionAttrsPass> {
PreservedAnalyses run(Module &M, AnalysisManager<Module> *AM);
};
Modified: llvm/trunk/include/llvm/Transforms/IPO/StripDeadPrototypes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/IPO/StripDeadPrototypes.h?rev=262004&r1=262003&r2=262004&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/IPO/StripDeadPrototypes.h (original)
+++ llvm/trunk/include/llvm/Transforms/IPO/StripDeadPrototypes.h Fri Feb 26 05:44:45 2016
@@ -23,9 +23,7 @@
namespace llvm {
/// Pass to remove unused function declarations.
-class StripDeadPrototypesPass {
-public:
- static StringRef name() { return "StripDeadPrototypesPass"; }
+struct StripDeadPrototypesPass : PassBase<StripDeadPrototypesPass> {
PreservedAnalyses run(Module &M);
};
Modified: llvm/trunk/include/llvm/Transforms/InstCombine/InstCombine.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/InstCombine/InstCombine.h?rev=262004&r1=262003&r2=262004&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/InstCombine/InstCombine.h (original)
+++ llvm/trunk/include/llvm/Transforms/InstCombine/InstCombine.h Fri Feb 26 05:44:45 2016
@@ -24,7 +24,7 @@
namespace llvm {
-class InstCombinePass {
+class InstCombinePass : public PassBase<InstCombinePass> {
InstCombineWorklist Worklist;
public:
Modified: llvm/trunk/include/llvm/Transforms/Scalar/ADCE.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Scalar/ADCE.h?rev=262004&r1=262003&r2=262004&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/Scalar/ADCE.h (original)
+++ llvm/trunk/include/llvm/Transforms/Scalar/ADCE.h Fri Feb 26 05:44:45 2016
@@ -28,9 +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.
-class ADCEPass {
-public:
- static StringRef name() { return "ADCEPass"; }
+struct ADCEPass : PassBase<ADCEPass> {
PreservedAnalyses run(Function &F);
};
}
Modified: llvm/trunk/include/llvm/Transforms/Scalar/EarlyCSE.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Scalar/EarlyCSE.h?rev=262004&r1=262003&r2=262004&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/Scalar/EarlyCSE.h (original)
+++ llvm/trunk/include/llvm/Transforms/Scalar/EarlyCSE.h Fri Feb 26 05:44:45 2016
@@ -26,10 +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.
-class EarlyCSEPass {
-public:
- static StringRef name() { return "EarlyCSEPass"; }
-
+struct EarlyCSEPass : PassBase<EarlyCSEPass> {
/// \brief Run the pass over the function.
PreservedAnalyses run(Function &F, AnalysisManager<Function> *AM);
};
Modified: llvm/trunk/include/llvm/Transforms/Scalar/LowerExpectIntrinsic.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Scalar/LowerExpectIntrinsic.h?rev=262004&r1=262003&r2=262004&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/Scalar/LowerExpectIntrinsic.h (original)
+++ llvm/trunk/include/llvm/Transforms/Scalar/LowerExpectIntrinsic.h Fri Feb 26 05:44:45 2016
@@ -21,10 +21,7 @@
namespace llvm {
-class LowerExpectIntrinsicPass {
-public:
- static StringRef name() { return "LowerExpectIntrinsicPass"; }
-
+struct LowerExpectIntrinsicPass : PassBase<LowerExpectIntrinsicPass> {
/// \brief Run the pass over the function.
///
/// This will lower all of th expect intrinsic calls in this function into
Modified: llvm/trunk/include/llvm/Transforms/Scalar/SROA.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Scalar/SROA.h?rev=262004&r1=262003&r2=262004&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/Scalar/SROA.h (original)
+++ llvm/trunk/include/llvm/Transforms/Scalar/SROA.h Fri Feb 26 05:44:45 2016
@@ -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 {
+class SROA : public PassBase<SROA> {
LLVMContext *C;
DominatorTree *DT;
AssumptionCache *AC;
@@ -101,8 +101,6 @@ class SROA {
public:
SROA() : C(nullptr), DT(nullptr), AC(nullptr) {}
- static StringRef name() { return "SROA"; }
-
/// \brief Run the pass over the function.
PreservedAnalyses run(Function &F, AnalysisManager<Function> *AM);
Modified: llvm/trunk/include/llvm/Transforms/Scalar/SimplifyCFG.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Scalar/SimplifyCFG.h?rev=262004&r1=262003&r2=262004&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/Scalar/SimplifyCFG.h (original)
+++ llvm/trunk/include/llvm/Transforms/Scalar/SimplifyCFG.h Fri Feb 26 05:44:45 2016
@@ -25,12 +25,10 @@ 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 {
+class SimplifyCFGPass : public PassBase<SimplifyCFGPass> {
int BonusInstThreshold;
public:
- static StringRef name() { return "SimplifyCFGPass"; }
-
/// \brief Construct a pass with the default thresholds.
SimplifyCFGPass();
Modified: llvm/trunk/lib/Analysis/AliasAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/AliasAnalysis.cpp?rev=262004&r1=262003&r2=262004&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/AliasAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/AliasAnalysis.cpp Fri Feb 26 05:44:45 2016
@@ -390,9 +390,6 @@ bool AAResults::canInstructionRangeModRe
// Provide a definition for the root virtual destructor.
AAResults::Concept::~Concept() {}
-// Provide a definition for the static object used to identify passes.
-char AAManager::PassID;
-
namespace {
/// A wrapper pass for external alias analyses. This just squirrels away the
/// callback used to run any analyses and register their results.
Modified: llvm/trunk/lib/Analysis/AssumptionCache.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/AssumptionCache.cpp?rev=262004&r1=262003&r2=262004&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/AssumptionCache.cpp (original)
+++ llvm/trunk/lib/Analysis/AssumptionCache.cpp Fri Feb 26 05:44:45 2016
@@ -74,8 +74,6 @@ void AssumptionCache::registerAssumption
#endif
}
-char AssumptionAnalysis::PassID;
-
PreservedAnalyses AssumptionPrinterPass::run(Function &F,
AnalysisManager<Function> *AM) {
AssumptionCache &AC = AM->getResult<AssumptionAnalysis>(F);
Modified: llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp?rev=262004&r1=262003&r2=262004&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp Fri Feb 26 05:44:45 2016
@@ -1586,8 +1586,6 @@ bool BasicAAResult::constantOffsetHeuris
// BasicAliasAnalysis Pass
//===----------------------------------------------------------------------===//
-char BasicAA::PassID;
-
BasicAAResult BasicAA::run(Function &F, AnalysisManager<Function> *AM) {
return BasicAAResult(F.getParent()->getDataLayout(),
AM->getResult<TargetLibraryAnalysis>(F),
Modified: llvm/trunk/lib/Analysis/CFLAliasAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/CFLAliasAnalysis.cpp?rev=262004&r1=262003&r2=262004&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/CFLAliasAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/CFLAliasAnalysis.cpp Fri Feb 26 05:44:45 2016
@@ -1093,8 +1093,6 @@ CFLAAResult CFLAA::run(Function &F, Anal
return CFLAAResult(AM->getResult<TargetLibraryAnalysis>(F));
}
-char CFLAA::PassID;
-
char CFLAAWrapperPass::ID = 0;
INITIALIZE_PASS_BEGIN(CFLAAWrapperPass, "cfl-aa", "CFL-Based Alias Analysis",
false, true)
Modified: llvm/trunk/lib/Analysis/CGSCCPassManager.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/CGSCCPassManager.cpp?rev=262004&r1=262003&r2=262004&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/CGSCCPassManager.cpp (original)
+++ llvm/trunk/lib/Analysis/CGSCCPassManager.cpp Fri Feb 26 05:44:45 2016
@@ -13,8 +13,6 @@
using namespace llvm;
-char CGSCCAnalysisManagerModuleProxy::PassID;
-
CGSCCAnalysisManagerModuleProxy::Result
CGSCCAnalysisManagerModuleProxy::run(Module &M) {
assert(CGAM->empty() && "CGSCC analyses ran prior to the module proxy!");
@@ -44,10 +42,6 @@ bool CGSCCAnalysisManagerModuleProxy::Re
return false;
}
-char ModuleAnalysisManagerCGSCCProxy::PassID;
-
-char FunctionAnalysisManagerCGSCCProxy::PassID;
-
FunctionAnalysisManagerCGSCCProxy::Result
FunctionAnalysisManagerCGSCCProxy::run(LazyCallGraph::SCC &C) {
return Result(*FAM);
@@ -75,5 +69,3 @@ bool FunctionAnalysisManagerCGSCCProxy::
// Return false to indicate that this result is still a valid proxy.
return false;
}
-
-char CGSCCAnalysisManagerFunctionProxy::PassID;
Modified: llvm/trunk/lib/Analysis/CallGraph.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/CallGraph.cpp?rev=262004&r1=262003&r2=262004&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/CallGraph.cpp (original)
+++ llvm/trunk/lib/Analysis/CallGraph.cpp Fri Feb 26 05:44:45 2016
@@ -263,8 +263,6 @@ void CallGraphNode::replaceCallEdge(Call
// Out-of-line definitions of CallGraphAnalysis class members.
//
-char CallGraphAnalysis::PassID;
-
//===----------------------------------------------------------------------===//
// Implementations of the CallGraphWrapperPass class methods.
//
Modified: llvm/trunk/lib/Analysis/DominanceFrontier.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/DominanceFrontier.cpp?rev=262004&r1=262003&r2=262004&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/DominanceFrontier.cpp (original)
+++ llvm/trunk/lib/Analysis/DominanceFrontier.cpp Fri Feb 26 05:44:45 2016
@@ -56,8 +56,6 @@ LLVM_DUMP_METHOD void DominanceFrontierW
}
#endif
-char DominanceFrontierAnalysis::PassID;
-
DominanceFrontier DominanceFrontierAnalysis::run(Function &F,
FunctionAnalysisManager *AM) {
DominanceFrontier DF;
Modified: llvm/trunk/lib/Analysis/GlobalsModRef.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/GlobalsModRef.cpp?rev=262004&r1=262003&r2=262004&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/GlobalsModRef.cpp (original)
+++ llvm/trunk/lib/Analysis/GlobalsModRef.cpp Fri Feb 26 05:44:45 2016
@@ -940,8 +940,6 @@ GlobalsAAResult GlobalsAA::run(Module &M
AM->getResult<CallGraphAnalysis>(M));
}
-char GlobalsAA::PassID;
-
char GlobalsAAWrapperPass::ID = 0;
INITIALIZE_PASS_BEGIN(GlobalsAAWrapperPass, "globals-aa",
"Globals Alias Analysis", false, true)
Modified: llvm/trunk/lib/Analysis/LazyCallGraph.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LazyCallGraph.cpp?rev=262004&r1=262003&r2=262004&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/LazyCallGraph.cpp (original)
+++ llvm/trunk/lib/Analysis/LazyCallGraph.cpp Fri Feb 26 05:44:45 2016
@@ -1499,8 +1499,6 @@ LazyCallGraph::RefSCC *LazyCallGraph::ge
}
}
-char LazyCallGraphAnalysis::PassID;
-
LazyCallGraphPrinterPass::LazyCallGraphPrinterPass(raw_ostream &OS) : OS(OS) {}
static void printNode(raw_ostream &OS, LazyCallGraph::Node &N) {
Modified: llvm/trunk/lib/Analysis/LoopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LoopInfo.cpp?rev=262004&r1=262003&r2=262004&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/LoopInfo.cpp (original)
+++ llvm/trunk/lib/Analysis/LoopInfo.cpp Fri Feb 26 05:44:45 2016
@@ -641,8 +641,6 @@ void LoopInfo::markAsRemoved(Loop *Unloo
}
}
-char LoopAnalysis::PassID;
-
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
Modified: llvm/trunk/lib/Analysis/LoopPassManager.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LoopPassManager.cpp?rev=262004&r1=262003&r2=262004&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/LoopPassManager.cpp (original)
+++ llvm/trunk/lib/Analysis/LoopPassManager.cpp Fri Feb 26 05:44:45 2016
@@ -11,8 +11,6 @@
using namespace llvm;
-char LoopAnalysisManagerFunctionProxy::PassID;
-
LoopAnalysisManagerFunctionProxy::Result
LoopAnalysisManagerFunctionProxy::run(Function &F) {
// TODO: In FunctionAnalysisManagerModuleProxy we assert that the
@@ -41,5 +39,3 @@ bool LoopAnalysisManagerFunctionProxy::R
// Return false to indicate that this result is still a valid proxy.
return false;
}
-
-char FunctionAnalysisManagerLoopProxy::PassID;
Modified: llvm/trunk/lib/Analysis/ObjCARCAliasAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ObjCARCAliasAnalysis.cpp?rev=262004&r1=262003&r2=262004&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ObjCARCAliasAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/ObjCARCAliasAnalysis.cpp Fri Feb 26 05:44:45 2016
@@ -136,8 +136,6 @@ ObjCARCAAResult ObjCARCAA::run(Function
AM->getResult<TargetLibraryAnalysis>(F));
}
-char ObjCARCAA::PassID;
-
char ObjCARCAAWrapperPass::ID = 0;
INITIALIZE_PASS_BEGIN(ObjCARCAAWrapperPass, "objc-arc-aa",
"ObjC-ARC-Based Alias Analysis", false, true)
Modified: llvm/trunk/lib/Analysis/PostDominators.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/PostDominators.cpp?rev=262004&r1=262003&r2=262004&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/PostDominators.cpp (original)
+++ llvm/trunk/lib/Analysis/PostDominators.cpp Fri Feb 26 05:44:45 2016
@@ -44,8 +44,6 @@ FunctionPass* llvm::createPostDomTree()
return new PostDominatorTreeWrapperPass();
}
-char PostDominatorTreeAnalysis::PassID;
-
PostDominatorTree PostDominatorTreeAnalysis::run(Function &F) {
PostDominatorTree PDT;
PDT.recalculate(F);
Modified: llvm/trunk/lib/Analysis/RegionInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/RegionInfo.cpp?rev=262004&r1=262003&r2=262004&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/RegionInfo.cpp (original)
+++ llvm/trunk/lib/Analysis/RegionInfo.cpp Fri Feb 26 05:44:45 2016
@@ -185,8 +185,6 @@ namespace llvm {
// RegionInfoAnalysis implementation
//
-char RegionInfoAnalysis::PassID;
-
RegionInfo RegionInfoAnalysis::run(Function &F, AnalysisManager<Function> *AM) {
RegionInfo RI;
auto *DT = &AM->getResult<DominatorTreeAnalysis>(F);
Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=262004&r1=262003&r2=262004&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original)
+++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Fri Feb 26 05:44:45 2016
@@ -9554,8 +9554,6 @@ void ScalarEvolution::verify() const {
// TODO: Verify more things.
}
-char ScalarEvolutionAnalysis::PassID;
-
ScalarEvolution ScalarEvolutionAnalysis::run(Function &F,
AnalysisManager<Function> *AM) {
return ScalarEvolution(F, AM->getResult<TargetLibraryAnalysis>(F),
Modified: llvm/trunk/lib/Analysis/ScalarEvolutionAliasAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolutionAliasAnalysis.cpp?rev=262004&r1=262003&r2=262004&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ScalarEvolutionAliasAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/ScalarEvolutionAliasAnalysis.cpp Fri Feb 26 05:44:45 2016
@@ -116,8 +116,6 @@ SCEVAAResult SCEVAA::run(Function &F, An
AM->getResult<ScalarEvolutionAnalysis>(F));
}
-char SCEVAA::PassID;
-
char SCEVAAWrapperPass::ID = 0;
INITIALIZE_PASS_BEGIN(SCEVAAWrapperPass, "scev-aa",
"ScalarEvolution-based Alias Analysis", false, true)
Modified: llvm/trunk/lib/Analysis/ScopedNoAliasAA.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScopedNoAliasAA.cpp?rev=262004&r1=262003&r2=262004&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ScopedNoAliasAA.cpp (original)
+++ llvm/trunk/lib/Analysis/ScopedNoAliasAA.cpp Fri Feb 26 05:44:45 2016
@@ -178,8 +178,6 @@ ScopedNoAliasAAResult ScopedNoAliasAA::r
return ScopedNoAliasAAResult(AM->getResult<TargetLibraryAnalysis>(F));
}
-char ScopedNoAliasAA::PassID;
-
char ScopedNoAliasAAWrapperPass::ID = 0;
INITIALIZE_PASS_BEGIN(ScopedNoAliasAAWrapperPass, "scoped-noalias",
"Scoped NoAlias Alias Analysis", false, true)
Modified: llvm/trunk/lib/Analysis/TargetLibraryInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/TargetLibraryInfo.cpp?rev=262004&r1=262003&r2=262004&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/TargetLibraryInfo.cpp (original)
+++ llvm/trunk/lib/Analysis/TargetLibraryInfo.cpp Fri Feb 26 05:44:45 2016
@@ -636,8 +636,6 @@ TargetLibraryInfoWrapperPass::TargetLibr
initializeTargetLibraryInfoWrapperPassPass(*PassRegistry::getPassRegistry());
}
-char TargetLibraryAnalysis::PassID;
-
// Register the basic pass.
INITIALIZE_PASS(TargetLibraryInfoWrapperPass, "targetlibinfo",
"Target Library Information", false, true)
Modified: llvm/trunk/lib/Analysis/TargetTransformInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/TargetTransformInfo.cpp?rev=262004&r1=262003&r2=262004&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/TargetTransformInfo.cpp (original)
+++ llvm/trunk/lib/Analysis/TargetTransformInfo.cpp Fri Feb 26 05:44:45 2016
@@ -377,8 +377,6 @@ TargetIRAnalysis::Result TargetIRAnalysi
return TTICallback(F);
}
-char TargetIRAnalysis::PassID;
-
TargetIRAnalysis::Result TargetIRAnalysis::getDefaultTTI(const Function &F) {
return Result(F.getParent()->getDataLayout());
}
Modified: llvm/trunk/lib/Analysis/TypeBasedAliasAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/TypeBasedAliasAnalysis.cpp?rev=262004&r1=262003&r2=262004&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/TypeBasedAliasAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/TypeBasedAliasAnalysis.cpp Fri Feb 26 05:44:45 2016
@@ -588,8 +588,6 @@ TypeBasedAAResult TypeBasedAA::run(Funct
return TypeBasedAAResult(AM->getResult<TargetLibraryAnalysis>(F));
}
-char TypeBasedAA::PassID;
-
char TypeBasedAAWrapperPass::ID = 0;
INITIALIZE_PASS_BEGIN(TypeBasedAAWrapperPass, "tbaa",
"Type-Based Alias Analysis", false, true)
Modified: llvm/trunk/lib/IR/Dominators.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Dominators.cpp?rev=262004&r1=262003&r2=262004&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Dominators.cpp (original)
+++ llvm/trunk/lib/IR/Dominators.cpp Fri Feb 26 05:44:45 2016
@@ -308,8 +308,6 @@ DominatorTree DominatorTreeAnalysis::run
return DT;
}
-char DominatorTreeAnalysis::PassID;
-
DominatorTreePrinterPass::DominatorTreePrinterPass(raw_ostream &OS) : OS(OS) {}
PreservedAnalyses DominatorTreePrinterPass::run(Function &F,
Modified: llvm/trunk/lib/IR/PassManager.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/PassManager.cpp?rev=262004&r1=262003&r2=262004&view=diff
==============================================================================
--- llvm/trunk/lib/IR/PassManager.cpp (original)
+++ llvm/trunk/lib/IR/PassManager.cpp Fri Feb 26 05:44:45 2016
@@ -13,8 +13,6 @@
using namespace llvm;
-char FunctionAnalysisManagerModuleProxy::PassID;
-
FunctionAnalysisManagerModuleProxy::Result
FunctionAnalysisManagerModuleProxy::run(Module &M) {
assert(FAM->empty() && "Function analyses ran prior to the module proxy!");
@@ -43,5 +41,3 @@ bool FunctionAnalysisManagerModuleProxy:
// Return false to indicate that this result is still a valid proxy.
return false;
}
-
-char ModuleAnalysisManagerFunctionProxy::PassID;
Modified: llvm/trunk/lib/Passes/PassBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Passes/PassBuilder.cpp?rev=262004&r1=262003&r2=262004&view=diff
==============================================================================
--- llvm/trunk/lib/Passes/PassBuilder.cpp (original)
+++ llvm/trunk/lib/Passes/PassBuilder.cpp Fri Feb 26 05:44:45 2016
@@ -61,17 +61,12 @@ struct NoOpModulePass {
};
/// \brief No-op module analysis.
-struct NoOpModuleAnalysis {
+struct NoOpModuleAnalysis : AnalysisBase<NoOpModuleAnalysis> {
struct Result {};
Result run(Module &) { return Result(); }
static StringRef name() { return "NoOpModuleAnalysis"; }
- static void *ID() { return (void *)&PassID; }
-private:
- static char PassID;
};
-char NoOpModuleAnalysis::PassID;
-
/// \brief No-op CGSCC pass which does nothing.
struct NoOpCGSCCPass {
PreservedAnalyses run(LazyCallGraph::SCC &C) {
@@ -81,17 +76,12 @@ struct NoOpCGSCCPass {
};
/// \brief No-op CGSCC analysis.
-struct NoOpCGSCCAnalysis {
+struct NoOpCGSCCAnalysis : AnalysisBase<NoOpCGSCCAnalysis> {
struct Result {};
Result run(LazyCallGraph::SCC &) { return Result(); }
static StringRef name() { return "NoOpCGSCCAnalysis"; }
- static void *ID() { return (void *)&PassID; }
-private:
- static char PassID;
};
-char NoOpCGSCCAnalysis::PassID;
-
/// \brief No-op function pass which does nothing.
struct NoOpFunctionPass {
PreservedAnalyses run(Function &F) { return PreservedAnalyses::all(); }
@@ -99,17 +89,12 @@ struct NoOpFunctionPass {
};
/// \brief No-op function analysis.
-struct NoOpFunctionAnalysis {
+struct NoOpFunctionAnalysis : AnalysisBase<NoOpFunctionAnalysis> {
struct Result {};
Result run(Function &) { return Result(); }
static StringRef name() { return "NoOpFunctionAnalysis"; }
- static void *ID() { return (void *)&PassID; }
-private:
- static char PassID;
};
-char NoOpFunctionAnalysis::PassID;
-
/// \brief No-op loop pass which does nothing.
struct NoOpLoopPass {
PreservedAnalyses run(Loop &L) { return PreservedAnalyses::all(); }
@@ -117,17 +102,12 @@ struct NoOpLoopPass {
};
/// \brief No-op loop analysis.
-struct NoOpLoopAnalysis {
+struct NoOpLoopAnalysis : AnalysisBase<NoOpLoopAnalysis> {
struct Result {};
Result run(Loop &) { return Result(); }
static StringRef name() { return "NoOpLoopAnalysis"; }
- static void *ID() { return (void *)&PassID; }
-private:
- static char PassID;
};
-char NoOpLoopAnalysis::PassID;
-
} // End anonymous namespace.
void PassBuilder::registerModuleAnalyses(ModuleAnalysisManager &MAM) {
Modified: llvm/trunk/test/Other/new-pass-manager.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Other/new-pass-manager.ll?rev=262004&r1=262003&r2=262004&view=diff
==============================================================================
--- llvm/trunk/test/Other/new-pass-manager.ll (original)
+++ llvm/trunk/test/Other/new-pass-manager.ll Fri Feb 26 05:44:45 2016
@@ -21,7 +21,7 @@
; CHECK-CGSCC-PASS: Starting llvm::Module pass manager run
; CHECK-CGSCC-PASS-NEXT: Running pass: ModuleToPostOrderCGSCCPassAdaptor
; CHECK-CGSCC-PASS-NEXT: Running analysis: CGSCCAnalysisManagerModuleProxy
-; CHECK-CGSCC-PASS-NEXT: Running analysis: Lazy CallGraph Analysis
+; CHECK-CGSCC-PASS-NEXT: Running analysis: LazyCallGraphAnalysis
; CHECK-CGSCC-PASS-NEXT: Starting llvm::LazyCallGraph::SCC pass manager run
; CHECK-CGSCC-PASS-NEXT: Running pass: NoOpCGSCCPass
; CHECK-CGSCC-PASS-NEXT: Finished llvm::LazyCallGraph::SCC pass manager run
Modified: llvm/trunk/unittests/IR/PassManagerTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/IR/PassManagerTest.cpp?rev=262004&r1=262003&r2=262004&view=diff
==============================================================================
--- llvm/trunk/unittests/IR/PassManagerTest.cpp (original)
+++ llvm/trunk/unittests/IR/PassManagerTest.cpp Fri Feb 26 05:44:45 2016
@@ -19,19 +19,13 @@ using namespace llvm;
namespace {
-class TestFunctionAnalysis {
+class TestFunctionAnalysis : public AnalysisBase<TestFunctionAnalysis> {
public:
struct Result {
Result(int Count) : InstructionCount(Count) {}
int InstructionCount;
};
- /// \brief Returns an opaque, unique ID for this pass type.
- static void *ID() { return (void *)&PassID; }
-
- /// \brief Returns the name of the analysis.
- static StringRef name() { return "TestFunctionAnalysis"; }
-
TestFunctionAnalysis(int &Runs) : Runs(Runs) {}
/// \brief Run the analysis pass over the function and return a result.
@@ -46,25 +40,16 @@ public:
}
private:
- /// \brief Private static data to provide unique ID.
- static char PassID;
-
int &Runs;
};
-char TestFunctionAnalysis::PassID;
-
-class TestModuleAnalysis {
+class TestModuleAnalysis : public AnalysisBase<TestModuleAnalysis> {
public:
struct Result {
Result(int Count) : FunctionCount(Count) {}
int FunctionCount;
};
- static void *ID() { return (void *)&PassID; }
-
- static StringRef name() { return "TestModuleAnalysis"; }
-
TestModuleAnalysis(int &Runs) : Runs(Runs) {}
Result run(Module &M, ModuleAnalysisManager *AM) {
@@ -76,14 +61,10 @@ public:
}
private:
- static char PassID;
-
int &Runs;
};
-char TestModuleAnalysis::PassID;
-
-struct TestModulePass {
+struct TestModulePass : PassBase<TestModulePass> {
TestModulePass(int &RunCount) : RunCount(RunCount) {}
PreservedAnalyses run(Module &M) {
@@ -91,18 +72,14 @@ struct TestModulePass {
return PreservedAnalyses::none();
}
- static StringRef name() { return "TestModulePass"; }
-
int &RunCount;
};
-struct TestPreservingModulePass {
+struct TestPreservingModulePass : PassBase<TestPreservingModulePass> {
PreservedAnalyses run(Module &M) { return PreservedAnalyses::all(); }
-
- static StringRef name() { return "TestPreservingModulePass"; }
};
-struct TestMinPreservingModulePass {
+struct TestMinPreservingModulePass : PassBase<TestMinPreservingModulePass> {
PreservedAnalyses run(Module &M, ModuleAnalysisManager *AM) {
PreservedAnalyses PA;
@@ -112,11 +89,9 @@ struct TestMinPreservingModulePass {
PA.preserve<FunctionAnalysisManagerModuleProxy>();
return PA;
}
-
- static StringRef name() { return "TestMinPreservingModulePass"; }
};
-struct TestFunctionPass {
+struct TestFunctionPass : PassBase<TestFunctionPass> {
TestFunctionPass(int &RunCount, int &AnalyzedInstrCount,
int &AnalyzedFunctionCount,
bool OnlyUseCachedResults = false)
@@ -147,8 +122,6 @@ struct TestFunctionPass {
return PreservedAnalyses::all();
}
- static StringRef name() { return "TestFunctionPass"; }
-
int &RunCount;
int &AnalyzedInstrCount;
int &AnalyzedFunctionCount;
@@ -157,7 +130,7 @@ struct TestFunctionPass {
// A test function pass that invalidates all function analyses for a function
// with a specific name.
-struct TestInvalidationFunctionPass {
+struct TestInvalidationFunctionPass : PassBase<TestInvalidationFunctionPass> {
TestInvalidationFunctionPass(StringRef FunctionName) : Name(FunctionName) {}
PreservedAnalyses run(Function &F) {
@@ -165,8 +138,6 @@ struct TestInvalidationFunctionPass {
: PreservedAnalyses::all();
}
- static StringRef name() { return "TestInvalidationFunctionPass"; }
-
StringRef Name;
};
More information about the llvm-commits
mailing list