From: Owen Anderson Date: Thu, 7 Oct 2010 04:13:08 +0000 (+0000) Subject: Move the pass initialization helper functions into the llvm namespace, and add X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=71802344fcb224a89e4e636c1ec47f3730969be7;p=oota-llvm.git Move the pass initialization helper functions into the llvm namespace, and add 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 --- diff --git a/include/llvm/PassSupport.h b/include/llvm/PassSupport.h index 2c17ddd217a..4c630105bba 100644 --- a/include/llvm/PassSupport.h +++ b/include/llvm/PassSupport.h @@ -23,6 +23,7 @@ #include "Pass.h" #include "llvm/PassRegistry.h" +#include "llvm/InitializePasses.h" #include 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##_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); \ diff --git a/lib/Analysis/DbgInfoPrinter.cpp b/lib/Analysis/DbgInfoPrinter.cpp index 05677506061..ba41361c625 100644 --- a/lib/Analysis/DbgInfoPrinter.cpp +++ b/lib/Analysis/DbgInfoPrinter.cpp @@ -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) { diff --git a/lib/Analysis/RegionPrinter.cpp b/lib/Analysis/RegionPrinter.cpp index fee5c1bae97..f39a08c5732 100644 --- a/lib/Analysis/RegionPrinter.cpp +++ b/lib/Analysis/RegionPrinter.cpp @@ -123,21 +123,14 @@ struct RegionViewer static char ID; RegionViewer() : DOTGraphTraitsViewer("reg", ID){} }; - char RegionViewer::ID = 0; -INITIALIZE_PASS(RegionViewer, "view-regions", "View regions of function", - true, true); struct RegionOnlyViewer : public DOTGraphTraitsViewer { static char ID; RegionOnlyViewer() : DOTGraphTraitsViewer("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 { @@ -145,12 +138,19 @@ struct RegionPrinter RegionPrinter() : DOTGraphTraitsPrinter("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 diff --git a/lib/Transforms/Utils/InstructionNamer.cpp b/lib/Transforms/Utils/InstructionNamer.cpp index 5ca82996b42..522439c04be 100644 --- a/lib/Transforms/Utils/InstructionNamer.cpp +++ b/lib/Transforms/Utils/InstructionNamer.cpp @@ -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; //===----------------------------------------------------------------------===// //