Hide analysis group registration behind a macro, just like pass registration.
authorOwen Anderson <resistor@mac.com>
Wed, 6 Oct 2010 21:02:27 +0000 (21:02 +0000)
committerOwen Anderson <resistor@mac.com>
Wed, 6 Oct 2010 21:02:27 +0000 (21:02 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115835 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/PassSupport.h
lib/Analysis/AliasAnalysis.cpp
lib/Analysis/IPA/CallGraph.cpp
lib/Analysis/ProfileInfo.cpp
lib/CodeGen/RegisterCoalescer.cpp

index ac61eb6a0736a8543e736e9958a6ceec3d4ff7db..2c17ddd217acb09e454d7aa062170e14f67150cd 100644 (file)
@@ -210,6 +210,13 @@ struct RegisterAnalysisGroup : public RegisterAGBase {
   }
 };
 
+#define INITIALIZE_ANALYSIS_GROUP(agName, name) \
+  void initialize##agName##AnalysisGroup(PassRegistry &Registry) { \
+    PassInfo *AI = new PassInfo(name, & agName :: ID); \
+    Registry.registerAnalysisGroup(& agName ::ID, 0, *AI, false); \
+  } \
+  static RegisterAnalysisGroup<agName> agName##_info (name)
+
 #define INITIALIZE_AG_PASS(passName, agName, arg, name, cfg, analysis, def) \
   void initialize##passName##Pass(PassRegistry &Registry) { \
     PassInfo *PI = new PassInfo(name, arg, & passName ::ID, \
index b9cd5a69203e83a35207dbaa07f6a278ce6c0142..79ccabe88e1d08525ffbbaa1aaa1e05e8fe9f1a5 100644 (file)
@@ -36,7 +36,7 @@
 using namespace llvm;
 
 // Register the AliasAnalysis interface, providing a nice name to refer to.
-static RegisterAnalysisGroup<AliasAnalysis> Z("Alias Analysis");
+INITIALIZE_ANALYSIS_GROUP(AliasAnalysis, "Alias Analysis");
 char AliasAnalysis::ID = 0;
 
 //===----------------------------------------------------------------------===//
index b3635283fda58b1aa9a178d66b3ec1ce4c9511fd..d3d3af3fdf983d57ee775545f9d1b0af9b37fdbc 100644 (file)
@@ -171,7 +171,7 @@ private:
 
 } //End anonymous namespace
 
-static RegisterAnalysisGroup<CallGraph> X("Call Graph");
+INITIALIZE_ANALYSIS_GROUP(CallGraph, "Call Graph");
 INITIALIZE_AG_PASS(BasicCallGraph, CallGraph, "basiccg",
                    "Basic CallGraph Construction", false, true, true);
 
index fc7f28662c017b1670d5a42895730da815832389..9d10f4e9243670d1354d4a4337bea5f087acdc8d 100644 (file)
@@ -25,7 +25,7 @@
 using namespace llvm;
 
 // Register the ProfileInfo interface, providing a nice name to refer to.
-static RegisterAnalysisGroup<ProfileInfo> Z("Profile Information");
+INITIALIZE_ANALYSIS_GROUP(ProfileInfo, "Profile Information");
 
 namespace llvm {
 
index 02b5539f0f4f0506b11d011c369acaa701887603..b97a3a09414096bde651167a10a847580cde0e43 100644 (file)
@@ -24,7 +24,7 @@
 using namespace llvm;
 
 // Register the RegisterCoalescer interface, providing a nice name to refer to.
-static RegisterAnalysisGroup<RegisterCoalescer> Z("Register Coalescer");
+INITIALIZE_ANALYSIS_GROUP(RegisterCoalescer, "Register Coalescer");
 char RegisterCoalescer::ID = 0;
 
 // RegisterCoalescer destructor: DO NOT move this to the header file