mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-19 06:31:18 +00:00
Refactor the handling of lexical block and inline scope ranges
into a single function. No functional change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196181 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
5c21e864d9
commit
5b93ae5ab5
@ -467,6 +467,25 @@ bool DwarfDebug::isLexicalScopeDIENull(LexicalScope *Scope) {
|
|||||||
return !End;
|
return !End;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DwarfDebug::addScopeRangeList(CompileUnit *TheCU, DIE *ScopeDIE,
|
||||||
|
const SmallVectorImpl<InsnRange> &Range) {
|
||||||
|
// Emit offset in .debug_range as a relocatable label. emitDIE will handle
|
||||||
|
// emitting it appropriately.
|
||||||
|
TheCU->addSectionLabel(ScopeDIE, dwarf::DW_AT_ranges,
|
||||||
|
Asm->GetTempSymbol("debug_ranges", GlobalRangeCount));
|
||||||
|
RangeSpanList *List = new RangeSpanList(GlobalRangeCount++);
|
||||||
|
for (SmallVectorImpl<InsnRange>::const_iterator RI = Range.begin(),
|
||||||
|
RE = Range.end();
|
||||||
|
RI != RE; ++RI) {
|
||||||
|
RangeSpan Span(getLabelBeforeInsn(RI->first),
|
||||||
|
getLabelAfterInsn(RI->second));
|
||||||
|
List->addRange(Span);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add the range list to the set of ranges to be emitted.
|
||||||
|
TheCU->addRangeList(List);
|
||||||
|
}
|
||||||
|
|
||||||
// Construct new DW_TAG_lexical_block for this scope and attach
|
// Construct new DW_TAG_lexical_block for this scope and attach
|
||||||
// DW_AT_low_pc/DW_AT_high_pc labels.
|
// DW_AT_low_pc/DW_AT_high_pc labels.
|
||||||
DIE *DwarfDebug::constructLexicalScopeDIE(CompileUnit *TheCU,
|
DIE *DwarfDebug::constructLexicalScopeDIE(CompileUnit *TheCU,
|
||||||
@ -479,25 +498,10 @@ DIE *DwarfDebug::constructLexicalScopeDIE(CompileUnit *TheCU,
|
|||||||
return ScopeDIE;
|
return ScopeDIE;
|
||||||
|
|
||||||
const SmallVectorImpl<InsnRange> &ScopeRanges = Scope->getRanges();
|
const SmallVectorImpl<InsnRange> &ScopeRanges = Scope->getRanges();
|
||||||
|
|
||||||
// If we have multiple ranges, emit them into the range section.
|
// If we have multiple ranges, emit them into the range section.
|
||||||
if (ScopeRanges.size() > 1) {
|
if (ScopeRanges.size() > 1) {
|
||||||
// .debug_range section has not been laid out yet. Emit offset in
|
addScopeRangeList(TheCU, ScopeDIE, ScopeRanges);
|
||||||
// .debug_range as a relocatable label. emitDIE will handle
|
|
||||||
// emitting it appropriately.
|
|
||||||
TheCU->addSectionLabel(
|
|
||||||
ScopeDIE, dwarf::DW_AT_ranges,
|
|
||||||
Asm->GetTempSymbol("debug_ranges", GlobalRangeCount));
|
|
||||||
RangeSpanList *List = new RangeSpanList(GlobalRangeCount++);
|
|
||||||
for (SmallVectorImpl<InsnRange>::const_iterator RI = ScopeRanges.begin(),
|
|
||||||
RE = ScopeRanges.end();
|
|
||||||
RI != RE; ++RI) {
|
|
||||||
RangeSpan Range(getLabelBeforeInsn(RI->first),
|
|
||||||
getLabelAfterInsn(RI->second));
|
|
||||||
List->addRange(Range);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add the range list to the set of ranges to be emitted.
|
|
||||||
TheCU->addRangeList(List);
|
|
||||||
return ScopeDIE;
|
return ScopeDIE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -537,25 +541,10 @@ DIE *DwarfDebug::constructInlinedScopeDIE(CompileUnit *TheCU,
|
|||||||
DIE *ScopeDIE = new DIE(dwarf::DW_TAG_inlined_subroutine);
|
DIE *ScopeDIE = new DIE(dwarf::DW_TAG_inlined_subroutine);
|
||||||
TheCU->addDIEEntry(ScopeDIE, dwarf::DW_AT_abstract_origin, OriginDIE);
|
TheCU->addDIEEntry(ScopeDIE, dwarf::DW_AT_abstract_origin, OriginDIE);
|
||||||
|
|
||||||
if (ScopeRanges.size() > 1) {
|
// If we have multiple ranges, emit them into the range section.
|
||||||
// .debug_range section has not been laid out yet. Emit offset in
|
if (ScopeRanges.size() > 1)
|
||||||
// .debug_range as a relocatable label. emitDIE will handle
|
addScopeRangeList(TheCU, ScopeDIE, ScopeRanges);
|
||||||
// emitting it appropriately.
|
else {
|
||||||
TheCU->addSectionLabel(
|
|
||||||
ScopeDIE, dwarf::DW_AT_ranges,
|
|
||||||
Asm->GetTempSymbol("debug_ranges", GlobalRangeCount));
|
|
||||||
RangeSpanList *List = new RangeSpanList(GlobalRangeCount++);
|
|
||||||
for (SmallVectorImpl<InsnRange>::const_iterator RI = ScopeRanges.begin(),
|
|
||||||
RE = ScopeRanges.end();
|
|
||||||
RI != RE; ++RI) {
|
|
||||||
RangeSpan Range(getLabelBeforeInsn(RI->first),
|
|
||||||
getLabelAfterInsn(RI->second));
|
|
||||||
List->addRange(Range);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add the range list to the set of ranges to be emitted.
|
|
||||||
TheCU->addRangeList(List);
|
|
||||||
} else {
|
|
||||||
SmallVectorImpl<InsnRange>::const_iterator RI = ScopeRanges.begin();
|
SmallVectorImpl<InsnRange>::const_iterator RI = ScopeRanges.begin();
|
||||||
MCSymbol *StartLabel = getLabelBeforeInsn(RI->first);
|
MCSymbol *StartLabel = getLabelBeforeInsn(RI->first);
|
||||||
MCSymbol *EndLabel = getLabelAfterInsn(RI->second);
|
MCSymbol *EndLabel = getLabelAfterInsn(RI->second);
|
||||||
|
@ -501,6 +501,11 @@ class DwarfDebug {
|
|||||||
/// going to be null.
|
/// going to be null.
|
||||||
bool isLexicalScopeDIENull(LexicalScope *Scope);
|
bool isLexicalScopeDIENull(LexicalScope *Scope);
|
||||||
|
|
||||||
|
/// \brief A helper function to construct a RangeSpanList for a given
|
||||||
|
/// lexical scope.
|
||||||
|
void addScopeRangeList(CompileUnit *TheCU, DIE *ScopeDIE,
|
||||||
|
const SmallVectorImpl<InsnRange> &Range);
|
||||||
|
|
||||||
/// \brief Construct new DW_TAG_lexical_block for this scope and
|
/// \brief Construct new DW_TAG_lexical_block for this scope and
|
||||||
/// attach DW_AT_low_pc/DW_AT_high_pc labels.
|
/// attach DW_AT_low_pc/DW_AT_high_pc labels.
|
||||||
DIE *constructLexicalScopeDIE(CompileUnit *TheCU, LexicalScope *Scope);
|
DIE *constructLexicalScopeDIE(CompileUnit *TheCU, LexicalScope *Scope);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user