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

Anton Korobeynikov asl at math.spbu.ru
Sat May 5 02:05:22 PDT 2007



Changes in directory llvm/lib/Target/X86:

X86ATTAsmPrinter.cpp updated: 1.104 -> 1.105
X86AsmPrinter.cpp updated: 1.241 -> 1.242
X86TargetAsmInfo.cpp updated: 1.40 -> 1.41
---
Log message:

Emit sections/directives in the proper order. This fixes PR1376: http://llvm.org/PR1376 . Also, 
some small cleanup was made.


---
Diffs of the changes:  (+20 -34)

 X86ATTAsmPrinter.cpp |   21 ++++++---------------
 X86AsmPrinter.cpp    |    4 +---
 X86TargetAsmInfo.cpp |   29 +++++++++++++----------------
 3 files changed, 20 insertions(+), 34 deletions(-)


Index: llvm/lib/Target/X86/X86ATTAsmPrinter.cpp
diff -u llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.104 llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.105
--- llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.104	Sun Apr 29 13:35:00 2007
+++ llvm/lib/Target/X86/X86ATTAsmPrinter.cpp	Sat May  5 04:04:50 2007
@@ -71,9 +71,7 @@
 /// method to print assembly for each instruction.
 ///
 bool X86ATTAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
-  if (Subtarget->isTargetDarwin() ||
-      Subtarget->isTargetELF() ||
-      Subtarget->isTargetCygMing()) {
+  if (TAI->doesSupportDebugInformation()) {
     // Let PassManager know we need debug information and relay
     // the MachineModuleInfo address on to DwarfWriter.
     DW.SetModuleInfo(&getAnalysis<MachineModuleInfo>());
@@ -150,9 +148,7 @@
        F->getLinkage() == Function::WeakLinkage))
     O << "Lllvm$workaround$fake$stub$" << CurrentFnName << ":\n";
 
-  if (Subtarget->isTargetDarwin() ||
-      Subtarget->isTargetELF() ||
-      Subtarget->isTargetCygMing()) {
+  if (TAI->doesSupportDebugInformation()) {
     // Emit pre-function debug information.
     DW.BeginFunction(&MF);
   }
@@ -173,22 +169,17 @@
     }
   }
 
-  // Print out jump tables referenced by the function.
-  
-  // Mac OS X requires that the jump table follow the function, so that the jump
-  // table is part of the same atom that the function is in.
-  EmitJumpTableInfo(MF.getJumpTableInfo(), MF);
-  
   if (TAI->hasDotTypeDotSizeDirective())
     O << "\t.size " << CurrentFnName << ", .-" << CurrentFnName << "\n";
 
-  if (Subtarget->isTargetDarwin() ||
-      Subtarget->isTargetELF() ||
-      Subtarget->isTargetCygMing()) {
+  if (TAI->doesSupportDebugInformation()) {
     // Emit post-function debug information.
     DW.EndFunction();
   }
 
+  // Print out jump tables referenced by the function.
+  EmitJumpTableInfo(MF.getJumpTableInfo(), MF);
+  
   // We didn't modify anything.
   return false;
 }


