mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 20:32:21 +00:00
simplify AnalysisGroup registration, eliminating one typeid call.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29932 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
84f82f7fac
commit
a5370172b6
@ -241,23 +241,15 @@ public:
|
||||
~RegisterAGBase();
|
||||
};
|
||||
|
||||
|
||||
template<typename Interface, typename DefaultImplementationPass = void,
|
||||
bool Default = false>
|
||||
template<typename Interface, bool Default = false>
|
||||
struct RegisterAnalysisGroup : public RegisterAGBase {
|
||||
RegisterAnalysisGroup() : RegisterAGBase(typeid(Interface),
|
||||
&typeid(DefaultImplementationPass),
|
||||
Default) {
|
||||
RegisterAnalysisGroup(RegisterPassBase &RPB)
|
||||
: RegisterAGBase(typeid(Interface), &RPB.getPassInfo()->getTypeInfo(),
|
||||
Default) {
|
||||
}
|
||||
};
|
||||
|
||||
/// Define a specialization of RegisterAnalysisGroup that is used to set the
|
||||
/// name for the analysis group.
|
||||
///
|
||||
template<typename Interface>
|
||||
struct RegisterAnalysisGroup<Interface, void, false> : public RegisterAGBase {
|
||||
RegisterAnalysisGroup(const char *Name)
|
||||
: RegisterAGBase(typeid(Interface)) {
|
||||
: RegisterAGBase(typeid(Interface)) {
|
||||
setGroupName(Name);
|
||||
}
|
||||
};
|
||||
|
@ -111,7 +111,7 @@ namespace {
|
||||
|
||||
RegisterPass<AliasAnalysisCounter>
|
||||
X("count-aa", "Count Alias Analysis Query Responses");
|
||||
RegisterAnalysisGroup<AliasAnalysis, AliasAnalysisCounter> Y;
|
||||
RegisterAnalysisGroup<AliasAnalysis> Y(X);
|
||||
}
|
||||
|
||||
ModulePass *llvm::createAliasAnalysisCounterPass() {
|
||||
|
@ -76,7 +76,7 @@ namespace {
|
||||
U("no-aa", "No Alias Analysis (always returns 'may' alias)");
|
||||
|
||||
// Declare that we implement the AliasAnalysis interface
|
||||
RegisterAnalysisGroup<AliasAnalysis, NoAA> V;
|
||||
RegisterAnalysisGroup<AliasAnalysis> V(U);
|
||||
} // End of anonymous namespace
|
||||
|
||||
ImmutablePass *llvm::createNoAAPass() { return new NoAA(); }
|
||||
@ -121,7 +121,7 @@ namespace {
|
||||
X("basicaa", "Basic Alias Analysis (default AA impl)");
|
||||
|
||||
// Declare that we implement the AliasAnalysis interface
|
||||
RegisterAnalysisGroup<AliasAnalysis, BasicAliasAnalysis, true> Y;
|
||||
RegisterAnalysisGroup<AliasAnalysis, true> Y(X);
|
||||
} // End of anonymous namespace
|
||||
|
||||
ImmutablePass *llvm::createBasicAliasAnalysisPass() {
|
||||
|
@ -99,7 +99,7 @@ namespace {
|
||||
RegisterPass<DSAA> X("ds-aa", "Data Structure Graph Based Alias Analysis");
|
||||
|
||||
// Register as an implementation of AliasAnalysis
|
||||
RegisterAnalysisGroup<AliasAnalysis, DSAA> Y;
|
||||
RegisterAnalysisGroup<AliasAnalysis> Y(X);
|
||||
}
|
||||
|
||||
ModulePass *llvm::createDSAAPass() { return new DSAA(); }
|
||||
|
@ -77,7 +77,7 @@ namespace {
|
||||
"Steensgaard's alias analysis (DSGraph based)");
|
||||
|
||||
// Register as an implementation of AliasAnalysis
|
||||
RegisterAnalysisGroup<AliasAnalysis, Steens> Y;
|
||||
RegisterAnalysisGroup<AliasAnalysis> Y(X);
|
||||
}
|
||||
|
||||
ModulePass *llvm::createSteensgaardPass() { return new Steens(); }
|
||||
|
@ -338,7 +338,7 @@ namespace {
|
||||
|
||||
RegisterPass<Andersens> X("anders-aa",
|
||||
"Andersen's Interprocedural Alias Analysis");
|
||||
RegisterAnalysisGroup<AliasAnalysis, Andersens> Y;
|
||||
RegisterAnalysisGroup<AliasAnalysis> Y(X);
|
||||
}
|
||||
|
||||
ModulePass *llvm::createAndersensPass() { return new Andersens(); }
|
||||
|
@ -183,7 +183,7 @@ private:
|
||||
|
||||
RegisterAnalysisGroup<CallGraph> X("Call Graph");
|
||||
RegisterPass<BasicCallGraph> Y("basiccg", "Basic CallGraph Construction");
|
||||
RegisterAnalysisGroup<CallGraph, BasicCallGraph, true> Z;
|
||||
RegisterAnalysisGroup<CallGraph, true> Z(Y);
|
||||
|
||||
} //End anonymous namespace
|
||||
|
||||
|
@ -137,7 +137,7 @@ namespace {
|
||||
|
||||
RegisterPass<GlobalsModRef> X("globalsmodref-aa",
|
||||
"Simple mod/ref analysis for globals");
|
||||
RegisterAnalysisGroup<AliasAnalysis, GlobalsModRef> Y;
|
||||
RegisterAnalysisGroup<AliasAnalysis> Y(X);
|
||||
}
|
||||
|
||||
Pass *llvm::createGlobalsModRefPass() { return new GlobalsModRef(); }
|
||||
|
@ -84,7 +84,7 @@ namespace {
|
||||
RegisterPass<LoadVN> X("load-vn", "Load Value Numbering");
|
||||
|
||||
// Declare that we implement the ValueNumbering interface
|
||||
RegisterAnalysisGroup<ValueNumbering, LoadVN> Y;
|
||||
RegisterAnalysisGroup<ValueNumbering> Y(X);
|
||||
}
|
||||
|
||||
FunctionPass *llvm::createLoadValueNumberingPass() { return new LoadVN(); }
|
||||
|
@ -89,7 +89,7 @@ namespace {
|
||||
X("no-profile", "No Profile Information");
|
||||
|
||||
// Declare that we implement the ProfileInfo interface
|
||||
RegisterAnalysisGroup<ProfileInfo, NoProfileInfo, true> Y;
|
||||
RegisterAnalysisGroup<ProfileInfo, true> Y(X);
|
||||
} // End of anonymous namespace
|
||||
|
||||
ImmutablePass *llvm::createNoProfileInfoPass() { return new NoProfileInfo(); }
|
||||
|
@ -52,7 +52,7 @@ namespace {
|
||||
RegisterPass<LoaderPass>
|
||||
X("profile-loader", "Load profile information from llvmprof.out");
|
||||
|
||||
RegisterAnalysisGroup<ProfileInfo, LoaderPass> Y;
|
||||
RegisterAnalysisGroup<ProfileInfo> Y(X);
|
||||
} // End of anonymous namespace
|
||||
|
||||
ModulePass *llvm::createProfileLoaderPass() { return new LoaderPass(); }
|
||||
|
@ -64,7 +64,7 @@ namespace {
|
||||
X("basicvn", "Basic Value Numbering (default GVN impl)");
|
||||
|
||||
// Declare that we implement the ValueNumbering interface
|
||||
RegisterAnalysisGroup<ValueNumbering, BasicVN, true> Y;
|
||||
RegisterAnalysisGroup<ValueNumbering, true> Y(X);
|
||||
|
||||
/// BVNImpl - Implement BasicVN in terms of a visitor class that
|
||||
/// handles the different types of instructions as appropriate.
|
||||
|
@ -53,7 +53,7 @@ using namespace sys;
|
||||
// is configured into the LIBS variable.
|
||||
// Note: this line of code generates a warning if pthread_mutex_init is not
|
||||
// declared with weak linkage. It's safe to ignore the warning.
|
||||
static const bool pthread_enabled = static_cast<bool>(pthread_mutex_init);
|
||||
static const bool pthread_enabled = true;
|
||||
|
||||
// Construct a Mutex using pthread calls
|
||||
Mutex::Mutex( bool recursive)
|
||||
|
@ -37,7 +37,7 @@ namespace {
|
||||
|
||||
RegisterPass<FunctionProfiler> X("insert-function-profiling",
|
||||
"Insert instrumentation for function profiling");
|
||||
RegisterAnalysisGroup<RSProfilers, FunctionProfiler> XG;
|
||||
RegisterAnalysisGroup<RSProfilers> XG(X);
|
||||
|
||||
}
|
||||
|
||||
@ -83,7 +83,7 @@ namespace {
|
||||
|
||||
RegisterPass<BlockProfiler> Y("insert-block-profiling",
|
||||
"Insert instrumentation for block profiling");
|
||||
RegisterAnalysisGroup<RSProfilers, BlockProfiler> YG;
|
||||
RegisterAnalysisGroup<RSProfilers> YG(Y);
|
||||
}
|
||||
|
||||
ModulePass *llvm::createBlockProfilerPass() { return new BlockProfiler(); }
|
||||
|
@ -89,7 +89,7 @@ namespace {
|
||||
static RegisterAnalysisGroup<RSProfilers> A("Profiling passes");
|
||||
static RegisterPass<NullProfilerRS> NP("insert-null-profiling-rs",
|
||||
"Measure profiling framework overhead");
|
||||
static RegisterAnalysisGroup<RSProfilers, NullProfilerRS, true> NPT;
|
||||
static RegisterAnalysisGroup<RSProfilers, true> NPT(NP);
|
||||
|
||||
/// Chooser - Something that chooses when to make a sample of the profiled code
|
||||
class Chooser {
|
||||
|
Loading…
Reference in New Issue
Block a user