diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2009-05-20 22:57:17 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2009-05-20 22:57:17 +0000 |
commit | a3437647dc6996499db4823c31242184c93e6e2e (patch) | |
tree | b11e9216b210aa292c44b188250195ef8292d4b3 /lib/CodeGen/SelectionDAG/FastISel.cpp | |
parent | b60182f1b0218e0196c78f1cfeda2cf223a47146 (diff) |
Introduce DebugScope which gets embedded into the machine instructions' DebugLoc.
DebugScope refers to a debug region, function or block.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72191 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/FastISel.cpp')
-rw-r--r-- | lib/CodeGen/SelectionDAG/FastISel.cpp | 38 |
1 files changed, 26 insertions, 12 deletions
diff --git a/lib/CodeGen/SelectionDAG/FastISel.cpp b/lib/CodeGen/SelectionDAG/FastISel.cpp index 367cf4cd5c..1c05b0a6ce 100644 --- a/lib/CodeGen/SelectionDAG/FastISel.cpp +++ b/lib/CodeGen/SelectionDAG/FastISel.cpp @@ -331,17 +331,22 @@ bool FastISel::SelectCall(User *I) { DICompileUnit CU(cast<GlobalVariable>(SPI->getContext())); unsigned Line = SPI->getLine(); unsigned Col = SPI->getColumn(); - unsigned Idx = MF.getOrCreateDebugLocID(CU.getGV(), Line, Col); + unsigned Idx = MF.getOrCreateDebugLocID(CU.getGV(), + DbgScopeTrack.getCurScope(), + Line, Col); setCurDebugLoc(DebugLoc::get(Idx)); } return true; } case Intrinsic::dbg_region_start: { DbgRegionStartInst *RSI = cast<DbgRegionStartInst>(I); - if (DIDescriptor::ValidDebugInfo(RSI->getContext(), CodeGenOpt::None) && - DW && DW->ShouldEmitDwarfDebug()) { - unsigned ID = - DW->RecordRegionStart(cast<GlobalVariable>(RSI->getContext())); + if (!DIDescriptor::ValidDebugInfo(RSI->getContext(), CodeGenOpt::None)) + return true; + + GlobalVariable *Rgn = cast<GlobalVariable>(RSI->getContext()); + DbgScopeTrack.EnterDebugScope(Rgn, MF); + if (DW && DW->ShouldEmitDwarfDebug()) { + unsigned ID = DW->RecordRegionStart(Rgn); const TargetInstrDesc &II = TII.get(TargetInstrInfo::DBG_LABEL); BuildMI(MBB, DL, II).addImm(ID); } @@ -349,10 +354,14 @@ bool FastISel::SelectCall(User *I) { } case Intrinsic::dbg_region_end: { DbgRegionEndInst *REI = cast<DbgRegionEndInst>(I); - if (DIDescriptor::ValidDebugInfo(REI->getContext(), CodeGenOpt::None) && - DW && DW->ShouldEmitDwarfDebug()) { + if (!DIDescriptor::ValidDebugInfo(REI->getContext(), CodeGenOpt::None)) + return true; + + GlobalVariable *Rgn = cast<GlobalVariable>(REI->getContext()); + DbgScopeTrack.ExitDebugScope(Rgn, MF); + if (DW && DW->ShouldEmitDwarfDebug()) { unsigned ID = 0; - DISubprogram Subprogram(cast<GlobalVariable>(REI->getContext())); + DISubprogram Subprogram(Rgn); if (!Subprogram.isNull() && !Subprogram.describes(MF.getFunction())) { // This is end of an inlined function. const TargetInstrDesc &II = TII.get(TargetInstrInfo::DBG_LABEL); @@ -382,6 +391,7 @@ bool FastISel::SelectCall(User *I) { DebugLoc PrevLoc = DL; DISubprogram Subprogram(cast<GlobalVariable>(SP)); DICompileUnit CompileUnit = Subprogram.getCompileUnit(); + DbgScopeTrack.EnterDebugScope(Subprogram.getGV(), MF); if (!Subprogram.describes(MF.getFunction())) { // This is a beginning of an inlined function. @@ -393,8 +403,10 @@ bool FastISel::SelectCall(User *I) { return true; // Record the source line. unsigned Line = Subprogram.getLineNumber(); - setCurDebugLoc(DebugLoc::get(MF.getOrCreateDebugLocID( - CompileUnit.getGV(), Line, 0))); + setCurDebugLoc( + DebugLoc::get(MF.getOrCreateDebugLocID(CompileUnit.getGV(), + DbgScopeTrack.getCurScope(), + Line, 0))); if (DW && DW->ShouldEmitDwarfDebug()) { DebugLocTuple PrevLocTpl = MF.getDebugLocTuple(PrevLoc); @@ -408,8 +420,10 @@ bool FastISel::SelectCall(User *I) { } else { // Record the source line. unsigned Line = Subprogram.getLineNumber(); - MF.setDefaultDebugLoc(DebugLoc::get(MF.getOrCreateDebugLocID( - CompileUnit.getGV(), Line, 0))); + MF.setDefaultDebugLoc( + DebugLoc::get(MF.getOrCreateDebugLocID(CompileUnit.getGV(), + DbgScopeTrack.getCurScope(), + Line, 0))); if (DW && DW->ShouldEmitDwarfDebug()) { // llvm.dbg.func_start also defines beginning of function scope. DW->RecordRegionStart(cast<GlobalVariable>(FSI->getSubprogram())); |