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

Chris Lattner lattner at cs.uiuc.edu
Mon May 8 22:00:14 PDT 2006



Changes in directory llvm/lib/Target/X86:

X86ATTAsmPrinter.cpp updated: 1.44 -> 1.45
X86AsmPrinter.cpp updated: 1.179 -> 1.180
X86IntelAsmPrinter.cpp updated: 1.44 -> 1.45
---
Log message:

Split SwitchSection into SwitchTo{Text|Data}Section methods.


---
Diffs of the changes:  (+18 -16)

 X86ATTAsmPrinter.cpp   |    9 +++++----
 X86AsmPrinter.cpp      |   15 ++++++++-------
 X86IntelAsmPrinter.cpp |   10 +++++-----
 3 files changed, 18 insertions(+), 16 deletions(-)


Index: llvm/lib/Target/X86/X86ATTAsmPrinter.cpp
diff -u llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.44 llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.45
--- llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.44	Mon May  8 03:01:26 2006
+++ llvm/lib/Target/X86/X86ATTAsmPrinter.cpp	Mon May  8 23:59:56 2006
@@ -46,25 +46,26 @@
   switch (F->getLinkage()) {
   default: assert(0 && "Unknown linkage type!");
   case Function::InternalLinkage:  // Symbols default to internal.
-    SwitchSection(".text", F);
+    SwitchToTextSection(".text", F);
     EmitAlignment(4, F);     // FIXME: This should be parameterized somewhere.
     break;
   case Function::ExternalLinkage:
-    SwitchSection(".text", F);
+    SwitchToTextSection(".text", F);
     EmitAlignment(4, F);     // FIXME: This should be parameterized somewhere.
     O << "\t.globl\t" << CurrentFnName << "\n";
     break;
   case Function::WeakLinkage:
   case Function::LinkOnceLinkage:
     if (forDarwin) {
-      SwitchSection(".section __TEXT,__textcoal_nt,coalesced,pure_instructions",
-                    F);
+      SwitchToTextSection(
+                ".section __TEXT,__textcoal_nt,coalesced,pure_instructions", F);
       O << "\t.globl\t" << CurrentFnName << "\n";
       O << "\t.weak_definition\t" << CurrentFnName << "\n";
     } else {
       EmitAlignment(4, F);     // FIXME: This should be parameterized somewhere.
       O << "\t.section\t.llvm.linkonce.t." << CurrentFnName
         << ",\"ax\", at progbits\n";
+      SwitchToTextSection("", F);
       O << "\t.weak " << CurrentFnName << "\n";
     }
     break;


Index: llvm/lib/Target/X86/X86AsmPrinter.cpp
diff -u llvm/lib/Target/X86/X86AsmPrinter.cpp:1.179 llvm/lib/Target/X86/X86AsmPrinter.cpp:1.180
--- llvm/lib/Target/X86/X86AsmPrinter.cpp:1.179	Sat May  6 16:27:14 2006
+++ llvm/lib/Target/X86/X86AsmPrinter.cpp	Mon May  8 23:59:56 2006
@@ -119,7 +119,7 @@
           O << "\t.zerofill __DATA__, __common, " << name << ", "
             << Size << ", " << Align;
       } else {
-        SwitchSection(".data", I);
+        SwitchToDataSection(".data", I);
         if (LCOMMDirective != NULL) {
           if (I->hasInternalLinkage()) {
             O << LCOMMDirective << name << "," << Size;
@@ -143,7 +143,7 @@
         if (forDarwin) {
           O << "\t.globl " << name << "\n"
             << "\t.weak_definition " << name << "\n";
-          SwitchSection(".section __DATA,__datacoal_nt,coalesced", I);
+          SwitchToDataSection(".section __DATA,__datacoal_nt,coalesced", I);
         } else {
           O << "\t.section\t.llvm.linkonce.d." << name << ",\"aw\", at progbits\n";
           O << "\t.weak " << name << "\n";
@@ -157,7 +157,7 @@
         O << "\t.globl " << name << "\n";
         // FALL THROUGH
       case GlobalValue::InternalLinkage:
-        SwitchSection(".data", I);
+        SwitchToDataSection(".data", I);
         break;
       default:
         assert(0 && "Unknown linkage type!");
@@ -175,14 +175,14 @@
   }
   
   if (forDarwin) {
-    SwitchSection("", 0);
+    SwitchToDataSection("", 0);
 
     // Output stubs for dynamically-linked functions
     unsigned j = 1;
     for (std::set<std::string>::iterator i = FnStubs.begin(), e = FnStubs.end();
          i != e; ++i, ++j) {
-      SwitchSection(".section __IMPORT,__jump_table,symbol_stubs,"
-                    "self_modifying_code+pure_instructions,5", 0);
+      SwitchToDataSection(".section __IMPORT,__jump_table,symbol_stubs,"
+                          "self_modifying_code+pure_instructions,5", 0);
       O << "L" << *i << "$stub:\n";
       O << "\t.indirect_symbol " << *i << "\n";
       O << "\thlt ; hlt ; hlt ; hlt ; hlt\n";
@@ -192,7 +192,8 @@
 
     // Output stubs for external and common global variables.
     if (GVStubs.begin() != GVStubs.end())
-      SwitchSection(".section __IMPORT,__pointers,non_lazy_symbol_pointers", 0);
+      SwitchToDataSection(
+                    ".section __IMPORT,__pointers,non_lazy_symbol_pointers", 0);
     for (std::set<std::string>::iterator i = GVStubs.begin(), e = GVStubs.end();
          i != e; ++i) {
       O << "L" << *i << "$non_lazy_ptr:\n";


Index: llvm/lib/Target/X86/X86IntelAsmPrinter.cpp
diff -u llvm/lib/Target/X86/X86IntelAsmPrinter.cpp:1.44 llvm/lib/Target/X86/X86IntelAsmPrinter.cpp:1.45
--- llvm/lib/Target/X86/X86IntelAsmPrinter.cpp:1.44	Mon May  8 03:01:26 2006
+++ llvm/lib/Target/X86/X86IntelAsmPrinter.cpp	Mon May  8 23:59:56 2006
@@ -37,7 +37,7 @@
   EmitConstantPool(MF.getConstantPool());
 
   // Print out labels for the function.
-  SwitchSection(".code", MF.getFunction());
+  SwitchToTextSection(".code", MF.getFunction());
   EmitAlignment(4);
   if (MF.getFunction()->getLinkage() == GlobalValue::ExternalLinkage)
     O << "\tpublic " << CurrentFnName << "\n";
@@ -342,14 +342,14 @@
     switch (I->getLinkage()) {
     case GlobalValue::LinkOnceLinkage:
     case GlobalValue::WeakLinkage:
-      SwitchSection("", 0);
+      SwitchToDataSection("", 0);
       O << name << "?\tsegment common 'COMMON'\n";
       bCustomSegment = true;
       // FIXME: the default alignment is 16 bytes, but 1, 2, 4, and 256
       // are also available.
       break;
     case GlobalValue::AppendingLinkage:
-      SwitchSection("", 0);
+      SwitchToDataSection("", 0);
       O << name << "?\tsegment public 'DATA'\n";
       bCustomSegment = true;
       // FIXME: the default alignment is 16 bytes, but 1, 2, 4, and 256
@@ -359,7 +359,7 @@
       O << "\tpublic " << name << "\n";
       // FALL THROUGH
     case GlobalValue::InternalLinkage:
-      SwitchSection(".data", I);
+      SwitchToDataSection(".data", I);
       break;
     default:
       assert(0 && "Unknown linkage type!");
@@ -378,7 +378,7 @@
   
   // Bypass X86SharedAsmPrinter::doFinalization().
   AsmPrinter::doFinalization(M);
-  SwitchSection("", 0);
+  SwitchToDataSection("", 0);
   O << "\tend\n";
   return false; // success
 }






More information about the llvm-commits mailing list