diff --git a/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp index 09780cc350e..f843ba47d44 100644 --- a/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp @@ -894,7 +894,7 @@ dwarf::Tag DwarfCompileUnit::getDwarf5OrGNUCallSiteTag(dwarf::Tag Tag) { bool ApplyGNUExtensions = DD->getDwarfVersion() == 4 && DD->tuneForGDB(); if (!ApplyGNUExtensions) return Tag; - switch(Tag) { + switch (Tag) { case dwarf::DW_TAG_call_site: return dwarf::DW_TAG_GNU_call_site; case dwarf::DW_TAG_call_site_parameter: @@ -904,11 +904,12 @@ dwarf::Tag DwarfCompileUnit::getDwarf5OrGNUCallSiteTag(dwarf::Tag Tag) { } } -dwarf::Attribute DwarfCompileUnit::getDwarf5OrGNUCallSiteAttr(dwarf::Attribute Attr) { +dwarf::Attribute +DwarfCompileUnit::getDwarf5OrGNUCallSiteAttr(dwarf::Attribute Attr) { bool ApplyGNUExtensions = DD->getDwarfVersion() == 4 && DD->tuneForGDB(); if (!ApplyGNUExtensions) return Attr; - switch(Attr) { + switch (Attr) { case dwarf::DW_AT_call_all_calls: return dwarf::DW_AT_GNU_all_call_sites; case dwarf::DW_AT_call_target: @@ -926,31 +927,30 @@ dwarf::Attribute DwarfCompileUnit::getDwarf5OrGNUCallSiteAttr(dwarf::Attribute A } } -DIE &DwarfCompileUnit::constructCallSiteEntryDIE(DIE &ScopeDIE, - const DISubprogram *CalleeSP, - bool IsTail, - const MCSymbol *PCAddr, - const MCExpr *PCOffset, - unsigned CallReg) { +DIE &DwarfCompileUnit::constructCallSiteEntryDIE( + DIE &ScopeDIE, const DISubprogram *CalleeSP, bool IsTail, + const MCSymbol *PCAddr, const MCExpr *PCOffset, unsigned CallReg) { // Insert a call site entry DIE within ScopeDIE. - DIE &CallSiteDIE = - createAndAddDIE(getDwarf5OrGNUCallSiteTag(dwarf::DW_TAG_call_site), - ScopeDIE, nullptr); + DIE &CallSiteDIE = createAndAddDIE( + getDwarf5OrGNUCallSiteTag(dwarf::DW_TAG_call_site), ScopeDIE, nullptr); if (CallReg) { // Indirect call. - addAddress(CallSiteDIE, getDwarf5OrGNUCallSiteAttr(dwarf::DW_AT_call_target), + addAddress(CallSiteDIE, + getDwarf5OrGNUCallSiteAttr(dwarf::DW_AT_call_target), MachineLocation(CallReg)); } else { DIE *CalleeDIE = getOrCreateSubprogramDIE(CalleeSP); assert(CalleeDIE && "Could not create DIE for call site entry origin"); - addDIEEntry(CallSiteDIE, getDwarf5OrGNUCallSiteAttr(dwarf::DW_AT_call_origin), + addDIEEntry(CallSiteDIE, + getDwarf5OrGNUCallSiteAttr(dwarf::DW_AT_call_origin), *CalleeDIE); } if (IsTail) // Attach DW_AT_call_tail_call to tail calls for standards compliance. - addFlag(CallSiteDIE, getDwarf5OrGNUCallSiteAttr(dwarf::DW_AT_call_tail_call)); + addFlag(CallSiteDIE, + getDwarf5OrGNUCallSiteAttr(dwarf::DW_AT_call_tail_call)); // Attach the return PC to allow the debugger to disambiguate call paths // from one function to another. diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 6c6349d4987..26b6adeea65 100644 --- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -604,8 +604,7 @@ static void collectCallSiteParameters(const MachineInstr *CallMI, return 0; }; - auto finishCallSiteParam = [&](DbgValueLoc &DbgLocVal, - unsigned &Reg) { + auto finishCallSiteParam = [&](DbgValueLoc &DbgLocVal, unsigned &Reg) { unsigned FwdReg = Reg; if (ShouldTryEmitEntryVals && RegsForEntryValues.count(Reg)) FwdReg = RegsForEntryValues[Reg]; @@ -642,8 +641,7 @@ static void collectCallSiteParameters(const MachineInstr *CallMI, unsigned FP = TRI->getFrameRegister(*MF); bool IsSPorFP = (RegLoc == SP) || (RegLoc == FP); if (TRI->isCallerPreservedPhysReg(RegLoc, *MF) || IsSPorFP) { - DbgValueLoc DbgLocVal( - Expr, MachineLocation(RegLoc, IsSPorFP)); + DbgValueLoc DbgLocVal(Expr, MachineLocation(RegLoc, IsSPorFP)); finishCallSiteParam(DbgLocVal, Reg); } else if (ShouldTryEmitEntryVals) { ArgsRegsForProcess.insert(RegLoc); @@ -689,7 +687,6 @@ void DwarfDebug::constructCallSiteEntryDIEs(const DISubprogram &SP, const TargetInstrInfo *TII = MF.getSubtarget().getInstrInfo(); assert(TII && "TargetInstrInfo not found: cannot label tail calls"); - const TargetRegisterInfo *TRI = MF.getSubtarget().getRegisterInfo(); bool ApplyGNUExtensions = getDwarfVersion() == 4 && tuneForGDB(); // Emit call site entries for each call or tail call in the function. @@ -748,9 +745,10 @@ void DwarfDebug::constructCallSiteEntryDIEs(const DISubprogram &SP, LLVM_DEBUG(dbgs() << "CallSiteEntry: " << MF.getName() << " -> " << (CalleeDecl ? CalleeDecl->getName() - : StringRef(TRI->getName(CallReg))) - << (IsTail ? " [IsTail]" : "") - << "\n"); + : StringRef(MF.getSubtarget() + .getRegisterInfo() + ->getName(CallReg))) + << (IsTail ? " [IsTail]" : "") << "\n"); DIE &CallSiteDIE = CU.constructCallSiteEntryDIE(ScopeDIE, CalleeSP, IsTail, PCAddr,