[llvm-commits] CVS: llvm/lib/Target/X86/X86AsmPrinter.cpp

Evan Cheng evan.cheng at apple.com
Tue Feb 14 17:56:35 PST 2006



Changes in directory llvm/lib/Target/X86:

X86AsmPrinter.cpp updated: 1.164 -> 1.165
---
Log message:

Use .zerofill on x86/darwin.


---
Diffs of the changes:  (+22 -15)

 X86AsmPrinter.cpp |   37 ++++++++++++++++++++++---------------
 1 files changed, 22 insertions(+), 15 deletions(-)


Index: llvm/lib/Target/X86/X86AsmPrinter.cpp
diff -u llvm/lib/Target/X86/X86AsmPrinter.cpp:1.164 llvm/lib/Target/X86/X86AsmPrinter.cpp:1.165
--- llvm/lib/Target/X86/X86AsmPrinter.cpp:1.164	Wed Feb  8 17:42:22 2006
+++ llvm/lib/Target/X86/X86AsmPrinter.cpp	Tue Feb 14 19:56:23 2006
@@ -96,24 +96,31 @@
 
     if (C->isNullValue() && /* FIXME: Verify correct */
         (I->hasInternalLinkage() || I->hasWeakLinkage() ||
-         I->hasLinkOnceLinkage())) {
+         I->hasLinkOnceLinkage() ||
+         (forDarwin && I->hasExternalLinkage() && !I->hasSection()))) {
       if (Size == 0) Size = 1;   // .comm Foo, 0 is undefined, avoid it.
-      SwitchSection(".data", I);
-      if (LCOMMDirective != NULL) {
-        if (I->hasInternalLinkage()) {
-          O << LCOMMDirective << name << "," << Size;
-          if (forDarwin)
-            O << "," << (AlignmentIsInBytes ? (1 << Align) : Align);
-        } else
-          O << COMMDirective  << name << "," << Size;
+      if (I->hasExternalLinkage()) {
+          O << "\t.global\t" << name << "\n";
+          O << "\t.zerofill __DATA__, __common, " << name << ", "
+            << Size << ", " << Align;
       } else {
-        if (I->hasInternalLinkage())
-          O <<"\t.local\t" << name << "\n";
-        O << COMMDirective  << name << "," << Size;
-        if (COMMDirectiveTakesAlignment)
-          O << "," << (AlignmentIsInBytes ? (1 << Align) : Align);
+        SwitchSection(".data", I);
+        if (LCOMMDirective != NULL) {
+          if (I->hasInternalLinkage()) {
+            O << LCOMMDirective << name << "," << Size;
+            if (forDarwin)
+              O << "," << (AlignmentIsInBytes ? (1 << Align) : Align);
+          } else
+            O << COMMDirective  << name << "," << Size;
+        } else {
+          if (I->hasInternalLinkage())
+            O << "\t.local\t" << name << "\n";
+          O << COMMDirective  << name << "," << Size;
+          if (COMMDirectiveTakesAlignment)
+            O << "," << (AlignmentIsInBytes ? (1 << Align) : Align);
+        }
+        O << "\t\t" << CommentString << " " << I->getName() << "\n";
       }
-      O << "\t\t" << CommentString << " " << I->getName() << "\n";
     } else {
       switch (I->getLinkage()) {
       case GlobalValue::LinkOnceLinkage:






More information about the llvm-commits mailing list