[llvm] r203187 - DebugInfo: Emit DW_TAG_subprogram's DW_AT_high_pc as an offset from the low_pc

Oliver Stannard oliver.stannard at arm.com
Fri Mar 7 03:44:15 PST 2014


Hi David,

This patch relies on DW_AT_high_pc being of class DW_FORM_data4, a feature
which was first introduced in DWARF4. Would it be possible to fall back to
the old output when -gdwarf-2 or -gdwarf-3 is used?

Oliver

-----Original Message-----
From: llvm-commits-bounces at cs.uiuc.edu
[mailto:llvm-commits-bounces at cs.uiuc.edu] On Behalf Of David Blaikie
Sent: 07 March 2014 01:31
To: llvm-commits at cs.uiuc.edu
Subject: [llvm] r203187 - DebugInfo: Emit DW_TAG_subprogram's DW_AT_high_pc
as an offset from the low_pc

Author: dblaikie
Date: Thu Mar  6 19:30:55 2014
New Revision: 203187

URL: http://llvm.org/viewvc/llvm-project?rev=203187&view=rev
Log:
DebugInfo: Emit DW_TAG_subprogram's DW_AT_high_pc as an offset from the
low_pc

This removes a relocation from each subprogram, reducing link times,
etc.

Modified:
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h
    llvm/trunk/test/DebugInfo/AArch64/dwarfdump.ll
    llvm/trunk/test/DebugInfo/X86/dbg-value-location.ll

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL:
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfD
ebug.cpp?rev=203187&r1=203186&r2=203187&view=diff
============================================================================
==
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Thu Mar  6 19:30:55
2014
@@ -413,7 +413,8 @@ DIE *DwarfDebug::updateSubprogramScopeDI
   }
 
   SPCU->addLabelAddress(SPDie, dwarf::DW_AT_low_pc, FunctionBeginSym);
-  SPCU->addLabelAddress(SPDie, dwarf::DW_AT_high_pc, FunctionEndSym);
+  SPCU->addLabelDelta(SPDie, dwarf::DW_AT_high_pc, FunctionEndSym,
+                      FunctionBeginSym);
 
   const TargetRegisterInfo *RI = Asm->TM.getRegisterInfo();
   MachineLocation Location(RI->getFrameRegister(*Asm->MF));

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
URL:
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfU
nit.cpp?rev=203187&r1=203186&r2=203187&view=diff
============================================================================
==
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp Thu Mar  6 19:30:55 2014
@@ -320,6 +320,12 @@ void DwarfUnit::addSectionDelta(DIE *Die
     Die->addValue(Attribute, dwarf::DW_FORM_data4, Value);
 }
 
+void DwarfUnit::addLabelDelta(DIE *Die, dwarf::Attribute Attribute,
+                              const MCSymbol *Hi, const MCSymbol *Lo) {
+  DIEValue *Value = new (DIEValueAllocator) DIEDelta(Hi, Lo);
+  Die->addValue(Attribute, dwarf::DW_FORM_data4, Value);
+}
+
 /// addDIEEntry - Add a DIE attribute data and value.
 ///
 void DwarfUnit::addDIEEntry(DIE *Die, dwarf::Attribute Attribute, DIE
*Entry) {

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h
URL:
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfU
nit.h?rev=203187&r1=203186&r2=203187&view=diff
============================================================================
==
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h Thu Mar  6 19:30:55 2014
@@ -359,6 +359,10 @@ public:
   void addSectionDelta(DIE *Die, dwarf::Attribute Attribute, const MCSymbol
*Hi,
                        const MCSymbol *Lo);
 
+  /// addLabelDelta - Add a label delta attribute data and value.
+  void addLabelDelta(DIE *Die, dwarf::Attribute Attribute, const MCSymbol
*Hi,
+                     const MCSymbol *Lo);
+
   /// addDIEEntry - Add a DIE attribute data and value.
   void addDIEEntry(DIE *Die, dwarf::Attribute Attribute, DIE *Entry);
 

Modified: llvm/trunk/test/DebugInfo/AArch64/dwarfdump.ll
URL:
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/AArch64/dwarfd
ump.ll?rev=203187&r1=203186&r2=203187&view=diff
============================================================================
==
--- llvm/trunk/test/DebugInfo/AArch64/dwarfdump.ll (original)
+++ llvm/trunk/test/DebugInfo/AArch64/dwarfdump.ll Thu Mar  6 19:30:55 2014
@@ -12,7 +12,7 @@
 ; A couple of ABS64s similarly:
 
 ; CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000000000000)
-; CHECK: DW_AT_high_pc [DW_FORM_addr] (0x0000000000000008)
+; CHECK: DW_AT_high_pc [DW_FORM_data4] (0x00000008)
 
 define i32 @main() nounwind {
   ret i32 0, !dbg !8

Modified: llvm/trunk/test/DebugInfo/X86/dbg-value-location.ll
URL:
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/dbg-value-
location.ll?rev=203187&r1=203186&r2=203187&view=diff
============================================================================
==
--- llvm/trunk/test/DebugInfo/X86/dbg-value-location.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/dbg-value-location.ll Thu Mar  6 19:30:55
2014
@@ -4,7 +4,7 @@ target datalayout = "e-p:64:64:64-i1:8:8
 target triple = "x86_64-apple-darwin10.0.0"
 ;Radar 8950491
 
-;CHECK: .long Lset5
+;CHECK: .long Lset6
 ;CHECK-NEXT:        ## DW_AT_decl_file
 ;CHECK-NEXT:        ## DW_AT_decl_line
 ;CHECK-NEXT:        ## DW_AT_type


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







More information about the llvm-commits mailing list