From e68261749e506a5f773c4a9e4cb96e75201ea111 Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Sun, 3 May 2009 23:27:19 +0000 Subject: [PATCH] Revert r70803 for now, it causes a regression. llvm-svn: 70811 --- lib/CodeGen/AsmPrinter/DwarfWriter.cpp | 7 +++++++ lib/CodeGen/SelectionDAG/FastISel.cpp | 8 +++++++- lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp | 3 ++- test/DebugInfo/2009-01-29-HeaderLocation.ll | 2 +- utils/TableGen/AsmWriterEmitter.cpp | 4 ++-- 5 files changed, 19 insertions(+), 5 deletions(-) diff --git a/lib/CodeGen/AsmPrinter/DwarfWriter.cpp b/lib/CodeGen/AsmPrinter/DwarfWriter.cpp index 0d21dea2514..848f45ea8c9 100644 --- a/lib/CodeGen/AsmPrinter/DwarfWriter.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfWriter.cpp @@ -3262,6 +3262,13 @@ public: // Assumes in correct section after the entry point. EmitLabel("func_begin", ++SubprogramCount); + // Emit label for the implicitly defined dbg.stoppoint at the start of + // the function. + if (!Lines.empty()) { + const SrcLineInfo &LineInfo = Lines[0]; + Asm->printLabel(LineInfo.getLabelID()); + } + if (TimePassesIsEnabled) DebugTimer->stopTimer(); } diff --git a/lib/CodeGen/SelectionDAG/FastISel.cpp b/lib/CodeGen/SelectionDAG/FastISel.cpp index 6ad8a059f8f..afcda1f82e0 100644 --- a/lib/CodeGen/SelectionDAG/FastISel.cpp +++ b/lib/CodeGen/SelectionDAG/FastISel.cpp @@ -333,6 +333,11 @@ bool FastISel::SelectCall(User *I) { unsigned Col = SPI->getColumn(); unsigned Idx = MF.getOrCreateDebugLocID(CU.getGV(), Line, Col); setCurDebugLoc(DebugLoc::get(Idx)); + if (DW && DW->ShouldEmitDwarfDebug()) { + unsigned ID = DW->RecordSourceLine(Line, Col, CU); + const TargetInstrDesc &II = TII.get(TargetInstrInfo::DBG_LABEL); + BuildMI(MBB, DL, II).addImm(ID); + } } return true; } @@ -397,7 +402,7 @@ bool FastISel::SelectCall(User *I) { CompileUnit.getGV(), Line, 0))); if (DW && DW->ShouldEmitDwarfDebug()) { - unsigned LabelID = MMI->NextLabelID(); + unsigned LabelID = DW->RecordSourceLine(Line, 0, CompileUnit); const TargetInstrDesc &II = TII.get(TargetInstrInfo::DBG_LABEL); BuildMI(MBB, DL, II).addImm(LabelID); DebugLocTuple PrevLocTpl = MF.getDebugLocTuple(PrevLoc); @@ -412,6 +417,7 @@ bool FastISel::SelectCall(User *I) { setCurDebugLoc(DebugLoc::get(MF.getOrCreateDebugLocID( CompileUnit.getGV(), Line, 0))); if (DW && DW->ShouldEmitDwarfDebug()) { + DW->RecordSourceLine(Line, 0, CompileUnit); // llvm.dbg.func_start also defines beginning of function scope. DW->RecordRegionStart(cast(FSI->getSubprogram())); } diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp index 61db1fb4669..acdb04339bd 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp @@ -3980,7 +3980,7 @@ SelectionDAGLowering::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) { MF.getOrCreateDebugLocID(CompileUnit.getGV(), Line, 0))); if (DW && DW->ShouldEmitDwarfDebug()) { - unsigned LabelID = DAG.getMachineModuleInfo()->NextLabelID(); + unsigned LabelID = DW->RecordSourceLine(Line, 0, CompileUnit); DAG.setRoot(DAG.getLabel(ISD::DBG_LABEL, getCurDebugLoc(), getRoot(), LabelID)); DebugLocTuple PrevLocTpl = MF.getDebugLocTuple(PrevLoc); @@ -3995,6 +3995,7 @@ SelectionDAGLowering::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) { setCurDebugLoc(DebugLoc::get( MF.getOrCreateDebugLocID(CompileUnit.getGV(), Line, 0))); if (DW && DW->ShouldEmitDwarfDebug()) { + DW->RecordSourceLine(Line, 0, CompileUnit); // llvm.dbg.func_start also defines beginning of function scope. DW->RecordRegionStart(cast(FSI.getSubprogram())); } diff --git a/test/DebugInfo/2009-01-29-HeaderLocation.ll b/test/DebugInfo/2009-01-29-HeaderLocation.ll index a201bd5a02d..c59a1c730cd 100644 --- a/test/DebugInfo/2009-01-29-HeaderLocation.ll +++ b/test/DebugInfo/2009-01-29-HeaderLocation.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc | grep "\\"m.h\\"" | count 1 +; RUN: llvm-as < %s | llc | grep "m.h" | count 1 target triple = "i386-apple-darwin9.6" %llvm.dbg.anchor.type = type { i32, i32 } %llvm.dbg.basictype.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, i32 } diff --git a/utils/TableGen/AsmWriterEmitter.cpp b/utils/TableGen/AsmWriterEmitter.cpp index 3937fd104a7..2c259e5ee0c 100644 --- a/utils/TableGen/AsmWriterEmitter.cpp +++ b/utils/TableGen/AsmWriterEmitter.cpp @@ -650,12 +650,12 @@ void AsmWriterEmitter::run(std::ostream &O) { O << "\";\n\n"; O << " if (TAI->doesSupportDebugInformation() &&\n" - << " DW->ShouldEmitDwarfDebug()) {\n" + << " DW->ShouldEmitDwarfDebug() && OptLevel != CodeGenOpt::None) {\n" << " DebugLoc CurDL = MI->getDebugLoc();\n\n" << " if (!CurDL.isUnknown()) {\n" << " static DebugLocTuple PrevDLT(0, ~0U, ~0U);\n" << " DebugLocTuple CurDLT = MF->getDebugLocTuple(CurDL);\n\n" - << " if (CurDLT.CompileUnit != 0 && PrevDLT != CurDLT)\n" + << " if (PrevDLT.CompileUnit != 0 && PrevDLT != CurDLT)\n" << " printLabel(DW->RecordSourceLine(CurDLT.Line, CurDLT.Col,\n" << " DICompileUnit(CurDLT.CompileUnit)));\n\n" << " PrevDLT = CurDLT;\n"