diff options
Diffstat (limited to 'include/llvm/PassSupport.h')
-rw-r--r-- | include/llvm/PassSupport.h | 41 |
1 files changed, 17 insertions, 24 deletions
diff --git a/include/llvm/PassSupport.h b/include/llvm/PassSupport.h index 8d978b35d1..95702c0cfa 100644 --- a/include/llvm/PassSupport.h +++ b/include/llvm/PassSupport.h @@ -179,24 +179,33 @@ template<typename PassName> struct RegisterPass : public RegisterPassBase { // Register Pass using default constructor... - RegisterPass(const char *PassArg, const char *Name) + RegisterPass(const char *PassArg, const char *Name, bool CFGOnly = false) : RegisterPassBase(Name, PassArg, typeid(PassName), - callDefaultCtor<PassName>) {} + callDefaultCtor<PassName>) { + if (CFGOnly) setOnlyUsesCFG(); + } // Register Pass using default constructor explicitly... RegisterPass(const char *PassArg, const char *Name, - Pass *(*ctor)()) - : RegisterPassBase(Name, PassArg, typeid(PassName), ctor) {} + Pass *(*ctor)(), bool CFGOnly = false) + : RegisterPassBase(Name, PassArg, typeid(PassName), ctor) { + if (CFGOnly) setOnlyUsesCFG(); + } // Register Pass using TargetMachine constructor... RegisterPass(const char *PassArg, const char *Name, - Pass *(*targetctor)(TargetMachine &)) - : RegisterPassBase(Name, PassArg, typeid(PassName), 0, targetctor) {} + Pass *(*targetctor)(TargetMachine &), bool CFGOnly = false) + : RegisterPassBase(Name, PassArg, typeid(PassName), 0, targetctor) { + if (CFGOnly) setOnlyUsesCFG(); + } // Generic constructor version that has an unknown ctor type... template<typename CtorType> - RegisterPass(const char *PassArg, const char *Name, CtorType *Fn) - : RegisterPassBase(Name, PassArg, typeid(PassName), 0) {} + RegisterPass(const char *PassArg, const char *Name, CtorType *Fn, + bool CFGOnly = false) + : RegisterPassBase(Name, PassArg, typeid(PassName), 0) { + if (CFGOnly) setOnlyUsesCFG(); + } }; /// RegisterOpt - Register something that is to show up in Opt, this is just a @@ -246,22 +255,6 @@ struct RegisterOpt : public RegisterPassBase { } }; -/// 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), - callDefaultCtor<PassName>) { - if (CFGOnly) setOnlyUsesCFG(); - } -}; - /// RegisterAnalysisGroup - Register a Pass as a member of an analysis _group_. /// Analysis groups are used to define an interface (which need not derive from |