diff options
author | Thomas Lively <tlively@google.com> | 2020-02-05 22:35:01 -0800 |
---|---|---|
committer | Thomas Lively <tlively@google.com> | 2020-02-18 13:49:46 -0800 |
commit | 9d37f5afac4a3b9194b9001bed84f58ca8bd6c02 (patch) | |
tree | 72449add2d5916fae1f5954b8af5b5074ea0cce9 /llvm/lib/Target/WebAssembly/WebAssemblyUtilities.cpp | |
parent | d51910967fd34ca6462dc2211cb954d22367da9b (diff) | |
download | llvm-9d37f5afac4a3b9194b9001bed84f58ca8bd6c02.zip llvm-9d37f5afac4a3b9194b9001bed84f58ca8bd6c02.tar.gz llvm-9d37f5afac4a3b9194b9001bed84f58ca8bd6c02.tar.bz2 |
[WebAssembly] Implement multivalue call_indirects
Summary:
Unlike normal calls, call_indirects have immediate arguments that
caused a MachineVerifier failure without a small tweak to loosen the
verifier's requirements for variadicOpsAreDefs instructions.
One nice thing about the new call_indirects is that they do not need
to participate in the PCALL_INDIRECT mechanism because their post-isel
hook handles moving the function pointer argument and adding the flags
and typeindex arguments itself.
Reviewers: aheejin
Subscribers: dschuff, sbc100, jgravelle-google, hiraditya, sunfish, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D74191
Diffstat (limited to 'llvm/lib/Target/WebAssembly/WebAssemblyUtilities.cpp')
-rw-r--r-- | llvm/lib/Target/WebAssembly/WebAssemblyUtilities.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyUtilities.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyUtilities.cpp index 5b77798..1e04438 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyUtilities.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyUtilities.cpp @@ -80,7 +80,7 @@ bool WebAssembly::mayThrow(const MachineInstr &MI) { return true; } -inline const MachineOperand &getCalleeOp(const MachineInstr &MI) { +const MachineOperand &WebAssembly::getCalleeOp(const MachineInstr &MI) { switch (MI.getOpcode()) { case WebAssembly::CALL_VOID: case WebAssembly::CALL_VOID_S: @@ -138,7 +138,10 @@ inline const MachineOperand &getCalleeOp(const MachineInstr &MI) { return MI.getOperand(1); case WebAssembly::CALL: case WebAssembly::CALL_S: - return MI.getOperand(MI.getNumDefs()); + return MI.getOperand(MI.getNumExplicitDefs()); + case WebAssembly::CALL_INDIRECT: + case WebAssembly::CALL_INDIRECT_S: + return MI.getOperand(MI.getNumOperands() - 1); default: llvm_unreachable("Not a call instruction"); } |