diff options
author | Thomas Lively <tlively@google.com> | 2024-11-26 21:57:29 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-26 21:57:29 -0800 |
commit | f8e1622bf0835dec2bb97bcb73281d34dbde4e2d (patch) | |
tree | 76bfc786e8dc113005be6167721b94ae4639e137 /test/lit/string.as_wtf16.wast | |
parent | 6f0f2e00521843118b63f41732dc2eb86d39fa09 (diff) | |
download | binaryen-f8e1622bf0835dec2bb97bcb73281d34dbde4e2d.tar.gz binaryen-f8e1622bf0835dec2bb97bcb73281d34dbde4e2d.tar.bz2 binaryen-f8e1622bf0835dec2bb97bcb73281d34dbde4e2d.zip |
Use IRBuilder in the binary parser (#6963)
IRBuilder is a utility for turning arbitrary valid streams of Wasm
instructions into valid Binaryen IR. It is already used in the text
parser, so now use it in the binary parser as well. Since the IRBuilder
API for building each intruction requires only the information that the
binary and text formats include as immediates to that instruction, the
parser is now much simpler than before. In particular, it does not need
to manage a stack of instructions to figure out what the children of
each expression should be; IRBuilder handles this instead.
There are some differences between the IR constructed by IRBuilder and
the IR the binary parser constructed before this change. Most
importantly, IRBuilder generates better multivalue code because it
avoids eagerly breaking up multivalue results into individual components
that might need to be immediately reassembled into a tuple. It also
parses try-delegate more correctly, allowing the delegate to target
arbitrary labels, not just other `try`s. There are also a couple
superficial differences in the generated label and scratch local names.
As part of this change, add support for recording binary source
locations in IRBuilder.
Diffstat (limited to 'test/lit/string.as_wtf16.wast')
-rw-r--r-- | test/lit/string.as_wtf16.wast | 98 |
1 files changed, 49 insertions, 49 deletions
diff --git a/test/lit/string.as_wtf16.wast b/test/lit/string.as_wtf16.wast index 60bdcf5ec..74bbc97ea 100644 --- a/test/lit/string.as_wtf16.wast +++ b/test/lit/string.as_wtf16.wast @@ -26,33 +26,33 @@ ;; CHECK-NEXT: ) ;; RTRIP: (func $codeunit (type $1) (result i32) ;; RTRIP-NEXT: (local $0 i32) - ;; RTRIP-NEXT: (local $1 (ref string)) + ;; RTRIP-NEXT: (local $scratch (ref string)) ;; RTRIP-NEXT: (stringview_wtf16.get_codeunit ;; RTRIP-NEXT: (block (result (ref string)) - ;; RTRIP-NEXT: (local.set $1 + ;; RTRIP-NEXT: (local.set $scratch ;; RTRIP-NEXT: (string.const "abc") ;; RTRIP-NEXT: ) ;; RTRIP-NEXT: (local.set $0 ;; RTRIP-NEXT: (i32.const 0) ;; RTRIP-NEXT: ) - ;; RTRIP-NEXT: (local.get $1) + ;; RTRIP-NEXT: (local.get $scratch) ;; RTRIP-NEXT: ) ;; RTRIP-NEXT: (local.get $0) ;; RTRIP-NEXT: ) ;; RTRIP-NEXT: ) ;; RRTRP: (func $codeunit (type $1) (result i32) ;; RRTRP-NEXT: (local $0 i32) - ;; RRTRP-NEXT: (local $1 (ref string)) - ;; RRTRP-NEXT: (local $2 (ref string)) + ;; RRTRP-NEXT: (local $scratch (ref string)) + ;; RRTRP-NEXT: (local $scratch_2 (ref string)) ;; RRTRP-NEXT: (stringview_wtf16.get_codeunit ;; RRTRP-NEXT: (block (result (ref string)) - ;; RRTRP-NEXT: (local.set $2 + ;; RRTRP-NEXT: (local.set $scratch_2 ;; RRTRP-NEXT: (string.const "abc") ;; RRTRP-NEXT: ) ;; RRTRP-NEXT: (local.set $0 ;; RRTRP-NEXT: (i32.const 0) ;; RRTRP-NEXT: ) - ;; RRTRP-NEXT: (local.get $2) + ;; RRTRP-NEXT: (local.get $scratch_2) ;; RRTRP-NEXT: ) ;; RRTRP-NEXT: (local.get $0) ;; RRTRP-NEXT: ) @@ -108,25 +108,25 @@ ;; RTRIP: (func $slice (type $0) (result stringref) ;; RTRIP-NEXT: (local $0 i32) ;; RTRIP-NEXT: (local $1 i32) - ;; RTRIP-NEXT: (local $2 i32) - ;; RTRIP-NEXT: (local $3 (ref string)) + ;; RTRIP-NEXT: (local $scratch i32) + ;; RTRIP-NEXT: (local $scratch_3 (ref string)) ;; RTRIP-NEXT: (stringview_wtf16.slice ;; RTRIP-NEXT: (block (result (ref string)) - ;; RTRIP-NEXT: (local.set $3 + ;; RTRIP-NEXT: (local.set $scratch_3 ;; RTRIP-NEXT: (string.const "abc") ;; RTRIP-NEXT: ) ;; RTRIP-NEXT: (local.set $0 ;; RTRIP-NEXT: (block (result i32) - ;; RTRIP-NEXT: (local.set $2 + ;; RTRIP-NEXT: (local.set $scratch ;; RTRIP-NEXT: (i32.const 1) ;; RTRIP-NEXT: ) ;; RTRIP-NEXT: (local.set $1 ;; RTRIP-NEXT: (i32.const 2) ;; RTRIP-NEXT: ) - ;; RTRIP-NEXT: (local.get $2) + ;; RTRIP-NEXT: (local.get $scratch) ;; RTRIP-NEXT: ) ;; RTRIP-NEXT: ) - ;; RTRIP-NEXT: (local.get $3) + ;; RTRIP-NEXT: (local.get $scratch_3) ;; RTRIP-NEXT: ) ;; RTRIP-NEXT: (local.get $0) ;; RTRIP-NEXT: (local.get $1) @@ -135,27 +135,27 @@ ;; RRTRP: (func $slice (type $0) (result stringref) ;; RRTRP-NEXT: (local $0 i32) ;; RRTRP-NEXT: (local $1 i32) - ;; RRTRP-NEXT: (local $2 i32) - ;; RRTRP-NEXT: (local $3 (ref string)) - ;; RRTRP-NEXT: (local $4 i32) - ;; RRTRP-NEXT: (local $5 (ref string)) + ;; RRTRP-NEXT: (local $scratch i32) + ;; RRTRP-NEXT: (local $scratch_3 (ref string)) + ;; RRTRP-NEXT: (local $scratch_4 i32) + ;; RRTRP-NEXT: (local $scratch_5 (ref string)) ;; RRTRP-NEXT: (stringview_wtf16.slice ;; RRTRP-NEXT: (block (result (ref string)) - ;; RRTRP-NEXT: (local.set $5 + ;; RRTRP-NEXT: (local.set $scratch_5 ;; RRTRP-NEXT: (string.const "abc") ;; RRTRP-NEXT: ) ;; RRTRP-NEXT: (local.set $0 ;; RRTRP-NEXT: (block (result i32) - ;; RRTRP-NEXT: (local.set $4 + ;; RRTRP-NEXT: (local.set $scratch_4 ;; RRTRP-NEXT: (i32.const 1) ;; RRTRP-NEXT: ) ;; RRTRP-NEXT: (local.set $1 ;; RRTRP-NEXT: (i32.const 2) ;; RRTRP-NEXT: ) - ;; RRTRP-NEXT: (local.get $4) + ;; RRTRP-NEXT: (local.get $scratch_4) ;; RRTRP-NEXT: ) ;; RRTRP-NEXT: ) - ;; RRTRP-NEXT: (local.get $5) + ;; RRTRP-NEXT: (local.get $scratch_5) ;; RRTRP-NEXT: ) ;; RRTRP-NEXT: (local.get $0) ;; RRTRP-NEXT: (local.get $1) @@ -185,25 +185,25 @@ ;; RTRIP-NEXT: (local $start i32) ;; RTRIP-NEXT: (local $1 i32) ;; RTRIP-NEXT: (local $2 i32) - ;; RTRIP-NEXT: (local $3 i32) - ;; RTRIP-NEXT: (local $4 (ref string)) + ;; RTRIP-NEXT: (local $scratch i32) + ;; RTRIP-NEXT: (local $scratch_4 (ref string)) ;; RTRIP-NEXT: (stringview_wtf16.slice ;; RTRIP-NEXT: (block (result (ref string)) - ;; RTRIP-NEXT: (local.set $4 + ;; RTRIP-NEXT: (local.set $scratch_4 ;; RTRIP-NEXT: (string.const "abc") ;; RTRIP-NEXT: ) ;; RTRIP-NEXT: (local.set $1 ;; RTRIP-NEXT: (block (result i32) - ;; RTRIP-NEXT: (local.set $3 + ;; RTRIP-NEXT: (local.set $scratch ;; RTRIP-NEXT: (local.get $start) ;; RTRIP-NEXT: ) ;; RTRIP-NEXT: (local.set $2 ;; RTRIP-NEXT: (i32.const 2) ;; RTRIP-NEXT: ) - ;; RTRIP-NEXT: (local.get $3) + ;; RTRIP-NEXT: (local.get $scratch) ;; RTRIP-NEXT: ) ;; RTRIP-NEXT: ) - ;; RTRIP-NEXT: (local.get $4) + ;; RTRIP-NEXT: (local.get $scratch_4) ;; RTRIP-NEXT: ) ;; RTRIP-NEXT: (local.get $1) ;; RTRIP-NEXT: (local.get $2) @@ -213,27 +213,27 @@ ;; RRTRP-NEXT: (local $start i32) ;; RRTRP-NEXT: (local $1 i32) ;; RRTRP-NEXT: (local $2 i32) - ;; RRTRP-NEXT: (local $3 i32) - ;; RRTRP-NEXT: (local $4 (ref string)) - ;; RRTRP-NEXT: (local $5 i32) - ;; RRTRP-NEXT: (local $6 (ref string)) + ;; RRTRP-NEXT: (local $scratch i32) + ;; RRTRP-NEXT: (local $scratch_4 (ref string)) + ;; RRTRP-NEXT: (local $scratch_5 i32) + ;; RRTRP-NEXT: (local $scratch_6 (ref string)) ;; RRTRP-NEXT: (stringview_wtf16.slice ;; RRTRP-NEXT: (block (result (ref string)) - ;; RRTRP-NEXT: (local.set $6 + ;; RRTRP-NEXT: (local.set $scratch_6 ;; RRTRP-NEXT: (string.const "abc") ;; RRTRP-NEXT: ) ;; RRTRP-NEXT: (local.set $1 ;; RRTRP-NEXT: (block (result i32) - ;; RRTRP-NEXT: (local.set $5 + ;; RRTRP-NEXT: (local.set $scratch_5 ;; RRTRP-NEXT: (local.get $start) ;; RRTRP-NEXT: ) ;; RRTRP-NEXT: (local.set $2 ;; RRTRP-NEXT: (i32.const 2) ;; RRTRP-NEXT: ) - ;; RRTRP-NEXT: (local.get $5) + ;; RRTRP-NEXT: (local.get $scratch_5) ;; RRTRP-NEXT: ) ;; RRTRP-NEXT: ) - ;; RRTRP-NEXT: (local.get $6) + ;; RRTRP-NEXT: (local.get $scratch_6) ;; RRTRP-NEXT: ) ;; RRTRP-NEXT: (local.get $1) ;; RRTRP-NEXT: (local.get $2) @@ -261,25 +261,25 @@ ;; RTRIP-NEXT: (local $end i32) ;; RTRIP-NEXT: (local $1 i32) ;; RTRIP-NEXT: (local $2 i32) - ;; RTRIP-NEXT: (local $3 i32) - ;; RTRIP-NEXT: (local $4 (ref string)) + ;; RTRIP-NEXT: (local $scratch i32) + ;; RTRIP-NEXT: (local $scratch_4 (ref string)) ;; RTRIP-NEXT: (stringview_wtf16.slice ;; RTRIP-NEXT: (block (result (ref string)) - ;; RTRIP-NEXT: (local.set $4 + ;; RTRIP-NEXT: (local.set $scratch_4 ;; RTRIP-NEXT: (string.const "abc") ;; RTRIP-NEXT: ) ;; RTRIP-NEXT: (local.set $1 ;; RTRIP-NEXT: (block (result i32) - ;; RTRIP-NEXT: (local.set $3 + ;; RTRIP-NEXT: (local.set $scratch ;; RTRIP-NEXT: (i32.const 1) ;; RTRIP-NEXT: ) ;; RTRIP-NEXT: (local.set $2 ;; RTRIP-NEXT: (local.get $end) ;; RTRIP-NEXT: ) - ;; RTRIP-NEXT: (local.get $3) + ;; RTRIP-NEXT: (local.get $scratch) ;; RTRIP-NEXT: ) ;; RTRIP-NEXT: ) - ;; RTRIP-NEXT: (local.get $4) + ;; RTRIP-NEXT: (local.get $scratch_4) ;; RTRIP-NEXT: ) ;; RTRIP-NEXT: (local.get $1) ;; RTRIP-NEXT: (local.get $2) @@ -289,27 +289,27 @@ ;; RRTRP-NEXT: (local $end i32) ;; RRTRP-NEXT: (local $1 i32) ;; RRTRP-NEXT: (local $2 i32) - ;; RRTRP-NEXT: (local $3 i32) - ;; RRTRP-NEXT: (local $4 (ref string)) - ;; RRTRP-NEXT: (local $5 i32) - ;; RRTRP-NEXT: (local $6 (ref string)) + ;; RRTRP-NEXT: (local $scratch i32) + ;; RRTRP-NEXT: (local $scratch_4 (ref string)) + ;; RRTRP-NEXT: (local $scratch_5 i32) + ;; RRTRP-NEXT: (local $scratch_6 (ref string)) ;; RRTRP-NEXT: (stringview_wtf16.slice ;; RRTRP-NEXT: (block (result (ref string)) - ;; RRTRP-NEXT: (local.set $6 + ;; RRTRP-NEXT: (local.set $scratch_6 ;; RRTRP-NEXT: (string.const "abc") ;; RRTRP-NEXT: ) ;; RRTRP-NEXT: (local.set $1 ;; RRTRP-NEXT: (block (result i32) - ;; RRTRP-NEXT: (local.set $5 + ;; RRTRP-NEXT: (local.set $scratch_5 ;; RRTRP-NEXT: (i32.const 1) ;; RRTRP-NEXT: ) ;; RRTRP-NEXT: (local.set $2 ;; RRTRP-NEXT: (local.get $end) ;; RRTRP-NEXT: ) - ;; RRTRP-NEXT: (local.get $5) + ;; RRTRP-NEXT: (local.get $scratch_5) ;; RRTRP-NEXT: ) ;; RRTRP-NEXT: ) - ;; RRTRP-NEXT: (local.get $6) + ;; RRTRP-NEXT: (local.get $scratch_6) ;; RRTRP-NEXT: ) ;; RRTRP-NEXT: (local.get $1) ;; RRTRP-NEXT: (local.get $2) |