mc'ize some stuff, don't comment out .lcomm directive in -fverbose-asm mode.
authorChris Lattner <sabre@nondot.org>
Tue, 19 Jan 2010 06:01:04 +0000 (06:01 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 19 Jan 2010 06:01:04 +0000 (06:01 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93860 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/AsmPrinter/AsmPrinter.cpp
lib/MC/MCAsmStreamer.cpp

index 3e54f0992a5fad03707ffe5425d015ed44e542b7..bdebcd6eb86843025bd839e65d019b5c3c3a4193 100644 (file)
@@ -169,26 +169,23 @@ void AsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) {
       O.PadToColumn(MAI->getCommentColumn());
       O << MAI->getCommentString() << ' ';
       WriteAsOperand(O, GV, /*PrintType=*/false, GV->getParent());
+      O << '\n';
     }
     if (GVKind.isCommon()) {
       // .comm _foo, 42, 4
-      O << MAI->getCOMMDirective() << *GVSym << ',' << Size;
-      if (MAI->getCOMMDirectiveTakesAlignment())
-        O << ',' << (MAI->getAlignmentIsInBytes() ? (1 << AlignLog) : AlignLog);
+      OutStreamer.EmitCommonSymbol(GVSym, Size, 1 << AlignLog);
     } else if (const char *LComm = MAI->getLCOMMDirective()) {
       // .lcomm _foo, 42, 4
       O << LComm << *GVSym << ',' << Size;
       if (MAI->getLCOMMDirectiveTakesAlignment())
         O << ',' << AlignLog;
+      O << '\n';
     } else {
       // .local _foo
       O << "\t.local\t" << *GVSym << '\n';
       // .comm _foo, 42, 4
-      O << MAI->getCOMMDirective() << *GVSym << ',' << Size;
-      if (MAI->getCOMMDirectiveTakesAlignment())
-        O << ',' << (MAI->getAlignmentIsInBytes() ? (1 << AlignLog) : AlignLog);
+      OutStreamer.EmitCommonSymbol(GVSym, Size, 1 << AlignLog);
     }
-    O << '\n';
     return;
   }
   
index 4768c623552b91fdf69255a3798bf7ba71caa4f5..4e571ff98c56bf1066500533b4431c2bca924c93 100644 (file)
@@ -151,9 +151,13 @@ void MCAsmStreamer::EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) {
 
 void MCAsmStreamer::EmitCommonSymbol(MCSymbol *Symbol, unsigned Size,
                                      unsigned ByteAlignment) {
-  OS << ".comm " << *Symbol << ',' << Size;
-  if (ByteAlignment != 0)
-    OS << ',' << Log2_32(ByteAlignment);
+  OS << MAI.getCOMMDirective() << *Symbol << ',' << Size;
+  if (ByteAlignment != 0 && MAI.getCOMMDirectiveTakesAlignment()) {
+    if (MAI.getAlignmentIsInBytes())
+      OS << ',' << ByteAlignment;
+    else
+      OS << ',' << Log2_32(ByteAlignment);
+  }
   OS << '\n';
 }