Some eye-candy
authorAnton Korobeynikov <asl@math.spbu.ru>
Sun, 3 May 2009 13:17:31 +0000 (13:17 +0000)
committerAnton Korobeynikov <asl@math.spbu.ru>
Sun, 3 May 2009 13:17:31 +0000 (13:17 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70762 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/MSP430/MSP430AsmPrinter.cpp
lib/Target/MSP430/MSP430TargetAsmInfo.cpp
lib/Target/MSP430/MSP430TargetAsmInfo.h

index 0755e369814e7fa1bb1a38a28fb6b10dfe50446d..c606112c2c6732b0524f7b53ff07247f2d215ce8 100644 (file)
@@ -125,6 +125,7 @@ void MSP430AsmPrinter::emitFunctionHeader(const MachineFunction &MF) {
 
 bool MSP430AsmPrinter::runOnMachineFunction(MachineFunction &MF) {
   SetupMachineFunction(MF);
+  O << "\n\n";
 
   // Print the 'header' of function
   emitFunctionHeader(MF);
@@ -133,20 +134,18 @@ bool MSP430AsmPrinter::runOnMachineFunction(MachineFunction &MF) {
   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);
+    if (!VerboseAsm && (I->pred_empty() || I->isOnlyReachableByFallthrough())) {
+      // This is an entry block or a block that's only reachable via a
+      // fallthrough edge. In non-VerboseAsm mode, don't print the label.
+    } else {
+      printBasicBlockLabel(I, true, true, VerboseAsm);
       O << '\n';
     }
 
     for (MachineBasicBlock::const_iterator II = I->begin(), E = I->end();
-         II != E; ++II) {
+         II != E; ++II)
       // Print the assembly for the instruction.
-      O << "\t";
       printMachineInstruction(II);
-    }
-
-    // Each Basic Block is separated by a newline
-    O << '\n';
   }
 
   if (TAI->hasDotTypeDotSizeDirective())
index 8fc5c24d304124f73286839e3e885680c07f05e9..ab181de13f94d4bc3659e3ef566bffc064306bc9 100644 (file)
@@ -17,5 +17,6 @@
 using namespace llvm;
 
 MSP430TargetAsmInfo::MSP430TargetAsmInfo(const MSP430TargetMachine &TM)
-  : TargetAsmInfo(TM) {
+  : ELFTargetAsmInfo(TM) {
+  AlignmentIsInBytes = false;
 }
index 64188e3bdc627c1b30fea620d8081c3c111084be..b58d5c9c764cdfa37f07619ac52eaece6245b92a 100644 (file)
 #define MSP430TARGETASMINFO_H
 
 #include "llvm/Target/TargetAsmInfo.h"
+#include "llvm/Target/ELFTargetAsmInfo.h"
 
 namespace llvm {
 
   // Forward declaration.
   class MSP430TargetMachine;
 
-  struct MSP430TargetAsmInfo : public TargetAsmInfo {
+  struct MSP430TargetAsmInfo : public ELFTargetAsmInfo {
     explicit MSP430TargetAsmInfo(const MSP430TargetMachine &TM);
   };