Sink DwarfDebug::addScopeRangeList down into DwarfCompileUnit

(& add a few accessors/make a couple of things public for this - it's a
bit of a toss-up, but I think I prefer it this way, keeping some more of
the meaty code down in DwarfCompileUnit - if only to make for smaller
implementation files, etc)

I think we could simplify range handling a bit if we removed the range
lists from each unit and just put a single range list on DwarfDebug,
similar to address pooling.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219370 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Blaikie
2014-10-09 00:11:39 +00:00
parent 6aaac28658
commit cbb705d900
4 changed files with 43 additions and 37 deletions

View File

@ -330,31 +330,6 @@ bool DwarfDebug::isLexicalScopeDIENull(LexicalScope *Scope) {
return !getLabelAfterInsn(Ranges.front().second);
}
void DwarfDebug::addScopeRangeList(DwarfCompileUnit &TheCU, DIE &ScopeDIE,
const SmallVectorImpl<InsnRange> &Range) {
// Emit offset in .debug_range as a relocatable label. emitDIE will handle
// emitting it appropriately.
MCSymbol *RangeSym = Asm->GetTempSymbol("debug_ranges", GlobalRangeCount++);
// Under fission, ranges are specified by constant offsets relative to the
// CU's DW_AT_GNU_ranges_base.
if (useSplitDwarf())
TheCU.addSectionDelta(ScopeDIE, dwarf::DW_AT_ranges, RangeSym,
DwarfDebugRangeSectionSym);
else
TheCU.addSectionLabel(ScopeDIE, dwarf::DW_AT_ranges, RangeSym,
DwarfDebugRangeSectionSym);
RangeSpanList List(RangeSym);
for (const InsnRange &R : Range) {
RangeSpan Span(getLabelBeforeInsn(R.first), getLabelAfterInsn(R.second));
List.addRange(std::move(Span));
}
// Add the range list to the set of ranges to be emitted.
TheCU.addRangeList(std::move(List));
}
void DwarfDebug::attachRangesOrLowHighPC(DwarfCompileUnit &TheCU, DIE &Die,
const SmallVectorImpl<InsnRange> &Ranges) {
assert(!Ranges.empty());
@ -362,7 +337,7 @@ void DwarfDebug::attachRangesOrLowHighPC(DwarfCompileUnit &TheCU, DIE &Die,
TheCU.attachLowHighPC(Die, getLabelBeforeInsn(Ranges.front().first),
getLabelAfterInsn(Ranges.front().second));
else
addScopeRangeList(TheCU, Die, Ranges);
TheCU.addScopeRangeList(Die, Ranges);
}
// Construct new DW_TAG_lexical_block for this scope and attach