From 5d8925c7c506a54ebdfb0bc93437ec9f602eaaa0 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 27 Aug 2006 22:30:17 +0000 Subject: Eliminate RegisterAnalysis. RegisterPass now does all that is necessary. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29921 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/PassSupport.h | 41 +++++++++++++++++------------------------ 1 file changed, 17 insertions(+), 24 deletions(-) (limited to 'include/llvm/PassSupport.h') 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 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) {} + callDefaultCtor) { + 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 - 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 -struct RegisterAnalysis : public RegisterPassBase { - RegisterAnalysis(const char *PassArg, const char *Name, - bool CFGOnly = false) - : RegisterPassBase(Name, PassArg, typeid(PassName), - callDefaultCtor) { - 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 -- cgit v1.2.3