[llvm] r221067 - Remove DwarfUnit::LabelEnd in favor of computing the length of the section directly

David Blaikie dblaikie at gmail.com
Sat Nov 1 16:07:14 PDT 2014


Author: dblaikie
Date: Sat Nov  1 18:07:14 2014
New Revision: 221067

URL: http://llvm.org/viewvc/llvm-project?rev=221067&view=rev
Log:
Remove DwarfUnit::LabelEnd in favor of computing the length of the section directly

This was a compile-unit specific label (unused in type units) and seems
unnecessary anyway when we can more easily directly compute the size of
the compile unit.

Modified:
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.cpp
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h
    llvm/trunk/test/DebugInfo/X86/ref_addr_relocation.ll
    llvm/trunk/test/DebugInfo/dwarf-public-names.ll

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h?rev=221067&r1=221066&r2=221067&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h Sat Nov  1 18:07:14 2014
@@ -173,6 +173,10 @@ public:
     this->SectionSym = SectionSym;
   }
 
+  unsigned getLength() {
+    return sizeof(uint32_t) + // Length field
+        getHeaderSize() + UnitDie.getSize();
+  }
 };
 
 } // end llvm namespace

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=221067&r1=221066&r2=221067&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Sat Nov  1 18:07:14 2014
@@ -1598,7 +1598,7 @@ void DwarfDebug::emitDebugPubSection(
     Asm->EmitSectionOffset(TheU->getLabelBegin(), TheU->getSectionSym());
 
     Asm->OutStreamer.AddComment("Compilation Unit Length");
-    Asm->EmitLabelDifference(TheU->getLabelEnd(), TheU->getLabelBegin(), 4);
+    Asm->EmitInt32(TheU->getLength());
 
     // Emit the pubnames for this compilation unit.
     for (const auto &GI : Globals) {

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.cpp?rev=221067&r1=221066&r2=221067&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.cpp Sat Nov  1 18:07:14 2014
@@ -65,7 +65,6 @@ void DwarfFile::emitUnits(const MCSymbol
     TheU->emitHeader(ASectionSym);
 
     DD.emitDIE(Die);
-    Asm->OutStreamer.EmitLabel(TheU->getLabelEnd());
   }
 }
 

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp?rev=221067&r1=221066&r2=221067&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp Sat Nov  1 18:07:14 2014
@@ -1750,8 +1750,6 @@ void DwarfUnit::initSection(const MCSect
   this->Section = Section;
   this->LabelBegin =
       Asm->GetTempSymbol(Section->getLabelBeginName(), getUniqueID());
-  this->LabelEnd =
-      Asm->GetTempSymbol(Section->getLabelEndName(), getUniqueID());
 }
 
 void DwarfTypeUnit::emitHeader(const MCSymbol *ASectionSym) const {

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h?rev=221067&r1=221066&r2=221067&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h Sat Nov  1 18:07:14 2014
@@ -132,9 +132,6 @@ protected:
   /// The start of the unit within its section.
   MCSymbol *LabelBegin;
 
-  /// The end of the unit within its section.
-  MCSymbol *LabelEnd;
-
   DwarfUnit(unsigned UID, dwarf::Tag, DICompileUnit CU, AsmPrinter *A,
             DwarfDebug *DW, DwarfFile *DWU);
 
@@ -152,11 +149,6 @@ public:
     return LabelBegin;
   }
 
-  MCSymbol *getLabelEnd() const {
-    assert(Section);
-    return LabelEnd;
-  }
-
   // Accessors.
   unsigned getUniqueID() const { return UniqueID; }
   uint16_t getLanguage() const { return CUNode.getLanguage(); }

Modified: llvm/trunk/test/DebugInfo/X86/ref_addr_relocation.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/ref_addr_relocation.ll?rev=221067&r1=221066&r2=221067&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/ref_addr_relocation.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/ref_addr_relocation.ll Sat Nov  1 18:07:14 2014
@@ -23,7 +23,7 @@
 ; CHECK: DW_TAG_variable
 ; CHECK: .long [[TYPE:.*]] # DW_AT_type
 ; CHECK: DW_TAG_structure_type
-; CHECK: debug_info_end0
+; CHECK: debug_info_begin1
 ; CHECK: DW_TAG_compile_unit
 ; CHECK-NOT: DW_TAG_structure_type
 ; This variable's type is in the 1st CU.
@@ -31,7 +31,7 @@
 ; Make sure this is relocatable.
 ; CHECK: .quad .Lsection_info+[[TYPE]] # DW_AT_type
 ; CHECK-NOT: DW_TAG_structure_type
-; CHECK: debug_info_end1
+; CHECK: .section
 
 ; CHECK-DWARF: DW_TAG_compile_unit
 ; CHECK-DWARF: 0x[[ADDR:.*]]: DW_TAG_structure_type

Modified: llvm/trunk/test/DebugInfo/dwarf-public-names.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/dwarf-public-names.ll?rev=221067&r1=221066&r2=221067&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/dwarf-public-names.ll (original)
+++ llvm/trunk/test/DebugInfo/dwarf-public-names.ll Sat Nov  1 18:07:14 2014
@@ -37,7 +37,7 @@
 
 ; Skip the output to the header of the pubnames section.
 ; CHECK: debug_pubnames
-; CHECK: version = 0x0002
+; CHECK: version = 0x0002 {{.*}} unit_size = 0x00000128
 
 ; Check for each name in the output.
 ; CHECK-DAG: "ns"





More information about the llvm-commits mailing list