summaryrefslogtreecommitdiff
path: root/src/wasm-builder.h
diff options
context:
space:
mode:
authorThomas Lively <tlively@google.com>2023-04-06 13:35:12 -0700
committerGitHub <noreply@github.com>2023-04-06 20:35:12 +0000
commit4f91c6a569614275d906a825d3f495541aa8802d (patch)
tree26b438a2aeec65e93a219da792b928b7c9c0eece /src/wasm-builder.h
parent6afbc200b57acd1b9111de7729d47fea1d04c5f6 (diff)
downloadbinaryen-4f91c6a569614275d906a825d3f495541aa8802d.tar.gz
binaryen-4f91c6a569614275d906a825d3f495541aa8802d.tar.bz2
binaryen-4f91c6a569614275d906a825d3f495541aa8802d.zip
Implement array.fill, array.init_data, and array.init_elem (#5637)
These complement array.copy, which we already supported, as an initial complete set of bulk array operations. Replace the WIP spec tests with the upstream spec tests, lightly edited for compatibility with Binaryen.
Diffstat (limited to 'src/wasm-builder.h')
-rw-r--r--src/wasm-builder.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/wasm-builder.h b/src/wasm-builder.h
index dbddb248b..020badf16 100644
--- a/src/wasm-builder.h
+++ b/src/wasm-builder.h
@@ -991,6 +991,34 @@ public:
ret->finalize();
return ret;
}
+ ArrayFill* makeArrayFill(Expression* ref,
+ Expression* index,
+ Expression* value,
+ Expression* size) {
+ auto* ret = wasm.allocator.alloc<ArrayFill>();
+ ret->ref = ref;
+ ret->index = index;
+ ret->value = value;
+ ret->size = size;
+ ret->finalize();
+ return ret;
+ }
+ ArrayInit* makeArrayInit(ArrayInitOp op,
+ Name seg,
+ Expression* ref,
+ Expression* index,
+ Expression* offset,
+ Expression* size) {
+ auto* ret = wasm.allocator.alloc<ArrayInit>();
+ ret->op = op;
+ ret->segment = seg;
+ ret->ref = ref;
+ ret->index = index;
+ ret->offset = offset;
+ ret->size = size;
+ ret->finalize();
+ return ret;
+ }
RefAs* makeRefAs(RefAsOp op, Expression* value) {
auto* ret = wasm.allocator.alloc<RefAs>();
ret->op = op;