[llvm-commits] CVS: llvm/lib/CodeGen/MachineFunction.cpp

Brian Gaeke gaeke at cs.uiuc.edu
Fri Jan 30 15:54:10 PST 2004


Changes in directory llvm/lib/CodeGen:

MachineFunction.cpp updated: 1.46 -> 1.47

---
Log message:

Give clients of MachineFunctionPrinter the ability to specify a banner and
choose an ostream.


---
Diffs of the changes:  (+14 -3)

Index: llvm/lib/CodeGen/MachineFunction.cpp
diff -u llvm/lib/CodeGen/MachineFunction.cpp:1.46 llvm/lib/CodeGen/MachineFunction.cpp:1.47
--- llvm/lib/CodeGen/MachineFunction.cpp:1.46	Sat Dec 20 04:20:58 2003
+++ llvm/lib/CodeGen/MachineFunction.cpp	Fri Jan 30 15:53:46 2004
@@ -34,6 +34,12 @@
 
 namespace {
   struct Printer : public MachineFunctionPass {
+    std::ostream *OS;
+    const std::string &Banner;
+
+    Printer (std::ostream *_OS, const std::string &_Banner) :
+      OS (_OS), Banner (_Banner) { }
+
     const char *getPassName() const { return "MachineFunction Printer"; }
 
     virtual void getAnalysisUsage(AnalysisUsage &AU) const {
@@ -41,14 +47,19 @@
     }
 
     bool runOnMachineFunction(MachineFunction &MF) {
-      MF.dump();
+      (*OS) << Banner;
+      MF.print (*OS);
       return false;
     }
   };
 }
 
-FunctionPass *llvm::createMachineFunctionPrinterPass() {
-  return new Printer();
+/// Returns a newly-created MachineFunction Printer pass. The default output
+/// stream is std::cerr; the default banner is empty.
+///
+FunctionPass *llvm::createMachineFunctionPrinterPass(std::ostream *OS,
+                                                     const std::string &Banner) {
+  return new Printer(OS, Banner);
 }
 
 namespace {





More information about the llvm-commits mailing list