Change over to use new style pass mechanism, now passes only expose small
creation functions in their public header file, unless they can help it.

llvm-svn: 1816
diff --git a/llvm/lib/Transforms/Instrumentation/TraceValues.cpp b/llvm/lib/Transforms/Instrumentation/TraceValues.cpp
index aad63c8..6e4fedc 100644
--- a/llvm/lib/Transforms/Instrumentation/TraceValues.cpp
+++ b/llvm/lib/Transforms/Instrumentation/TraceValues.cpp
@@ -15,12 +15,55 @@
 #include "llvm/Method.h"
 #include "llvm/Module.h"
 #include "llvm/SymbolTable.h"
+#include "llvm/Pass.h"
 #include "llvm/Assembly/Writer.h"
 #include "Support/StringExtras.h"
 #include <sstream>
 using std::vector;
 using std::string;
 
+namespace {
+  class InsertTraceCode : public MethodPass {
+    bool TraceBasicBlockExits, TraceMethodExits;
+    Method *PrintfMeth;
+  public:
+    InsertTraceCode(bool traceBasicBlockExits, bool traceMethodExits)
+      : TraceBasicBlockExits(traceBasicBlockExits), 
+        TraceMethodExits(traceMethodExits) {}
+    
+    // Add a prototype for printf if it is not already in the program.
+    //
+    bool doInitialization(Module *M);
+    
+    //--------------------------------------------------------------------------
+    // Function InsertCodeToTraceValues
+    // 
+    // Inserts tracing code for all live values at basic block and/or method
+    // exits as specified by `traceBasicBlockExits' and `traceMethodExits'.
+    //
+    static bool doit(Method *M, bool traceBasicBlockExits,
+                     bool traceMethodExits, Method *Printf);
+    
+    // runOnMethod - This method does the work.  Always successful.
+    //
+    bool runOnMethod(Method *M) {
+      return doit(M, TraceBasicBlockExits, TraceMethodExits, PrintfMeth);
+    }
+  };
+} // end anonymous namespace
+
+
+Pass *createTraceValuesPassForMethod() {       // Just trace methods
+  return new InsertTraceCode(false, true);
+}
+
+Pass *createTraceValuesPassForBasicBlocks() {  // Trace BB's and methods
+  return new InsertTraceCode(true, true);
+}
+
+
+
+
 // Add a prototype for printf if it is not already in the program.
 //
 bool InsertTraceCode::doInitialization(Module *M) {