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

Anton Korobeynikov asl at math.spbu.ru
Tue Oct 31 00:31:41 PST 2006



Changes in directory llvm/lib/Target/X86:

X86ATTAsmPrinter.cpp updated: 1.70 -> 1.71
X86AsmPrinter.cpp updated: 1.211 -> 1.212
X86AsmPrinter.h updated: 1.34 -> 1.35
X86ISelLowering.cpp updated: 1.283 -> 1.284
X86IntelAsmPrinter.cpp updated: 1.62 -> 1.63
X86TargetAsmInfo.cpp updated: 1.6 -> 1.7
---
Log message:

1. Clean up code due to changes in SwitchTo*Section(2)
2. Added partial debug support for mingw\cygwin targets (the same as 
   Linux\ELF). Please note, that currently mingw\cygwin uses 'stabs' format
   for storing debug info by default, thus many (runtime) libraries has 
   this information included. These formats shouldn't be mixed in one binary
   ('stabs' & 'DWARF'), otherwise binutils tools will be confused. 


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

 X86ATTAsmPrinter.cpp   |   12 +++++++++---
 X86AsmPrinter.cpp      |   12 ++++++------
 X86AsmPrinter.h        |    4 +++-
 X86ISelLowering.cpp    |    4 +++-
 X86IntelAsmPrinter.cpp |    8 ++++----
 X86TargetAsmInfo.cpp   |   18 ++++++++++++++++++
 6 files changed, 43 insertions(+), 15 deletions(-)


Index: llvm/lib/Target/X86/X86ATTAsmPrinter.cpp
diff -u llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.70 llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.71
--- llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.70	Mon Oct 30 16:32:30 2006
+++ llvm/lib/Target/X86/X86ATTAsmPrinter.cpp	Tue Oct 31 02:31:24 2006
@@ -52,7 +52,9 @@
 /// method to print assembly for each instruction.
 ///
 bool X86ATTAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
-  if (Subtarget->isTargetDarwin() || Subtarget->isTargetELF()) {
+  if (Subtarget->isTargetDarwin() ||
+      Subtarget->isTargetELF() ||
+      Subtarget->isTargetCygwin()) {
     // Let PassManager know we need debug information and relay
     // the MachineDebugInfo address on to DwarfWriter.
     DW.SetDebugInfo(&getAnalysis<MachineDebugInfo>());
@@ -111,7 +113,9 @@
        F->getLinkage() == Function::WeakLinkage))
     O << "_llvm$workaround$fake$stub_" << CurrentFnName << ":\n";
 
