diff options
author | Thomas Lively <7121787+tlively@users.noreply.github.com> | 2019-02-05 12:35:09 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-05 12:35:09 -0800 |
commit | f424f81886405fc26a415fc86900c0f8d0df14eb (patch) | |
tree | 5896c316f216fca9654f55e41809839d181ca53b /src/wasm/wasm-s-parser.cpp | |
parent | 484f62f985cb2180139d1cf991ac04ee41635417 (diff) | |
download | binaryen-f424f81886405fc26a415fc86900c0f8d0df14eb.tar.gz binaryen-f424f81886405fc26a415fc86900c0f8d0df14eb.tar.bz2 binaryen-f424f81886405fc26a415fc86900c0f8d0df14eb.zip |
Bulk memory operations (#1892)
Bulk memory operations
The only parts missing are the interpreter implementation
and spec tests.
Diffstat (limited to 'src/wasm/wasm-s-parser.cpp')
-rw-r--r-- | src/wasm/wasm-s-parser.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/wasm/wasm-s-parser.cpp b/src/wasm/wasm-s-parser.cpp index eca4c7493..09cc044bf 100644 --- a/src/wasm/wasm-s-parser.cpp +++ b/src/wasm/wasm-s-parser.cpp @@ -1134,6 +1134,41 @@ Expression* SExpressionWasmBuilder::makeSIMDShift(Element& s, SIMDShiftOp op) { return ret; } +Expression* SExpressionWasmBuilder::makeMemoryInit(Element& s) { + auto ret = allocator.alloc<MemoryInit>(); + ret->segment = atoi(s[1]->str().c_str()); + ret->dest = parseExpression(s[2]); + ret->offset = parseExpression(s[3]); + ret->size = parseExpression(s[4]); + ret->finalize(); + return ret; +} + +Expression* SExpressionWasmBuilder::makeDataDrop(Element& s) { + auto ret = allocator.alloc<DataDrop>(); + ret->segment = atoi(s[1]->str().c_str()); + ret->finalize(); + return ret; +} + +Expression* SExpressionWasmBuilder::makeMemoryCopy(Element& s) { + auto ret = allocator.alloc<MemoryCopy>(); + ret->dest = parseExpression(s[1]); + ret->source = parseExpression(s[2]); + ret->size = parseExpression(s[3]); + ret->finalize(); + return ret; +} + +Expression* SExpressionWasmBuilder::makeMemoryFill(Element& s) { + auto ret = allocator.alloc<MemoryFill>(); + ret->dest = parseExpression(s[1]); + ret->value = parseExpression(s[2]); + ret->size = parseExpression(s[3]); + ret->finalize(); + return ret; +} + Expression* SExpressionWasmBuilder::makeIf(Element& s) { auto ret = allocator.alloc<If>(); Index i = 1; |