Refactor MachineFunction::print() into MachineBasicBlock::print().
authorBrian Gaeke <gaeke@uiuc.edu>
Fri, 13 Feb 2004 04:39:55 +0000 (04:39 +0000)
committerBrian Gaeke <gaeke@uiuc.edu>
Fri, 13 Feb 2004 04:39:55 +0000 (04:39 +0000)
Add MachineBasicBlock::dump().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11364 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/MachineFunction.cpp

index 4de55f4596e9dfc436b711fee273a6056b9c6c87..645e7cfedfe784042d1ab2d1991156b2f6eddd4d 100644 (file)
@@ -94,17 +94,21 @@ void MachineFunction::print(std::ostream &OS) const {
   // 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.