summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2014-11-03 23:10:59 +0000
committerDavid Blaikie <dblaikie@gmail.com>2014-11-03 23:10:59 +0000
commit5b02a19f909bf7610c629ac1f16e79bd88a3d442 (patch)
tree9c8edc047ad0321c7cc8845f4676ed004c9f5058 /llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
parenta3f3fd35aed02b0ee9b19e85c9a562917f313da4 (diff)
downloadbcm5719-llvm-5b02a19f909bf7610c629ac1f16e79bd88a3d442.tar.gz
bcm5719-llvm-5b02a19f909bf7610c629ac1f16e79bd88a3d442.zip
Use common range handling for the CU's ranges
This generalizes the range handling for ranges in both the skeleton and full unit, laying the foundation for the addition of more ranges (rather than just the CU's special case) in the skeleton CU with fission+gmlt. llvm-svn: 221202
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp46
1 files changed, 26 insertions, 20 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
index 1bb546e54b2..580785588a7 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
@@ -372,40 +372,46 @@ void DwarfCompileUnit::addSectionDelta(DIE &Die, dwarf::Attribute Attribute,
Value);
}
-void
-DwarfCompileUnit::addScopeRangeList(DIE &ScopeDIE,
- const SmallVectorImpl<InsnRange> &Range) {
+void DwarfCompileUnit::addScopeRangeList(DIE &ScopeDIE,
+ SmallVector<RangeSpan, 2> Range) {
// Emit offset in .debug_range as a relocatable label. emitDIE will handle
// emitting it appropriately.
- MCSymbol *RangeSym =
- Asm->GetTempSymbol("debug_ranges", DD->getNextRangeNumber());
-
auto *RangeSectionSym = DD->getRangeSectionSym();
+ RangeSpanList List(
+ Asm->GetTempSymbol("debug_ranges", DD->getNextRangeNumber()),
+ std::move(Range));
+
// Under fission, ranges are specified by constant offsets relative to the
// CU's DW_AT_GNU_ranges_base.
- if (DD->useSplitDwarf())
- addSectionDelta(ScopeDIE, dwarf::DW_AT_ranges, RangeSym, RangeSectionSym);
+ if (isDwoUnit())
+ addSectionDelta(ScopeDIE, dwarf::DW_AT_ranges, List.getSym(),
+ RangeSectionSym);
else
- addSectionLabel(ScopeDIE, dwarf::DW_AT_ranges, RangeSym, RangeSectionSym);
-
- RangeSpanList List(RangeSym);
- for (const InsnRange &R : Range)
- List.addRange(RangeSpan(DD->getLabelBeforeInsn(R.first),
- DD->getLabelAfterInsn(R.second)));
+ addSectionLabel(ScopeDIE, dwarf::DW_AT_ranges, List.getSym(),
+ RangeSectionSym);
// Add the range list to the set of ranges to be emitted.
(Skeleton ? Skeleton : this)->CURangeLists.push_back(std::move(List));
}
void DwarfCompileUnit::attachRangesOrLowHighPC(
+ DIE &Die, SmallVector<RangeSpan, 2> Ranges) {
+ if (Ranges.size() == 1) {
+ const auto &single = Ranges.front();
+ attachLowHighPC(Die, single.getStart(), single.getEnd());
+ } else
+ addScopeRangeList(Die, std::move(Ranges));
+}
+
+void DwarfCompileUnit::attachRangesOrLowHighPC(
DIE &Die, const SmallVectorImpl<InsnRange> &Ranges) {
- assert(!Ranges.empty());
- if (Ranges.size() == 1)
- attachLowHighPC(Die, DD->getLabelBeforeInsn(Ranges.front().first),
- DD->getLabelAfterInsn(Ranges.front().second));
- else
- addScopeRangeList(Die, Ranges);
+ SmallVector<RangeSpan, 2> List;
+ List.reserve(Ranges.size());
+ for (const InsnRange &R : Ranges)
+ List.push_back(RangeSpan(DD->getLabelBeforeInsn(R.first),
+ DD->getLabelAfterInsn(R.second)));
+ attachRangesOrLowHighPC(Die, std::move(List));
}
// This scope represents inlined body of a function. Construct DIE to
OpenPOWER on IntegriCloud