[llvm-commits] [llvm] r93702 - in /llvm/trunk: include/llvm/MC/MCAsmInfo.h lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp

Chris Lattner sabre at nondot.org
Sun Jan 17 17:21:08 PST 2010


Author: lattner
Date: Sun Jan 17 19:21:08 2010
New Revision: 93702

URL: http://llvm.org/viewvc/llvm-project?rev=93702&view=rev
Log:
switch x86 zerofill emission over to use MCStreamer.

Modified:
    llvm/trunk/include/llvm/MC/MCAsmInfo.h
    llvm/trunk/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp

Modified: llvm/trunk/include/llvm/MC/MCAsmInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCAsmInfo.h?rev=93702&r1=93701&r2=93702&view=diff

==============================================================================
--- llvm/trunk/include/llvm/MC/MCAsmInfo.h (original)
+++ llvm/trunk/include/llvm/MC/MCAsmInfo.h Sun Jan 17 19:21:08 2010
@@ -316,6 +316,8 @@
     const char *getZeroFillDirective() const {
       return ZeroFillDirective;
     }
+    bool hasZeroFillDirective() const { return ZeroFillDirective != 0; }
+    
     const char *getNonexecutableStackDirective() const {
       return NonexecutableStackDirective;
     }

Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp?rev=93702&r1=93701&r2=93702&view=diff

==============================================================================
--- llvm/trunk/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp Sun Jan 17 19:21:08 2010
@@ -685,10 +685,19 @@
       // Don't put things that should go in the cstring section into "comm".
       !TheSection->getKind().isMergeableCString()) {
     if (GVar->hasExternalLinkage()) {
-      if (const char *Directive = MAI->getZeroFillDirective()) {
+      if (MAI->hasZeroFillDirective()) {
+        // .globl _foo
         OutStreamer.EmitSymbolAttribute(GVSym, MCStreamer::Global);
-        O << Directive << "__DATA, __common, " << *GVSym;
-        O << ", " << Size << ", " << Align << '\n';
+        // .zerofill __DATA, __common, _foo, 400, 5
+        TargetLoweringObjectFileMachO &TLOFMacho = 
+          static_cast<TargetLoweringObjectFileMachO &>(getObjFileLowering());
+        // FIXME: This stuff should already be handled by SectionForGlobal!
+        const MCSection *TheSection = 
+          TLOFMacho.getMachOSection("__DATA", "__common",
+                                    MCSectionMachO::S_ZEROFILL,
+                                    SectionKind::getBSS());
+          
+        OutStreamer.EmitZerofill(TheSection, GVSym, Size, 1 << Align);
         return;
       }
     }





More information about the llvm-commits mailing list