From a5037484a4999e2f4e15b5e97da2a4d47ac22576 Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Thu, 30 Apr 2009 23:22:31 +0000 Subject: Make DebugLoc independent of DwarfWriter. -Replace DebugLocTuple's Source ID with CompileUnit's GlobalVariable* -Remove DwarfWriter::getOrCreateSourceID -Make necessary changes for the above (fix callsites, etc.) llvm-svn: 70520 --- llvm/lib/CodeGen/SelectionDAG/FastISel.cpp | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) (limited to 'llvm/lib/CodeGen/SelectionDAG/FastISel.cpp') diff --git a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp index 09ac586dd5e..58e84908820 100644 --- a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp @@ -329,13 +329,10 @@ bool FastISel::SelectCall(User *I) { DbgStopPointInst *SPI = cast(I); if (DW && DW->ValidDebugInfo(SPI->getContext(), CodeGenOpt::None)) { DICompileUnit CU(cast(SPI->getContext())); - std::string Dir, FN; - unsigned SrcFile = DW->getOrCreateSourceID(CU.getDirectory(Dir), - CU.getFilename(FN)); unsigned Line = SPI->getLine(); unsigned Col = SPI->getColumn(); - unsigned ID = DW->RecordSourceLine(Line, Col, SrcFile); - unsigned Idx = MF.getOrCreateDebugLocID(SrcFile, Line, Col); + unsigned ID = DW->RecordSourceLine(Line, Col, CU); + unsigned Idx = MF.getOrCreateDebugLocID(CU.getGV(), Line, Col); setCurDebugLoc(DebugLoc::get(Idx)); const TargetInstrDesc &II = TII.get(TargetInstrInfo::DBG_LABEL); BuildMI(MBB, DL, II).addImm(ID); @@ -386,9 +383,6 @@ bool FastISel::SelectCall(User *I) { DebugLoc PrevLoc = DL; DISubprogram Subprogram(cast(SP)); DICompileUnit CompileUnit = Subprogram.getCompileUnit(); - std::string Dir, FN; - unsigned SrcFile = DW->getOrCreateSourceID(CompileUnit.getDirectory(Dir), - CompileUnit.getFilename(FN)); if (!Subprogram.describes(MF.getFunction())) { // This is a beginning of an inlined function. @@ -400,21 +394,23 @@ bool FastISel::SelectCall(User *I) { return true; // Record the source line. unsigned Line = Subprogram.getLineNumber(); - unsigned LabelID = DW->RecordSourceLine(Line, 0, SrcFile); - setCurDebugLoc(DebugLoc::get(MF.getOrCreateDebugLocID(SrcFile, Line, 0))); + unsigned LabelID = DW->RecordSourceLine(Line, 0, CompileUnit); + setCurDebugLoc(DebugLoc::get(MF.getOrCreateDebugLocID( + CompileUnit.getGV(), Line, 0))); const TargetInstrDesc &II = TII.get(TargetInstrInfo::DBG_LABEL); BuildMI(MBB, DL, II).addImm(LabelID); DebugLocTuple PrevLocTpl = MF.getDebugLocTuple(PrevLoc); DW->RecordInlinedFnStart(FSI, Subprogram, LabelID, - PrevLocTpl.Src, + DICompileUnit(PrevLocTpl.CompileUnit), PrevLocTpl.Line, PrevLocTpl.Col); } else { // Record the source line. unsigned Line = Subprogram.getLineNumber(); - setCurDebugLoc(DebugLoc::get(MF.getOrCreateDebugLocID(SrcFile, Line, 0))); - DW->RecordSourceLine(Line, 0, SrcFile); + setCurDebugLoc(DebugLoc::get(MF.getOrCreateDebugLocID( + CompileUnit.getGV(), Line, 0))); + DW->RecordSourceLine(Line, 0, CompileUnit); // llvm.dbg.func_start also defines beginning of function scope. DW->RecordRegionStart(cast(FSI->getSubprogram())); } -- cgit v1.2.3