Index: llvm/lib/Target/X86/X86AsmPrinter.cpp
diff -u llvm/lib/Target/X86/X86AsmPrinter.cpp:1.241 llvm/lib/Target/X86/X86AsmPrinter.cpp:1.242
--- llvm/lib/Target/X86/X86AsmPrinter.cpp:1.241	Sun Apr 29 13:35:00 2007
+++ llvm/lib/Target/X86/X86AsmPrinter.cpp	Sat May  5 04:04:50 2007
@@ -115,9 +115,7 @@
 
 /// doInitialization
 bool X86SharedAsmPrinter::doInitialization(Module &M) {
-  if (Subtarget->isTargetELF() ||
-      Subtarget->isTargetCygMing() ||
-      Subtarget->isTargetDarwin()) {
+  if (TAI->doesSupportDebugInformation()) {
     // Emit initial debug information.
     DW.BeginModule(&M);
   }


Index: llvm/lib/Target/X86/X86TargetAsmInfo.cpp
diff -u llvm/lib/Target/X86/X86TargetAsmInfo.cpp:1.40 llvm/lib/Target/X86/X86TargetAsmInfo.cpp:1.41
--- llvm/lib/Target/X86/X86TargetAsmInfo.cpp:1.40	Thu May  3 11:38:57 2007
+++ llvm/lib/Target/X86/X86TargetAsmInfo.cpp	Sat May  5 04:04:50 2007
@@ -81,7 +81,8 @@
       // Emit a local label that is preserved until the linker runs.
       JumpTableSpecialLabelPrefix = "l";
     }
-    
+
+    SupportsDebugInformation = true;
     NeedsSet = true;
     DwarfAbbrevSection = ".section __DWARF,__debug_abbrev,regular,debug";
     DwarfInfoSection = ".section __DWARF,__debug_info,regular,debug";
@@ -97,26 +98,21 @@
     break;
 
   case X86Subtarget::isELF:
-    // Set up DWARF directives
-    HasLEB128 = true;  // Target asm supports leb128 directives (little-endian)
-    AbsoluteDebugSectionOffsets = true;
-    AbsoluteEHSectionOffsets = false;
-    // bool HasLEB128; // Defaults to false.
-    // hasDotLoc - True if target asm supports .loc directives.
-    // bool HasDotLoc; // Defaults to false.
-    // HasDotFile - True if target asm supports .file directives.
-    // bool HasDotFile; // Defaults to false.
     ReadOnlySection = "\t.section\t.rodata\n";
     FourByteConstantSection = "\t.section\t.rodata.cst4,\"aM\", at progbits,4";
     EightByteConstantSection = "\t.section\t.rodata.cst8,\"aM\", at progbits,8";
-    SixteenByteConstantSection =
-                             "\t.section\t.rodata.cst16,\"aM\", at progbits,16";
+    SixteenByteConstantSection = "\t.section\t.rodata.cst16,\"aM\", at progbits,16";
     CStringSection = "\t.section\t.rodata.str1.1,\"aMS\", at progbits,1";
     PrivateGlobalPrefix = ".L";
     WeakRefDirective = "\t.weak\t";
     SetDirective = "\t.set\t";
     PCSymbol = ".";
-    
+
+    // Set up DWARF directives
+    HasLEB128 = true;  // Target asm supports leb128 directives (little-endian)
+    AbsoluteDebugSectionOffsets = true;
+    AbsoluteEHSectionOffsets = false;
+    SupportsDebugInformation = true;
     DwarfRequiresFrameSection = false;
     DwarfAbbrevSection =  "\t.section\t.debug_abbrev,\"\", at progbits";
     DwarfInfoSection =    "\t.section\t.debug_info,\"\", at progbits";
@@ -144,14 +140,15 @@
     StaticCtorsSection = "\t.section .ctors,\"aw\"";
     StaticDtorsSection = "\t.section .dtors,\"aw\"";
     HiddenDirective = NULL;
+    PrivateGlobalPrefix = "L";  // Prefix for private global symbols
+    WeakRefDirective = "\t.weak\t";
+    SetDirective = "\t.set\t";
 
     // Set up DWARF directives
     HasLEB128 = true;  // Target asm supports leb128 directives (little-endian)
     AbsoluteDebugSectionOffsets = true;
     AbsoluteEHSectionOffsets = false;
-    PrivateGlobalPrefix = "L";  // Prefix for private global symbols
-    WeakRefDirective = "\t.weak\t";
-    SetDirective = "\t.set\t";
+    SupportsDebugInformation = true;
     DwarfRequiresFrameSection = false;
     DwarfSectionOffsetDirective = "\t.secrel32\t";
     DwarfAbbrevSection =  "\t.section\t.debug_abbrev,\"dr\"";






More information about the llvm-commits mailing list