DebugInfo: Simplify section label caching/usage

llvm-svn: 373273
This commit is contained in:
David Blaikie 2019-09-30 23:19:10 +00:00
parent 63e8a0f55f
commit 38456776b3
2 changed files with 4 additions and 9 deletions

View File

@ -329,7 +329,6 @@ void DwarfCompileUnit::addRange(RangeSpan Range) {
(&CURanges.back().getEnd()->getSection() !=
&Range.getEnd()->getSection())) {
CURanges.push_back(Range);
DD->addSectionLabel(Range.getStart());
return;
}

View File

@ -1757,6 +1757,9 @@ void DwarfDebug::beginFunctionImpl(const MachineFunction *MF) {
if (SP->getUnit()->getEmissionKind() == DICompileUnit::NoDebug)
return;
SectionLabels.insert(std::make_pair(&Asm->getFunctionBegin()->getSection(),
Asm->getFunctionBegin()));
DwarfCompileUnit &CU = getOrCreateDwarfCompileUnit(SP->getUnit());
// Set DwarfDwarfCompileUnitID in MCContext to the Compile Unit this function
@ -2582,11 +2585,8 @@ static void emitRangeList(DwarfDebug &DD, AsmPrinter *Asm,
if (!Base && (P.second.size() > 1 || DwarfVersion < 5) &&
(CU.getCUNode()->getRangesBaseAddress() || DwarfVersion >= 5)) {
BaseIsSet = true;
// FIXME/use care: This may not be a useful base address if it's not
// the lowest address/range in this object.
Base = P.second.front()->getStart();
Base = DD.getSectionLabel(&P.second.front()->getStart()->getSection());
if (DwarfVersion >= 5) {
Base = DD.getSectionLabel(&Base->getSection());
Asm->OutStreamer->AddComment("DW_RLE_base_addressx");
Asm->OutStreamer->EmitIntValue(dwarf::DW_RLE_base_addressx, 1);
Asm->OutStreamer->AddComment(" base address index");
@ -3029,10 +3029,6 @@ uint16_t DwarfDebug::getDwarfVersion() const {
return Asm->OutStreamer->getContext().getDwarfVersion();
}
void DwarfDebug::addSectionLabel(const MCSymbol *Sym) {
SectionLabels.insert(std::make_pair(&Sym->getSection(), Sym));
}
const MCSymbol *DwarfDebug::getSectionLabel(const MCSection *S) {
return SectionLabels.find(S)->second;
}