[PATCH] D86927: [DebugInfo] Emit a 1-byte value as a terminator of entries list in the name index.

Igor Kudrin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 1 03:52:07 PDT 2020


ikudrin created this revision.
ikudrin added reviewers: labath, dblaikie, jhenderson.
ikudrin added projects: LLVM, debug-info.
Herald added subscribers: ormris, arphaman, hiraditya.
ikudrin requested review of this revision.

The termination entry of the list has the abbreviation code of 0, and one byte is enough to store that. The patch saves approximately 3 bytes per name in the name index table (the calculation is not exact because there is an alignment operator after the entry pool).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D86927

Files:
  llvm/lib/CodeGen/AsmPrinter/AccelTable.cpp
  llvm/test/DebugInfo/X86/debug-names-end-of-list.ll


Index: llvm/test/DebugInfo/X86/debug-names-end-of-list.ll
===================================================================
--- /dev/null
+++ llvm/test/DebugInfo/X86/debug-names-end-of-list.ll
@@ -0,0 +1,24 @@
+; This checks that the list of index entries in the name index is terminated
+; with a 1-byte value.
+
+; RUN: llc -mtriple x86_64 -accel-tables=Dwarf -dwarf-version=5 -filetype=asm %s -o - | \
+; RUN:   FileCheck %s
+
+; CHECK:   .section .debug_names,"", at progbits
+; CHECK: .Lnames_entries0:
+; CHECK:   .byte 0    # End of list: int
+; CHECK:   .byte 0    # End of list: foo
+
+ at foo = common dso_local global i32 0, align 4, !dbg !5
+
+!llvm.dbg.cu = !{!2}
+!llvm.module.flags = !{!0}
+
+!0 = !{i32 2, !"Debug Info Version", i32 3}
+!1 = !DIFile(filename: "foo.c", directory: "/tmp")
+!2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "Manual", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !3, globals: !4)
+!3 = !{}
+!4 = !{!5}
+!5 = !DIGlobalVariableExpression(var: !6, expr: !DIExpression())
+!6 = distinct !DIGlobalVariable(name: "foo", scope: !2, file: !1, line: 1, type: !7, isLocal: false, isDefinition: true)
+!7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
Index: llvm/lib/CodeGen/AsmPrinter/AccelTable.cpp
===================================================================
--- llvm/lib/CodeGen/AsmPrinter/AccelTable.cpp
+++ llvm/lib/CodeGen/AsmPrinter/AccelTable.cpp
@@ -506,7 +506,7 @@
       for (const auto *Value : Hash->Values)
         emitEntry(*static_cast<const DataT *>(Value));
       Asm->OutStreamer->AddComment("End of list: " + Hash->Name.getString());
-      Asm->emitInt32(0);
+      Asm->emitInt8(0);
     }
   }
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86927.289121.patch
Type: text/x-patch
Size: 1727 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200901/384d55e7/attachment.bin>


More information about the llvm-commits mailing list