simplify AnalysisGroup registration, eliminating one typeid call.
authorChris Lattner <sabre@nondot.org>
Mon, 28 Aug 2006 00:42:29 +0000 (00:42 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 28 Aug 2006 00:42:29 +0000 (00:42 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29932 91177308-0d34-0410-b5e6-96231b3b80d8

15 files changed:
include/llvm/PassSupport.h
lib/Analysis/AliasAnalysisCounter.cpp
lib/Analysis/BasicAliasAnalysis.cpp
lib/Analysis/DataStructure/DataStructureAA.cpp
lib/Analysis/DataStructure/Steensgaard.cpp
lib/Analysis/IPA/Andersens.cpp
lib/Analysis/IPA/CallGraph.cpp
lib/Analysis/IPA/GlobalsModRef.cpp
lib/Analysis/LoadValueNumbering.cpp
lib/Analysis/ProfileInfo.cpp
lib/Analysis/ProfileInfoLoaderPass.cpp
lib/Analysis/ValueNumbering.cpp
lib/System/Mutex.cpp
lib/Transforms/Instrumentation/BlockProfiling.cpp
lib/Transforms/Instrumentation/RSProfiling.cpp

index 5f8a1458c2b31cf02c5fee925af7c5a47926f08b..4921848aba3244377b5085778d0b0105fbe8e2d9 100644 (file)
@@ -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);
   }
 };
index 562b4f50b88987fafc3888cdab508c653663ffa9..25ace732e2dd4d7c7583cc256af97057a6d168cf 100644 (file)
@@ -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() {
index 2c5fc81b150d4c4b2a7453baa10688b5cd0837a8..167d3b0c02ca71fbcbf9a07e9eff9b6914205124 100644 (file)
@@ -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() {
index bbb2ba21f344192a9a04d1104105f1b7c3786706..6e9f07bdd20dbc5acb6202f9e8b9b1042df04ec6 100644 (file)
@@ -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(); }
index 8a98022869db110e5ee6ef7831956f53c63c90a3..c7e32202cf709a1345a9b7cd34c1f5eda11543c7 100644 (file)
@@ -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(); }
index bc80f5b9568ad6121d68977fa9d3e40e3daf00b7..c9f5871b7251cf8f3a32b9ac4c6674d0532f1a7a 100644 (file)
@@ -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(); }
index 8836807bfc61251d14c87df97430a4bc8a81fe77..dab6867d323006d2259c83e610ea69b90b294ee5 100644 (file)
@@ -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
 
index 6739dfbf0ee4bec60ebd637792a37beba76a76a6..2db4ed89c996b5c5ffe73c29bb89be6c481df714 100644 (file)
@@ -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(); }
index bac80c8d986f5e23e7d763b659113c90ad3659da..3fbf23806ce60fcb17796f87e06d5de1534ec089 100644 (file)
@@ -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(); }
index b8ab88b8f2e0a0a3a40275a50e34e22100660fd4..c35d00ca05995443064eb2b11bf0d92ae3e4cedb 100644 (file)
@@ -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(); }
index 57e3627c53c024ade504bbb57b8247d88943a71f..b5cb95433fcdc432530cbb9d4f6a1b0dba19a602 100644 (file)
@@ -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(); }
index fb3bed05531ac37b2155f1037229c6e6d9f9c2a6..0224a0132fd86c6e98dd871d4bf66bdfab6f4765 100644 (file)
@@ -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.
index 44e3332d1791477464cd8f28071b87c01ed2ab3b..467bc8522bb3f67ba7fccb6fb705e45f0901b89d 100644 (file)
@@ -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)
index 859f596fa6230430cfde727280ec888a5a9bc7e9..7e1f5cc76ca8f8fba705377ac8a0c2daf771b06a 100644 (file)
@@ -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(); }
index 984190a611b9575659b8c7f0602687ac27d71daf..54a9ef7003b4dbbfd15568b2bb2e12c5a9ac7abe 100644 (file)
@@ -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 {