-  if (Subtarget->isTargetDarwin() || Subtarget->isTargetELF()) {
+  if (Subtarget->isTargetDarwin() ||
+      Subtarget->isTargetELF() ||
+      Subtarget->isTargetCygwin()) {
     // Emit pre-function debug information.
     DW.BeginFunction(&MF);
   }
@@ -141,7 +145,9 @@
   if (TAI->hasDotTypeDotSizeDirective())
     O << "\t.size " << CurrentFnName << ", .-" << CurrentFnName << "\n";
 
-  if (Subtarget->isTargetDarwin() || Subtarget->isTargetELF()) {
+  if (Subtarget->isTargetDarwin() ||
+      Subtarget->isTargetELF() ||
+      Subtarget->isTargetCygwin()) {
     // Emit post-function debug information.
     DW.EndFunction();
   }


Index: llvm/lib/Target/X86/X86AsmPrinter.cpp
diff -u llvm/lib/Target/X86/X86AsmPrinter.cpp:1.211 llvm/lib/Target/X86/X86AsmPrinter.cpp:1.212
--- llvm/lib/Target/X86/X86AsmPrinter.cpp:1.211	Tue Oct 31 00:11:06 2006
+++ llvm/lib/Target/X86/X86AsmPrinter.cpp	Tue Oct 31 02:31:24 2006
@@ -116,7 +116,7 @@
 
     // Emit initial debug information.
     DW.BeginModule(&M);
-  } else if (Subtarget->isTargetELF()) {
+  } else if (Subtarget->isTargetELF() || Subtarget->isTargetCygwin()) {
     // Emit initial debug information.
     DW.BeginModule(&M);
   }
@@ -253,7 +253,7 @@
   
   // Output linker support code for dllexported globals
   if (DLLExportedGVs.begin() != DLLExportedGVs.end()) {
-    SwitchToDataSection(".section .drectve", 0);    
+    SwitchToDataSection(".section .drectve");
   }
 
   for (std::set<std::string>::iterator i = DLLExportedGVs.begin(),
@@ -263,7 +263,7 @@
   }    
 
   if (DLLExportedFns.begin() != DLLExportedFns.end()) {
-    SwitchToDataSection(".section .drectve", 0);    
+    SwitchToDataSection(".section .drectve");
   }
 
   for (std::set<std::string>::iterator i = DLLExportedFns.begin(),
@@ -273,7 +273,7 @@
   }    
  
   if (Subtarget->isTargetDarwin()) {
-    SwitchToDataSection("", 0);
+    SwitchToDataSection("");
 
     // Output stubs for dynamically-linked functions
     unsigned j = 1;
@@ -291,7 +291,7 @@
     // Output stubs for external and common global variables.
     if (GVStubs.begin() != GVStubs.end())
       SwitchToDataSection(
-                    ".section __IMPORT,__pointers,non_lazy_symbol_pointers", 0);
+                    ".section __IMPORT,__pointers,non_lazy_symbol_pointers");
     for (std::set<std::string>::iterator i = GVStubs.begin(), e = GVStubs.end();
          i != e; ++i) {
       O << "L" << *i << "$non_lazy_ptr:\n";
@@ -308,7 +308,7 @@
     // linker can safely perform dead code stripping.  Since LLVM never
     // generates code that does this, it is always safe to set.
     O << "\t.subsections_via_symbols\n";
-  } else if (Subtarget->isTargetELF()) {
+  } else if (Subtarget->isTargetELF() || Subtarget->isTargetCygwin()) {
     // Emit final debug information.
     DW.EndModule();
   }


Index: llvm/lib/Target/X86/X86AsmPrinter.h
diff -u llvm/lib/Target/X86/X86AsmPrinter.h:1.34 llvm/lib/Target/X86/X86AsmPrinter.h:1.35
--- llvm/lib/Target/X86/X86AsmPrinter.h:1.34	Mon Oct 30 16:32:30 2006
+++ llvm/lib/Target/X86/X86AsmPrinter.h	Tue Oct 31 02:31:24 2006
@@ -67,7 +67,9 @@
 
   void getAnalysisUsage(AnalysisUsage &AU) const {
     AU.setPreservesAll();
-    if (Subtarget->isTargetDarwin() || Subtarget->isTargetELF()) {
+    if (Subtarget->isTargetDarwin() ||
+        Subtarget->isTargetELF() ||
+        Subtarget->isTargetCygwin()) {
       AU.addRequired<MachineDebugInfo>();
     }
     MachineFunctionPass::getAnalysisUsage(AU);


Index: llvm/lib/Target/X86/X86ISelLowering.cpp
diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.283 llvm/lib/Target/X86/X86ISelLowering.cpp:1.284
--- llvm/lib/Target/X86/X86ISelLowering.cpp:1.283	Mon Oct 30 16:32:30 2006
+++ llvm/lib/Target/X86/X86ISelLowering.cpp	Tue Oct 31 02:31:24 2006
@@ -219,7 +219,9 @@
   setOperationAction(ISD::LOCATION, MVT::Other, Expand);
   setOperationAction(ISD::DEBUG_LOC, MVT::Other, Expand);
   // FIXME - use subtarget debug flags
-  if (!Subtarget->isTargetDarwin() && !Subtarget->isTargetELF())
+  if (!Subtarget->isTargetDarwin() &&
+      !Subtarget->isTargetELF() &&
+      !Subtarget->isTargetCygwin())
     setOperationAction(ISD::DEBUG_LABEL, MVT::Other, Expand);
 
   // VASTART needs to be custom lowered to use the VarArgsFrameIndex


Index: llvm/lib/Target/X86/X86IntelAsmPrinter.cpp
diff -u llvm/lib/Target/X86/X86IntelAsmPrinter.cpp:1.62 llvm/lib/Target/X86/X86IntelAsmPrinter.cpp:1.63
--- llvm/lib/Target/X86/X86IntelAsmPrinter.cpp:1.62	Tue Oct 24 15:32:14 2006
+++ llvm/lib/Target/X86/X86IntelAsmPrinter.cpp	Tue Oct 31 02:31:24 2006
@@ -393,14 +393,14 @@
     switch (I->getLinkage()) {
     case GlobalValue::LinkOnceLinkage:
     case GlobalValue::WeakLinkage:
-      SwitchToDataSection("", 0);
+      SwitchToDataSection("");
       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:
-      SwitchToDataSection("", 0);
+      SwitchToDataSection("");
       O << name << "?\tsegment public 'DATA'\n";
       bCustomSegment = true;
       // FIXME: the default alignment is 16 bytes, but 1, 2, 4, and 256
@@ -434,7 +434,7 @@
     // Output linker support code for dllexported globals
   if ((DLLExportedGVs.begin() != DLLExportedGVs.end()) ||
       (DLLExportedFns.begin() != DLLExportedFns.end())) {
-    SwitchToDataSection("", 0);
+    SwitchToDataSection("");
     O << "; WARNING: The following code is valid only with MASM v8.x and (possible) higher\n"
       << "; This version of MASM is usually shipped with Microsoft Visual Studio 2005\n"
       << "; or (possible) further versions. Unfortunately, there is no way to support\n"
@@ -461,7 +461,7 @@
   
   // Bypass X86SharedAsmPrinter::doFinalization().
   AsmPrinter::doFinalization(M);
-  SwitchToDataSection("", 0);
+  SwitchToDataSection("");
   O << "\tend\n";
   return false; // success
 }


Index: llvm/lib/Target/X86/X86TargetAsmInfo.cpp
diff -u llvm/lib/Target/X86/X86TargetAsmInfo.cpp:1.6 llvm/lib/Target/X86/X86TargetAsmInfo.cpp:1.7
--- llvm/lib/Target/X86/X86TargetAsmInfo.cpp:1.6	Mon Oct 30 16:32:30 2006
+++ llvm/lib/Target/X86/X86TargetAsmInfo.cpp	Tue Oct 31 02:31:24 2006
@@ -90,6 +90,24 @@
     HasDotTypeDotSizeDirective = false;
     StaticCtorsSection = "\t.section .ctors,\"aw\"";
     StaticDtorsSection = "\t.section .dtors,\"aw\"";
+
+    // Set up DWARF directives
+    HasLEB128 = true;  // Target asm supports leb128 directives (little-endian)
+    PrivateGlobalPrefix = "L";  // Prefix for private global symbols
+    DwarfRequiresFrameSection = false;
+    DwarfAbbrevSection =  "\t.section\t.debug_abbrev,\"dr\"";
+    DwarfInfoSection =    "\t.section\t.debug_info,\"dr\"";
+    DwarfLineSection =    "\t.section\t.debug_line,\"dr\"";
+    DwarfFrameSection =   "\t.section\t.debug_frame,\"dr\"";
+    DwarfPubNamesSection ="\t.section\t.debug_pubnames,\"dr\"";
+    DwarfPubTypesSection ="\t.section\t.debug_pubtypes,\"dr\"";
+    DwarfStrSection =     "\t.section\t.debug_str,\"dr\"";
+    DwarfLocSection =     "\t.section\t.debug_loc,\"dr\"";
+    DwarfARangesSection = "\t.section\t.debug_aranges,\"dr\"";
+    DwarfRangesSection =  "\t.section\t.debug_ranges,\"dr\"";
+    DwarfMacInfoSection = "\t.section\t.debug_macinfo,\"dr\"";
+    break;
+    
     break;
   case X86Subtarget::isWindows:
     GlobalPrefix = "_";






More information about the llvm-commits mailing list