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
This commit is contained in:
Owen Anderson 2010-10-07 04:13:08 +00:00
parent 5a50ceeaea
commit 71802344fc
4 changed files with 17 additions and 16 deletions

View 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); \

View 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) {

View 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

View 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;
//===----------------------------------------------------------------------===//
//