diff options
author | Thomas Lively <tlively@google.com> | 2024-01-04 14:25:18 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-04 14:25:18 -0800 |
commit | a58281ca114359cd6e65f5daaf086636aa18b0b0 (patch) | |
tree | ff98bd31d1c87b598027c2303b17855a44346515 /test/passes/print_g.bin.txt | |
parent | 0ed42cf976ce9a3dfbe9cbb0885122e8fb6a377b (diff) | |
download | binaryen-a58281ca114359cd6e65f5daaf086636aa18b0b0.tar.gz binaryen-a58281ca114359cd6e65f5daaf086636aa18b0b0.tar.bz2 binaryen-a58281ca114359cd6e65f5daaf086636aa18b0b0.zip |
Require `then` and `else` with `if` (#6201)
We previously supported (and primarily used) a non-standard text format for
conditionals in which the condition, if-true expression, and if-false expression
were all simply s-expression children of the `if` expression. The standard text
format, however, requires the use of `then` and `else` forms to introduce the
if-true and if-false arms of the conditional. Update the legacy text parser to
require the standard format and update all tests to match. Update the printer to
print the standard format as well.
The .wast and .wat test inputs were mechanically updated with this script:
https://gist.github.com/tlively/85ae7f01f92f772241ec994c840ccbb1
Diffstat (limited to 'test/passes/print_g.bin.txt')
-rw-r--r-- | test/passes/print_g.bin.txt | 136 |
1 files changed, 70 insertions, 66 deletions
diff --git a/test/passes/print_g.bin.txt b/test/passes/print_g.bin.txt index 21f31a831..174230388 100644 --- a/test/passes/print_g.bin.txt +++ b/test/passes/print_g.bin.txt @@ -33,49 +33,51 @@ ;; code offset: 0xd (i32.const 55) ) - ;; code offset: 0x12 - (loop $label$2 - ;; code offset: 0x2e - (br_if $label$2 - ;; code offset: 0x2d - (i32.ne - ;; code offset: 0x2a - (i32.rem_s - ;; code offset: 0x25 - (local.tee $0 - ;; code offset: 0x24 - (i32.add - ;; code offset: 0x21 + (then + ;; code offset: 0x12 + (loop $label$2 + ;; code offset: 0x2e + (br_if $label$2 + ;; code offset: 0x2d + (i32.ne + ;; code offset: 0x2a + (i32.rem_s + ;; code offset: 0x25 + (local.tee $0 + ;; code offset: 0x24 (i32.add - ;; code offset: 0x1b - (i32.mul - ;; code offset: 0x18 + ;; code offset: 0x21 + (i32.add + ;; code offset: 0x1b (i32.mul - ;; code offset: 0x14 + ;; code offset: 0x18 + (i32.mul + ;; code offset: 0x14 + (local.get $0) + ;; code offset: 0x16 + (local.get $0) + ) + ;; code offset: 0x19 (local.get $0) - ;; code offset: 0x16 + ) + ;; code offset: 0x20 + (i32.div_s + ;; code offset: 0x1c (local.get $0) + ;; code offset: 0x1e + (i32.const -2) ) - ;; code offset: 0x19 - (local.get $0) - ) - ;; code offset: 0x20 - (i32.div_s - ;; code offset: 0x1c - (local.get $0) - ;; code offset: 0x1e - (i32.const -2) ) + ;; code offset: 0x22 + (i32.const 13) ) - ;; code offset: 0x22 - (i32.const 13) ) + ;; code offset: 0x27 + (i32.const 120) ) - ;; code offset: 0x27 - (i32.const 120) + ;; code offset: 0x2b + (i32.const 55) ) - ;; code offset: 0x2b - (i32.const 55) ) ) ) @@ -163,49 +165,51 @@ ;; code offset: 0xd (i32.const 55) ) - ;; code offset: 0x12 - (loop $label$2 - ;; code offset: 0x2e - (br_if $label$2 - ;; code offset: 0x2d - (i32.ne - ;; code offset: 0x2a - (i32.rem_s - ;; code offset: 0x25 - (local.tee $0 - ;; code offset: 0x24 - (i32.add - ;; code offset: 0x21 + (then + ;; code offset: 0x12 + (loop $label$2 + ;; code offset: 0x2e + (br_if $label$2 + ;; code offset: 0x2d + (i32.ne + ;; code offset: 0x2a + (i32.rem_s + ;; code offset: 0x25 + (local.tee $0 + ;; code offset: 0x24 (i32.add - ;; code offset: 0x1b - (i32.mul - ;; code offset: 0x18 + ;; code offset: 0x21 + (i32.add + ;; code offset: 0x1b (i32.mul - ;; code offset: 0x14 + ;; code offset: 0x18 + (i32.mul + ;; code offset: 0x14 + (local.get $0) + ;; code offset: 0x16 + (local.get $0) + ) + ;; code offset: 0x19 (local.get $0) - ;; code offset: 0x16 + ) + ;; code offset: 0x20 + (i32.div_s + ;; code offset: 0x1c (local.get $0) + ;; code offset: 0x1e + (i32.const -2) ) - ;; code offset: 0x19 - (local.get $0) - ) - ;; code offset: 0x20 - (i32.div_s - ;; code offset: 0x1c - (local.get $0) - ;; code offset: 0x1e - (i32.const -2) ) + ;; code offset: 0x22 + (i32.const 13) ) - ;; code offset: 0x22 - (i32.const 13) ) + ;; code offset: 0x27 + (i32.const 120) ) - ;; code offset: 0x27 - (i32.const 120) + ;; code offset: 0x2b + (i32.const 55) ) - ;; code offset: 0x2b - (i32.const 55) ) ) ) |