[llvm-commits] CVS: llvm/include/llvm/PassSupport.h

Chris Lattner lattner at cs.uiuc.edu
Sun Aug 27 15:30:41 PDT 2006



Changes in directory llvm/include/llvm:

PassSupport.h updated: 1.27 -> 1.28
---
Log message:

Eliminate RegisterAnalysis.  RegisterPass now does all that is necessary.


---
Diffs of the changes:  (+17 -24)

 PassSupport.h |   41 +++++++++++++++++------------------------
 1 files changed, 17 insertions(+), 24 deletions(-)


Index: llvm/include/llvm/PassSupport.h
diff -u llvm/include/llvm/PassSupport.h:1.27 llvm/include/llvm/PassSupport.h:1.28
--- llvm/include/llvm/PassSupport.h:1.27	Sun Aug 27 17:21:55 2006
+++ llvm/include/llvm/PassSupport.h	Sun Aug 27 17:30:17 2006
@@ -179,24 +179,33 @@
 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 @@
   }
 };
 
-/// 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






More information about the llvm-commits mailing list