diff options
author | Thomas Lively <tlively@google.com> | 2023-04-06 13:35:12 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-06 20:35:12 +0000 |
commit | 4f91c6a569614275d906a825d3f495541aa8802d (patch) | |
tree | 26b438a2aeec65e93a219da792b928b7c9c0eece /src/passes/Print.cpp | |
parent | 6afbc200b57acd1b9111de7729d47fea1d04c5f6 (diff) | |
download | binaryen-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/passes/Print.cpp')
-rw-r--r-- | src/passes/Print.cpp | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/src/passes/Print.cpp b/src/passes/Print.cpp index 9f765bb79..650a17203 100644 --- a/src/passes/Print.cpp +++ b/src/passes/Print.cpp @@ -2273,7 +2273,6 @@ struct PrintExpressionContents switch (curr->op) { case NewData: printMedium(o, "data"); - break; case NewElem: printMedium(o, "elem"); @@ -2327,6 +2326,30 @@ struct PrintExpressionContents o << ' '; TypeNamePrinter(o, wasm).print(curr->srcRef->type.getHeapType()); } + void visitArrayFill(ArrayFill* curr) { + if (printUnreachableOrNullReplacement(curr->ref)) { + return; + } + printMedium(o, "array.fill "); + TypeNamePrinter(o, wasm).print(curr->ref->type.getHeapType()); + } + void visitArrayInit(ArrayInit* curr) { + if (printUnreachableOrNullReplacement(curr->ref)) { + return; + } + switch (curr->op) { + case InitData: + printMedium(o, "array.init_data "); + break; + case InitElem: + printMedium(o, "array.init_elem "); + break; + default: + WASM_UNREACHABLE("unexpected op"); + } + TypeNamePrinter(o, wasm).print(curr->ref->type.getHeapType()); + o << " $" << curr->segment; + } void visitRefAs(RefAs* curr) { switch (curr->op) { case RefAsNonNull: |