DebugInfo: Shrink pubnames/pubtypes in the presence of type units by only emitting...
authorDavid Blaikie <dblaikie@gmail.com>
Thu, 6 Mar 2014 01:42:00 +0000 (01:42 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Thu, 6 Mar 2014 01:42:00 +0000 (01:42 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203057 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/AsmPrinter/DwarfDebug.cpp
lib/CodeGen/AsmPrinter/DwarfUnit.cpp
test/DebugInfo/X86/generate-odr-hash.ll

index a59b40d90bf6b462ee60384363319cc9ac22ce43..6404e4b52299b083fde70d83a033492f9b008652 100644 (file)
@@ -2310,10 +2310,10 @@ void DwarfDebug::emitDebugPubNames(bool GnuStyle) {
       GnuStyle ? Asm->getObjFileLowering().getDwarfGnuPubNamesSection()
                : Asm->getObjFileLowering().getDwarfPubNamesSection();
 
-  DwarfFile &Holder = useSplitDwarf() ? SkeletonHolder : InfoHolder;
-  const SmallVectorImpl<DwarfUnit *> &Units = Holder.getUnits();
-  for (unsigned i = 0; i != Units.size(); ++i) {
-    DwarfUnit *TheU = Units[i];
+  for (const auto &NU : CUMap) {
+    DwarfCompileUnit *TheU = NU.second;
+    if (auto Skeleton = static_cast<DwarfCompileUnit *>(TheU->getSkeleton()))
+      TheU = Skeleton;
     unsigned ID = TheU->getUniqueID();
 
     // Start the dwarf pubnames section.
@@ -2374,10 +2374,10 @@ void DwarfDebug::emitDebugPubTypes(bool GnuStyle) {
       GnuStyle ? Asm->getObjFileLowering().getDwarfGnuPubTypesSection()
                : Asm->getObjFileLowering().getDwarfPubTypesSection();
 
-  DwarfFile &Holder = useSplitDwarf() ? SkeletonHolder : InfoHolder;
-  const SmallVectorImpl<DwarfUnit *> &Units = Holder.getUnits();
-  for (unsigned i = 0; i != Units.size(); ++i) {
-    DwarfUnit *TheU = Units[i];
+  for (const auto &NU : CUMap) {
+    DwarfCompileUnit *TheU = NU.second;
+    if (auto Skeleton = static_cast<DwarfCompileUnit *>(TheU->getSkeleton()))
+      TheU = Skeleton;
     unsigned ID = TheU->getUniqueID();
 
     // Start the dwarf pubtypes section.
index d2ac2897239c285572de4dded14ca860df60efb5..ddc1c2f4bc0d0b68531bcc43a69834517d58be83 100644 (file)
@@ -958,6 +958,8 @@ DIE *DwarfUnit::getOrCreateTypeDIE(const MDNode *TyNode) {
   // Create new type.
   TyDIE = createAndAddDIE(Ty.getTag(), *ContextDIE, Ty);
 
+  updateAcceleratorTables(Context, Ty, TyDIE);
+
   if (Ty.isBasicType())
     constructTypeDIE(*TyDIE, DIBasicType(Ty));
   else if (Ty.isCompositeType()) {
@@ -974,8 +976,6 @@ DIE *DwarfUnit::getOrCreateTypeDIE(const MDNode *TyNode) {
     constructTypeDIE(*TyDIE, DIDerivedType(Ty));
   }
 
-  updateAcceleratorTables(Context, Ty, TyDIE);
-
   return TyDIE;
 }
 
index f166bdf029f215c2f0c4be53215f531c1ce4a039..64a428e2d5246834bce04da67873509862042e12 100644 (file)
 ; FISSION-LABEL: .debug_info.dwo contents:
 ; CHECK: Compile Unit: length = [[CU_SIZE:[0-9a-f]+]]
 
-; CHECK: DW_TAG_structure_type
+; CHECK: [[BAR:^0x........]]: DW_TAG_structure_type
 ; CHECK-NEXT: DW_AT_declaration
-; CHECK-NEXT: DW_AT_signature
-; CHECK: DW_TAG_class_type
+; CHECK-NEXT: DW_AT_signature {{.*}} (0x1d02f3be30cc5688)
+; CHECK: [[FLUFFY:^0x........]]: DW_TAG_class_type
 ; CHECK-NEXT: DW_AT_declaration
-; CHECK-NEXT: DW_AT_signature
+; CHECK-NEXT: DW_AT_signature {{.*}} (0xb04af47397402e77)
 
 ; Ensure the CU-local type 'walrus' is not placed in a type unit.
-; CHECK: DW_TAG_structure_type
+; CHECK: [[WALRUS:^0x........]]: DW_TAG_structure_type
 ; CHECK-NEXT: DW_AT_name{{.*}}"walrus"
 ; CHECK-NEXT: DW_AT_byte_size
 ; CHECK-NEXT: DW_AT_decl_file
 ; CHECK-NEXT: DW_AT_decl_line
 
+
+; CHECK: [[WOMBAT:^0x........]]: DW_TAG_structure_type
+; CHECK-NEXT: DW_AT_declaration
+; CHECK-NEXT: DW_AT_signature {{.*}} (0xfd756cee88f8a118)
+
 ; FISSION-LABEL: .debug_types contents:
 ; FISSION-NOT: type_signature
 ; FISSION-LABEL: type_signature = 0x1d02f3be30cc5688
 ; Don't emit pubtype entries for type DIEs in the compile unit that just indirect to a type unit.
 ; CHECK-NEXT: unit_size = [[CU_SIZE]]
 ; CHECK-NEXT: Offset Name
-; CHECK-NEXT: "walrus"
-; Type unit for 'bar'
-; SINGLE-NEXT: unit_size = 0x00000027
-; FISSION-NEXT: unit_size = 0x00000028
-; CHECK-NEXT: Offset Name
-; CHECK-NEXT: "bar"
-; SINGLE-NEXT: unit_size = 0x00000061
-; FISSION-NEXT: unit_size = 0x00000028
-; CHECK-NEXT: Offset Name
-; CHECK-NEXT: "int"
-; CHECK-NEXT: "echidna::capybara::mongoose::fluffy"
-; SINGLE-NEXT: unit_size = 0x0000003e
-; FISSION-NEXT: unit_size = 0x00000028
-; CHECK-NEXT: Offset Name
-; CHECK-NEXT: "wombat"
-; SINGLE-NEXT: unit_size = 0x0000004f
-; FISSION-NEXT: unit_size = 0x00000028
-; CHECK-NEXT: Offset Name
-; CHECK-NEXT: "int"
+; CHECK-NEXT: [[BAR]] "bar"
+; CHECK-NEXT: [[WOMBAT]] "wombat"
+; CHECK-NEXT: [[FLUFFY]] "echidna::capybara::mongoose::fluffy"
+; CHECK-NEXT: [[WALRUS]] "walrus"
 
 %struct.bar = type { i8 }
 %"class.echidna::capybara::mongoose::fluffy" = type { i32, i32 }