[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:

Could you describe this in more detail? "combinations" of what?

We have abbrev technology for the debug_info (I know, they're different abbrevs with different tag types - so not suggesting reusing the actual code (though it might be interesting to generalize it at some point)). Looks like the way the abbrevs work is via `FoldingSet<DIEAbbrev>` and `DIEAbbrev::Profile` - wonder if it's worth doing something like that?

Ah, I guess some of what's confusing here is the term "tag" - we have a concept of tags, DW_IDX_* are tags in this case. What this may be more accurately called is an abbreviation or maybe an abbreviation hash? Though it's a bit confusing - why are we putting DW_IDX_die_offset in here, if it's always in here? That wouldn't need to be part of the unique identifier... 

But, yeah, maybe doing something closer to the way the debug_info DIEs/tags/attributes are handled would be more clear... 

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


More information about the llvm-commits mailing list