Convert to new simpler pass structure
authorChris Lattner <sabre@nondot.org>
Thu, 18 Oct 2001 05:21:56 +0000 (05:21 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 18 Oct 2001 05:21:56 +0000 (05:21 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@877 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Optimizations/LevelChange.h
include/llvm/Transforms/FunctionInlining.h
include/llvm/Transforms/Scalar/ConstantProp.h
include/llvm/Transforms/Scalar/DCE.h
include/llvm/Transforms/Scalar/InductionVars.h
include/llvm/Transforms/Scalar/SymbolStripping.h

index 2afbb390dc7d6df77dd65834090342913c24bee5..128e9e1b2125fa24f6c59cc4e7354522c5333e43 100644 (file)
@@ -51,8 +51,8 @@ namespace opt {
     return DoRaiseRepresentation(M, Level::Highest);
   }
 
-  struct RaiseRepresentation : public StatelessPass<RaiseRepresentation> {
-    inline static bool doPerMethodWork(Method *M) {
+  struct RaiseRepresentation : public Pass {
+    virtual bool doPerMethodWork(Method *M) {
       return DoRaiseRepresentation(M);
     }
   };
index 5a87c1b8e5cbeb2127a5001495f691ce7566033d..373708d6b0de806ecbccdbf5a42dae00d841ff39 100644 (file)
@@ -13,13 +13,13 @@ class CallInst;
 
 namespace opt {
 
-struct MethodInlining : public StatelessPass<MethodInlining> {
+struct MethodInlining : public Pass {
   // DoMethodInlining - Use a heuristic based approach to inline methods that
   // seem to look good.
   //
   static bool doMethodInlining(Method *M);
 
-  inline static bool doPerMethodWork(Method *M) {
+  virtual bool doPerMethodWork(Method *M) {
     return doMethodInlining(M);
   }
 };
index 3cf6d94c4fbb510b0d52cd8ee299d54f2fdeb309..918ef07270bd7837ac3252c4f3dd0d35477c07b3 100644 (file)
@@ -12,12 +12,12 @@ class TerminatorInst;
 
 namespace opt {
 
-struct ConstantPropogation : public StatelessPass<ConstantPropogation> {
+struct ConstantPropogation : public Pass {
   // doConstantPropogation - Do trivial constant propogation and expression
   // folding
   static bool doConstantPropogation(Method *M);
 
-  inline static bool doPerMethodWork(Method *M) {
+  inline bool doPerMethodWork(Method *M) {
     return doConstantPropogation(M);
   }
 };
@@ -34,11 +34,10 @@ bool ConstantFoldTerminator(TerminatorInst *T);
 //===----------------------------------------------------------------------===//
 // Sparse Conditional Constant Propogation Pass
 //
-
-struct SCCPPass : public StatelessPass<SCCPPass> {
+struct SCCPPass : public Pass {
   static bool doSCCP(Method *M);
 
-  inline static bool doPerMethodWork(Method *M) {
+  inline bool doPerMethodWork(Method *M) {
     return doSCCP(M);
   }
 };
index 287a2a8086ba935736ef7c20e7ec9ed7fc5766f5..9a7bd6e77b4830e3b740e62cd41fff2c86e57a30 100644 (file)
@@ -12,7 +12,7 @@
 
 namespace opt {
 
-struct DeadCodeElimination : public StatelessPass<DeadCodeElimination> {
+struct DeadCodeElimination : public Pass {
   // External Interface:
   //
   static bool doDCE(Method *M);
@@ -32,23 +32,23 @@ struct DeadCodeElimination : public StatelessPass<DeadCodeElimination> {
   // static bool RemoveUnusedGlobalValuesAfterLink(Module *M); // TODO
 
   // Pass Interface...
-  inline static bool doPassInitialization(Module *M) {
+  virtual bool doPassInitialization(Module *M) {
     return RemoveUnusedGlobalValues(M);
   }
-  inline static bool doPerMethodWork(Method *M) { return doDCE(M); }
-  inline static bool doPassFinalization(Module *M) {
+  virtual bool doPerMethodWork(Method *M) { return doDCE(M); }
+  virtual bool doPassFinalization(Module *M) {
     return RemoveUnusedGlobalValues(M);
   }
 };
 
 
 
-struct AgressiveDCE : public StatelessPass<AgressiveDCE> {
+struct AgressiveDCE : public Pass {
   // DoADCE - Execute the Agressive Dead Code Elimination Algorithm
   //
   static bool doADCE(Method *M);                        // Defined in ADCE.cpp
 
-  inline static bool doPerMethodWork(Method *M) {
+  virtual bool doPerMethodWork(Method *M) {
     return doADCE(M);
   }
 };
index 48b267c61ac09d78b8ece050904a21558471c845..e0c46d85efab0619144a6d8ef38c25ab921869bd 100644 (file)
 
 namespace opt {
 
-// DoInductionVariableCannonicalize - Simplify induction variables in loops
-//
-bool DoInductionVariableCannonicalize(Method *M);
-static inline bool DoInductionVariableCannonicalize(Module *M) { 
-  return M->reduceApply(DoInductionVariableCannonicalize); 
-}
+struct InductionVariableCannonicalize : public Pass {
+  // doInductionVariableCannonicalize - Simplify induction variables in loops
+  //
+  static bool doIt(Method *M);
 
-struct InductionVariableCannonicalize : 
-    public StatelessPass<InductionVariableCannonicalize> {
-  inline static bool doPerMethodWork(Method *M) {
-    return DoInductionVariableCannonicalize(M);
+  virtual bool doPerMethodWork(Method *M) {
+    return doIt(M);
   }
 };
 
index 83724eb739443dbc084d8b3bfd47a9ab1735f4d2..a5540f9869fd03682a1cb91fc1dc7e035d937906 100644 (file)
@@ -14,28 +14,28 @@ class Module;
 
 namespace opt {
 
-struct SymbolStripping : public StatelessPass<SymbolStripping> {
+struct SymbolStripping : public Pass {
   // doSymbolStripping - Remove all symbolic information from a method
   //
   static bool doSymbolStripping(Method *M);
 
-  inline static bool doPerMethodWork(Method *M) {
+  virtual bool doPerMethodWork(Method *M) {
     return doSymbolStripping(M);
   }
 };
 
-struct FullSymbolStripping : public StatelessPass<FullSymbolStripping> {
+struct FullSymbolStripping : public Pass {
   
   // doStripGlobalSymbols - Remove all symbolic information from all methods 
   // in a module, and all module level symbols. (method names, etc...)
   //
   static bool doStripGlobalSymbols(Module *M);
 
-  inline static bool doPassInitialization(Module *M) {
+  virtual bool doPassInitialization(Module *M) {
     return doStripGlobalSymbols(M);
   }
 
-  inline static bool doPerMethodWork(Method *M) {
+  virtual bool doPerMethodWork(Method *M) {
     return SymbolStripping::doSymbolStripping(M);
   }
 };