Convert optimizations to use the Pass infrastructure
[oota-llvm.git] / include / llvm / Transforms / Scalar / SymbolStripping.h
index 1b26685d1e805f5f6e2c1fcf1df2a86e51fe135c..83724eb739443dbc084d8b3bfd47a9ab1735f4d2 100644 (file)
 
 class Method;
 class Module;
+#include "llvm/Transforms/Pass.h"
 
 namespace opt {
 
-// DoSymbolStripping - Remove all symbolic information from a method
-//
-bool DoSymbolStripping(Method *M);
+struct SymbolStripping : public StatelessPass<SymbolStripping> {
+  // doSymbolStripping - Remove all symbolic information from a method
+  //
+  static bool doSymbolStripping(Method *M);
 
-// DoSymbolStripping - Remove all symbolic information from all methods in a 
-// module
-//
-static inline bool DoSymbolStripping(Module *M) { 
-  return M->reduceApply(DoSymbolStripping); 
-}
+  inline static bool doPerMethodWork(Method *M) {
+    return doSymbolStripping(M);
+  }
+};
 
-// DoFullSymbolStripping - Remove all symbolic information from all methods 
-// in a module, and all module level symbols. (method names, etc...)
-//
-bool DoFullSymbolStripping(Module *M);
+struct FullSymbolStripping : public StatelessPass<FullSymbolStripping> {
+  
+  // 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) {
+    return doStripGlobalSymbols(M);
+  }
+
+  inline static bool doPerMethodWork(Method *M) {
+    return SymbolStripping::doSymbolStripping(M);
+  }
+};
 
 } // End namespace opt 
 #endif