[llvm] [LLVM][DWARF] Add support for monolithic types in .debug_names (PR #70515)

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 1 17:06:28 PDT 2023


================
@@ -391,31 +397,39 @@ void Dwarf5AccelTableWriter<DataT>::Header::emit(Dwarf5AccelTableWriter &Ctx) {
   Asm->OutStreamer->emitBytes({AugmentationString, AugmentationStringSize});
 }
 
+static uint32_t constexpr LowerBitSize = dwarf::DW_IDX_type_hash;
+static uint32_t getTagFromAbbreviationTag(const uint32_t AbbrvTag) {
+  return AbbrvTag >> LowerBitSize;
+}
+static uint32_t
+constructAbbreviationTag(const unsigned Tag,
+                         const GetIndexForEntryReturnType &EntryRet) {
+  uint32_t AbbrvTag = 0;
+  if (EntryRet)
+    AbbrvTag |= 1 << EntryRet->second.Index;
+  AbbrvTag |= 1 << dwarf::DW_IDX_die_offset;
+  AbbrvTag |= Tag << LowerBitSize;
+  return AbbrvTag;
+}
----------------
dwblaikie wrote:

So previously this thing could be called a tag because it was a tag - now it's not a hash, but it's a single int bitpacked with the tag and some other stuff.

the "other stuff" at the moment only needs to be the "will this tag have an index attached to it" - but it's also got this `DW_IDX_die_offset` which doesn't seem strictly necessary. It's like it's sort of half-generalized, but not entirely, and packed into an int I guess to avoid needing to define a new type and a hash function/densemap traits for it.

This is I think a bit too awkward. Yeah, still thinking maybe something like the FoldingSet used by the real abbrevs would be good here. (& extending the representation to include the tag, rather than having tag as the key and attributes as the value)

https://github.com/llvm/llvm-project/pull/70515


More information about the llvm-commits mailing list