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

Evan Cheng evan.cheng at apple.com
Mon Mar 6 18:23:39 PST 2006



Changes in directory llvm/lib/Target/X86:

X86ATTAsmPrinter.cpp updated: 1.29 -> 1.30
X86AsmPrinter.cpp updated: 1.168 -> 1.169
X86AsmPrinter.h updated: 1.12 -> 1.13
X86IntelAsmPrinter.cpp updated: 1.22 -> 1.23
---
Log message:

- Emit subsections_via_symbols for Darwin.
- Conditionalize Dwarf debugging output (Darwin only for now).


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

 X86ATTAsmPrinter.cpp   |   20 +++++++++++++-------
 X86AsmPrinter.cpp      |   19 ++++++++++++++-----
 X86AsmPrinter.h        |    2 +-
 X86IntelAsmPrinter.cpp |   20 +++++++++++++-------
 4 files changed, 41 insertions(+), 20 deletions(-)


Index: llvm/lib/Target/X86/X86ATTAsmPrinter.cpp
diff -u llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.29 llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.30
--- llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.29	Mon Mar  6 20:02:57 2006
+++ llvm/lib/Target/X86/X86ATTAsmPrinter.cpp	Mon Mar  6 20:23:26 2006
@@ -27,15 +27,19 @@
 /// method to print assembly for each instruction.
 ///
 bool X86ATTAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
-  // Let PassManager know we need debug information and relay
-  // the MachineDebugInfo address on to DwarfWriter.
-  DW.SetDebugInfo(&getAnalysis<MachineDebugInfo>());
+  //  if (forDarwin) {
+    // Let PassManager know we need debug information and relay
+    // the MachineDebugInfo address on to DwarfWriter.
+    DW.SetDebugInfo(&getAnalysis<MachineDebugInfo>());
+    //  }
 
   SetupMachineFunction(MF);
   O << "\n\n";
 
-  // Emit pre-function debug information.
-  DW.BeginFunction(MF);
+  if (forDarwin) {
+    // Emit pre-function debug information.
+    DW.BeginFunction(MF);
+  }
 
   // Print out constants referenced by the function
   EmitConstantPool(MF.getConstantPool());
@@ -88,8 +92,10 @@
   if (HasDotTypeDotSizeDirective)
     O << "\t.size " << CurrentFnName << ", .-" << CurrentFnName << "\n";
 
-  // Emit post-function debug information.
-  DW.EndFunction(MF);
+  if (forDarwin) {
+    // Emit post-function debug information.
+    DW.EndFunction(MF);
+  }
 
   // We didn't modify anything.
   return false;


Index: llvm/lib/Target/X86/X86AsmPrinter.cpp
diff -u llvm/lib/Target/X86/X86AsmPrinter.cpp:1.168 llvm/lib/Target/X86/X86AsmPrinter.cpp:1.169
--- llvm/lib/Target/X86/X86AsmPrinter.cpp:1.168	Mon Mar  6 20:02:57 2006
+++ llvm/lib/Target/X86/X86AsmPrinter.cpp	Mon Mar  6 20:23:26 2006
@@ -75,8 +75,10 @@
   default: break;
   }
   
-  // Emit initial debug information.
-  DW.BeginModule(M);
+  if (forDarwin) {
+    // Emit initial debug information.
+    DW.BeginModule(M);
+  }
 
   return AsmPrinter::doInitialization(M);
 }
@@ -188,10 +190,17 @@
       O << "\t.indirect_symbol " << *i << "\n";
       O << "\t.long\t0\n";
     }
-  }
 
-  // Emit initial debug information.
-  DW.EndModule(M);
+    // Emit initial debug information.
+    DW.EndModule(M);
+
+    // Funny Darwin hack: This flag tells the linker that no global symbols
+    // contain code that falls through to other global symbols (e.g. the obvious
+    // implementation of multiple entry points).  If this doesn't occur, the
+    // 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";
+  }
 
   AsmPrinter::doFinalization(M);
   return false; // success


Index: llvm/lib/Target/X86/X86AsmPrinter.h
diff -u llvm/lib/Target/X86/X86AsmPrinter.h:1.12 llvm/lib/Target/X86/X86AsmPrinter.h:1.13
--- llvm/lib/Target/X86/X86AsmPrinter.h:1.12	Mon Mar  6 20:02:57 2006
+++ llvm/lib/Target/X86/X86AsmPrinter.h	Mon Mar  6 20:23:26 2006
@@ -68,7 +68,7 @@
     MachineFunctionPass::getAnalysisUsage(AU);
   }
 
-    bool forDarwin;  // FIXME: eliminate.
+  bool forDarwin;  // FIXME: eliminate.
 
   // Necessary for Darwin to print out the apprioriate types of linker stubs
   std::set<std::string> FnStubs, GVStubs, LinkOnceStubs;


Index: llvm/lib/Target/X86/X86IntelAsmPrinter.cpp
diff -u llvm/lib/Target/X86/X86IntelAsmPrinter.cpp:1.22 llvm/lib/Target/X86/X86IntelAsmPrinter.cpp:1.23
--- llvm/lib/Target/X86/X86IntelAsmPrinter.cpp:1.22	Mon Mar  6 20:02:57 2006
+++ llvm/lib/Target/X86/X86IntelAsmPrinter.cpp	Mon Mar  6 20:23:26 2006
@@ -26,15 +26,19 @@
 /// method to print assembly for each instruction.
 ///
 bool X86IntelAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
-  // Let PassManager know we need debug information and relay
-  // the MachineDebugInfo address on to DwarfWriter.
-  DW.SetDebugInfo(&getAnalysis<MachineDebugInfo>());
+  if (forDarwin) {
+    // Let PassManager know we need debug information and relay
+    // the MachineDebugInfo address on to DwarfWriter.
+    DW.SetDebugInfo(&getAnalysis<MachineDebugInfo>());
+  }
 
   SetupMachineFunction(MF);
   O << "\n\n";
 
-  // Emit pre-function debug information.
-  DW.BeginFunction(MF);
+  if (forDarwin) {
+    // Emit pre-function debug information.
+    DW.BeginFunction(MF);
+  }
 
   // Print out constants referenced by the function
   EmitConstantPool(MF.getConstantPool());
@@ -63,8 +67,10 @@
     }
   }
 
-  // Emit post-function debug information.
-  DW.EndFunction(MF);
+  if (forDarwin) {
+    // Emit post-function debug information.
+    DW.EndFunction(MF);
+  }
 
   // We didn't modify anything.
   return false;






More information about the llvm-commits mailing list