DebugInfo: Refactor high_pc/low_pc construction into reusable function

For incoming improvements to inlined functions and lexical blocks
suggested by Adrian Prantl in review of r203187.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203263 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Blaikie 2014-03-07 18:49:45 +00:00
parent f456d37c4f
commit 5ba79a9952
2 changed files with 13 additions and 6 deletions

View File

@ -412,12 +412,7 @@ DIE *DwarfDebug::updateSubprogramScopeDIE(DwarfCompileUnit *SPCU,
}
}
SPCU->addLabelAddress(SPDie, dwarf::DW_AT_low_pc, FunctionBeginSym);
if (DwarfVersion < 4 || Triple(Asm->getTargetTriple()).isOSDarwin())
SPCU->addLabelAddress(SPDie, dwarf::DW_AT_high_pc, FunctionEndSym);
else
SPCU->addLabelDelta(SPDie, dwarf::DW_AT_high_pc, FunctionEndSym,
FunctionBeginSym);
attachLowHighPC(SPCU, SPDie, FunctionBeginSym, FunctionEndSym);
const TargetRegisterInfo *RI = Asm->TM.getRegisterInfo();
MachineLocation Location(RI->getFrameRegister(*Asm->MF));
@ -2977,3 +2972,12 @@ void DwarfDebug::addDwarfTypeUnitType(DwarfCompileUnit &CU,
CU.addDIETypeSignature(RefDie, *NewTU);
}
void DwarfDebug::attachLowHighPC(DwarfCompileUnit *Unit, DIE *D,
MCSymbol *Begin, MCSymbol *End) {
Unit->addLabelAddress(D, dwarf::DW_AT_low_pc, Begin);
if (DwarfVersion < 4 || Triple(Asm->getTargetTriple()).isOSDarwin())
Unit->addLabelAddress(D, dwarf::DW_AT_high_pc, End);
else
Unit->addLabelDelta(D, dwarf::DW_AT_high_pc, End, Begin);
}

View File

@ -680,6 +680,9 @@ class DwarfDebug : public AsmPrinterHandler {
/// \brief Return Label immediately following the instruction.
MCSymbol *getLabelAfterInsn(const MachineInstr *MI);
void attachLowHighPC(DwarfCompileUnit *Unit, DIE *D, MCSymbol *Begin,
MCSymbol *End);
public:
//===--------------------------------------------------------------------===//
// Main entry points.