From ad8134f03b0c930538d69a20adde542ed941d55a Mon Sep 17 00:00:00 2001 From: Owen Anderson Date: Wed, 6 Oct 2010 21:02:27 +0000 Subject: [PATCH] Hide analysis group registration behind a macro, just like pass registration. llvm-svn: 115835 --- llvm/include/llvm/PassSupport.h | 7 +++++++ llvm/lib/Analysis/AliasAnalysis.cpp | 2 +- llvm/lib/Analysis/IPA/CallGraph.cpp | 2 +- llvm/lib/Analysis/ProfileInfo.cpp | 2 +- llvm/lib/CodeGen/RegisterCoalescer.cpp | 2 +- 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/llvm/include/llvm/PassSupport.h b/llvm/include/llvm/PassSupport.h index ac61eb6a0736..2c17ddd217ac 100644 --- a/llvm/include/llvm/PassSupport.h +++ b/llvm/include/llvm/PassSupport.h @@ -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##_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, \ diff --git a/llvm/lib/Analysis/AliasAnalysis.cpp b/llvm/lib/Analysis/AliasAnalysis.cpp index b9cd5a69203e..79ccabe88e1d 100644 --- a/llvm/lib/Analysis/AliasAnalysis.cpp +++ b/llvm/lib/Analysis/AliasAnalysis.cpp @@ -36,7 +36,7 @@ using namespace llvm; // Register the AliasAnalysis interface, providing a nice name to refer to. -static RegisterAnalysisGroup Z("Alias Analysis"); +INITIALIZE_ANALYSIS_GROUP(AliasAnalysis, "Alias Analysis"); char AliasAnalysis::ID = 0; //===----------------------------------------------------------------------===// diff --git a/llvm/lib/Analysis/IPA/CallGraph.cpp b/llvm/lib/Analysis/IPA/CallGraph.cpp index b3635283fda5..d3d3af3fdf98 100644 --- a/llvm/lib/Analysis/IPA/CallGraph.cpp +++ b/llvm/lib/Analysis/IPA/CallGraph.cpp @@ -171,7 +171,7 @@ private: } //End anonymous namespace -static RegisterAnalysisGroup X("Call Graph"); +INITIALIZE_ANALYSIS_GROUP(CallGraph, "Call Graph"); INITIALIZE_AG_PASS(BasicCallGraph, CallGraph, "basiccg", "Basic CallGraph Construction", false, true, true); diff --git a/llvm/lib/Analysis/ProfileInfo.cpp b/llvm/lib/Analysis/ProfileInfo.cpp index fc7f28662c01..9d10f4e92436 100644 --- a/llvm/lib/Analysis/ProfileInfo.cpp +++ b/llvm/lib/Analysis/ProfileInfo.cpp @@ -25,7 +25,7 @@ using namespace llvm; // Register the ProfileInfo interface, providing a nice name to refer to. -static RegisterAnalysisGroup Z("Profile Information"); +INITIALIZE_ANALYSIS_GROUP(ProfileInfo, "Profile Information"); namespace llvm { diff --git a/llvm/lib/CodeGen/RegisterCoalescer.cpp b/llvm/lib/CodeGen/RegisterCoalescer.cpp index 02b5539f0f4f..b97a3a094140 100644 --- a/llvm/lib/CodeGen/RegisterCoalescer.cpp +++ b/llvm/lib/CodeGen/RegisterCoalescer.cpp @@ -24,7 +24,7 @@ using namespace llvm; // Register the RegisterCoalescer interface, providing a nice name to refer to. -static RegisterAnalysisGroup Z("Register Coalescer"); +INITIALIZE_ANALYSIS_GROUP(RegisterCoalescer, "Register Coalescer"); char RegisterCoalescer::ID = 0; // RegisterCoalescer destructor: DO NOT move this to the header file