summaryrefslogtreecommitdiff
path: root/test/example
diff options
context:
space:
mode:
authorThomas Lively <7121787+tlively@users.noreply.github.com>2020-09-11 13:34:01 -0700
committerGitHub <noreply@github.com>2020-09-11 13:34:01 -0700
commit8ec8a0bbfb039852b60f121fb23c439228b9fe36 (patch)
tree7987dcb2af2141dfc709cc8b761a69fd14f79798 /test/example
parentdbff242b3bc1fdaec15140cc48a537d7a497fb48 (diff)
downloadbinaryen-8ec8a0bbfb039852b60f121fb23c439228b9fe36.tar.gz
binaryen-8ec8a0bbfb039852b60f121fb23c439228b9fe36.tar.bz2
binaryen-8ec8a0bbfb039852b60f121fb23c439228b9fe36.zip
Update Pop text format to handle tuples (#3116)
Previously Pops were printed as ({type}.pop), and if the popped type was a tuple, something like ((i32, i64).pop) would get printed. However, the parser didn't support pops of anything besides single basic types. This PR changes the text format to be (pop <type>*) and adds support for parsing pops of tuples of basic types. The text format change is designed to make parsing simpler. This change is necessary for writing Poppy IR tests (see #3059) that contain break or return instructions that consume multiple values, since in Poppy IR that requires tuple-typed pops.
Diffstat (limited to 'test/example')
-rw-r--r--test/example/c-api-kitchen-sink.c8
-rw-r--r--test/example/c-api-kitchen-sink.txt19
2 files changed, 17 insertions, 10 deletions
diff --git a/test/example/c-api-kitchen-sink.c b/test/example/c-api-kitchen-sink.c
index e242cfc8e..e6450db6c 100644
--- a/test/example/c-api-kitchen-sink.c
+++ b/test/example/c-api-kitchen-sink.c
@@ -723,8 +723,11 @@ void test_core() {
BinaryenRefIsNull(module, externrefExpr),
BinaryenRefIsNull(module, funcrefExpr),
BinaryenRefIsNull(module, exnrefExpr),
- BinaryenSelect(
- module, temp10, BinaryenRefNull(module, BinaryenTypeFuncref()), BinaryenRefFunc(module, "kitchen()sinker"), BinaryenTypeFuncref()),
+ BinaryenSelect(module,
+ temp10,
+ BinaryenRefNull(module, BinaryenTypeFuncref()),
+ BinaryenRefFunc(module, "kitchen()sinker"),
+ BinaryenTypeFuncref()),
// Exception handling
BinaryenTry(module, tryBody, catchBody),
// Atomics
@@ -752,6 +755,7 @@ void test_core() {
BinaryenPop(module, BinaryenTypeFuncref()),
BinaryenPop(module, BinaryenTypeExternref()),
BinaryenPop(module, BinaryenTypeExnref()),
+ BinaryenPop(module, iIfF),
// TODO: Host
BinaryenNop(module),
diff --git a/test/example/c-api-kitchen-sink.txt b/test/example/c-api-kitchen-sink.txt
index c5958ff1d..d4ff78dd2 100644
--- a/test/example/c-api-kitchen-sink.txt
+++ b/test/example/c-api-kitchen-sink.txt
@@ -1782,7 +1782,7 @@ BinaryenFeatureAll: 2047
)
(catch
(local.set $5
- (exnref.pop)
+ (pop exnref)
)
(drop
(block $try-block (result i32)
@@ -1834,25 +1834,28 @@ BinaryenFeatureAll: 2047
)
)
(drop
- (i32.pop)
+ (pop i32)
)
(drop
- (i64.pop)
+ (pop i64)
)
(drop
- (f32.pop)
+ (pop f32)
)
(drop
- (f64.pop)
+ (pop f64)
)
(drop
- (funcref.pop)
+ (pop funcref)
)
(drop
- (externref.pop)
+ (pop externref)
)
(drop
- (exnref.pop)
+ (pop exnref)
+ )
+ (drop
+ (pop i32 i64 f32 f64)
)
(nop)
(unreachable)