aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineBasicBlock.cpp
diff options
context:
space:
mode:
authorDerek Schuff <dschuff@google.com>2018-03-15 22:06:51 +0000
committerDerek Schuff <dschuff@google.com>2018-03-15 22:06:51 +0000
commit10b313581f5aa3836b8e22570cd4cfaa3d61568d (patch)
tree3ce6c3a380599508b6fb8f9753eb256cf4bf9979 /llvm/lib/CodeGen/MachineBasicBlock.cpp
parent7b14e7f041187b1ec63c55adb9dda6f39750ea1d (diff)
downloadllvm-10b313581f5aa3836b8e22570cd4cfaa3d61568d.zip
llvm-10b313581f5aa3836b8e22570cd4cfaa3d61568d.tar.gz
llvm-10b313581f5aa3836b8e22570cd4cfaa3d61568d.tar.bz2
[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/CodeGen/MachineBasicBlock.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineBasicBlock.cpp10
1 files changed, 10 insertions, 0 deletions
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