aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Target/WebAssembly/Utils/WebAssemblyUtilities.cpp
diff options
context:
space:
mode:
authorHeejin Ahn <aheejin@gmail.com>2021-05-21 12:12:44 -0700
committerHeejin Ahn <aheejin@gmail.com>2021-05-26 11:43:59 -0700
commit5dd86aadf0b014913bd35bb7435808eb081bc049 (patch)
tree978ea3eb99b6eaf8b12c2f07cf489492b8623186 /llvm/lib/Target/WebAssembly/Utils/WebAssemblyUtilities.cpp
parent5bfe06ad3590d5aeb14c2fc3fae729abc6412cb3 (diff)
downloadllvm-5dd86aadf0b014913bd35bb7435808eb081bc049.zip
llvm-5dd86aadf0b014913bd35bb7435808eb081bc049.tar.gz
llvm-5dd86aadf0b014913bd35bb7435808eb081bc049.tar.bz2
[WebAssembly] Add TargetInstrInfo::getCalleeOperand
DwarfDebug unconditionally assumes for all call instructions the 0th operand is the callee operand, which seems to be true for other targets, but not for WebAssembly. This adds `TargetInstrInfo::getCallOperand` method whose default implementation returns `getOperand(0)` and makes WebAssembly overrides it to use its own utility method to get the callee operand. This also fixes an existing bug in `WebAssembly::getCalleeOp`, which was uncovered by this CL. Reviewed By: dschuff, djtodoro Differential Revision: https://reviews.llvm.org/D102978
Diffstat (limited to 'llvm/lib/Target/WebAssembly/Utils/WebAssemblyUtilities.cpp')
-rw-r--r--llvm/lib/Target/WebAssembly/Utils/WebAssemblyUtilities.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Target/WebAssembly/Utils/WebAssemblyUtilities.cpp b/llvm/lib/Target/WebAssembly/Utils/WebAssemblyUtilities.cpp
index b9344bb..824d336 100644
--- a/llvm/lib/Target/WebAssembly/Utils/WebAssemblyUtilities.cpp
+++ b/llvm/lib/Target/WebAssembly/Utils/WebAssemblyUtilities.cpp
@@ -91,7 +91,7 @@ const MachineOperand &WebAssembly::getCalleeOp(const MachineInstr &MI) {
case WebAssembly::CALL_INDIRECT_S:
case WebAssembly::RET_CALL_INDIRECT:
case WebAssembly::RET_CALL_INDIRECT_S:
- return MI.getOperand(MI.getNumOperands() - 1);
+ return MI.getOperand(MI.getNumExplicitOperands() - 1);
default:
llvm_unreachable("Not a call instruction");
}