mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-14 15:28:20 +00:00
Sink and coalesce DwarfDebug.cpp::addSectionLabel and DwarfUnit::addSectionLabel down into DwarfCompileUnit::addSectionLabel
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219351 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -254,6 +254,18 @@ void DwarfCompileUnit::addRange(RangeSpan Range) {
|
||||
CURanges.back().setEnd(Range.getEnd());
|
||||
}
|
||||
|
||||
void DwarfCompileUnit::addSectionLabel(DIE &Die, dwarf::Attribute Attribute,
|
||||
const MCSymbol *Label,
|
||||
const MCSymbol *Sec) {
|
||||
if (Asm->MAI->doesDwarfUseRelocationsAcrossSections())
|
||||
addLabel(Die, Attribute,
|
||||
DD->getDwarfVersion() >= 4 ? dwarf::DW_FORM_sec_offset
|
||||
: dwarf::DW_FORM_data4,
|
||||
Label);
|
||||
else
|
||||
addSectionDelta(Die, Attribute, Label, Sec);
|
||||
}
|
||||
|
||||
void DwarfCompileUnit::initStmtList(MCSymbol *DwarfLineSectionSym) {
|
||||
// Define start line table label for each Compile Unit.
|
||||
MCSymbol *LineTableStartSym =
|
||||
@@ -266,10 +278,7 @@ void DwarfCompileUnit::initStmtList(MCSymbol *DwarfLineSectionSym) {
|
||||
// left in the skeleton CU and so not included.
|
||||
// The line table entries are not always emitted in assembly, so it
|
||||
// is not okay to use line_table_start here.
|
||||
if (Asm->MAI->doesDwarfUseRelocationsAcrossSections())
|
||||
addSectionLabel(UnitDie, dwarf::DW_AT_stmt_list, LineTableStartSym);
|
||||
else
|
||||
addSectionDelta(UnitDie, dwarf::DW_AT_stmt_list, LineTableStartSym,
|
||||
addSectionLabel(UnitDie, dwarf::DW_AT_stmt_list, LineTableStartSym,
|
||||
DwarfLineSectionSym);
|
||||
}
|
||||
|
||||
|
@@ -64,6 +64,11 @@ public:
|
||||
|
||||
void attachLowHighPC(DIE &D, const MCSymbol *Begin, const MCSymbol *End);
|
||||
|
||||
/// addSectionLabel - Add a Dwarf section label attribute data and value.
|
||||
///
|
||||
void addSectionLabel(DIE &Die, dwarf::Attribute Attribute,
|
||||
const MCSymbol *Label, const MCSymbol *Sec);
|
||||
|
||||
/// \brief Find DIE for the given subprogram and attach appropriate
|
||||
/// DW_AT_low_pc and DW_AT_high_pc attributes. If there are global
|
||||
/// variables in this scope then create and insert DIEs for these
|
||||
|
@@ -330,15 +330,6 @@ bool DwarfDebug::isLexicalScopeDIENull(LexicalScope *Scope) {
|
||||
return !getLabelAfterInsn(Ranges.front().second);
|
||||
}
|
||||
|
||||
static void addSectionLabel(AsmPrinter &Asm, DwarfUnit &U, DIE &D,
|
||||
dwarf::Attribute A, const MCSymbol *L,
|
||||
const MCSymbol *Sec) {
|
||||
if (Asm.MAI->doesDwarfUseRelocationsAcrossSections())
|
||||
U.addSectionLabel(D, A, L);
|
||||
else
|
||||
U.addSectionDelta(D, A, L, Sec);
|
||||
}
|
||||
|
||||
void DwarfDebug::addScopeRangeList(DwarfCompileUnit &TheCU, DIE &ScopeDIE,
|
||||
const SmallVectorImpl<InsnRange> &Range) {
|
||||
// Emit offset in .debug_range as a relocatable label. emitDIE will handle
|
||||
@@ -351,7 +342,7 @@ void DwarfDebug::addScopeRangeList(DwarfCompileUnit &TheCU, DIE &ScopeDIE,
|
||||
TheCU.addSectionDelta(ScopeDIE, dwarf::DW_AT_ranges, RangeSym,
|
||||
DwarfDebugRangeSectionSym);
|
||||
else
|
||||
addSectionLabel(*Asm, TheCU, ScopeDIE, dwarf::DW_AT_ranges, RangeSym,
|
||||
TheCU.addSectionLabel(ScopeDIE, dwarf::DW_AT_ranges, RangeSym,
|
||||
DwarfDebugRangeSectionSym);
|
||||
|
||||
RangeSpanList List(RangeSym);
|
||||
@@ -821,12 +812,11 @@ void DwarfDebug::finalizeModuleInfo() {
|
||||
// We don't keep track of which addresses are used in which CU so this
|
||||
// is a bit pessimistic under LTO.
|
||||
if (!AddrPool.isEmpty())
|
||||
addSectionLabel(*Asm, *SkCU, SkCU->getUnitDie(),
|
||||
dwarf::DW_AT_GNU_addr_base, DwarfAddrSectionSym,
|
||||
DwarfAddrSectionSym);
|
||||
SkCU->addSectionLabel(SkCU->getUnitDie(), dwarf::DW_AT_GNU_addr_base,
|
||||
DwarfAddrSectionSym, DwarfAddrSectionSym);
|
||||
if (!TheU->getRangeLists().empty())
|
||||
addSectionLabel(*Asm, *SkCU, SkCU->getUnitDie(),
|
||||
dwarf::DW_AT_GNU_ranges_base,
|
||||
SkCU->addSectionLabel(
|
||||
SkCU->getUnitDie(), dwarf::DW_AT_GNU_ranges_base,
|
||||
DwarfDebugRangeSectionSym, DwarfDebugRangeSectionSym);
|
||||
}
|
||||
|
||||
@@ -841,7 +831,7 @@ void DwarfDebug::finalizeModuleInfo() {
|
||||
unsigned NumRanges = TheU->getRanges().size();
|
||||
if (NumRanges) {
|
||||
if (NumRanges > 1) {
|
||||
addSectionLabel(*Asm, U, U.getUnitDie(), dwarf::DW_AT_ranges,
|
||||
U.addSectionLabel(U.getUnitDie(), dwarf::DW_AT_ranges,
|
||||
Asm->GetTempSymbol("cu_ranges", U.getUniqueID()),
|
||||
DwarfDebugRangeSectionSym);
|
||||
|
||||
|
@@ -255,16 +255,6 @@ void DwarfUnit::addLabel(DIELoc &Die, dwarf::Form Form, const MCSymbol *Label) {
|
||||
addLabel(Die, (dwarf::Attribute)0, Form, Label);
|
||||
}
|
||||
|
||||
/// addSectionLabel - Add a Dwarf section label attribute data and value.
|
||||
///
|
||||
void DwarfUnit::addSectionLabel(DIE &Die, dwarf::Attribute Attribute,
|
||||
const MCSymbol *Label) {
|
||||
if (DD->getDwarfVersion() >= 4)
|
||||
addLabel(Die, Attribute, dwarf::DW_FORM_sec_offset, Label);
|
||||
else
|
||||
addLabel(Die, Attribute, dwarf::DW_FORM_data4, Label);
|
||||
}
|
||||
|
||||
/// addSectionOffset - Add an offset into a section attribute data and value.
|
||||
///
|
||||
void DwarfUnit::addSectionOffset(DIE &Die, dwarf::Attribute Attribute,
|
||||
|
@@ -292,11 +292,6 @@ public:
|
||||
/// addLocationList - Add a Dwarf loclistptr attribute data and value.
|
||||
void addLocationList(DIE &Die, dwarf::Attribute Attribute, unsigned Index);
|
||||
|
||||
/// addSectionLabel - Add a Dwarf section label attribute data and value.
|
||||
///
|
||||
void addSectionLabel(DIE &Die, dwarf::Attribute Attribute,
|
||||
const MCSymbol *Label);
|
||||
|
||||
/// addSectionOffset - Add an offset into a section attribute data and value.
|
||||
///
|
||||
void addSectionOffset(DIE &Die, dwarf::Attribute Attribute, uint64_t Integer);
|
||||
|
Reference in New Issue
Block a user