Changes in directory llvm/lib/Target/X86:

X86ATTAsmPrinter.cpp updated: 1.28 -> 1.29
X86ATTAsmPrinter.h updated: 1.8 -> 1.9
X86AsmPrinter.cpp updated: 1.167 -> 1.168
X86AsmPrinter.h updated: 1.11 -> 1.12
X86ISelLowering.cpp updated: 1.102 -> 1.103
X86InstrInfo.td updated: 1.251 -> 1.252
X86IntelAsmPrinter.cpp updated: 1.21 -> 1.22
X86IntelAsmPrinter.h updated: 1.9 -> 1.10
---
Log message:

Enable Dwarf debugging info.


---
Diffs of the changes:  (+83 -6)

 X86ATTAsmPrinter.cpp   |   14 +++++++++++++-
 X86ATTAsmPrinter.h     |    2 +-
 X86AsmPrinter.cpp      |    6 ++++++
 X86AsmPrinter.h        |   38 ++++++++++++++++++++++++++++++++++++--
 X86ISelLowering.cpp    |    4 +++-
 X86InstrInfo.td        |   13 +++++++++++++
 X86IntelAsmPrinter.cpp |   10 ++++++++++
 X86IntelAsmPrinter.h   |    2 +-
 8 files changed, 83 insertions(+), 6 deletions(-)


Index: llvm/lib/Target/X86/X86ATTAsmPrinter.cpp
diff -u llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.28 
llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.29
--- llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.28       Sun Feb 26 02:28:12 2006
+++ llvm/lib/Target/X86/X86ATTAsmPrinter.cpp    Mon Mar  6 20:02:57 2006
@@ -27,9 +27,16 @@
 /// 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>());
+
   SetupMachineFunction(MF);
   O << "\n\n";
 
+  // Emit pre-function debug information.
+  DW.BeginFunction(MF);
+
   // Print out constants referenced by the function
   EmitConstantPool(MF.getConstantPool());
 
@@ -81,6 +88,9 @@
   if (HasDotTypeDotSizeDirective)
     O << "\t.size " << CurrentFnName << ", .-" << CurrentFnName << "\n";
 
+  // Emit post-function debug information.
+  DW.EndFunction(MF);
+
   // We didn't modify anything.
   return false;
 }
@@ -101,7 +111,9 @@
 
   case MachineOperand::MO_SignExtendedImmed:
   case MachineOperand::MO_UnextendedImmed:
-    O << '$' << (int)MO.getImmedValue();
+    if (!Modifier || strcmp(Modifier, "debug") != 0)
+      O << '$';
+    O << (int)MO.getImmedValue();
     return;
   case MachineOperand::MO_MachineBasicBlock: {
     MachineBasicBlock *MBBOp = MO.getMachineBasicBlock();


Index: llvm/lib/Target/X86/X86ATTAsmPrinter.h
diff -u llvm/lib/Target/X86/X86ATTAsmPrinter.h:1.8 
llvm/lib/Target/X86/X86ATTAsmPrinter.h:1.9
--- llvm/lib/Target/X86/X86ATTAsmPrinter.h:1.8  Tue Feb 21 20:26:30 2006
+++ llvm/lib/Target/X86/X86ATTAsmPrinter.h      Mon Mar  6 20:02:57 2006
@@ -21,7 +21,7 @@
 namespace x86 {
 
 struct X86ATTAsmPrinter : public X86SharedAsmPrinter {
-  X86ATTAsmPrinter(std::ostream &O, TargetMachine &TM)
+ X86ATTAsmPrinter(std::ostream &O, TargetMachine &TM)
     : X86SharedAsmPrinter(O, TM) { }
 
   virtual const char *getPassName() const {


Index: llvm/lib/Target/X86/X86AsmPrinter.cpp
diff -u llvm/lib/Target/X86/X86AsmPrinter.cpp:1.167 
llvm/lib/Target/X86/X86AsmPrinter.cpp:1.168
--- llvm/lib/Target/X86/X86AsmPrinter.cpp:1.167 Wed Feb 22 23:25:02 2006
+++ llvm/lib/Target/X86/X86AsmPrinter.cpp       Mon Mar  6 20:02:57 2006
@@ -75,6 +75,9 @@
   default: break;
   }
   
+  // Emit initial debug information.
+  DW.BeginModule(M);
+
   return AsmPrinter::doInitialization(M);
 }
 
@@ -187,6 +190,9 @@
     }
   }
 
