Remove DwarfUnit::LabelEnd in favor of computing the length of the section directly
authorDavid Blaikie <dblaikie@gmail.com>
Sat, 1 Nov 2014 23:07:14 +0000 (23:07 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Sat, 1 Nov 2014 23:07:14 +0000 (23:07 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221067 91177308-0d34-0410-b5e6-96231b3b80d8

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

index dd59024e786f69a5eee001d315535121ae90c9a0..a84c81e0bf5e67590896e8e578976a7f124f2cfe 100644 (file)
@@ -173,6 +173,10 @@ public:
     this->SectionSym = SectionSym;
   }
 
+  unsigned getLength() {
+    return sizeof(uint32_t) + // Length field
+        getHeaderSize() + UnitDie.getSize();
+  }
 };
 
 } // end llvm namespace
index bbac4794aad697ff0f4394e37b9760a87b6f4ded..ce59debe2355951f4e96de445ba67788266acd40 100644 (file)
@@ -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) {
index d62e9bcc86cd34d7bf7147b7087b297fdb3a4d96..89d38a2e3aef52b235502b2f213b144bf1d99858 100644 (file)
@@ -65,7 +65,6 @@ void DwarfFile::emitUnits(const MCSymbol *ASectionSym) {
     TheU->emitHeader(ASectionSym);
 
     DD.emitDIE(Die);
-    Asm->OutStreamer.EmitLabel(TheU->getLabelEnd());
   }
 }
 
index 1b1d3edcc7edad7065a53bb38da28606c3dcc5bf..bdcb8cc11eed3e520ff3303755904dc18a9b051f 100644 (file)
@@ -1750,8 +1750,6 @@ void DwarfUnit::initSection(const MCSection *Section) {
   this->Section = Section;
   this->LabelBegin =
       Asm->GetTempSymbol(Section->getLabelBeginName(), getUniqueID());
-  this->LabelEnd =
-      Asm->GetTempSymbol(Section->getLabelEndName(), getUniqueID());
 }
 
 void DwarfTypeUnit::emitHeader(const MCSymbol *ASectionSym) const {
index 63fb79f0170b191676559d1284fa2c8f005b90ce..feb7ffa125a674c0d54d066b9fef8917c39cf067 100644 (file)
@@ -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(); }
index efb8e9f055275744520de7553bab3fcc5658c085..4d77322455d3f130737ab5a4c933bb1f7ddbb14a 100644 (file)
@@ -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
index f6d8cd343cdb137a6a6276c5d7558d8cc84ba208..890ab8af771ac0cdb99eedf1db50e3e749d9e775 100644 (file)
@@ -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"