aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Target/WebAssembly/WebAssemblyMCInstLower.cpp
diff options
context:
space:
mode:
authorAndy Wingo <wingo@igalia.com>2020-11-03 10:46:23 -0800
committerThomas Lively <tlively@google.com>2020-11-03 10:46:23 -0800
commit107c3a12d627f12a23f138a00d6aabe9de7402f7 (patch)
tree956497feb7d3fde2dd7af347b539891e618f2f93 /llvm/lib/Target/WebAssembly/WebAssemblyMCInstLower.cpp
parentca5b31502c828f8e7160a77f54a5a131dc298005 (diff)
downloadllvm-107c3a12d627f12a23f138a00d6aabe9de7402f7.zip
llvm-107c3a12d627f12a23f138a00d6aabe9de7402f7.tar.gz
llvm-107c3a12d627f12a23f138a00d6aabe9de7402f7.tar.bz2
[WebAssembly] Implement ref.null
This patch adds a new "heap type" operand kind to the WebAssembly MC layer, used by ref.null. Currently the possible values are "extern" and "func"; when typed function references come, though, this operand may be a type index. Note that the "heap type" production is still known as "refedtype" in the draft proposal; changing its name in the spec is ongoing (https://github.com/WebAssembly/reference-types/issues/123). The register form of ref.null is still untested. Differential Revision: https://reviews.llvm.org/D90608
Diffstat (limited to 'llvm/lib/Target/WebAssembly/WebAssemblyMCInstLower.cpp')
-rw-r--r--llvm/lib/Target/WebAssembly/WebAssemblyMCInstLower.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyMCInstLower.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyMCInstLower.cpp
index 7774a0d..09d1b96 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyMCInstLower.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyMCInstLower.cpp
@@ -271,6 +271,11 @@ void WebAssemblyMCInstLower::lower(const MachineInstr *MI,
SmallVector<wasm::ValType, 4>());
break;
}
+ } else if (Info.OperandType == WebAssembly::OPERAND_HEAPTYPE) {
+ auto HT = static_cast<WebAssembly::HeapType>(MO.getImm());
+ assert(HT != WebAssembly::HeapType::Invalid);
+ // With typed function references, this will need a case for type
+ // index operands. Otherwise, fall through.
}
}
MCOp = MCOperand::createImm(MO.getImm());