diff options
author | Alon Zakai <alonzakai@gmail.com> | 2016-06-24 13:06:00 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-06-24 13:06:00 -0700 |
commit | a88f8f275e068d6cdfb8879dc3bab1fe3201efbc (patch) | |
tree | 81a147693e4f65c025f11cafe6ee89b588106707 /test/example/c-api-kitchen-sink.c | |
parent | ed4e614430e8864c9f02508f5920c45fd137faf1 (diff) | |
download | binaryen-a88f8f275e068d6cdfb8879dc3bab1fe3201efbc.tar.gz binaryen-a88f8f275e068d6cdfb8879dc3bab1fe3201efbc.tar.bz2 binaryen-a88f8f275e068d6cdfb8879dc3bab1fe3201efbc.zip |
finalize blocks properly in relooper (#600)
Diffstat (limited to 'test/example/c-api-kitchen-sink.c')
-rw-r--r-- | test/example/c-api-kitchen-sink.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/example/c-api-kitchen-sink.c b/test/example/c-api-kitchen-sink.c index 4cbbb8fb5..84f04b45a 100644 --- a/test/example/c-api-kitchen-sink.c +++ b/test/example/c-api-kitchen-sink.c @@ -378,6 +378,17 @@ void test_relooper() { BinaryenFunctionRef sinker = BinaryenAddFunction(module, "nontrivial-loop-plus-phi-to-head", v, localTypes, 1, body); } + BinaryenFunctionTypeRef i = BinaryenAddFunctionType(module, "i", BinaryenInt32(), NULL, 0); + + { // return in a block + RelooperRef relooper = RelooperCreate(); + BinaryenExpressionRef listList[] = { makeInt32(module, 42), BinaryenReturn(module, makeInt32(module, 1337)) }; + BinaryenExpressionRef list = BinaryenBlock(module, "the-list", listList, 2); + RelooperBlockRef block = RelooperAddBlock(relooper, list); + BinaryenExpressionRef body = RelooperRenderAndDispose(relooper, block, 0, module); + BinaryenFunctionRef sinker = BinaryenAddFunction(module, "return", i, localTypes, 1, body); + } + assert(BinaryenModuleValidate(module)); printf("raw:\n"); |