diff options
author | Derek Schuff <dschuff@google.com> | 2018-03-15 22:06:51 +0000 |
---|---|---|
committer | Derek Schuff <dschuff@google.com> | 2018-03-15 22:06:51 +0000 |
commit | 10b313581f5aa3836b8e22570cd4cfaa3d61568d (patch) | |
tree | 3ce6c3a380599508b6fb8f9753eb256cf4bf9979 /llvm/lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp | |
parent | 7b14e7f041187b1ec63c55adb9dda6f39750ea1d (diff) | |
download | bcm5719-llvm-10b313581f5aa3836b8e22570cd4cfaa3d61568d.tar.gz bcm5719-llvm-10b313581f5aa3836b8e22570cd4cfaa3d61568d.zip |
[WebAssembly] Add DebugLoc information to WebAssembly block and loop.
Patch by Yury Delendik
Differential Revision: https://reviews.llvm.org/D44448
llvm-svn: 327673
Diffstat (limited to 'llvm/lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp')
-rw-r--r-- | llvm/lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp index cab21007d3f..5a8ddadb0c9 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp @@ -143,9 +143,9 @@ static void PlaceBlockMarker( } // Add the BLOCK. - MachineInstr *Begin = BuildMI(*Header, InsertPos, DebugLoc(), + MachineInstr *Begin = BuildMI(*Header, InsertPos, MBB.findDebugLoc(InsertPos), TII.get(WebAssembly::BLOCK)) - .addImm(int64_t(WebAssembly::ExprType::Void)); + .addImm(int64_t(WebAssembly::ExprType::Void)); // Mark the end of the block. InsertPos = MBB.begin(); @@ -153,7 +153,7 @@ static void PlaceBlockMarker( InsertPos->getOpcode() == WebAssembly::END_LOOP && LoopTops[&*InsertPos]->getParent()->getNumber() >= Header->getNumber()) ++InsertPos; - MachineInstr *End = BuildMI(MBB, InsertPos, DebugLoc(), + MachineInstr *End = BuildMI(MBB, InsertPos, MBB.findPrevDebugLoc(InsertPos), TII.get(WebAssembly::END_BLOCK)); BlockTops[End] = Begin; @@ -193,12 +193,14 @@ static void PlaceLoopMarker( while (InsertPos != MBB.end() && InsertPos->getOpcode() == WebAssembly::END_LOOP) ++InsertPos; - MachineInstr *Begin = BuildMI(MBB, InsertPos, DebugLoc(), + MachineInstr *Begin = BuildMI(MBB, InsertPos, MBB.findDebugLoc(InsertPos), TII.get(WebAssembly::LOOP)) - .addImm(int64_t(WebAssembly::ExprType::Void)); + .addImm(int64_t(WebAssembly::ExprType::Void)); - // Mark the end of the loop. - MachineInstr *End = BuildMI(*AfterLoop, AfterLoop->begin(), DebugLoc(), + // Mark the end of the loop (using arbitrary debug location that branched + // to the loop end as its location). + DebugLoc EndDL = (*AfterLoop->pred_rbegin())->findBranchDebugLoc(); + MachineInstr *End = BuildMI(*AfterLoop, AfterLoop->begin(), EndDL, TII.get(WebAssembly::END_LOOP)); LoopTops[End] = Begin; @@ -276,7 +278,8 @@ static void FixEndsAtEndOfFunction( static void AppendEndToFunction( MachineFunction &MF, const WebAssemblyInstrInfo &TII) { - BuildMI(MF.back(), MF.back().end(), DebugLoc(), + BuildMI(MF.back(), MF.back().end(), + MF.back().findPrevDebugLoc(MF.back().end()), TII.get(WebAssembly::END_FUNCTION)); } |