diff options
author | Derek Schuff <dschuff@chromium.org> | 2016-10-06 15:55:21 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-06 15:55:21 -0700 |
commit | 7b637b77437157fdf207304e3179079a78de72b9 (patch) | |
tree | 435c648cdc4450ecbb4c148e229a7e0c73d2b5d0 /src | |
parent | b910f49ede15d27391418b0056e1817e462d855f (diff) | |
download | binaryen-7b637b77437157fdf207304e3179079a78de72b9.tar.gz binaryen-7b637b77437157fdf207304e3179079a78de72b9.tar.bz2 binaryen-7b637b77437157fdf207304e3179079a78de72b9.zip |
Update s2wasm for removal of store results (#749)
Corresponds to LLVM change https://reviews.llvm.org/D25122
Diffstat (limited to 'src')
-rw-r--r-- | src/s2wasm.h | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/s2wasm.h b/src/s2wasm.h index 383ff1e36..d7aa69945 100644 --- a/src/s2wasm.h +++ b/src/s2wasm.h @@ -837,12 +837,15 @@ class S2WasmBuilder { setOutput(curr, assign); }; auto makeStore = [&](WasmType type) { - skipComma(); auto curr = allocator->alloc<Store>(); curr->valueType = type; - int32_t bytes = getInt() / CHAR_BIT; - curr->bytes = bytes > 0 ? bytes : getWasmTypeSize(type); - Name assign = getAssign(); + s += strlen("store"); + if(!isspace(*s)) { + curr->bytes = getInt() / CHAR_BIT; + } else { + curr->bytes = getWasmTypeSize(type); + } + skipWhitespace(); getRelocatableConst(&curr->offset.addr); mustMatch("("); auto attributes = getAttributes(2); @@ -855,7 +858,7 @@ class S2WasmBuilder { } curr->value = inputs[1]; curr->finalize(); - setOutput(curr, assign); + addToBlock(curr); }; auto makeSelect = [&](WasmType type) { Name assign = getAssign(); @@ -1029,7 +1032,7 @@ class S2WasmBuilder { else if (match("shr_u")) makeBinary(BINARY_INT(ShrU), type); else if (match("shl")) makeBinary(BINARY_INT(Shl), type); else if (match("sub")) makeBinary(BINARY_INT_OR_FLOAT(Sub), type); - else if (match("store")) makeStore(type); + else if (peek("store")) makeStore(type); else if (match("select")) makeSelect(type); else if (match("sqrt")) makeUnary(type == f32 ? UnaryOp::SqrtFloat32 : UnaryOp::SqrtFloat64, type); else abort_on("type.s"); |