+  // Emit initial debug information.
+  DW.EndModule(M);
+
   AsmPrinter::doFinalization(M);
   return false; // success
 }


Index: llvm/lib/Target/X86/X86AsmPrinter.h
diff -u llvm/lib/Target/X86/X86AsmPrinter.h:1.11 
llvm/lib/Target/X86/X86AsmPrinter.h:1.12
--- llvm/lib/Target/X86/X86AsmPrinter.h:1.11    Sat Feb 25 03:56:50 2006
+++ llvm/lib/Target/X86/X86AsmPrinter.h Mon Mar  6 20:02:57 2006
@@ -18,6 +18,8 @@
 
 #include "X86.h"
 #include "llvm/CodeGen/AsmPrinter.h"
+#include "llvm/CodeGen/DwarfWriter.h"
+#include "llvm/CodeGen/MachineDebugInfo.h"
 #include "llvm/ADT/Statistic.h"
 #include <set>
 
@@ -27,14 +29,46 @@
 
 extern Statistic<> EmittedInsts;
 
+/// X86DwarfWriter - Dwarf debug info writer customized for Darwin/Mac OS X
+///
+struct X86DwarfWriter : public DwarfWriter {
+ // Ctor.
+X86DwarfWriter(std::ostream &o, AsmPrinter *ap)
+  : DwarfWriter(o, ap)
+    {
+      needsSet = true;
+      DwarfAbbrevSection = ".section __DWARFA,__debug_abbrev";
+      DwarfInfoSection = ".section __DWARFA,__debug_info";
+      DwarfLineSection = ".section __DWARFA,__debug_line";
+      DwarfFrameSection = ".section __DWARFA,__debug_frame";
+      DwarfPubNamesSection = ".section __DWARFA,__debug_pubnames";
+      DwarfPubTypesSection = ".section __DWARFA,__debug_pubtypes";
+      DwarfStrSection = ".section __DWARFA,__debug_str";
+      DwarfLocSection = ".section __DWARFA,__debug_loc";
+      DwarfARangesSection = ".section __DWARFA,__debug_aranges";
+      DwarfRangesSection = ".section __DWARFA,__debug_ranges";
+      DwarfMacInfoSection = ".section __DWARFA,__debug_macinfo";
+      TextSection = ".text";
+       DataSection = ".data";
+    }
+};
+
 struct X86SharedAsmPrinter : public AsmPrinter {
+  X86DwarfWriter DW;
+
   X86SharedAsmPrinter(std::ostream &O, TargetMachine &TM)
-    : AsmPrinter(O, TM), forDarwin(false) { }
+    : AsmPrinter(O, TM), DW(O, this), forDarwin(false) { }
 
   bool doInitialization(Module &M);
   bool doFinalization(Module &M);
 
-  bool forDarwin;  // FIXME: eliminate.
+  void getAnalysisUsage(AnalysisUsage &AU) const {
+    AU.setPreservesAll();
+    AU.addRequired<MachineDebugInfo>();
+    MachineFunctionPass::getAnalysisUsage(AU);
+  }
+
+    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/X86ISelLowering.cpp
diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.102 
llvm/lib/Target/X86/X86ISelLowering.cpp:1.103
--- llvm/lib/Target/X86/X86ISelLowering.cpp:1.102       Sat Mar  4 23:08:37 2006
+++ llvm/lib/Target/X86/X86ISelLowering.cpp     Mon Mar  6 20:02:57 2006
@@ -168,7 +168,9 @@
   // We don't have line number support yet.
   setOperationAction(ISD::LOCATION, MVT::Other, Expand);
   setOperationAction(ISD::DEBUG_LOC, MVT::Other, Expand);
-  setOperationAction(ISD::DEBUG_LABEL, MVT::Other, Expand);
+  // FIXME - use subtarget debug flags
+  if (!TM.getSubtarget<X86Subtarget>().isTargetDarwin())
+    setOperationAction(ISD::DEBUG_LABEL, MVT::Other, Expand);
 
   // VASTART needs to be custom lowered to use the VarArgsFrameIndex
   setOperationAction(ISD::VASTART           , MVT::Other, Custom);


Index: llvm/lib/Target/X86/X86InstrInfo.td
diff -u llvm/lib/Target/X86/X86InstrInfo.td:1.251 
llvm/lib/Target/X86/X86InstrInfo.td:1.252
--- llvm/lib/Target/X86/X86InstrInfo.td:1.251   Thu Mar  2 18:19:44 2006
+++ llvm/lib/Target/X86/X86InstrInfo.td Mon Mar  6 20:02:57 2006
@@ -2353,6 +2353,19 @@
                  [(set R32:$dst, 0)]>;
 
 
//===----------------------------------------------------------------------===//
+// DWARF Pseudo Instructions
+//
+
+def DWARF_LOC   : I<0, Pseudo, (ops i32imm:$line, i32imm:$col, i32imm:$file),
+                    "; .loc $file, $line, $col",
+                    [(dwarf_loc (i32 imm:$line), (i32 imm:$col),
+                      (i32 imm:$file))]>;
+
+def DWARF_LABEL : I<0, Pseudo, (ops i32imm:$id),
+                   "\nLdebug_loc${id:debug}:",
+                   [(dwarf_label (i32 imm:$id))]>;
+
+//===----------------------------------------------------------------------===//
 // Non-Instruction Patterns
 
//===----------------------------------------------------------------------===//
 


Index: llvm/lib/Target/X86/X86IntelAsmPrinter.cpp
diff -u llvm/lib/Target/X86/X86IntelAsmPrinter.cpp:1.21 
llvm/lib/Target/X86/X86IntelAsmPrinter.cpp:1.22
--- llvm/lib/Target/X86/X86IntelAsmPrinter.cpp:1.21     Sun Feb 26 02:28:12 2006
+++ llvm/lib/Target/X86/X86IntelAsmPrinter.cpp  Mon Mar  6 20:02:57 2006
@@ -26,9 +26,16 @@
 /// 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>());
+
   SetupMachineFunction(MF);
   O << "\n\n";
 
+  // Emit pre-function debug information.
+  DW.BeginFunction(MF);
+
   // Print out constants referenced by the function
   EmitConstantPool(MF.getConstantPool());
 
@@ -56,6 +63,9 @@
     }
   }
 
+  // Emit post-function debug information.
+  DW.EndFunction(MF);
+
   // We didn't modify anything.
   return false;
 }


Index: llvm/lib/Target/X86/X86IntelAsmPrinter.h
diff -u llvm/lib/Target/X86/X86IntelAsmPrinter.h:1.9 
llvm/lib/Target/X86/X86IntelAsmPrinter.h:1.10
--- llvm/lib/Target/X86/X86IntelAsmPrinter.h:1.9        Tue Feb 21 20:26:30 2006
+++ llvm/lib/Target/X86/X86IntelAsmPrinter.h    Mon Mar  6 20:02:57 2006
@@ -23,7 +23,7 @@
 namespace x86 {
 
 struct X86IntelAsmPrinter : public X86SharedAsmPrinter {
-  X86IntelAsmPrinter(std::ostream &O, TargetMachine &TM)
+ X86IntelAsmPrinter(std::ostream &O, TargetMachine &TM)
     : X86SharedAsmPrinter(O, TM) { }
 
   virtual const char *getPassName() const {



_______________________________________________
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

Reply via email to