Add function body printing routine
authorAnton Korobeynikov <asl@math.spbu.ru>
Sun, 3 May 2009 13:01:41 +0000 (13:01 +0000)
committerAnton Korobeynikov <asl@math.spbu.ru>
Sun, 3 May 2009 13:01:41 +0000 (13:01 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70709 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/MSP430/MSP430AsmPrinter.cpp

index a9e119f6eaef4a5f6f12a80ca65a605e82b7ca9e..6b0f5100c30d2a088bc1173837e2caf238e88c36 100644 (file)
@@ -83,7 +83,27 @@ bool MSP430AsmPrinter::doFinalization(Module &M) {
   return AsmPrinter::doFinalization(M);
 }
 
-bool MSP430AsmPrinter::runOnMachineFunction(MachineFunction &F) {
+bool MSP430AsmPrinter::runOnMachineFunction(MachineFunction &MF) {
+  // Print out code for the function.
+  for (MachineFunction::const_iterator I = MF.begin(), E = MF.end();
+       I != E; ++I) {
+    // Print a label for the basic block.
+    if (I != MF.begin()) {
+      printBasicBlockLabel(I, true , true);
+      O << '\n';
+    }
+
+    for (MachineBasicBlock::const_iterator II = I->begin(), E = I->end();
+         II != E; ++II) {
+      // Print the assembly for the instruction.
+      O << "\t";
+      printMachineInstruction(II);
+    }
+
+    // Each Basic Block is separated by a newline
+    O << '\n';
+  }
+
   // We didn't modify anything
   return false;
 }