- RegisterPass(const char *PassArg, const char *Name, unsigned char PassTy = 0)
- : RegisterPassBase(Name, PassArg, typeid(PassName), PassTy,
- callDefaultCtor<PassName>) {}
-
- // Register Pass using default constructor explicitly...
- RegisterPass(const char *PassArg, const char *Name, unsigned char PassTy,
- Pass *(*ctor)())
- : RegisterPassBase(Name, PassArg, typeid(PassName), PassTy, ctor) {}
-
- // Register Pass using TargetMachine constructor...
- RegisterPass(const char *PassArg, const char *Name, unsigned char PassTy,
- Pass *(*targetctor)(TargetMachine &))
- : RegisterPassBase(Name, PassArg, typeid(PassName), PassTy,
- 0, targetctor) {}
-
- // Generic constructor version that has an unknown ctor type...
- template<typename CtorType>
- RegisterPass(const char *PassArg, const char *Name, unsigned char PassTy,
- CtorType *Fn)
- : RegisterPassBase(Name, PassArg, typeid(PassName), PassTy, 0) {}
-};
-
-/// RegisterOpt - Register something that is to show up in Opt, this is just a
-/// shortcut for specifying RegisterPass...
-///
-template<typename PassName>
-struct RegisterOpt : public RegisterPassBase {
- RegisterOpt(const char *PassArg, const char *Name, bool CFGOnly = false)
- : RegisterPassBase(Name, PassArg, typeid(PassName), PassInfo::Optimization,
- callDefaultCtor<PassName>) {
- if (CFGOnly) setOnlyUsesCFG();
- }
-
- /// Register Pass using default constructor explicitly...
- ///
- RegisterOpt(const char *PassArg, const char *Name, Pass *(*ctor)(),
- bool CFGOnly = false)
- : RegisterPassBase(Name, PassArg, typeid(PassName),
- PassInfo::Optimization, ctor) {
- if (CFGOnly) setOnlyUsesCFG();
- }
-
- /// Register FunctionPass using default constructor explicitly...
- ///
- RegisterOpt(const char *PassArg, const char *Name, FunctionPass *(*ctor)(),
- bool CFGOnly = false)
- : RegisterPassBase(Name, PassArg, typeid(PassName), PassInfo::Optimization,
- static_cast<Pass*(*)()>(ctor)) {
- if (CFGOnly) setOnlyUsesCFG();
- }
-
- /// Register Pass using TargetMachine constructor...
- ///
- RegisterOpt(const char *PassArg, const char *Name,
- Pass *(*targetctor)(TargetMachine &), bool CFGOnly = false)
- : RegisterPassBase(Name, PassArg, typeid(PassName),
- PassInfo::Optimization, 0, targetctor) {
- if (CFGOnly) setOnlyUsesCFG();
- }
-
- /// Register FunctionPass using TargetMachine constructor...
- ///
- RegisterOpt(const char *PassArg, const char *Name,
- FunctionPass *(*targetctor)(TargetMachine &),
- bool CFGOnly = false)
- : RegisterPassBase(Name, PassArg, typeid(PassName), PassInfo::Optimization, 0,
- static_cast<Pass*(*)(TargetMachine&)>(targetctor)) {
- if (CFGOnly) setOnlyUsesCFG();
- }
-};
-
-/// RegisterAnalysis - Register something that is to show up in Analysis, this
-/// is just a shortcut for specifying RegisterPass... Analyses take a special
-/// argument that, when set to true, tells the system that the analysis ONLY
-/// depends on the shape of the CFG, so if a transformation preserves the CFG
-/// that the analysis is not invalidated.
-///
-template<typename PassName>
-struct RegisterAnalysis : public RegisterPassBase {
- RegisterAnalysis(const char *PassArg, const char *Name,
- bool CFGOnly = false)
- : RegisterPassBase(Name, PassArg, typeid(PassName), PassInfo::Analysis,
- callDefaultCtor<PassName>) {
- if (CFGOnly) setOnlyUsesCFG();