Move the pass initialization helper functions into the llvm namespace, and add
authorOwen Anderson <resistor@mac.com>
Thu, 7 Oct 2010 04:13:08 +0000 (04:13 +0000)
committerOwen Anderson <resistor@mac.com>
Thu, 7 Oct 2010 04:13:08 +0000 (04:13 +0000)
a header declaring them all.  This is also where we will declare per-library pass-set
initializer functions down the road.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115900 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/PassSupport.h
lib/Analysis/DbgInfoPrinter.cpp
lib/Analysis/RegionPrinter.cpp
lib/Transforms/Utils/InstructionNamer.cpp

index 2c17ddd217acb09e454d7aa062170e14f67150cd..4c630105bbae718e755f7280d0571009e53dd7b6 100644 (file)
@@ -23,6 +23,7 @@
 
 #include "Pass.h"
 #include "llvm/PassRegistry.h"
+#include "llvm/InitializePasses.h"
 #include <vector>
 
 namespace llvm {
@@ -128,7 +129,7 @@ private:
 };
 
 #define INITIALIZE_PASS(passName, arg, name, cfg, analysis) \
-  void initialize##passName##Pass(PassRegistry &Registry) { \
+  void llvm::initialize##passName##Pass(PassRegistry &Registry) { \
     PassInfo *PI = new PassInfo(name, arg, & passName ::ID, \
       PassInfo::NormalCtor_t(callDefaultCtor< passName >), cfg, analysis); \
     Registry.registerPass(*PI); \
@@ -211,14 +212,14 @@ struct RegisterAnalysisGroup : public RegisterAGBase {
 };
 
 #define INITIALIZE_ANALYSIS_GROUP(agName, name) \
-  void initialize##agName##AnalysisGroup(PassRegistry &Registry) { \
+  void llvm::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) { \
+  void llvm::initialize##passName##Pass(PassRegistry &Registry) { \
     PassInfo *PI = new PassInfo(name, arg, & passName ::ID, \
       PassInfo::NormalCtor_t(callDefaultCtor< passName >), cfg, analysis); \
     Registry.registerPass(*PI); \
index 0567750606104a51211e5e9b9c99fa928808758a..ba41361c6254659065bbc970223c8d45c248dfff 100644 (file)
@@ -48,10 +48,11 @@ namespace {
     }
   };
   char PrintDbgInfo::ID = 0;
-  INITIALIZE_PASS(PrintDbgInfo, "print-dbginfo",
-                  "Print debug info in human readable form", false, false);
 }
 
+INITIALIZE_PASS(PrintDbgInfo, "print-dbginfo",
+                "Print debug info in human readable form", false, false);
+
 FunctionPass *llvm::createDbgInfoPrinterPass() { return new PrintDbgInfo(); }
 
 void PrintDbgInfo::printVariableDeclaration(const Value *V) {
index fee5c1bae97646fbbea01a5c4437b5b9a751c112..f39a08c57326925fd92d78c713ec90ae682605d3 100644 (file)
@@ -123,21 +123,14 @@ struct RegionViewer
   static char ID;
   RegionViewer() : DOTGraphTraitsViewer<RegionInfo, false>("reg", ID){}
 };
-
 char RegionViewer::ID = 0;
-INITIALIZE_PASS(RegionViewer, "view-regions", "View regions of function",
-                true, true);
 
 struct RegionOnlyViewer
   : public DOTGraphTraitsViewer<RegionInfo, true> {
   static char ID;
   RegionOnlyViewer() : DOTGraphTraitsViewer<RegionInfo, true>("regonly", ID){}
 };
-
 char RegionOnlyViewer::ID = 0;
-INITIALIZE_PASS(RegionOnlyViewer, "view-regions-only",
-                "View regions of function (with no function bodies)",
-                true, true);
 
 struct RegionPrinter
   : public DOTGraphTraitsPrinter<RegionInfo, false> {
@@ -145,12 +138,19 @@ struct RegionPrinter
   RegionPrinter() :
     DOTGraphTraitsPrinter<RegionInfo, false>("reg", ID) {}
 };
+char RegionPrinter::ID = 0;
 } //end anonymous namespace
 
-char RegionPrinter::ID = 0;
 INITIALIZE_PASS(RegionPrinter, "dot-regions",
                 "Print regions of function to 'dot' file", true, true);
 
+INITIALIZE_PASS(RegionViewer, "view-regions", "View regions of function",
+                true, true);
+                
+INITIALIZE_PASS(RegionOnlyViewer, "view-regions-only",
+                "View regions of function (with no function bodies)",
+                true, true);
+
 namespace {
 
 struct RegionOnlyPrinter
index 5ca82996b42f48a0676441bdfdfb0f97ac4767f1..522439c04be2aac78467773a86b2dcd7d1628ab8 100644 (file)
@@ -48,11 +48,10 @@ namespace {
   };
   
   char InstNamer::ID = 0;
-  INITIALIZE_PASS(InstNamer, "instnamer", 
-                  "Assign names to anonymous instructions", false, false);
 }
 
-
+INITIALIZE_PASS(InstNamer, "instnamer", 
+                "Assign names to anonymous instructions", false, false);
 char &llvm::InstructionNamerID = InstNamer::ID;
 //===----------------------------------------------------------------------===//
 //