[llvm] r231338 - Use the existing begin and end symbol for debug info.
Eric Christopher
echristo at gmail.com
Thu Mar 5 00:54:34 PST 2015
Thanks Rafael!
-eric
On Wed, Mar 4, 2015 at 6:11 PM Rafael Espindola <rafael.espindola at gmail.com>
wrote:
> Author: rafael
> Date: Wed Mar 4 20:05:42 2015
> New Revision: 231338
>
> URL: http://llvm.org/viewvc/llvm-project?rev=231338&view=rev
> Log:
> Use the existing begin and end symbol for debug info.
>
> Modified:
> llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
> llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
> llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
> llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
> llvm/trunk/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.cpp
> llvm/trunk/test/DebugInfo/COFF/asan-module-ctor.ll
> llvm/trunk/test/DebugInfo/COFF/asm.ll
> llvm/trunk/test/DebugInfo/COFF/multifile.ll
> llvm/trunk/test/DebugInfo/COFF/multifunction.ll
> llvm/trunk/test/DebugInfo/COFF/simple.ll
> llvm/trunk/test/DebugInfo/COFF/tail-call-without-lexical-scopes.ll
> llvm/trunk/test/DebugInfo/X86/debug-loc-asan.ll
> llvm/trunk/test/DebugInfo/X86/pr19307.ll
>
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/
> CodeGen/AsmPrinter/AsmPrinter.cpp?rev=231338&r1=231337&r2=231338&view=diff
> ============================================================
> ==================
> --- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Wed Mar 4 20:05:42
> 2015
> @@ -556,7 +556,7 @@ void AsmPrinter::EmitFunctionHeader() {
> OutStreamer.EmitLabel(DeadBlockSyms[i]);
> }
>
> - if (!MMI->getLandingPads().empty()) {
> + if (!MMI->getLandingPads().empty() || MMI->hasDebugInfo()) {
> CurrentFnBegin = createTempSymbol("func_begin", getFunctionNumber());
>
> if (MAI->useAssignmentForEHBegin()) {
> @@ -882,7 +882,8 @@ void AsmPrinter::EmitFunctionBody() {
> // Emit target-specific gunk after the function body.
> EmitFunctionBodyEnd();
>
> - if (!MMI->getLandingPads().empty() || MAI->hasDotTypeDotSizeDirective())
> {
> + if (!MMI->getLandingPads().empty() || MMI->hasDebugInfo() ||
> + MAI->hasDotTypeDotSizeDirective()) {
> // Create a symbol for the end of function.
> CurrentFnEnd = createTempSymbol("func_end", getFunctionNumber());
> OutStreamer.EmitLabel(CurrentFnEnd);
>
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/
> CodeGen/AsmPrinter/DwarfCompileUnit.cpp?rev=231338&r1=231337&r2=231338&
> view=diff
> ============================================================
> ==================
> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp (original)
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp Wed Mar 4
> 20:05:42 2015
> @@ -287,7 +287,7 @@ void DwarfCompileUnit::attachLowHighPC(D
> DIE &DwarfCompileUnit::updateSubprogramScopeDIE(DISubprogram SP) {
> DIE *SPDie = getOrCreateSubprogramDIE(SP, includeMinimalInlineScopes());
>
> - attachLowHighPC(*SPDie, DD->getFunctionBeginSym(),
> DD->getFunctionEndSym());
> + attachLowHighPC(*SPDie, Asm->getFunctionBegin(), Asm->getFunctionEnd());
> if (!DD->getCurrentFunction()->getTarget().Options.
> DisableFramePointerElim(
> *DD->getCurrentFunction()))
> addFlag(*SPDie, dwarf::DW_AT_APPLE_omit_frame_ptr);
>
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/
> CodeGen/AsmPrinter/DwarfDebug.cpp?rev=231338&r1=231337&r2=231338&view=diff
> ============================================================
> ==================
> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Wed Mar 4 20:05:42
> 2015
> @@ -207,7 +207,6 @@ DwarfDebug::DwarfDebug(AsmPrinter *A, Mo
> DwarfLineSectionSym = nullptr;
> DwarfAddrSectionSym = nullptr;
> DwarfAbbrevDWOSectionSym = DwarfStrDWOSectionSym = nullptr;
> - FunctionBeginSym = FunctionEndSym = nullptr;
> CurFn = nullptr;
> CurMI = nullptr;
>
> @@ -855,7 +854,7 @@ DwarfDebug::buildLocationList(SmallVecto
> if (End != nullptr)
> EndLabel = getLabelAfterInsn(End);
> else if (std::next(I) == Ranges.end())
> - EndLabel = FunctionEndSym;
> + EndLabel = Asm->getFunctionEnd();
> else
> EndLabel = getLabelBeforeInsn(std::next(I)->first);
> assert(EndLabel && "Forgot label after instruction ending a range!");
> @@ -1146,11 +1145,6 @@ void DwarfDebug::beginFunction(const Mac
> else
> Asm->OutStreamer.getContext().setDwarfCompileUnitID(TheCU->
> getUniqueID());
>
> - // Emit a label for the function so that we have a beginning address.
> - FunctionBeginSym = Asm->GetTempSymbol("func_begin",
> Asm->getFunctionNumber());
> - // Assumes in correct section after the entry point.
> - Asm->OutStreamer.EmitLabel(FunctionBeginSym);
> -
> // Calculate history for local variables.
> calculateDbgValueHistory(MF, Asm->MF->getSubtarget().getRegisterInfo(),
> DbgValues);
> @@ -1161,12 +1155,12 @@ void DwarfDebug::beginFunction(const Mac
> if (Ranges.empty())
> continue;
>
> - // The first mention of a function argument gets the FunctionBeginSym
> + // The first mention of a function argument gets the CurrentFnBegin
> // label, so arguments are visible when breaking at function entry.
> DIVariable DIVar(Ranges.front().first->getDebugVariable());
> if (DIVar.isVariable() && DIVar.getTag() ==
> dwarf::DW_TAG_arg_variable &&
> getDISubprogram(DIVar.getContext()).describes(MF->getFunction()))
> {
> - LabelsBeforeInsn[Ranges.front().first] = FunctionBeginSym;
> + LabelsBeforeInsn[Ranges.front().first] = Asm->getFunctionBegin();
> if (Ranges.front().first->getDebugExpression().isBitPiece()) {
> // Mark all non-overlapping initial pieces.
> for (auto I = Ranges.begin(); I != Ranges.end(); ++I) {
> @@ -1175,7 +1169,7 @@ void DwarfDebug::beginFunction(const Mac
> [&](DbgValueHistoryMap::InstrRange Pred) {
> return !piecesOverlap(Piece, Pred.first->
> getDebugExpression());
> }))
> - LabelsBeforeInsn[I->first] = FunctionBeginSym;
> + LabelsBeforeInsn[I->first] = Asm->getFunctionBegin();
> else
> break;
> }
> @@ -1190,7 +1184,7 @@ void DwarfDebug::beginFunction(const Mac
> }
>
> PrevInstLoc = DebugLoc();
> - PrevLabel = FunctionBeginSym;
> + PrevLabel = Asm->getFunctionBegin();
>
> // Record beginning of function.
> PrologEndLoc = findPrologueEndLoc(MF);
> @@ -1221,11 +1215,6 @@ void DwarfDebug::endFunction(const Machi
> return;
> }
>
> - // Define end label for subprogram.
> - FunctionEndSym = Asm->GetTempSymbol("func_end",
> Asm->getFunctionNumber());
> - // Assumes in correct section after the entry point.
> - Asm->OutStreamer.EmitLabel(FunctionEndSym);
> -
> // Set DwarfDwarfCompileUnitID in MCContext to default value.
> Asm->OutStreamer.getContext().setDwarfCompileUnitID(0);
>
> @@ -1237,7 +1226,7 @@ void DwarfDebug::endFunction(const Machi
> collectVariableInfo(TheCU, SP, ProcessedVars);
>
> // Add the range of this function to the list of ranges for the CU.
> - TheCU.addRange(RangeSpan(FunctionBeginSym, FunctionEndSym));
> + TheCU.addRange(RangeSpan(Asm->getFunctionBegin(),
> Asm->getFunctionEnd()));
>
> // Under -gmlt, skip building the subprogram if there are no inlined
> // subroutines inside it.
>
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/
> CodeGen/AsmPrinter/DwarfDebug.h?rev=231338&r1=231337&r2=231338&view=diff
> ============================================================
> ==================
> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h (original)
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h Wed Mar 4 20:05:42
> 2015
> @@ -249,7 +249,6 @@ class DwarfDebug : public AsmPrinterHand
> MCSymbol *DwarfInfoSectionSym, *DwarfAbbrevSectionSym;
> MCSymbol *DwarfStrSectionSym, *TextSectionSym,
> *DwarfDebugRangeSectionSym;
> MCSymbol *DwarfDebugLocSectionSym, *DwarfLineSectionSym,
> *DwarfAddrSectionSym;
> - MCSymbol *FunctionBeginSym, *FunctionEndSym;
> MCSymbol *DwarfInfoDWOSectionSym, *DwarfAbbrevDWOSectionSym;
> MCSymbol *DwarfTypesDWOSectionSym;
> MCSymbol *DwarfStrDWOSectionSym;
> @@ -627,8 +626,6 @@ public:
> void addAccelType(StringRef Name, const DIE &Die, char Flags);
>
> const MachineFunction *getCurrentFunction() const { return CurFn; }
> - const MCSymbol *getFunctionBeginSym() const { return FunctionBeginSym; }
> - const MCSymbol *getFunctionEndSym() const { return FunctionEndSym; }
>
> iterator_range<ImportedEntityMap::const_iterator>
> findImportedEntitiesForScope(const MDNode *Scope) const {
>
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/
> CodeGen/AsmPrinter/WinCodeViewLineTables.cpp?rev=
> 231338&r1=231337&r2=231338&view=diff
> ============================================================
> ==================
> --- llvm/trunk/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.cpp (original)
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.cpp Wed Mar
> 4 20:05:42 2015
> @@ -364,10 +364,7 @@ void WinCodeViewLineTables::endFunction(
> FnDebugInfo.erase(GV);
> VisitedFunctions.pop_back();
> } else {
> - // Define end label for subprogram.
> - MCSymbol *FunctionEndSym = Asm->OutStreamer.getContext().
> CreateTempSymbol();
> - Asm->OutStreamer.EmitLabel(FunctionEndSym);
> - CurFn->End = FunctionEndSym;
> + CurFn->End = Asm->getFunctionEnd();
> }
> CurFn = nullptr;
> }
>
> Modified: llvm/trunk/test/DebugInfo/COFF/asan-module-ctor.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/
> DebugInfo/COFF/asan-module-ctor.ll?rev=231338&r1=231337&
> r2=231338&view=diff
> ============================================================
> ==================
> --- llvm/trunk/test/DebugInfo/COFF/asan-module-ctor.ll (original)
> +++ llvm/trunk/test/DebugInfo/COFF/asan-module-ctor.ll Wed Mar 4
> 20:05:42 2015
> @@ -9,6 +9,7 @@
>
> ; The module ctor has no debug info. All we have to do is don't crash.
> ; X86: _asan.module_ctor:
> +; X86-NEXT: L{{.*}}:
> ; X86-NEXT: # BB
> ; X86-NEXT: calll ___asan_init_v3
> ; X86-NEXT: retl
>
> Modified: llvm/trunk/test/DebugInfo/COFF/asm.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/
> DebugInfo/COFF/asm.ll?rev=231338&r1=231337&r2=231338&view=diff
> ============================================================
> ==================
> --- llvm/trunk/test/DebugInfo/COFF/asm.ll (original)
> +++ llvm/trunk/test/DebugInfo/COFF/asm.ll Wed Mar 4 20:05:42 2015
> @@ -115,6 +115,7 @@
> ; OBJ32: }
>
> ; X64-LABEL: f:
> +; X64-NEXT: .L{{.*}}:{{$}}
> ; X64-NEXT: [[START:.*]]:{{$}}
> ; X64: # BB
> ; X64: subq $40, %rsp
>
> Modified: llvm/trunk/test/DebugInfo/COFF/multifile.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/
> DebugInfo/COFF/multifile.ll?rev=231338&r1=231337&r2=231338&view=diff
> ============================================================
> ==================
> --- llvm/trunk/test/DebugInfo/COFF/multifile.ll (original)
> +++ llvm/trunk/test/DebugInfo/COFF/multifile.ll Wed Mar 4 20:05:42 2015
> @@ -144,6 +144,7 @@
> ; OBJ32: }
>
> ; X64-LABEL: f:
> +; X64-NEXT: .L{{.*}}:{{$}}
> ; X64-NEXT: [[START:.*]]:{{$}}
> ; X64: # BB
> ; X64: subq $40, %rsp
>
> Modified: llvm/trunk/test/DebugInfo/COFF/multifunction.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/
> DebugInfo/COFF/multifunction.ll?rev=231338&r1=231337&r2=231338&view=diff
> ============================================================
> ==================
> --- llvm/trunk/test/DebugInfo/COFF/multifunction.ll (original)
> +++ llvm/trunk/test/DebugInfo/COFF/multifunction.ll Wed Mar 4 20:05:42
> 2015
> @@ -278,6 +278,7 @@
> ; OBJ32: }
>
> ; X64-LABEL: x:
> +; X64-NEXT: .L{{.*}}:
> ; X64-NEXT: [[X_START:.*]]:{{$}}
> ; X64: # BB
> ; X64: subq $40, %rsp
> @@ -290,6 +291,7 @@
> ; X64-NEXT: [[END_OF_X:.*]]:
> ;
> ; X64-LABEL: y:
> +; X64-NEXT: .L{{.*}}:
> ; X64-NEXT: [[Y_START:.*]]:{{$}}
> ; X64: # BB
> ; X64: subq $40, %rsp
> @@ -302,6 +304,7 @@
> ; X64-NEXT: [[END_OF_Y:.*]]:
> ;
> ; X64-LABEL: f:
> +; X64-NEXT: .L{{.*}}:
> ; X64-NEXT: [[F_START:.*]]:{{$}}
> ; X64: # BB
> ; X64: subq $40, %rsp
>
> Modified: llvm/trunk/test/DebugInfo/COFF/simple.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/
> DebugInfo/COFF/simple.ll?rev=231338&r1=231337&r2=231338&view=diff
> ============================================================
> ==================
> --- llvm/trunk/test/DebugInfo/COFF/simple.ll (original)
> +++ llvm/trunk/test/DebugInfo/COFF/simple.ll Wed Mar 4 20:05:42 2015
> @@ -107,6 +107,7 @@
> ; OBJ32: }
>
> ; X64-LABEL: f:
> +; X64-NEXT: .L{{.*}}:{{$}}
> ; X64-NEXT: [[START:.*]]:{{$}}
> ; X64: # BB
> ; X64: subq $40, %rsp
>
> Modified: llvm/trunk/test/DebugInfo/COFF/tail-call-without-
> lexical-scopes.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/
> DebugInfo/COFF/tail-call-without-lexical-scopes.ll?rev=
> 231338&r1=231337&r2=231338&view=diff
> ============================================================
> ==================
> --- llvm/trunk/test/DebugInfo/COFF/tail-call-without-lexical-scopes.ll
> (original)
> +++ llvm/trunk/test/DebugInfo/COFF/tail-call-without-lexical-scopes.ll
> Wed Mar 4 20:05:42 2015
> @@ -16,6 +16,7 @@
> ; with debug information available. This used to be PR19239.
>
> ; X86-LABEL: {{^}}"?bar@@YAXHZZ":
> +; X86-NEXT: L{{.*}}:
> ; X86-NEXT: # BB
> ; X86-NEXT: [[JMP_LINE:^L.*]]:{{$}}
> ; X86: jmp "?foo@@YAXXZ"
>
> Modified: llvm/trunk/test/DebugInfo/X86/debug-loc-asan.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/
> DebugInfo/X86/debug-loc-asan.ll?rev=231338&r1=231337&r2=231338&view=diff
> ============================================================
> ==================
> --- llvm/trunk/test/DebugInfo/X86/debug-loc-asan.ll (original)
> +++ llvm/trunk/test/DebugInfo/X86/debug-loc-asan.ll Wed Mar 4 20:05:42
> 2015
> @@ -28,7 +28,7 @@
>
> ; Then it's addressed via %rsp:
> ; CHECK: .quad [[START_LABEL]]-.Lfunc_begin0
> -; CHECK-NEXT: .Lfunc_end06-.Lfunc_begin0
> +; CHECK-NEXT: .Lfunc_end0-.Lfunc_begin0
> ; CHECK: DW_OP_breg7
> ; CHECK-NEXT: [[OFFSET]]
> ; CHECK: DW_OP_deref
>
> Modified: llvm/trunk/test/DebugInfo/X86/pr19307.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/
> DebugInfo/X86/pr19307.ll?rev=231338&r1=231337&r2=231338&view=diff
> ============================================================
> ==================
> --- llvm/trunk/test/DebugInfo/X86/pr19307.ll (original)
> +++ llvm/trunk/test/DebugInfo/X86/pr19307.ll Wed Mar 4 20:05:42 2015
> @@ -21,7 +21,7 @@
> ; CHECK: .Ldebug_loc{{[0-9]+}}:
> ; CHECK: DW_OP_breg1
> ; CHECK: .quad [[START_LABEL]]-.Lfunc_begin0
> -; CHECK-NEXT: .quad .Lfunc_end09-.Lfunc_begin0
> +; CHECK-NEXT: .quad .Lfunc_end0-.Lfunc_begin0
> ; CHECK: DW_OP_breg6
> ; CHECK: DW_OP_deref
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150305/e5d669c9/attachment.html>
More information about the llvm-commits
mailing list