summaryrefslogtreecommitdiff
path: root/src/asmjs
diff options
context:
space:
mode:
authorDaniel Wirtz <dcode@dcode.io>2020-08-17 19:50:37 +0200
committerGitHub <noreply@github.com>2020-08-17 10:50:37 -0700
commit0fdbb1d33810d84bbd9a408b3486bff0d9015989 (patch)
tree54a0955fa5b4640ab0b7538a7c5ba96578de6b7d /src/asmjs
parent5f992018bf0e80a430d9a0169c7f8048e0a98b2b (diff)
downloadbinaryen-0fdbb1d33810d84bbd9a408b3486bff0d9015989.tar.gz
binaryen-0fdbb1d33810d84bbd9a408b3486bff0d9015989.tar.bz2
binaryen-0fdbb1d33810d84bbd9a408b3486bff0d9015989.zip
Prepare for compound types that are single but not basic (#3046)
As a follow-up to https://github.com/WebAssembly/binaryen/pull/3012#pullrequestreview-459686171 this PR prepares for the new compound Signature, Struct and Array types that are single but not basic. This includes: * Renames `Type::getSingle` to `Type::getBasic` (NFC). Previously, its name was not representing its implementation (`isSingle` excluded `none` and `unreachable` while `getSingle` didn't, i.e. `getSingle` really was `getBasic`). Note that a hypothetical `Type::getSingle` cannot return `ValueType` anyway (new compound types are single but don't map to `ValueType`), so I figured it's best to skip implementing it until we actually need it. * Marks locations where we are (still) assuming that all single types are basic types, as suggested in https://github.com/WebAssembly/binaryen/pull/3012#discussion_r465356708, but using a macro, so we get useful errors once we start implementing the new types and can quickly traverse the affected locations. The macro is added where * there used to be a `switch (type.getSingle())` or similar that handled any basic type (NFC), but in the future will also have to handle single types that are not basic types. * we are not dealing with `Unary`, `Binary`, `Load`, `Store` or `AtomicXY` instructions, since these don't deal with compound types anyway.
Diffstat (limited to 'src/asmjs')
-rw-r--r--src/asmjs/asm_v_wasm.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/asmjs/asm_v_wasm.cpp b/src/asmjs/asm_v_wasm.cpp
index 98a6be046..75fc0506b 100644
--- a/src/asmjs/asm_v_wasm.cpp
+++ b/src/asmjs/asm_v_wasm.cpp
@@ -42,7 +42,8 @@ Type asmToWasmType(AsmType asmType) {
}
AsmType wasmToAsmType(Type type) {
- switch (type.getSingle()) {
+ TODO_SINGLE_COMPOUND(type);
+ switch (type.getBasic()) {
case Type::i32:
return ASM_INT;
case Type::f32:
@@ -67,7 +68,8 @@ AsmType wasmToAsmType(Type type) {
}
char getSig(Type type) {
- switch (type.getSingle()) {
+ TODO_SINGLE_COMPOUND(type);
+ switch (type.getBasic()) {
case Type::i32:
return 'i';
case Type::i64: