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

Brian Gaeke gaeke at cs.uiuc.edu
Thu Feb 12 22:41:27 PST 2004


Changes in directory llvm/lib/CodeGen:

MachineFunction.cpp updated: 1.49 -> 1.50

---
Log message:

Refactor MachineFunction::print() into MachineBasicBlock::print().
Add MachineBasicBlock::dump().


---
Diffs of the changes:  (+12 -8)

Index: llvm/lib/CodeGen/MachineFunction.cpp
diff -u llvm/lib/CodeGen/MachineFunction.cpp:1.49 llvm/lib/CodeGen/MachineFunction.cpp:1.50
--- llvm/lib/CodeGen/MachineFunction.cpp:1.49	Wed Feb 11 20:27:10 2004
+++ llvm/lib/CodeGen/MachineFunction.cpp	Thu Feb 12 22:39:55 2004
@@ -94,17 +94,21 @@
   // Print Constant Pool
   getConstantPool()->print(OS);
   
-  for (const_iterator BB = begin(); BB != end(); ++BB) {
-    const BasicBlock *LBB = BB->getBasicBlock();
-    OS << "\n" << LBB->getName() << " (" << (const void*)LBB << "):\n";
-    for (MachineBasicBlock::const_iterator I = BB->begin(); I != BB->end();++I){
-      OS << "\t";
-      I->print(OS, Target);
-    }
-  }
+  for (const_iterator BB = begin(); BB != end(); ++BB)
+    BB->print(OS);
   OS << "\nEnd function \"" << Fn->getName() << "\"\n\n";
 }
 
+void MachineBasicBlock::dump() const { print(std::cerr); }
+
+void MachineBasicBlock::print(std::ostream &OS) const {
+  const BasicBlock *LBB = getBasicBlock();
+  OS << "\n" << LBB->getName() << " (" << (const void*)LBB << "):\n";
+  for (const_iterator I = begin(); I != end(); ++I) {
+    OS << "\t";
+    I->print(OS, MachineFunction::get(LBB->getParent()).getTarget());
+  }
+}
 
 // The next two methods are used to construct and to retrieve
 // the MachineCodeForFunction object for the given function.





More information about the llvm-commits mailing list