From 10b313581f5aa3836b8e22570cd4cfaa3d61568d Mon Sep 17 00:00:00 2001 From: Derek Schuff Date: Thu, 15 Mar 2018 22:06:51 +0000 Subject: [WebAssembly] Add DebugLoc information to WebAssembly block and loop. Patch by Yury Delendik Differential Revision: https://reviews.llvm.org/D44448 llvm-svn: 327673 --- llvm/lib/CodeGen/MachineBasicBlock.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'llvm/lib/CodeGen/MachineBasicBlock.cpp') diff --git a/llvm/lib/CodeGen/MachineBasicBlock.cpp b/llvm/lib/CodeGen/MachineBasicBlock.cpp index 8fef85f..99e7615 100644 --- a/llvm/lib/CodeGen/MachineBasicBlock.cpp +++ b/llvm/lib/CodeGen/MachineBasicBlock.cpp @@ -1255,6 +1255,16 @@ MachineBasicBlock::findDebugLoc(instr_iterator MBBI) { return {}; } +/// Find the previous valid DebugLoc preceding MBBI, skipping and DBG_VALUE +/// instructions. Return UnknownLoc if there is none. +DebugLoc MachineBasicBlock::findPrevDebugLoc(instr_iterator MBBI) { + if (MBBI == instr_begin()) return {}; + // Skip debug declarations, we don't want a DebugLoc from them. + MBBI = skipDebugInstructionsBackward(std::prev(MBBI), instr_begin()); + if (!MBBI->isDebugValue()) return MBBI->getDebugLoc(); + return {}; +} + /// Find and return the merged DebugLoc of the branch instructions of the block. /// Return UnknownLoc if there is none. DebugLoc -- cgit v1.1