[llvm] f320065 - Revert "[LLVM][DWARF] Add support for monolithic types in .debug_names (#68131)"
Nico Weber via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 5 11:47:21 PDT 2023
Author: Nico Weber
Date: 2023-10-05T14:47:04-04:00
New Revision: f320065aeb379d8f9d2780a687768742f8b18eb2
URL: https://github.com/llvm/llvm-project/commit/f320065aeb379d8f9d2780a687768742f8b18eb2
DIFF: https://github.com/llvm/llvm-project/commit/f320065aeb379d8f9d2780a687768742f8b18eb2.diff
LOG: Revert "[LLVM][DWARF] Add support for monolithic types in .debug_names (#68131)"
This reverts commit 9bbd2bf654634cd95dd0be7948ec8402c3c76e1e.
Accidental commit: https://github.com/llvm/llvm-project/pull/68131#issuecomment-1749430207
Added:
Modified:
llvm/include/llvm/CodeGen/AccelTable.h
llvm/lib/CodeGen/AsmPrinter/AccelTable.cpp
llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp
llvm/lib/CodeGen/AsmPrinter/DwarfFile.h
llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h
llvm/lib/DWARFLinker/DWARFStreamer.cpp
llvm/lib/DWARFLinkerParallel/DWARFEmitterImpl.cpp
llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp
llvm/test/DebugInfo/X86/accel-tables-dwarf5.ll
llvm/test/DebugInfo/X86/debug-names-dwarf64.ll
llvm/test/DebugInfo/X86/dwarfdump-debug-names.s
llvm/test/tools/dsymutil/ARM/accel-imported-declarations.test
llvm/test/tools/dsymutil/ARM/dwarf5-dwarf4-combination-macho.test
llvm/test/tools/llvm-dwarfdump/X86/debug-names-misaligned.s
Removed:
llvm/test/DebugInfo/X86/debug-names-types-monolithic.ll
llvm/test/DebugInfo/X86/debug-names-types-split.ll
################################################################################
diff --git a/llvm/include/llvm/CodeGen/AccelTable.h b/llvm/include/llvm/CodeGen/AccelTable.h
index 537f6a4d42bef0e..d521b31e3d16ab4 100644
--- a/llvm/include/llvm/CodeGen/AccelTable.h
+++ b/llvm/include/llvm/CodeGen/AccelTable.h
@@ -106,7 +106,6 @@ namespace llvm {
class AsmPrinter;
class DwarfCompileUnit;
class DwarfDebug;
-class DwarfTypeUnit;
class MCSymbol;
class raw_ostream;
@@ -198,9 +197,6 @@ template <typename DataT> class AccelTable : public AccelTableBase {
template <typename... Types>
void addName(DwarfStringPoolEntryRef Name, Types &&... Args);
- void clear() { Entries.clear(); }
- void addEntries(AccelTable<DataT> &Table);
- const StringEntries getEntries() const { return Entries; }
};
template <typename AccelTableDataT>
@@ -219,16 +215,6 @@ void AccelTable<AccelTableDataT>::addName(DwarfStringPoolEntryRef Name,
AccelTableDataT(std::forward<Types>(Args)...));
}
-template <typename AccelTableDataT>
-void AccelTable<AccelTableDataT>::addEntries(
- AccelTable<AccelTableDataT> &Table) {
- for (auto &Entry : Table.getEntries()) {
- for (AccelTableData *Value : Entry.second.Values)
- addName(Entry.second.Name,
- static_cast<AccelTableDataT *>(Value)->getDie());
- }
-}
-
/// A base class for
diff erent implementations of Data classes for Apple
/// Accelerator Tables. The columns in the table are defined by the static Atoms
/// variable defined on the subclasses.
@@ -264,10 +250,6 @@ class AppleAccelTableData : public AccelTableData {
/// emitDWARF5AccelTable function.
class DWARF5AccelTableData : public AccelTableData {
public:
- struct AttributeEncoding {
- dwarf::Index Index;
- dwarf::Form Form;
- };
static uint32_t hash(StringRef Name) { return caseFoldingDjbHash(Name); }
DWARF5AccelTableData(const DIE &Die) : Die(Die) {}
@@ -327,20 +309,17 @@ void emitAppleAccelTable(AsmPrinter *Asm, AccelTable<DataT> &Contents,
void emitDWARF5AccelTable(AsmPrinter *Asm,
AccelTable<DWARF5AccelTableData> &Contents,
const DwarfDebug &DD,
- ArrayRef<std::unique_ptr<DwarfCompileUnit>> CUs,
- ArrayRef<std::unique_ptr<DwarfTypeUnit>> TUs);
-using GetIndexForEntryReturnType =
- std::optional<std::pair<unsigned, DWARF5AccelTableData::AttributeEncoding>>;
+ ArrayRef<std::unique_ptr<DwarfCompileUnit>> CUs);
+
/// Emit a DWARFv5 Accelerator Table consisting of entries in the specified
/// AccelTable. The \p CUs contains either symbols keeping offsets to the
/// start of compilation unit, either offsets to the start of compilation
/// unit themselves.
-void emitDWARF5AccelTable(AsmPrinter *Asm,
- AccelTable<DWARF5AccelTableStaticData> &Contents,
- ArrayRef<std::variant<MCSymbol *, uint64_t>> CUs,
- llvm::function_ref<GetIndexForEntryReturnType(
- const DWARF5AccelTableStaticData &)>
- getIndexForEntry);
+void emitDWARF5AccelTable(
+ AsmPrinter *Asm, AccelTable<DWARF5AccelTableStaticData> &Contents,
+ ArrayRef<std::variant<MCSymbol *, uint64_t>> CUs,
+ llvm::function_ref<unsigned(const DWARF5AccelTableStaticData &)>
+ getCUIndexForEntry);
/// Accelerator table data implementation for simple Apple accelerator tables
/// with just a DIE reference.
diff --git a/llvm/lib/CodeGen/AsmPrinter/AccelTable.cpp b/llvm/lib/CodeGen/AsmPrinter/AccelTable.cpp
index 5510932e96d2598..8f936037d132537 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AccelTable.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AccelTable.cpp
@@ -13,6 +13,7 @@
#include "llvm/CodeGen/AccelTable.h"
#include "DwarfCompileUnit.h"
#include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/Twine.h"
#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/CodeGen/AsmPrinter.h"
@@ -199,30 +200,32 @@ class Dwarf5AccelTableWriter : public AccelTableWriter {
uint32_t AugmentationStringSize = sizeof(AugmentationString);
char AugmentationString[8] = {'L', 'L', 'V', 'M', '0', '7', '0', '0'};
- Header(uint32_t CompUnitCount, uint32_t LocalTypeUnitCount,
- uint32_t BucketCount, uint32_t NameCount)
- : CompUnitCount(CompUnitCount), LocalTypeUnitCount(LocalTypeUnitCount),
- BucketCount(BucketCount), NameCount(NameCount) {}
+ Header(uint32_t CompUnitCount, uint32_t BucketCount, uint32_t NameCount)
+ : CompUnitCount(CompUnitCount), BucketCount(BucketCount),
+ NameCount(NameCount) {}
void emit(Dwarf5AccelTableWriter &Ctx);
};
+ struct AttributeEncoding {
+ dwarf::Index Index;
+ dwarf::Form Form;
+ };
Header Header;
- DenseMap<uint32_t, SmallVector<DWARF5AccelTableData::AttributeEncoding, 2>>
- Abbreviations;
+ DenseMap<uint32_t, SmallVector<AttributeEncoding, 2>> Abbreviations;
ArrayRef<std::variant<MCSymbol *, uint64_t>> CompUnits;
- ArrayRef<std::variant<MCSymbol *, uint64_t>> TypeUnits;
- llvm::function_ref<GetIndexForEntryReturnType(const DataT &)>
- getIndexForEntry;
+ llvm::function_ref<unsigned(const DataT &)> getCUIndexForEntry;
MCSymbol *ContributionEnd = nullptr;
MCSymbol *AbbrevStart = Asm->createTempSymbol("names_abbrev_start");
MCSymbol *AbbrevEnd = Asm->createTempSymbol("names_abbrev_end");
MCSymbol *EntryPool = Asm->createTempSymbol("names_entries");
- void populateAbbrevsMap();
+ DenseSet<uint32_t> getUniqueTags() const;
+
+ // Right now, we emit uniform attributes for all tags.
+ SmallVector<AttributeEncoding, 2> getUniformAttributes() const;
void emitCUList() const;
- void emitTUList() const;
void emitBuckets() const;
void emitStringOffsets() const;
void emitAbbrevs() const;
@@ -233,9 +236,7 @@ class Dwarf5AccelTableWriter : public AccelTableWriter {
Dwarf5AccelTableWriter(
AsmPrinter *Asm, const AccelTableBase &Contents,
ArrayRef<std::variant<MCSymbol *, uint64_t>> CompUnits,
- ArrayRef<std::variant<MCSymbol *, uint64_t>> TypeUnits,
- llvm::function_ref<GetIndexForEntryReturnType(const DataT &)>
- getIndexForEntry);
+ llvm::function_ref<unsigned(const DataT &)> GetCUIndexForEntry);
void emit();
};
@@ -387,39 +388,31 @@ 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;
-}
template <typename DataT>
-void Dwarf5AccelTableWriter<DataT>::populateAbbrevsMap() {
+DenseSet<uint32_t> Dwarf5AccelTableWriter<DataT>::getUniqueTags() const {
+ DenseSet<uint32_t> UniqueTags;
for (auto &Bucket : Contents.getBuckets()) {
for (auto *Hash : Bucket) {
for (auto *Value : Hash->Values) {
- GetIndexForEntryReturnType EntryRet =
- getIndexForEntry(*static_cast<const DataT *>(Value));
unsigned Tag = static_cast<const DataT *>(Value)->getDieTag();
- uint32_t AbbrvTag = constructAbbreviationTag(Tag, EntryRet);
- if (Abbreviations.count(AbbrvTag) == 0) {
- SmallVector<DWARF5AccelTableData::AttributeEncoding, 2> UA;
- if (EntryRet)
- UA.push_back(EntryRet->second);
- UA.push_back({dwarf::DW_IDX_die_offset, dwarf::DW_FORM_ref4});
- Abbreviations.try_emplace(AbbrvTag, UA);
- }
+ UniqueTags.insert(Tag);
}
}
}
+ return UniqueTags;
+}
+
+template <typename DataT>
+SmallVector<typename Dwarf5AccelTableWriter<DataT>::AttributeEncoding, 2>
+Dwarf5AccelTableWriter<DataT>::getUniformAttributes() const {
+ SmallVector<AttributeEncoding, 2> UA;
+ if (CompUnits.size() > 1) {
+ size_t LargestCUIndex = CompUnits.size() - 1;
+ dwarf::Form Form = DIEInteger::BestForm(/*IsSigned*/ false, LargestCUIndex);
+ UA.push_back({dwarf::DW_IDX_compile_unit, Form});
+ }
+ UA.push_back({dwarf::DW_IDX_die_offset, dwarf::DW_FORM_ref4});
+ return UA;
}
template <typename DataT>
@@ -433,17 +426,6 @@ void Dwarf5AccelTableWriter<DataT>::emitCUList() const {
}
}
-template <typename DataT>
-void Dwarf5AccelTableWriter<DataT>::emitTUList() const {
- for (const auto &TU : enumerate(TypeUnits)) {
- Asm->OutStreamer->AddComment("Type unit " + Twine(TU.index()));
- if (std::holds_alternative<MCSymbol *>(TU.value()))
- Asm->emitDwarfSymbolReference(std::get<MCSymbol *>(TU.value()));
- else
- Asm->emitDwarfLengthOrOffset(std::get<uint64_t>(TU.value()));
- }
-}
-
template <typename DataT>
void Dwarf5AccelTableWriter<DataT>::emitBuckets() const {
uint32_t Index = 1;
@@ -471,11 +453,10 @@ void Dwarf5AccelTableWriter<DataT>::emitAbbrevs() const {
Asm->OutStreamer->emitLabel(AbbrevStart);
for (const auto &Abbrev : Abbreviations) {
Asm->OutStreamer->AddComment("Abbrev code");
- uint32_t Tag = getTagFromAbbreviationTag(Abbrev.first);
- assert(Tag != 0);
+ assert(Abbrev.first != 0);
+ Asm->emitULEB128(Abbrev.first);
+ Asm->OutStreamer->AddComment(dwarf::TagString(Abbrev.first));
Asm->emitULEB128(Abbrev.first);
- Asm->OutStreamer->AddComment(dwarf::TagString(Tag));
- Asm->emitULEB128(Tag);
for (const auto &AttrEnc : Abbrev.second) {
Asm->emitULEB128(AttrEnc.Index, dwarf::IndexString(AttrEnc.Index).data());
Asm->emitULEB128(AttrEnc.Form,
@@ -490,21 +471,16 @@ void Dwarf5AccelTableWriter<DataT>::emitAbbrevs() const {
template <typename DataT>
void Dwarf5AccelTableWriter<DataT>::emitEntry(const DataT &Entry) const {
- GetIndexForEntryReturnType EntryRet = getIndexForEntry(Entry);
- uint32_t AbbrvTag = constructAbbreviationTag(Entry.getDieTag(), EntryRet);
- auto AbbrevIt = Abbreviations.find(AbbrvTag);
+ auto AbbrevIt = Abbreviations.find(Entry.getDieTag());
assert(AbbrevIt != Abbreviations.end() &&
"Why wasn't this abbrev generated?");
- assert(getTagFromAbbreviationTag(AbbrevIt->first) == Entry.getDieTag() &&
- "Invalid Tag");
- Asm->emitULEB128(AbbrevIt->first, "Abbreviation code");
+ Asm->emitULEB128(AbbrevIt->first, "Abbreviation code");
for (const auto &AttrEnc : AbbrevIt->second) {
Asm->OutStreamer->AddComment(dwarf::IndexString(AttrEnc.Index));
switch (AttrEnc.Index) {
- case dwarf::DW_IDX_compile_unit:
- case dwarf::DW_IDX_type_unit: {
- DIEInteger ID(EntryRet->first);
+ case dwarf::DW_IDX_compile_unit: {
+ DIEInteger ID(getCUIndexForEntry(Entry));
ID.emitValue(Asm, AttrEnc.Form);
break;
}
@@ -536,21 +512,22 @@ template <typename DataT>
Dwarf5AccelTableWriter<DataT>::Dwarf5AccelTableWriter(
AsmPrinter *Asm, const AccelTableBase &Contents,
ArrayRef<std::variant<MCSymbol *, uint64_t>> CompUnits,
- ArrayRef<std::variant<MCSymbol *, uint64_t>> TypeUnits,
- llvm::function_ref<GetIndexForEntryReturnType(const DataT &)>
- getIndexForEntry)
+ llvm::function_ref<unsigned(const DataT &)> getCUIndexForEntry)
: AccelTableWriter(Asm, Contents, false),
- Header(CompUnits.size(), TypeUnits.size(), Contents.getBucketCount(),
+ Header(CompUnits.size(), Contents.getBucketCount(),
Contents.getUniqueNameCount()),
- CompUnits(CompUnits), TypeUnits(TypeUnits),
- getIndexForEntry(std::move(getIndexForEntry)) {
- populateAbbrevsMap();
+ CompUnits(CompUnits), getCUIndexForEntry(std::move(getCUIndexForEntry)) {
+ DenseSet<uint32_t> UniqueTags = getUniqueTags();
+ SmallVector<AttributeEncoding, 2> UniformAttributes = getUniformAttributes();
+
+ Abbreviations.reserve(UniqueTags.size());
+ for (uint32_t Tag : UniqueTags)
+ Abbreviations.try_emplace(Tag, UniformAttributes);
}
template <typename DataT> void Dwarf5AccelTableWriter<DataT>::emit() {
Header.emit(*this);
emitCUList();
- emitTUList();
emitBuckets();
emitHashes();
emitStringOffsets();
@@ -568,17 +545,12 @@ void llvm::emitAppleAccelTableImpl(AsmPrinter *Asm, AccelTableBase &Contents,
AppleAccelTableWriter(Asm, Contents, Atoms, SecBegin).emit();
}
-void llvm::emitDWARF5AccelTable(AsmPrinter *Asm,
- AccelTable<DWARF5AccelTableData> &Contents,
- const DwarfDebug &DD,
- ArrayRef<std::unique_ptr<DwarfCompileUnit>> CUs,
- ArrayRef<std::unique_ptr<DwarfTypeUnit>> TUs) {
+void llvm::emitDWARF5AccelTable(
+ AsmPrinter *Asm, AccelTable<DWARF5AccelTableData> &Contents,
+ const DwarfDebug &DD, ArrayRef<std::unique_ptr<DwarfCompileUnit>> CUs) {
std::vector<std::variant<MCSymbol *, uint64_t>> CompUnits;
- std::vector<std::variant<MCSymbol *, uint64_t>> TypeUnits;
SmallVector<unsigned, 1> CUIndex(CUs.size());
- DenseMap<const DIE *, unsigned> TUIndex(TUs.size());
- int CUCount = 0;
- int TUCount = 0;
+ int Count = 0;
for (const auto &CU : enumerate(CUs)) {
switch (CU.value()->getCUNode()->getNameTableKind()) {
case DICompileUnit::DebugNameTableKind::Default:
@@ -587,25 +559,13 @@ void llvm::emitDWARF5AccelTable(AsmPrinter *Asm,
default:
continue;
}
- CUIndex[CU.index()] = CUCount++;
+ CUIndex[CU.index()] = Count++;
assert(CU.index() == CU.value()->getUniqueID());
const DwarfCompileUnit *MainCU =
DD.useSplitDwarf() ? CU.value()->getSkeleton() : CU.value().get();
CompUnits.push_back(MainCU->getLabelBegin());
}
- for (const auto &TU : enumerate(TUs)) {
- switch (TU.value()->getCUNode()->getNameTableKind()) {
- case DICompileUnit::DebugNameTableKind::Default:
- break;
- default:
- continue;
- }
- TUIndex[&TU.value()->getUnitDie()] = TUCount++;
- const DwarfTypeUnit *MainTU = TU.value().get();
- TypeUnits.push_back(MainTU->getLabelBegin());
- }
-
if (CompUnits.empty())
return;
@@ -613,21 +573,11 @@ void llvm::emitDWARF5AccelTable(AsmPrinter *Asm,
Asm->getObjFileLowering().getDwarfDebugNamesSection());
Contents.finalize(Asm, "names");
- dwarf::Form CUIndexForm =
- DIEInteger::BestForm(/*IsSigned*/ false, CompUnits.size() - 1);
- dwarf::Form TUIndexForm =
- DIEInteger::BestForm(/*IsSigned*/ false, TypeUnits.size() - 1);
Dwarf5AccelTableWriter<DWARF5AccelTableData>(
- Asm, Contents, CompUnits, TypeUnits,
- [&](const DWARF5AccelTableData &Entry) -> GetIndexForEntryReturnType {
+ Asm, Contents, CompUnits,
+ [&](const DWARF5AccelTableData &Entry) {
const DIE *CUDie = Entry.getDie().getUnitDie();
- GetIndexForEntryReturnType Index = std::nullopt;
- if (CUDie->getTag() == dwarf::DW_TAG_type_unit)
- Index = {TUIndex[CUDie], {dwarf::DW_IDX_type_unit, TUIndexForm}};
- else if (CUIndex.size() > 1)
- Index = {CUIndex[DD.lookupCU(CUDie)->getUniqueID()],
- {dwarf::DW_IDX_compile_unit, CUIndexForm}};
- return Index;
+ return CUIndex[DD.lookupCU(CUDie)->getUniqueID()];
})
.emit();
}
@@ -635,13 +585,11 @@ void llvm::emitDWARF5AccelTable(AsmPrinter *Asm,
void llvm::emitDWARF5AccelTable(
AsmPrinter *Asm, AccelTable<DWARF5AccelTableStaticData> &Contents,
ArrayRef<std::variant<MCSymbol *, uint64_t>> CUs,
- llvm::function_ref<
- GetIndexForEntryReturnType(const DWARF5AccelTableStaticData &)>
- getIndexForEntry) {
- std::vector<std::variant<MCSymbol *, uint64_t>> TypeUnits;
+ llvm::function_ref<unsigned(const DWARF5AccelTableStaticData &)>
+ getCUIndexForEntry) {
Contents.finalize(Asm, "names");
- Dwarf5AccelTableWriter<DWARF5AccelTableStaticData>(
- Asm, Contents, CUs, TypeUnits, getIndexForEntry)
+ Dwarf5AccelTableWriter<DWARF5AccelTableStaticData>(Asm, Contents, CUs,
+ getCUIndexForEntry)
.emit();
}
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index 8a680dd9c6976e0..ee2ab71ad28e47f 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -305,7 +305,6 @@ void Loc::MMI::addFrameIndexExpr(const DIExpression *Expr, int FI) {
static AccelTableKind computeAccelTableKind(unsigned DwarfVersion,
bool GenerateTypeUnits,
- bool HasSplitDwarf,
DebuggerKind Tuning,
const Triple &TT) {
// Honor an explicit request.
@@ -313,8 +312,7 @@ static AccelTableKind computeAccelTableKind(unsigned DwarfVersion,
return AccelTables;
// Accelerator tables with type units are currently not supported.
- if (GenerateTypeUnits &&
- (DwarfVersion < 5 || HasSplitDwarf || !TT.isOSBinFormatELF()))
+ if (GenerateTypeUnits)
return AccelTableKind::None;
// Accelerator tables get emitted if targetting DWARF v5 or LLDB. DWARF v5
@@ -327,9 +325,6 @@ static AccelTableKind computeAccelTableKind(unsigned DwarfVersion,
: AccelTableKind::Dwarf;
return AccelTableKind::None;
}
-void DwarfDebug::addTypeUnit(std::unique_ptr<DwarfTypeUnit> U) {
- InfoHolder.addTypeUnit(std::move(U));
-}
DwarfDebug::DwarfDebug(AsmPrinter *A)
: DebugHandlerBase(A), DebugLocs(A->OutStreamer->isVerboseAsm()),
@@ -405,9 +400,8 @@ DwarfDebug::DwarfDebug(AsmPrinter *A)
A->TM.getTargetTriple().isOSBinFormatWasm()) &&
GenerateDwarfTypeUnits;
- TheAccelTableKind =
- computeAccelTableKind(DwarfVersion, GenerateTypeUnits, HasSplitDwarf,
- DebuggerTuning, A->TM.getTargetTriple());
+ TheAccelTableKind = computeAccelTableKind(
+ DwarfVersion, GenerateTypeUnits, DebuggerTuning, A->TM.getTargetTriple());
// Work around a GDB bug. GDB doesn't support the standard opcode;
// SCE doesn't support GNU's; LLDB prefers the standard opcode, which
@@ -2400,7 +2394,7 @@ void DwarfDebug::emitAccelDebugNames() {
if (getUnits().empty())
return;
- emitDWARF5AccelTable(Asm, AccelDebugNames, *this, getUnits(), getTypeUnits());
+ emitDWARF5AccelTable(Asm, AccelDebugNames, *this, getUnits());
}
// Emit visible names into a hashed accelerator table section.
@@ -3505,7 +3499,7 @@ void DwarfDebug::addDwarfTypeUnitType(DwarfCompileUnit &CU,
// Types referencing entries in the address table cannot be placed in type
// units.
if (AddrPool.hasBeenUsed()) {
- AccelTypeUntsDebugNames.clear();
+
// Remove all the types built while building this type.
// This is pessimistic as some of these types might not be dependent on
// the type that used an address.
@@ -3520,15 +3514,11 @@ void DwarfDebug::addDwarfTypeUnitType(DwarfCompileUnit &CU,
return;
}
+ // If the type wasn't dependent on fission addresses, finish adding the type
+ // and all its dependent types.
for (auto &TU : TypeUnitsToAdd) {
InfoHolder.computeSizeAndOffsetsForUnit(TU.first.get());
InfoHolder.emitUnit(TU.first.get(), useSplitDwarf());
- if (getDwarfVersion() >= 5 &&
- getAccelTableKind() == AccelTableKind::Dwarf) {
- addTypeUnit(std::move(TU.first));
- AccelDebugNames.addEntries(AccelTypeUntsDebugNames);
- AccelTypeUntsDebugNames.clear();
- }
}
}
CU.addDIETypeSignature(RefDie, Signature);
@@ -3558,12 +3548,7 @@ void DwarfDebug::addAccelNameImpl(const DICompileUnit &CU,
AppleAccel.addName(Ref, Die);
break;
case AccelTableKind::Dwarf:
- // The type unit can be discarded, so need to add references to final
- // acceleration table once we know it's complete and we emit it.
- if (TypeUnitsUnderConstruction.empty())
- AccelDebugNames.addName(Ref, Die);
- else
- AccelTypeUntsDebugNames.addName(Ref, Die);
+ AccelDebugNames.addName(Ref, Die);
break;
case AccelTableKind::Default:
llvm_unreachable("Default should have already been resolved.");
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
index f6870d514ea0ee7..75649a747602ef5 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
@@ -497,7 +497,6 @@ class DwarfDebug : public DebugHandlerBase {
/// Accelerator tables.
AccelTable<DWARF5AccelTableData> AccelDebugNames;
- AccelTable<DWARF5AccelTableData> AccelTypeUntsDebugNames;
AccelTable<AppleAccelTableOffsetData> AccelNames;
AccelTable<AppleAccelTableOffsetData> AccelObjC;
AccelTable<AppleAccelTableOffsetData> AccelNamespace;
@@ -516,13 +515,6 @@ class DwarfDebug : public DebugHandlerBase {
return InfoHolder.getUnits();
}
- /// Returns Type Units constructed for this module.
- const SmallVectorImpl<std::unique_ptr<DwarfTypeUnit>> &getTypeUnits() {
- return InfoHolder.getTypeUnits();
- }
-
- void addTypeUnit(std::unique_ptr<DwarfTypeUnit> U);
-
using InlinedEntity = DbgValueHistoryMap::InlinedEntity;
void ensureAbstractEntityIsCreatedIfScoped(DwarfCompileUnit &CU,
@@ -788,9 +780,6 @@ class DwarfDebug : public DebugHandlerBase {
/// Returns what kind (if any) of accelerator tables to emit.
AccelTableKind getAccelTableKind() const { return TheAccelTableKind; }
- /// Seet TheAccelTableKind
- void setTheAccelTableKind(AccelTableKind K) { TheAccelTableKind = K; };
-
bool useAppleExtensionAttributes() const {
return HasAppleExtensionAttributes;
}
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp
index 5de7c91f021a871..eab798c0da78438 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp
@@ -24,10 +24,6 @@ void DwarfFile::addUnit(std::unique_ptr<DwarfCompileUnit> U) {
CUs.push_back(std::move(U));
}
-void DwarfFile::addTypeUnit(std::unique_ptr<DwarfTypeUnit> U) {
- TUs.push_back(std::move(U));
-}
-
// Emit the various dwarf units to the unit section USection with
// the abbreviations going into ASection.
void DwarfFile::emitUnits(bool UseOffsets) {
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfFile.h b/llvm/lib/CodeGen/AsmPrinter/DwarfFile.h
index 452a8f82379cd5f..f76858fc2f36a02 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfFile.h
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfFile.h
@@ -28,7 +28,6 @@ class DbgLabel;
class DINode;
class DILocalScope;
class DwarfCompileUnit;
-class DwarfTypeUnit;
class DwarfUnit;
class LexicalScope;
class MCSection;
@@ -60,9 +59,6 @@ class DwarfFile {
// A pointer to all units in the section.
SmallVector<std::unique_ptr<DwarfCompileUnit>, 1> CUs;
- // A pointer to all type units in the section.
- SmallVector<std::unique_ptr<DwarfTypeUnit>, 1> TUs;
-
DwarfStringPool StrPool;
// List of range lists for a given compile unit, separate from the ranges for
@@ -107,11 +103,6 @@ class DwarfFile {
return CUs;
}
- /// Returns type units that were constructed.
- const SmallVectorImpl<std::unique_ptr<DwarfTypeUnit>> &getTypeUnits() {
- return TUs;
- }
-
std::pair<uint32_t, RangeSpanList *> addRange(const DwarfCompileUnit &CU,
SmallVector<RangeSpan, 2> R);
@@ -133,11 +124,6 @@ class DwarfFile {
/// Add a unit to the list of CUs.
void addUnit(std::unique_ptr<DwarfCompileUnit> U);
- /// Add a unit to the list of TUs.
- /// Preserves type unit so that memory is not released before DWARF5
- /// accelerator table is created.
- void addTypeUnit(std::unique_ptr<DwarfTypeUnit> U);
-
/// Emit all of the units to the section listed with the given
/// abbreviation section.
void emitUnits(bool UseOffsets);
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
index 620f4288bd72025..d30f0ef7af348af 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
@@ -1778,10 +1778,6 @@ void DwarfUnit::emitCommonHeader(bool UseOffsets, dwarf::UnitType UT) {
}
void DwarfTypeUnit::emitHeader(bool UseOffsets) {
- if (!DD->useSplitDwarf()) {
- LabelBegin = Asm->createTempSymbol("tu_begin");
- Asm->OutStreamer->emitLabel(LabelBegin);
- }
DwarfUnit::emitCommonHeader(UseOffsets,
DD->useSplitDwarf() ? dwarf::DW_UT_split_type
: dwarf::DW_UT_type);
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h
index 1cda82db0b269dd..8f17e94c2d1c331 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h
@@ -362,8 +362,6 @@ class DwarfTypeUnit final : public DwarfUnit {
DwarfCompileUnit &CU;
MCDwarfDwoLineTable *SplitLineTable;
bool UsedLineTable = false;
- /// The start of the type unit within .debug_nfo section.
- MCSymbol *LabelBegin = nullptr;
unsigned getOrCreateSourceID(const DIFile *File) override;
void finishNonUnitTypeDIE(DIE& D, const DICompositeType *CTy) override;
@@ -374,8 +372,6 @@ class DwarfTypeUnit final : public DwarfUnit {
DwarfFile *DWU, MCDwarfDwoLineTable *SplitLineTable = nullptr);
void setTypeSignature(uint64_t Signature) { TypeSignature = Signature; }
- /// Returns Type Signature.
- uint64_t getTypeSignature() const { return TypeSignature; }
void setType(const DIE *Ty) { this->Ty = Ty; }
/// Emit the header for this unit, not including the initial length field.
@@ -389,11 +385,6 @@ class DwarfTypeUnit final : public DwarfUnit {
void addGlobalType(const DIType *Ty, const DIE &Die,
const DIScope *Context) override;
DwarfCompileUnit &getCU() override { return CU; }
- /// Get the the symbol for start of the section for this type unit.
- MCSymbol *getLabelBegin() const {
- assert(LabelBegin && "LabelBegin is not initialized");
- return LabelBegin;
- }
};
} // end llvm namespace
#endif
diff --git a/llvm/lib/DWARFLinker/DWARFStreamer.cpp b/llvm/lib/DWARFLinker/DWARFStreamer.cpp
index 75e189775dfa578..ff719d0a59bafaa 100644
--- a/llvm/lib/DWARFLinker/DWARFStreamer.cpp
+++ b/llvm/lib/DWARFLinker/DWARFStreamer.cpp
@@ -307,19 +307,10 @@ void DwarfStreamer::emitDebugNames(
}
Asm->OutStreamer->switchSection(MOFI->getDwarfDebugNamesSection());
- dwarf::Form Form = DIEInteger::BestForm(/*IsSigned*/ false,
- (uint64_t)UniqueIdToCuMap.size() - 1);
- /// llvm-dwarfutil doesn't support type units + .debug_names right now anyway,
- /// so just keeping current behavior.
emitDWARF5AccelTable(
Asm.get(), Table, CompUnits,
- [&UniqueIdToCuMap, &Form](const DWARF5AccelTableStaticData &Entry)
- -> GetIndexForEntryReturnType {
- GetIndexForEntryReturnType Index = std::nullopt;
- if (UniqueIdToCuMap.size() > 1)
- Index = {UniqueIdToCuMap[Entry.getCUIndex()],
- {dwarf::DW_IDX_compile_unit, Form}};
- return Index;
+ [&UniqueIdToCuMap](const DWARF5AccelTableStaticData &Entry) {
+ return UniqueIdToCuMap[Entry.getCUIndex()];
});
}
diff --git a/llvm/lib/DWARFLinkerParallel/DWARFEmitterImpl.cpp b/llvm/lib/DWARFLinkerParallel/DWARFEmitterImpl.cpp
index 4c2e4c45fd8e6c2..7885e3013a51d3f 100644
--- a/llvm/lib/DWARFLinkerParallel/DWARFEmitterImpl.cpp
+++ b/llvm/lib/DWARFLinkerParallel/DWARFEmitterImpl.cpp
@@ -230,20 +230,10 @@ void DwarfEmitterImpl::emitDebugNames(
return;
Asm->OutStreamer->switchSection(MOFI->getDwarfDebugNamesSection());
- dwarf::Form Form =
- DIEInteger::BestForm(/*IsSigned*/ false, (uint64_t)CUidToIdx.size() - 1);
- /// DWARFLinker doesn't support type units + .debug_names right now anyway,
- /// so just keeping current behavior.
- emitDWARF5AccelTable(
- Asm.get(), Table, CUOffsets,
- [&CUidToIdx, &Form](const DWARF5AccelTableStaticData &Entry)
- -> GetIndexForEntryReturnType {
- GetIndexForEntryReturnType Index = std::nullopt;
- if (CUidToIdx.size() > 1)
- Index = {CUidToIdx[Entry.getCUIndex()],
- {dwarf::DW_IDX_compile_unit, Form}};
- return Index;
- });
+ emitDWARF5AccelTable(Asm.get(), Table, CUOffsets,
+ [&CUidToIdx](const DWARF5AccelTableStaticData &Entry) {
+ return CUidToIdx[Entry.getCUIndex()];
+ });
}
void DwarfEmitterImpl::emitAppleNamespaces(
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp b/llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp
index 2c090599c22cd67..7d8289ed420abb9 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp
@@ -635,7 +635,7 @@ std::optional<uint64_t> DWARFDebugNames::Entry::getCUOffset() const {
}
void DWARFDebugNames::Entry::dump(ScopedPrinter &W) const {
- DictScope AbbrevScope(W, ("Abbrev: 0x" + Twine::utohexstr(Abbr->Code)).str());
+ W.printHex("Abbrev", Abbr->Code);
W.startLine() << formatv("Tag: {0}\n", Abbr->Tag);
assert(Abbr->Attributes.size() == Values.size());
for (auto Tuple : zip_first(Abbr->Attributes, Values)) {
diff --git a/llvm/test/DebugInfo/X86/accel-tables-dwarf5.ll b/llvm/test/DebugInfo/X86/accel-tables-dwarf5.ll
index 243dea608a2d7f7..e7cf7968003d9a6 100644
--- a/llvm/test/DebugInfo/X86/accel-tables-dwarf5.ll
+++ b/llvm/test/DebugInfo/X86/accel-tables-dwarf5.ll
@@ -22,6 +22,7 @@
; RUN: | llvm-readobj --sections - | FileCheck --check-prefix=DEBUG_NAMES %s
; NONE-NOT: apple_names
+; NONE-NOT: debug_names
; DEBUG_NAMES-NOT: apple_names
; DEBUG_NAMES: debug_names
diff --git a/llvm/test/DebugInfo/X86/debug-names-dwarf64.ll b/llvm/test/DebugInfo/X86/debug-names-dwarf64.ll
index f3b1d5c88996a21..3fc91ef85df1fb8 100644
--- a/llvm/test/DebugInfo/X86/debug-names-dwarf64.ll
+++ b/llvm/test/DebugInfo/X86/debug-names-dwarf64.ll
@@ -26,12 +26,12 @@
; CHECK-NEXT: CU[0]: 0x00000000
; CHECK-NEXT: ]
; CHECK-NEXT: Abbreviations [
-; CHECK-NEXT: Abbreviation [[ABBREV:0x[0-9a-f]*]] {
-; CHECK-NEXT: Tag: DW_TAG_base_type
+; CHECK-NEXT: Abbreviation 0x34 {
+; CHECK-NEXT: Tag: DW_TAG_variable
; CHECK-NEXT: DW_IDX_die_offset: DW_FORM_ref4
; CHECK-NEXT: }
-; CHECK-NEXT: Abbreviation [[ABBREV1:0x[0-9a-f]*]] {
-; CHECK-NEXT: Tag: DW_TAG_variable
+; CHECK-NEXT: Abbreviation 0x24 {
+; CHECK-NEXT: Tag: DW_TAG_base_type
; CHECK-NEXT: DW_IDX_die_offset: DW_FORM_ref4
; CHECK-NEXT: }
; CHECK-NEXT: ]
@@ -40,10 +40,9 @@
; CHECK-NEXT: Hash: 0xB888030
; CHECK-NEXT: String: {{.+}} "int"
; CHECK-NEXT: Entry @ {{.+}} {
-; CHECK-NEXT: Abbrev: [[ABBREV]] {
-; CHECK-NEXT: Tag: DW_TAG_base_type
-; CHECK-NEXT: DW_IDX_die_offset: [[TYPEDIE]]
-; CHECK-NEXT: }
+; CHECK-NEXT: Abbrev: 0x24
+; CHECK-NEXT: Tag: DW_TAG_base_type
+; CHECK-NEXT: DW_IDX_die_offset: [[TYPEDIE]]
; CHECK-NEXT: }
; CHECK-NEXT: }
; CHECK-NEXT: ]
@@ -52,10 +51,9 @@
; CHECK-NEXT: Hash: 0xB887389
; CHECK-NEXT: String: {{.+}} "foo"
; CHECK-NEXT: Entry @ {{.+}} {
-; CHECK-NEXT: Abbrev: [[ABBREV1]] {
-; CHECK-NEXT: Tag: DW_TAG_variable
-; CHECK-NEXT: DW_IDX_die_offset: [[VARDIE]]
-; CHECK-NEXT: }
+; CHECK-NEXT: Abbrev: 0x34
+; CHECK-NEXT: Tag: DW_TAG_variable
+; CHECK-NEXT: DW_IDX_die_offset: [[VARDIE]]
; CHECK-NEXT: }
; CHECK-NEXT: }
; CHECK-NEXT: ]
diff --git a/llvm/test/DebugInfo/X86/debug-names-types-monolithic.ll b/llvm/test/DebugInfo/X86/debug-names-types-monolithic.ll
deleted file mode 100644
index e86a226fc880ac1..000000000000000
--- a/llvm/test/DebugInfo/X86/debug-names-types-monolithic.ll
+++ /dev/null
@@ -1,168 +0,0 @@
-; This checks that .debug_names can be generated with monolithic -fdebug-type-sections.
-
-; RUN: llc -mtriple=x86_64 -generate-type-units -dwarf-version=5 -filetype=obj %s -o %t
-; RUN: llvm-dwarfdump -debug-info -debug-names %t | FileCheck %s
-
-; CHECK: .debug_info contents:
-; CHECK: DW_TAG_type_unit
-; CHECK-NEXT: DW_AT_language (DW_LANG_C_plus_plus_14)
-; CHECK-NEXT: DW_AT_stmt_list (0x00000000)
-; CHECK-NEXT: DW_AT_str_offsets_base (0x00000008)
-; CHECK: DW_TAG_structure_type
-; CHECK-NEXT: DW_AT_calling_convention (DW_CC_pass_by_value)
-; CHECK-NEXT: DW_AT_name ("Foo")
-; CHECK-NEXT: DW_AT_byte_size (0x08)
-; CHECK-NEXT: DW_AT_decl_file ("/typeSmall/main.cpp")
-; CHECK-NEXT: DW_AT_decl_line (1)
-; CHECK: DW_TAG_member
-; CHECK-NEXT: DW_AT_name ("c1")
-; CHECK-NEXT: DW_AT_type (0x00000033 "char *")
-; CHECK-NEXT: DW_AT_decl_file ("/typeSmall/main.cpp")
-; CHECK-NEXT: DW_AT_decl_line (2)
-; CHECK-NEXT: DW_AT_data_member_location (0x00)
-; CHECK: DW_TAG_pointer_type
-; CHECK-NEXT: DW_AT_type (0x00000038 "char")
-; CHECK: DW_TAG_base_type
-; CHECK-NEXT: DW_AT_name ("char")
-; CHECK-NEXT: DW_AT_encoding (DW_ATE_signed_char)
-; CHECK-NEXT: DW_AT_byte_size (0x01)
-; CHECK: .debug_names contents:
-; CHECK: Compilation Unit offsets [
-; CHECK-NEXT: CU[0]: 0x00000000
-; CHECK-NEXT: ]
-; CHECK-NEXT: Local Type Unit offsets [
-; CHECK-NEXT: LocalTU[0]: 0x00000000
-; CHECK-NEXT: ]
-; CHECK: Abbreviations [
-; CHECK-NEXT: Abbreviation [[ABBREV1:0x[0-9a-f]*]] {
-; CHECK-NEXT: Tag: DW_TAG_structure_type
-; CHECK-NEXT: DW_IDX_die_offset: DW_FORM_ref4
-; CHECK-NEXT: }
-; CHECK-NEXT: Abbreviation [[ABBREV3:0x[0-9a-f]*]] {
-; CHECK-NEXT: Tag: DW_TAG_structure_type
-; CHECK-NEXT: DW_IDX_type_unit: DW_FORM_data1
-; CHECK-NEXT: DW_IDX_die_offset: DW_FORM_ref4
-; CHECK-NEXT: }
-; CHECK-NEXT: Abbreviation [[ABBREV:0x[0-9a-f]*]] {
-; CHECK-NEXT: Tag: DW_TAG_base_type
-; CHECK-NEXT: DW_IDX_die_offset: DW_FORM_ref4
-; CHECK-NEXT: }
-; CHECK-NEXT: Abbreviation [[ABBREV2:0x[0-9a-f]*]] {
-; CHECK-NEXT: Tag: DW_TAG_subprogram
-; CHECK-NEXT: DW_IDX_die_offset: DW_FORM_ref4
-; CHECK-NEXT: }
-; CHECK-NEXT: Abbreviation [[ABBREV4:0x[0-9a-f]*]] {
-; CHECK-NEXT: Tag: DW_TAG_base_type
-; CHECK-NEXT: DW_IDX_type_unit: DW_FORM_data1
-; CHECK-NEXT: DW_IDX_die_offset: DW_FORM_ref4
-; CHECK-NEXT: }
-; CHECK-NEXT: ]
-; CHECK-NEXT: Bucket 0 [
-; CHECK-NEXT: Name 1 {
-; CHECK-NEXT: Hash: 0xB888030
-; CHECK-NEXT: String: {{.+}} "int"
-; CHECK-NEXT: Entry @ {{.+}} {
-; CHECK-NEXT: Abbrev: [[ABBREV]] {
-; CHECK-NEXT: Tag: DW_TAG_base_type
-; CHECK-NEXT: DW_IDX_die_offset: 0x0000003e
-; CHECK-NEXT: }
-; CHECK-NEXT: }
-; CHECK-NEXT: }
-; CHECK-NEXT: ]
-; CHECK-NEXT: Bucket 1 [
-; CHECK-NEXT: Name 2 {
-; CHECK-NEXT: Hash: 0xB887389
-; CHECK-NEXT: String: {{.+}} "Foo"
-; CHECK-NEXT: Entry @ {{.+}} {
-; CHECK-NEXT: Abbrev: [[ABBREV3]] {
-; CHECK-NEXT: Tag: DW_TAG_structure_type
-; CHECK-NEXT: DW_IDX_type_unit: 0x00
-; CHECK-NEXT: DW_IDX_die_offset: 0x00000023
-; CHECK-NEXT: }
-; CHECK-NEXT: }
-; CHECK-NEXT: Entry @ 0xaa {
-; CHECK-NEXT: Abbrev: [[ABBREV1]] {
-; CHECK-NEXT: Tag: DW_TAG_structure_type
-; CHECK-NEXT: DW_IDX_die_offset: 0x00000042
-; CHECK-NEXT: }
-; CHECK-NEXT: }
-; CHECK-NEXT: }
-; CHECK-NEXT: ]
-; CHECK-NEXT: Bucket 2 [
-; CHECK-NEXT: Name 3 {
-; CHECK-NEXT: Hash: 0x7C9A7F6A
-; CHECK-NEXT: String: {{.+}} "main"
-; CHECK-NEXT: Entry @ {{.+}} {
-; CHECK-NEXT: Abbrev: [[ABBREV2]] {
-; CHECK-NEXT: Tag: DW_TAG_subprogram
-; CHECK-NEXT: DW_IDX_die_offset: 0x00000023
-; CHECK-NEXT: }
-; CHECK-NEXT: }
-; CHECK-NEXT: }
-; CHECK-NEXT: ]
-; CHECK-NEXT: Bucket 3 [
-; CHECK-NEXT: Name 4 {
-; CHECK-NEXT: Hash: 0x7C952063
-; CHECK-NEXT: String: {{.+}} "char"
-; CHECK-NEXT: Entry @ {{.+}} {
-; CHECK-NEXT: Abbrev: [[ABBREV4]] {
-; CHECK-NEXT: Tag: DW_TAG_base_type
-; CHECK-NEXT: DW_IDX_type_unit: 0x00
-; CHECK-NEXT: DW_IDX_die_offset: 0x00000038
-; CHECK-NEXT: }
-; CHECK-NEXT: }
-; CHECK-NEXT: }
-; CHECK-NEXT: ]
-; CHECK-NEXT: }
-
-
-; ModuleID = 'main.cpp'
-source_filename = "main.cpp"
-target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
-target triple = "x86_64-unknown-linux-gnu"
-
-%struct.Foo = type { ptr }
-
-; Function Attrs: mustprogress noinline norecurse nounwind optnone uwtable
-define dso_local noundef i32 @main() #0 !dbg !10 {
-entry:
- %retval = alloca i32, align 4
- %f = alloca %struct.Foo, align 8
- store i32 0, ptr %retval, align 4
- call void @llvm.dbg.declare(metadata ptr %f, metadata !15, metadata !DIExpression()), !dbg !21
- ret i32 0, !dbg !22
-}
-
-; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
-declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
-
-attributes #0 = { mustprogress noinline norecurse nounwind optnone uwtable "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
-attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
-
-!llvm.dbg.cu = !{!0}
-!llvm.module.flags = !{!2, !3, !4, !5, !6, !7, !8}
-!llvm.ident = !{!9}
-
-!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 18.0.0", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false)
-!1 = !DIFile(filename: "main.cpp", directory: "/typeSmall", checksumkind: CSK_MD5, checksum: "e5b402e9dbafe24c7adbb087d1f03549")
-!2 = !{i32 7, !"Dwarf Version", i32 5}
-!3 = !{i32 2, !"Debug Info Version", i32 3}
-!4 = !{i32 1, !"wchar_size", i32 4}
-!5 = !{i32 8, !"PIC Level", i32 2}
-!6 = !{i32 7, !"PIE Level", i32 2}
-!7 = !{i32 7, !"uwtable", i32 2}
-!8 = !{i32 7, !"frame-pointer", i32 2}
-!9 = !{!"clang version 18.0.0"}
-!10 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 4, type: !11, scopeLine: 4, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !14)
-!11 = !DISubroutineType(types: !12)
-!12 = !{!13}
-!13 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
-!14 = !{}
-!15 = !DILocalVariable(name: "f", scope: !10, file: !1, line: 5, type: !16)
-!16 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Foo", file: !1, line: 1, size: 64, flags: DIFlagTypePassByValue, elements: !17, identifier: "_ZTS3Foo")
-!17 = !{!18}
-!18 = !DIDerivedType(tag: DW_TAG_member, name: "c1", scope: !16, file: !1, line: 2, baseType: !19, size: 64)
-!19 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !20, size: 64)
-!20 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char)
-!21 = !DILocation(line: 5, column: 6, scope: !10)
-!22 = !DILocation(line: 6, column: 2, scope: !10)
diff --git a/llvm/test/DebugInfo/X86/debug-names-types-split.ll b/llvm/test/DebugInfo/X86/debug-names-types-split.ll
deleted file mode 100644
index d5908aeaf114a20..000000000000000
--- a/llvm/test/DebugInfo/X86/debug-names-types-split.ll
+++ /dev/null
@@ -1,57 +0,0 @@
-; This checks that .debug_names is not generated with split-dwarf + -fdebug-type-sections.
-
-; RUN: llc -mtriple=x86_64 -generate-type-units -dwarf-version=5 -filetype=obj -split-dwarf-file=mainTypes.dwo --split-dwarf-output=mainTypes.dwo %s -o %t
-; RUN: llvm-readelf --sections %t | FileCheck %s
-
-; CHECK-NOT: .debug_names
-
-; ModuleID = 'main.cpp'
-source_filename = "main.cpp"
-target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
-target triple = "x86_64-unknown-linux-gnu"
-
-%struct.Foo = type { ptr }
-
-; Function Attrs: mustprogress noinline norecurse nounwind optnone uwtable
-define dso_local noundef i32 @main() #0 !dbg !10 {
-entry:
- %retval = alloca i32, align 4
- %f = alloca %struct.Foo, align 8
- store i32 0, ptr %retval, align 4
- call void @llvm.dbg.declare(metadata ptr %f, metadata !15, metadata !DIExpression()), !dbg !21
- ret i32 0, !dbg !22
-}
-
-; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
-declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
-
-attributes #0 = { mustprogress noinline norecurse nounwind optnone uwtable "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
-attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
-
-!llvm.dbg.cu = !{!0}
-!llvm.module.flags = !{!2, !3, !4, !5, !6, !7, !8}
-!llvm.ident = !{!9}
-
-!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 18.0.0 (ssh://git.vip.facebook.com/data/gitrepos/osmeta/external/llvm-project 680deb27e25976d9b74ad7b48ec5cb96be0e44b6)", isOptimized: false, runtimeVersion: 0, splitDebugFilename: "main.dwo", emissionKind: FullDebug, splitDebugInlining: false)
-!1 = !DIFile(filename: "main.cpp", directory: "/home/ayermolo/local/tasks/T138552329/typeSmallSplit", checksumkind: CSK_MD5, checksum: "e5b402e9dbafe24c7adbb087d1f03549")
-!2 = !{i32 7, !"Dwarf Version", i32 5}
-!3 = !{i32 2, !"Debug Info Version", i32 3}
-!4 = !{i32 1, !"wchar_size", i32 4}
-!5 = !{i32 8, !"PIC Level", i32 2}
-!6 = !{i32 7, !"PIE Level", i32 2}
-!7 = !{i32 7, !"uwtable", i32 2}
-!8 = !{i32 7, !"frame-pointer", i32 2}
-!9 = !{!"clang version 18.0.0 (ssh://git.vip.facebook.com/data/gitrepos/osmeta/external/llvm-project 680deb27e25976d9b74ad7b48ec5cb96be0e44b6)"}
-!10 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 4, type: !11, scopeLine: 4, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !14)
-!11 = !DISubroutineType(types: !12)
-!12 = !{!13}
-!13 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
-!14 = !{}
-!15 = !DILocalVariable(name: "f", scope: !10, file: !1, line: 5, type: !16)
-!16 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Foo", file: !1, line: 1, size: 64, flags: DIFlagTypePassByValue, elements: !17, identifier: "_ZTS3Foo")
-!17 = !{!18}
-!18 = !DIDerivedType(tag: DW_TAG_member, name: "c1", scope: !16, file: !1, line: 2, baseType: !19, size: 64)
-!19 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !20, size: 64)
-!20 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char)
-!21 = !DILocation(line: 5, column: 6, scope: !10)
-!22 = !DILocation(line: 6, column: 2, scope: !10)
diff --git a/llvm/test/DebugInfo/X86/dwarfdump-debug-names.s b/llvm/test/DebugInfo/X86/dwarfdump-debug-names.s
index cb211733c6f8e09..009a87325e8b4fe 100644
--- a/llvm/test/DebugInfo/X86/dwarfdump-debug-names.s
+++ b/llvm/test/DebugInfo/X86/dwarfdump-debug-names.s
@@ -151,7 +151,7 @@
# CHECK-NEXT: CU[0]: 0x00000000
# CHECK-NEXT: ]
# CHECK-NEXT: Abbreviations [
-# CHECK-NEXT: Abbreviation [[ABBREV:0x[0-9a-f]*]] {
+# CHECK-NEXT: Abbreviation 0x2e {
# CHECK-NEXT: Tag: DW_TAG_subprogram
# CHECK-NEXT: DW_IDX_die_offset: DW_FORM_ref4
# CHECK-NEXT: }
@@ -164,20 +164,18 @@
# CHECK-NEXT: Hash: 0xB887389
# CHECK-NEXT: String: 0x00000000 "foo"
# CHECK-NEXT: Entry @ 0x4f {
-# CHECK-NEXT: Abbrev: [[ABBREV]]
-# CHECK-NEXT: Tag: DW_TAG_subprogram
-# CHECK-NEXT: DW_IDX_die_offset: 0x00000001
-# CHECK-NEXT: }
+# CHECK-NEXT: Abbrev: 0x2E
+# CHECK-NEXT: Tag: DW_TAG_subprogram
+# CHECK-NEXT: DW_IDX_die_offset: 0x00000001
# CHECK-NEXT: }
# CHECK-NEXT: }
# CHECK-NEXT: Name 2 {
# CHECK-NEXT: Hash: 0xB5063D0B
# CHECK-NEXT: String: 0x00000004 "_Z3foov"
# CHECK-NEXT: Entry @ 0x58 {
-# CHECK-NEXT: Abbrev: [[ABBREV]]
-# CHECK-NEXT: Tag: DW_TAG_subprogram
-# CHECK-NEXT: DW_IDX_die_offset: 0x00000001
-# CHECK-NEXT: }
+# CHECK-NEXT: Abbrev: 0x2E
+# CHECK-NEXT: Tag: DW_TAG_subprogram
+# CHECK-NEXT: DW_IDX_die_offset: 0x00000001
# CHECK-NEXT: }
# CHECK-NEXT: }
# CHECK-NEXT: ]
@@ -199,7 +197,7 @@
# CHECK-NEXT: CU[0]: 0x00000002
# CHECK-NEXT: ]
# CHECK-NEXT: Abbreviations [
-# CHECK-NEXT: Abbreviation [[ABBREV1:0x[0-9a-f]*]] {
+# CHECK-NEXT: Abbreviation 0x34 {
# CHECK-NEXT: Tag: DW_TAG_variable
# CHECK-NEXT: DW_IDX_die_offset: DW_FORM_ref4
# CHECK-NEXT: }
@@ -209,10 +207,9 @@
# CHECK-NEXT: Hash: 0xB8860BA
# CHECK-NEXT: String: 0x0000000c "bar"
# CHECK-NEXT: Entry @ 0xa3 {
-# CHECK-NEXT: Abbrev: [[ABBREV1]]
-# CHECK-NEXT: Tag: DW_TAG_variable
-# CHECK-NEXT: DW_IDX_die_offset: 0x00000001
-# CHECK-NEXT: }
+# CHECK-NEXT: Abbrev: 0x34
+# CHECK-NEXT: Tag: DW_TAG_variable
+# CHECK-NEXT: DW_IDX_die_offset: 0x00000001
# CHECK-NEXT: }
# CHECK-NEXT: }
# CHECK-NEXT: ]
@@ -240,7 +237,7 @@
# CHECK-NEXT: ForeignTU[0]: 0xffffff00ffffffff
# CHECK-NEXT: ]
# CHECK-NEXT: Abbreviations [
-# CHECK-NEXT: Abbreviation [[ABBREV2:0x[0-9a-f]*]] {
+# CHECK-NEXT: Abbreviation 0x1 {
# CHECK-NEXT: Tag: DW_TAG_base_type
# CHECK-NEXT: DW_IDX_type_unit: DW_FORM_data4
# CHECK-NEXT: DW_IDX_type_hash: DW_FORM_data8
@@ -251,11 +248,10 @@
# CHECK-NEXT: Hash: 0xB887389
# CHECK-NEXT: String: 0x00000000 "foo"
# CHECK-NEXT: Entry @ 0x111 {
-# CHECK-NEXT: Abbrev: [[ABBREV2]]
-# CHECK-NEXT: Tag: DW_TAG_base_type
-# CHECK-NEXT: DW_IDX_type_unit: 0x00000001
-# CHECK-NEXT: DW_IDX_type_hash: 0x0000ff03ffffffff
-# CHECK-NEXT: }
+# CHECK-NEXT: Abbrev: 0x1
+# CHECK-NEXT: Tag: DW_TAG_base_type
+# CHECK-NEXT: DW_IDX_type_unit: 0x00000001
+# CHECK-NEXT: DW_IDX_type_hash: 0x0000ff03ffffffff
# CHECK-NEXT: }
# CHECK-NEXT: }
# CHECK-NEXT: ]
diff --git a/llvm/test/tools/dsymutil/ARM/accel-imported-declarations.test b/llvm/test/tools/dsymutil/ARM/accel-imported-declarations.test
index 04b2f9b158994f2..f1680ced6e5b4f0 100644
--- a/llvm/test/tools/dsymutil/ARM/accel-imported-declarations.test
+++ b/llvm/test/tools/dsymutil/ARM/accel-imported-declarations.test
@@ -4,12 +4,13 @@ RUN: dsymutil -accelerator=Apple -oso-prepend-path=%p/../Inputs %p/../Inputs/acc
RUN: llvm-dwarfdump -v %t.dwarf.dSYM | FileCheck %s -check-prefixes=DWARF,COMMON
RUN: llvm-dwarfdump -v %t.apple.dSYM | FileCheck %s -check-prefixes=APPLE,COMMON
-RUN2: dsymutil --linker llvm -accelerator=Dwarf -oso-prepend-path=%p/../Inputs \
-RUN2: %p/../Inputs/accel-imported-declaration.macho-arm64 -o %t.dwarf.dSYM
-RUN2: dsymutil --linker llvm -accelerator=Apple -oso-prepend-path=%p/../Inputs \
-RUN2: %p/../Inputs/accel-imported-declaration.macho-arm64 -o %t.apple.dSYM
-RUN2: llvm-dwarfdump -v %t.dwarf.dSYM | FileCheck %s -check-prefixes=DWARF,COMMON
-RUN2: llvm-dwarfdump -v %t.apple.dSYM | FileCheck %s -check-prefixes=APPLE,COMMON
+RUN: dsymutil --linker llvm -accelerator=Dwarf -oso-prepend-path=%p/../Inputs \
+RUN: %p/../Inputs/accel-imported-declaration.macho-arm64 -o %t.dwarf.dSYM
+RUN: dsymutil --linker llvm -accelerator=Apple -oso-prepend-path=%p/../Inputs \
+RUN: %p/../Inputs/accel-imported-declaration.macho-arm64 -o %t.apple.dSYM
+
+RUN: llvm-dwarfdump -v %t.dwarf.dSYM | FileCheck %s -check-prefixes=DWARF,COMMON
+RUN: llvm-dwarfdump -v %t.apple.dSYM | FileCheck %s -check-prefixes=APPLE,COMMON
COMMON: .debug_info contents
COMMON: {{.*}}DW_TAG_namespace
@@ -28,9 +29,8 @@ DWARF-NEXT: Hash: {{.*}}
DWARF-NEXT: String: {{.*}} "C"
DWARF-NEXT: Entry {{.*}} {
DWARF-NEXT: Abbrev: {{.*}}
-DWARF-NEXT: Tag: DW_TAG_namespace
-DWARF-NEXT: DW_IDX_die_offset: [[NAMESPACE]]
-DWARF-NEXT: }
+DWARF-NEXT: Tag: DW_TAG_namespace
+DWARF-NEXT: DW_IDX_die_offset: [[NAMESPACE]]
DWARF-NEXT: }
DWARF-NEXT: Entry {{.*}} {
DWARF-NEXT: Abbrev: {{.*}}
diff --git a/llvm/test/tools/dsymutil/ARM/dwarf5-dwarf4-combination-macho.test b/llvm/test/tools/dsymutil/ARM/dwarf5-dwarf4-combination-macho.test
index 3e4d90490931666..90f6818b8c8e5b0 100644
--- a/llvm/test/tools/dsymutil/ARM/dwarf5-dwarf4-combination-macho.test
+++ b/llvm/test/tools/dsymutil/ARM/dwarf5-dwarf4-combination-macho.test
@@ -44,7 +44,7 @@ CHECK:.debug_abbrev contents:
CHECK-NEXT: Abbrev table for offset: 0x00000000
CHECK: .debug_info contents:
-CHECK: 0x00000000: Compile Unit: length = 0x0000004a, format = DWARF32, version = 0x0005, unit_type = DW_UT_compile, abbr_offset = 0x0000, addr_size = 0x08
+CHECK: 0x00000000: Compile Unit: length = 0x0000004a, format = DWARF32, version = 0x0005, unit_type = DW_UT_compile, abbr_offset = 0x0000, addr_size = 0x08
CHECK: DW_AT_producer [DW_FORM_strx] (indexed (00000000) string = "Apple clang version 14.0.3 (clang-1403.0.22.14.1)")
CHECK: DW_AT_name [DW_FORM_strx] (indexed (00000001) string = "a.cpp")
CHECK: DW_AT_LLVM_sysroot [DW_FORM_strx] (indexed (00000002) string = "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk")
@@ -59,12 +59,12 @@ CHECK-NEXT: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000000) address = 0x[[
CHECK: DW_AT_linkage_name [DW_FORM_strx] (indexed (00000005) string = "_Z4foo2i")
CHECK: DW_AT_name [DW_FORM_strx] (indexed (00000006) string = "foo2")
CHECK: 0x0000003c: DW_TAG_formal_parameter [3] (0x0000002c)
-CHECK-NEXT: DW_AT_location [DW_FORM_sec_offset] (0x[[LOCLIST_OFFSET:[0-9a-f]+]]:
+CHECK-NEXT: DW_AT_location [DW_FORM_sec_offset] (0x[[LOCLIST_OFFSET:[0-9a-f]+]]:
CHECK-NEXT: [0x[[#%.16x,LOCLIST_PAIR_START:]], 0x[[#%.16x,LOCLIST_PAIR_END:]]): [[LOCLIST_EXPR:.*]]
CHECK-NEXT: [0x[[#%.16x,LOCLIST_PAIR_START2:]], 0x[[#%.16x,LOCLIST_PAIR_END2:]]): [[LOCLIST_EXPR2:.*]])
CHECK: DW_AT_name [DW_FORM_strx] (indexed (00000007) string = "a")
-CHECK: 0x0000004e: Compile Unit: length = 0x00000072, format = DWARF32, version = 0x0004, abbr_offset = 0x00{{00|5a}}, addr_size = 0x08
+CHECK: 0x0000004e: Compile Unit: length = 0x00000072, format = DWARF32, version = 0x0004, abbr_offset = 0x00{{00|5a}}, addr_size = 0x08
CHECK: DW_AT_producer [DW_FORM_strp] ( .debug_str[0x00000001] = "Apple clang version 14.0.3 (clang-1403.0.22.14.1)")
CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x000000e0] = "b.cpp")
CHECK: DW_AT_LLVM_sysroot [DW_FORM_strp] ( .debug_str[0x00000039] = "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk")
@@ -79,7 +79,7 @@ CHECK-NEXT: DW_AT_low_pc [DW_FORM_addr] (0x[[#%.16x,LOC_LOWPC
CHECK: DW_AT_linkage_name [DW_FORM_strp] ( .debug_str[0x000000e6] = "_Z3bari")
CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x000000ee] = "bar")
CHECK: 0x0000009d: DW_TAG_formal_parameter {{.*}} (0x00000080)
-CHECK-NEXT: DW_AT_location [DW_FORM_sec_offset] (0x[[LOC_OFFSET:[0-9a-f]+]]:
+CHECK-NEXT: DW_AT_location [DW_FORM_sec_offset] (0x[[LOC_OFFSET:[0-9a-f]+]]:
CHECK-NEXT: [0x[[#%.16x,LOC_PAIR_START:]], 0x[[#%.16x,LOC_PAIR_END:]]): [[LOC_EXPR:.*]]
CHECK-NEXT: [0x[[#%.16x,LOC_PAIR_START2:]], 0x[[#%.16x,LOC_PAIR_END2:]]): [[LOC_EXPR2:.*]])
CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x000000f2] = "x")
@@ -91,7 +91,7 @@ CHECK-NEXT: (0x[[#sub(LOC_PAIR_START2,LOC_LOWPC)]], 0x[[#sub(LOC_PAIR
CHECK: .debug_loclists contents:
CHECK-NEXT: 0x00000000: locations list header: length = 0x00000018, format = DWARF32, version = 0x0005, addr_size = 0x08, seg_size = 0x00, offset_entry_count = 0x00000000
-CHECK-NEXT: 0x[[LOCLIST_OFFSET]]:
+CHECK-NEXT: 0x[[LOCLIST_OFFSET]]:
CHECK-NEXT: DW_LLE_base_addressx (0x0000000000000000)
CHECK-NEXT: DW_LLE_offset_pair (0x[[#sub(LOCLIST_PAIR_START,LOCLIST_LOWPC)]], 0x[[#sub(LOCLIST_PAIR_END,LOCLIST_LOWPC)]])
CHECK-NEXT: DW_LLE_offset_pair (0x[[#sub(LOCLIST_PAIR_START2,LOCLIST_LOWPC)]], 0x[[#sub(LOCLIST_PAIR_END2,LOCLIST_LOWPC)]])
@@ -205,7 +205,7 @@ CHECK-NEXT: 0x00000028: 000000dc "int"
CHECK: .debug_names contents:
CHECK-NEXT: Name Index @ 0x0 {
CHECK-NEXT: Header {
-CHECK-NEXT: Length: 0xC4
+CHECK-NEXT: Length: 0xBC
CHECK-NEXT: Format: DWARF32
CHECK-NEXT: Version: 5
CHECK-NEXT: CU count: 2
@@ -213,6 +213,6 @@ CHECK-NEXT: Local TU count: 0
CHECK-NEXT: Foreign TU count: 0
CHECK-NEXT: Bucket count: 5
CHECK-NEXT: Name count: 5
-CHECK-NEXT: Abbreviations table size: 0x13
+CHECK-NEXT: Abbreviations table size: 0x11
CHECK-NEXT: Augmentation: 'LLVM0700'
CHECK-NEXT: }
diff --git a/llvm/test/tools/llvm-dwarfdump/X86/debug-names-misaligned.s b/llvm/test/tools/llvm-dwarfdump/X86/debug-names-misaligned.s
index 0ad4f50e98d988f..0acc745af1e5aa4 100644
--- a/llvm/test/tools/llvm-dwarfdump/X86/debug-names-misaligned.s
+++ b/llvm/test/tools/llvm-dwarfdump/X86/debug-names-misaligned.s
@@ -84,7 +84,7 @@
# CHECK: Name 1 {
# CHECK-NEXT: String: 0x00000000 "foo"
# CHECK-NEXT: Entry @ 0x37 {
-# CHECK-NEXT: Abbrev: 0x2e
+# CHECK-NEXT: Abbrev: 0x2E
# CHECK-NEXT: Tag: DW_TAG_subprogram
# CHECK-NEXT: DW_IDX_die_offset: 0x00000001
# CHECK-NEXT: }
More information about the llvm-commits
mailing list