diff options
Diffstat (limited to 'test/example')
-rw-r--r-- | test/example/c-api-kitchen-sink.c | 525 | ||||
-rw-r--r-- | test/example/c-api-kitchen-sink.txt | 136 | ||||
-rw-r--r-- | test/example/c-api-relooper-unreachable-if.cpp | 359 | ||||
-rw-r--r-- | test/example/c-api-unused-mem.cpp | 20 |
4 files changed, 635 insertions, 405 deletions
diff --git a/test/example/c-api-kitchen-sink.c b/test/example/c-api-kitchen-sink.c index f5fe5dc50..68d7e82ea 100644 --- a/test/example/c-api-kitchen-sink.c +++ b/test/example/c-api-kitchen-sink.c @@ -149,16 +149,78 @@ BinaryenExpressionRef makeMemoryFill(BinaryenModuleRef module) { // tests void test_types() { - printf("BinaryenTypeNone: %d\n", BinaryenTypeNone()); - printf("BinaryenTypeInt32: %d\n", BinaryenTypeInt32()); - printf("BinaryenTypeInt64: %d\n", BinaryenTypeInt64()); - printf("BinaryenTypeFloat32: %d\n", BinaryenTypeFloat32()); - printf("BinaryenTypeFloat64: %d\n", BinaryenTypeFloat64()); - printf("BinaryenTypeVec128: %d\n", BinaryenTypeVec128()); - printf("BinaryenTypeAnyref: %d\n", BinaryenTypeAnyref()); - printf("BinaryenTypeExnref: %d\n", BinaryenTypeExnref()); - printf("BinaryenTypeUnreachable: %d\n", BinaryenTypeUnreachable()); - printf("BinaryenTypeAuto: %d\n", BinaryenTypeAuto()); + BinaryenType valueType = 0xdeadbeef; + + BinaryenType none = BinaryenTypeNone(); + printf(" // BinaryenTypeNone: %d\n", none); + assert(BinaryenTypeArity(none) == 0); + BinaryenTypeExpand(none, &valueType); + assert(valueType == 0xdeadbeef); + + BinaryenType unreachable = BinaryenTypeUnreachable(); + printf(" // BinaryenTypeUnreachable: %d\n", unreachable); + assert(BinaryenTypeArity(unreachable) == 0); + BinaryenTypeExpand(unreachable, &valueType); + assert(valueType == 0xdeadbeef); + + BinaryenType i32 = BinaryenTypeInt32(); + printf(" // BinaryenTypeInt32: %d\n", i32); + assert(BinaryenTypeArity(i32) == 1); + BinaryenTypeExpand(i32, &valueType); + assert(valueType == i32); + + BinaryenType i64 = BinaryenTypeInt64(); + printf(" // BinaryenTypeInt64: %d\n", i64); + assert(BinaryenTypeArity(i64) == 1); + BinaryenTypeExpand(i64, &valueType); + assert(valueType == i64); + + BinaryenType f32 = BinaryenTypeFloat32(); + printf(" // BinaryenTypeFloat32: %d\n", f32); + assert(BinaryenTypeArity(f32) == 1); + BinaryenTypeExpand(f32, &valueType); + assert(valueType == f32); + + BinaryenType f64 = BinaryenTypeFloat64(); + printf(" // BinaryenTypeFloat64: %d\n", f64); + assert(BinaryenTypeArity(f64) == 1); + BinaryenTypeExpand(f64, &valueType); + assert(valueType == f64); + + BinaryenType v128 = BinaryenTypeVec128(); + printf(" // BinaryenTypeVec128: %d\n", v128); + assert(BinaryenTypeArity(v128) == 1); + BinaryenTypeExpand(v128, &valueType); + assert(valueType == v128); + + BinaryenType anyref = BinaryenTypeAnyref(); + printf(" // BinaryenTypeAnyref: %d\n", anyref); + assert(BinaryenTypeArity(anyref) == 1); + BinaryenTypeExpand(anyref, &valueType); + assert(valueType == anyref); + + BinaryenType exnref = BinaryenTypeExnref(); + printf(" // BinaryenTypeExnref: %d\n", exnref); + assert(BinaryenTypeArity(exnref) == 1); + BinaryenTypeExpand(exnref, &valueType); + assert(valueType == exnref); + + printf(" // BinaryenTypeAuto: %d\n", BinaryenTypeAuto()); + + BinaryenType pair[] = {i32, i32}; + + BinaryenType i32_pair = BinaryenTypeCreate(pair, 2); + assert(BinaryenTypeArity(i32_pair) == 2); + pair[0] = pair[1] = none; + BinaryenTypeExpand(i32_pair, pair); + assert(pair[0] == i32 && pair[1] == i32); + + BinaryenType duplicate_pair = BinaryenTypeCreate(pair, 2); + assert(duplicate_pair == i32_pair); + + pair[0] = pair[1] = f32; + BinaryenType float_pair = BinaryenTypeCreate(pair, 2); + assert(float_pair != i32_pair); } void test_features() { @@ -254,221 +316,227 @@ void test_core() { 2, BinaryenTypeNone()); + BinaryenType i32 = BinaryenTypeInt32(); + BinaryenType i64 = BinaryenTypeInt64(); + BinaryenType f32 = BinaryenTypeFloat32(); + BinaryenType f64 = BinaryenTypeFloat64(); + BinaryenType v128 = BinaryenTypeVec128(); + BinaryenExpressionRef valueList[] = { // Unary - makeUnary(module, BinaryenClzInt32(), 1), - makeUnary(module, BinaryenCtzInt64(), 2), - makeUnary(module, BinaryenPopcntInt32(), 1), - makeUnary(module, BinaryenNegFloat32(), 3), - makeUnary(module, BinaryenAbsFloat64(), 4), - makeUnary(module, BinaryenCeilFloat32(), 3), - makeUnary(module, BinaryenFloorFloat64(), 4), - makeUnary(module, BinaryenTruncFloat32(), 3), - makeUnary(module, BinaryenNearestFloat32(), 3), - makeUnary(module, BinaryenSqrtFloat64(), 4), - makeUnary(module, BinaryenEqZInt32(), 1), - makeUnary(module, BinaryenExtendSInt32(), 1), - makeUnary(module, BinaryenExtendUInt32(), 1), - makeUnary(module, BinaryenWrapInt64(), 2), - makeUnary(module, BinaryenTruncSFloat32ToInt32(), 3), - makeUnary(module, BinaryenTruncSFloat32ToInt64(), 3), - makeUnary(module, BinaryenTruncUFloat32ToInt32(), 3), - makeUnary(module, BinaryenTruncUFloat32ToInt64(), 3), - makeUnary(module, BinaryenTruncSFloat64ToInt32(), 4), - makeUnary(module, BinaryenTruncSFloat64ToInt64(), 4), - makeUnary(module, BinaryenTruncUFloat64ToInt32(), 4), - makeUnary(module, BinaryenTruncUFloat64ToInt64(), 4), - makeUnary(module, BinaryenTruncSatSFloat32ToInt32(), 3), - makeUnary(module, BinaryenTruncSatSFloat32ToInt64(), 3), - makeUnary(module, BinaryenTruncSatUFloat32ToInt32(), 3), - makeUnary(module, BinaryenTruncSatUFloat32ToInt64(), 3), - makeUnary(module, BinaryenTruncSatSFloat64ToInt32(), 4), - makeUnary(module, BinaryenTruncSatSFloat64ToInt64(), 4), - makeUnary(module, BinaryenTruncSatUFloat64ToInt32(), 4), - makeUnary(module, BinaryenTruncSatUFloat64ToInt64(), 4), - makeUnary(module, BinaryenReinterpretFloat32(), 3), - makeUnary(module, BinaryenReinterpretFloat64(), 4), - makeUnary(module, BinaryenConvertSInt32ToFloat32(), 1), - makeUnary(module, BinaryenConvertSInt32ToFloat64(), 1), - makeUnary(module, BinaryenConvertUInt32ToFloat32(), 1), - makeUnary(module, BinaryenConvertUInt32ToFloat64(), 1), - makeUnary(module, BinaryenConvertSInt64ToFloat32(), 2), - makeUnary(module, BinaryenConvertSInt64ToFloat64(), 2), - makeUnary(module, BinaryenConvertUInt64ToFloat32(), 2), - makeUnary(module, BinaryenConvertUInt64ToFloat64(), 2), - makeUnary(module, BinaryenPromoteFloat32(), 3), - makeUnary(module, BinaryenDemoteFloat64(), 4), - makeUnary(module, BinaryenReinterpretInt32(), 1), - makeUnary(module, BinaryenReinterpretInt64(), 2), - makeUnary(module, BinaryenSplatVecI8x16(), 1), - makeUnary(module, BinaryenSplatVecI16x8(), 1), - makeUnary(module, BinaryenSplatVecI32x4(), 1), - makeUnary(module, BinaryenSplatVecI64x2(), 2), - makeUnary(module, BinaryenSplatVecF32x4(), 3), - makeUnary(module, BinaryenSplatVecF64x2(), 4), - makeUnary(module, BinaryenNotVec128(), 5), - makeUnary(module, BinaryenNegVecI8x16(), 5), - makeUnary(module, BinaryenAnyTrueVecI8x16(), 5), - makeUnary(module, BinaryenAllTrueVecI8x16(), 5), - makeUnary(module, BinaryenNegVecI16x8(), 5), - makeUnary(module, BinaryenAnyTrueVecI16x8(), 5), - makeUnary(module, BinaryenAllTrueVecI16x8(), 5), - makeUnary(module, BinaryenNegVecI32x4(), 5), - makeUnary(module, BinaryenAnyTrueVecI32x4(), 5), - makeUnary(module, BinaryenAllTrueVecI32x4(), 5), - makeUnary(module, BinaryenNegVecI64x2(), 5), - makeUnary(module, BinaryenAnyTrueVecI64x2(), 5), - makeUnary(module, BinaryenAllTrueVecI64x2(), 5), - makeUnary(module, BinaryenAbsVecF32x4(), 5), - makeUnary(module, BinaryenNegVecF32x4(), 5), - makeUnary(module, BinaryenSqrtVecF32x4(), 5), - makeUnary(module, BinaryenAbsVecF64x2(), 5), - makeUnary(module, BinaryenNegVecF64x2(), 5), - makeUnary(module, BinaryenSqrtVecF64x2(), 5), - makeUnary(module, BinaryenTruncSatSVecF32x4ToVecI32x4(), 5), - makeUnary(module, BinaryenTruncSatUVecF32x4ToVecI32x4(), 5), - makeUnary(module, BinaryenTruncSatSVecF64x2ToVecI64x2(), 5), - makeUnary(module, BinaryenTruncSatUVecF64x2ToVecI64x2(), 5), - makeUnary(module, BinaryenConvertSVecI32x4ToVecF32x4(), 5), - makeUnary(module, BinaryenConvertUVecI32x4ToVecF32x4(), 5), - makeUnary(module, BinaryenConvertSVecI64x2ToVecF64x2(), 5), - makeUnary(module, BinaryenConvertUVecI64x2ToVecF64x2(), 5), - makeUnary(module, BinaryenWidenLowSVecI8x16ToVecI16x8(), 5), - makeUnary(module, BinaryenWidenHighSVecI8x16ToVecI16x8(), 5), - makeUnary(module, BinaryenWidenLowUVecI8x16ToVecI16x8(), 5), - makeUnary(module, BinaryenWidenHighUVecI8x16ToVecI16x8(), 5), - makeUnary(module, BinaryenWidenLowSVecI16x8ToVecI32x4(), 5), - makeUnary(module, BinaryenWidenHighSVecI16x8ToVecI32x4(), 5), - makeUnary(module, BinaryenWidenLowUVecI16x8ToVecI32x4(), 5), - makeUnary(module, BinaryenWidenHighUVecI16x8ToVecI32x4(), 5), + makeUnary(module, BinaryenClzInt32(), i32), + makeUnary(module, BinaryenCtzInt64(), i64), + makeUnary(module, BinaryenPopcntInt32(), i32), + makeUnary(module, BinaryenNegFloat32(), f32), + makeUnary(module, BinaryenAbsFloat64(), f64), + makeUnary(module, BinaryenCeilFloat32(), f32), + makeUnary(module, BinaryenFloorFloat64(), f64), + makeUnary(module, BinaryenTruncFloat32(), f32), + makeUnary(module, BinaryenNearestFloat32(), f32), + makeUnary(module, BinaryenSqrtFloat64(), f64), + makeUnary(module, BinaryenEqZInt32(), i32), + makeUnary(module, BinaryenExtendSInt32(), i32), + makeUnary(module, BinaryenExtendUInt32(), i32), + makeUnary(module, BinaryenWrapInt64(), i64), + makeUnary(module, BinaryenTruncSFloat32ToInt32(), f32), + makeUnary(module, BinaryenTruncSFloat32ToInt64(), f32), + makeUnary(module, BinaryenTruncUFloat32ToInt32(), f32), + makeUnary(module, BinaryenTruncUFloat32ToInt64(), f32), + makeUnary(module, BinaryenTruncSFloat64ToInt32(), f64), + makeUnary(module, BinaryenTruncSFloat64ToInt64(), f64), + makeUnary(module, BinaryenTruncUFloat64ToInt32(), f64), + makeUnary(module, BinaryenTruncUFloat64ToInt64(), f64), + makeUnary(module, BinaryenTruncSatSFloat32ToInt32(), f32), + makeUnary(module, BinaryenTruncSatSFloat32ToInt64(), f32), + makeUnary(module, BinaryenTruncSatUFloat32ToInt32(), f32), + makeUnary(module, BinaryenTruncSatUFloat32ToInt64(), f32), + makeUnary(module, BinaryenTruncSatSFloat64ToInt32(), f64), + makeUnary(module, BinaryenTruncSatSFloat64ToInt64(), f64), + makeUnary(module, BinaryenTruncSatUFloat64ToInt32(), f64), + makeUnary(module, BinaryenTruncSatUFloat64ToInt64(), f64), + makeUnary(module, BinaryenReinterpretFloat32(), f32), + makeUnary(module, BinaryenReinterpretFloat64(), f64), + makeUnary(module, BinaryenConvertSInt32ToFloat32(), i32), + makeUnary(module, BinaryenConvertSInt32ToFloat64(), i32), + makeUnary(module, BinaryenConvertUInt32ToFloat32(), i32), + makeUnary(module, BinaryenConvertUInt32ToFloat64(), i32), + makeUnary(module, BinaryenConvertSInt64ToFloat32(), i64), + makeUnary(module, BinaryenConvertSInt64ToFloat64(), i64), + makeUnary(module, BinaryenConvertUInt64ToFloat32(), i64), + makeUnary(module, BinaryenConvertUInt64ToFloat64(), i64), + makeUnary(module, BinaryenPromoteFloat32(), f32), + makeUnary(module, BinaryenDemoteFloat64(), f64), + makeUnary(module, BinaryenReinterpretInt32(), i32), + makeUnary(module, BinaryenReinterpretInt64(), i64), + makeUnary(module, BinaryenSplatVecI8x16(), i32), + makeUnary(module, BinaryenSplatVecI16x8(), i32), + makeUnary(module, BinaryenSplatVecI32x4(), i32), + makeUnary(module, BinaryenSplatVecI64x2(), i64), + makeUnary(module, BinaryenSplatVecF32x4(), f32), + makeUnary(module, BinaryenSplatVecF64x2(), f64), + makeUnary(module, BinaryenNotVec128(), v128), + makeUnary(module, BinaryenNegVecI8x16(), v128), + makeUnary(module, BinaryenAnyTrueVecI8x16(), v128), + makeUnary(module, BinaryenAllTrueVecI8x16(), v128), + makeUnary(module, BinaryenNegVecI16x8(), v128), + makeUnary(module, BinaryenAnyTrueVecI16x8(), v128), + makeUnary(module, BinaryenAllTrueVecI16x8(), v128), + makeUnary(module, BinaryenNegVecI32x4(), v128), + makeUnary(module, BinaryenAnyTrueVecI32x4(), v128), + makeUnary(module, BinaryenAllTrueVecI32x4(), v128), + makeUnary(module, BinaryenNegVecI64x2(), v128), + makeUnary(module, BinaryenAnyTrueVecI64x2(), v128), + makeUnary(module, BinaryenAllTrueVecI64x2(), v128), + makeUnary(module, BinaryenAbsVecF32x4(), v128), + makeUnary(module, BinaryenNegVecF32x4(), v128), + makeUnary(module, BinaryenSqrtVecF32x4(), v128), + makeUnary(module, BinaryenAbsVecF64x2(), v128), + makeUnary(module, BinaryenNegVecF64x2(), v128), + makeUnary(module, BinaryenSqrtVecF64x2(), v128), + makeUnary(module, BinaryenTruncSatSVecF32x4ToVecI32x4(), v128), + makeUnary(module, BinaryenTruncSatUVecF32x4ToVecI32x4(), v128), + makeUnary(module, BinaryenTruncSatSVecF64x2ToVecI64x2(), v128), + makeUnary(module, BinaryenTruncSatUVecF64x2ToVecI64x2(), v128), + makeUnary(module, BinaryenConvertSVecI32x4ToVecF32x4(), v128), + makeUnary(module, BinaryenConvertUVecI32x4ToVecF32x4(), v128), + makeUnary(module, BinaryenConvertSVecI64x2ToVecF64x2(), v128), + makeUnary(module, BinaryenConvertUVecI64x2ToVecF64x2(), v128), + makeUnary(module, BinaryenWidenLowSVecI8x16ToVecI16x8(), v128), + makeUnary(module, BinaryenWidenHighSVecI8x16ToVecI16x8(), v128), + makeUnary(module, BinaryenWidenLowUVecI8x16ToVecI16x8(), v128), + makeUnary(module, BinaryenWidenHighUVecI8x16ToVecI16x8(), v128), + makeUnary(module, BinaryenWidenLowSVecI16x8ToVecI32x4(), v128), + makeUnary(module, BinaryenWidenHighSVecI16x8ToVecI32x4(), v128), + makeUnary(module, BinaryenWidenLowUVecI16x8ToVecI32x4(), v128), + makeUnary(module, BinaryenWidenHighUVecI16x8ToVecI32x4(), v128), // Binary - makeBinary(module, BinaryenAddInt32(), 1), - makeBinary(module, BinaryenSubFloat64(), 4), - makeBinary(module, BinaryenDivSInt32(), 1), - makeBinary(module, BinaryenDivUInt64(), 2), - makeBinary(module, BinaryenRemSInt64(), 2), - makeBinary(module, BinaryenRemUInt32(), 1), - makeBinary(module, BinaryenAndInt32(), 1), - makeBinary(module, BinaryenOrInt64(), 2), - makeBinary(module, BinaryenXorInt32(), 1), - makeBinary(module, BinaryenShlInt64(), 2), - makeBinary(module, BinaryenShrUInt64(), 2), - makeBinary(module, BinaryenShrSInt32(), 1), - makeBinary(module, BinaryenRotLInt32(), 1), - makeBinary(module, BinaryenRotRInt64(), 2), - makeBinary(module, BinaryenDivFloat32(), 3), - makeBinary(module, BinaryenCopySignFloat64(), 4), - makeBinary(module, BinaryenMinFloat32(), 3), - makeBinary(module, BinaryenMaxFloat64(), 4), - makeBinary(module, BinaryenEqInt32(), 1), - makeBinary(module, BinaryenNeFloat32(), 3), - makeBinary(module, BinaryenLtSInt32(), 1), - makeBinary(module, BinaryenLtUInt64(), 2), - makeBinary(module, BinaryenLeSInt64(), 2), - makeBinary(module, BinaryenLeUInt32(), 1), - makeBinary(module, BinaryenGtSInt64(), 2), - makeBinary(module, BinaryenGtUInt32(), 1), - makeBinary(module, BinaryenGeSInt32(), 1), - makeBinary(module, BinaryenGeUInt64(), 2), - makeBinary(module, BinaryenLtFloat32(), 3), - makeBinary(module, BinaryenLeFloat64(), 4), - makeBinary(module, BinaryenGtFloat64(), 4), - makeBinary(module, BinaryenGeFloat32(), 3), - makeBinary(module, BinaryenEqVecI8x16(), 5), - makeBinary(module, BinaryenNeVecI8x16(), 5), - makeBinary(module, BinaryenLtSVecI8x16(), 5), - makeBinary(module, BinaryenLtUVecI8x16(), 5), - makeBinary(module, BinaryenGtSVecI8x16(), 5), - makeBinary(module, BinaryenGtUVecI8x16(), 5), - makeBinary(module, BinaryenLeSVecI8x16(), 5), - makeBinary(module, BinaryenLeUVecI8x16(), 5), - makeBinary(module, BinaryenGeSVecI8x16(), 5), - makeBinary(module, BinaryenGeUVecI8x16(), 5), - makeBinary(module, BinaryenEqVecI16x8(), 5), - makeBinary(module, BinaryenNeVecI16x8(), 5), - makeBinary(module, BinaryenLtSVecI16x8(), 5), - makeBinary(module, BinaryenLtUVecI16x8(), 5), - makeBinary(module, BinaryenGtSVecI16x8(), 5), - makeBinary(module, BinaryenGtUVecI16x8(), 5), - makeBinary(module, BinaryenLeSVecI16x8(), 5), - makeBinary(module, BinaryenLeUVecI16x8(), 5), - makeBinary(module, BinaryenGeSVecI16x8(), 5), - makeBinary(module, BinaryenGeUVecI16x8(), 5), - makeBinary(module, BinaryenEqVecI32x4(), 5), - makeBinary(module, BinaryenNeVecI32x4(), 5), - makeBinary(module, BinaryenLtSVecI32x4(), 5), - makeBinary(module, BinaryenLtUVecI32x4(), 5), - makeBinary(module, BinaryenGtSVecI32x4(), 5), - makeBinary(module, BinaryenGtUVecI32x4(), 5), - makeBinary(module, BinaryenLeSVecI32x4(), 5), - makeBinary(module, BinaryenLeUVecI32x4(), 5), - makeBinary(module, BinaryenGeSVecI32x4(), 5), - makeBinary(module, BinaryenGeUVecI32x4(), 5), - makeBinary(module, BinaryenEqVecF32x4(), 5), - makeBinary(module, BinaryenNeVecF32x4(), 5), - makeBinary(module, BinaryenLtVecF32x4(), 5), - makeBinary(module, BinaryenGtVecF32x4(), 5), - makeBinary(module, BinaryenLeVecF32x4(), 5), - makeBinary(module, BinaryenGeVecF32x4(), 5), - makeBinary(module, BinaryenEqVecF64x2(), 5), - makeBinary(module, BinaryenNeVecF64x2(), 5), - makeBinary(module, BinaryenLtVecF64x2(), 5), - makeBinary(module, BinaryenGtVecF64x2(), 5), - makeBinary(module, BinaryenLeVecF64x2(), 5), - makeBinary(module, BinaryenGeVecF64x2(), 5), - makeBinary(module, BinaryenAndVec128(), 5), - makeBinary(module, BinaryenOrVec128(), 5), - makeBinary(module, BinaryenXorVec128(), 5), - makeBinary(module, BinaryenAndNotVec128(), 5), - makeBinary(module, BinaryenAddVecI8x16(), 5), - makeBinary(module, BinaryenAddSatSVecI8x16(), 5), - makeBinary(module, BinaryenAddSatUVecI8x16(), 5), - makeBinary(module, BinaryenSubVecI8x16(), 5), - makeBinary(module, BinaryenSubSatSVecI8x16(), 5), - makeBinary(module, BinaryenSubSatUVecI8x16(), 5), - makeBinary(module, BinaryenMulVecI8x16(), 5), - makeBinary(module, BinaryenAddVecI16x8(), 5), - makeBinary(module, BinaryenAddSatSVecI16x8(), 5), - makeBinary(module, BinaryenAddSatUVecI16x8(), 5), - makeBinary(module, BinaryenSubVecI16x8(), 5), - makeBinary(module, BinaryenSubSatSVecI16x8(), 5), - makeBinary(module, BinaryenSubSatUVecI16x8(), 5), - makeBinary(module, BinaryenMulVecI16x8(), 5), - makeBinary(module, BinaryenMinSVecI16x8(), 5), - makeBinary(module, BinaryenMinUVecI16x8(), 5), - makeBinary(module, BinaryenMaxSVecI16x8(), 5), - makeBinary(module, BinaryenMaxUVecI16x8(), 5), - makeBinary(module, BinaryenAddVecI32x4(), 5), - makeBinary(module, BinaryenSubVecI32x4(), 5), - makeBinary(module, BinaryenMulVecI32x4(), 5), - makeBinary(module, BinaryenMinSVecI8x16(), 5), - makeBinary(module, BinaryenMinUVecI8x16(), 5), - makeBinary(module, BinaryenMaxSVecI8x16(), 5), - makeBinary(module, BinaryenMaxUVecI8x16(), 5), - makeBinary(module, BinaryenAddVecI64x2(), 5), - makeBinary(module, BinaryenSubVecI64x2(), 5), - makeBinary(module, BinaryenAddVecF32x4(), 5), - makeBinary(module, BinaryenSubVecF32x4(), 5), - makeBinary(module, BinaryenMulVecF32x4(), 5), - makeBinary(module, BinaryenMinSVecI32x4(), 5), - makeBinary(module, BinaryenMinUVecI32x4(), 5), - makeBinary(module, BinaryenMaxSVecI32x4(), 5), - makeBinary(module, BinaryenMaxUVecI32x4(), 5), - makeBinary(module, BinaryenDotSVecI16x8ToVecI32x4(), 5), - makeBinary(module, BinaryenDivVecF32x4(), 5), - makeBinary(module, BinaryenMinVecF32x4(), 5), - makeBinary(module, BinaryenMaxVecF32x4(), 5), - makeBinary(module, BinaryenAddVecF64x2(), 5), - makeBinary(module, BinaryenSubVecF64x2(), 5), - makeBinary(module, BinaryenMulVecF64x2(), 5), - makeBinary(module, BinaryenDivVecF64x2(), 5), - makeBinary(module, BinaryenMinVecF64x2(), 5), - makeBinary(module, BinaryenMaxVecF64x2(), 5), - makeBinary(module, BinaryenNarrowSVecI16x8ToVecI8x16(), 5), - makeBinary(module, BinaryenNarrowUVecI16x8ToVecI8x16(), 5), - makeBinary(module, BinaryenNarrowSVecI32x4ToVecI16x8(), 5), - makeBinary(module, BinaryenNarrowUVecI32x4ToVecI16x8(), 5), - makeBinary(module, BinaryenSwizzleVec8x16(), 5), + makeBinary(module, BinaryenAddInt32(), i32), + makeBinary(module, BinaryenSubFloat64(), f64), + makeBinary(module, BinaryenDivSInt32(), i32), + makeBinary(module, BinaryenDivUInt64(), i64), + makeBinary(module, BinaryenRemSInt64(), i64), + makeBinary(module, BinaryenRemUInt32(), i32), + makeBinary(module, BinaryenAndInt32(), i32), + makeBinary(module, BinaryenOrInt64(), i64), + makeBinary(module, BinaryenXorInt32(), i32), + makeBinary(module, BinaryenShlInt64(), i64), + makeBinary(module, BinaryenShrUInt64(), i64), + makeBinary(module, BinaryenShrSInt32(), i32), + makeBinary(module, BinaryenRotLInt32(), i32), + makeBinary(module, BinaryenRotRInt64(), i64), + makeBinary(module, BinaryenDivFloat32(), f32), + makeBinary(module, BinaryenCopySignFloat64(), f64), + makeBinary(module, BinaryenMinFloat32(), f32), + makeBinary(module, BinaryenMaxFloat64(), f64), + makeBinary(module, BinaryenEqInt32(), i32), + makeBinary(module, BinaryenNeFloat32(), f32), + makeBinary(module, BinaryenLtSInt32(), i32), + makeBinary(module, BinaryenLtUInt64(), i64), + makeBinary(module, BinaryenLeSInt64(), i64), + makeBinary(module, BinaryenLeUInt32(), i32), + makeBinary(module, BinaryenGtSInt64(), i64), + makeBinary(module, BinaryenGtUInt32(), i32), + makeBinary(module, BinaryenGeSInt32(), i32), + makeBinary(module, BinaryenGeUInt64(), i64), + makeBinary(module, BinaryenLtFloat32(), f32), + makeBinary(module, BinaryenLeFloat64(), f64), + makeBinary(module, BinaryenGtFloat64(), f64), + makeBinary(module, BinaryenGeFloat32(), f32), + makeBinary(module, BinaryenEqVecI8x16(), v128), + makeBinary(module, BinaryenNeVecI8x16(), v128), + makeBinary(module, BinaryenLtSVecI8x16(), v128), + makeBinary(module, BinaryenLtUVecI8x16(), v128), + makeBinary(module, BinaryenGtSVecI8x16(), v128), + makeBinary(module, BinaryenGtUVecI8x16(), v128), + makeBinary(module, BinaryenLeSVecI8x16(), v128), + makeBinary(module, BinaryenLeUVecI8x16(), v128), + makeBinary(module, BinaryenGeSVecI8x16(), v128), + makeBinary(module, BinaryenGeUVecI8x16(), v128), + makeBinary(module, BinaryenEqVecI16x8(), v128), + makeBinary(module, BinaryenNeVecI16x8(), v128), + makeBinary(module, BinaryenLtSVecI16x8(), v128), + makeBinary(module, BinaryenLtUVecI16x8(), v128), + makeBinary(module, BinaryenGtSVecI16x8(), v128), + makeBinary(module, BinaryenGtUVecI16x8(), v128), + makeBinary(module, BinaryenLeSVecI16x8(), v128), + makeBinary(module, BinaryenLeUVecI16x8(), v128), + makeBinary(module, BinaryenGeSVecI16x8(), v128), + makeBinary(module, BinaryenGeUVecI16x8(), v128), + makeBinary(module, BinaryenEqVecI32x4(), v128), + makeBinary(module, BinaryenNeVecI32x4(), v128), + makeBinary(module, BinaryenLtSVecI32x4(), v128), + makeBinary(module, BinaryenLtUVecI32x4(), v128), + makeBinary(module, BinaryenGtSVecI32x4(), v128), + makeBinary(module, BinaryenGtUVecI32x4(), v128), + makeBinary(module, BinaryenLeSVecI32x4(), v128), + makeBinary(module, BinaryenLeUVecI32x4(), v128), + makeBinary(module, BinaryenGeSVecI32x4(), v128), + makeBinary(module, BinaryenGeUVecI32x4(), v128), + makeBinary(module, BinaryenEqVecF32x4(), v128), + makeBinary(module, BinaryenNeVecF32x4(), v128), + makeBinary(module, BinaryenLtVecF32x4(), v128), + makeBinary(module, BinaryenGtVecF32x4(), v128), + makeBinary(module, BinaryenLeVecF32x4(), v128), + makeBinary(module, BinaryenGeVecF32x4(), v128), + makeBinary(module, BinaryenEqVecF64x2(), v128), + makeBinary(module, BinaryenNeVecF64x2(), v128), + makeBinary(module, BinaryenLtVecF64x2(), v128), + makeBinary(module, BinaryenGtVecF64x2(), v128), + makeBinary(module, BinaryenLeVecF64x2(), v128), + makeBinary(module, BinaryenGeVecF64x2(), v128), + makeBinary(module, BinaryenAndVec128(), v128), + makeBinary(module, BinaryenOrVec128(), v128), + makeBinary(module, BinaryenXorVec128(), v128), + makeBinary(module, BinaryenAndNotVec128(), v128), + makeBinary(module, BinaryenAddVecI8x16(), v128), + makeBinary(module, BinaryenAddSatSVecI8x16(), v128), + makeBinary(module, BinaryenAddSatUVecI8x16(), v128), + makeBinary(module, BinaryenSubVecI8x16(), v128), + makeBinary(module, BinaryenSubSatSVecI8x16(), v128), + makeBinary(module, BinaryenSubSatUVecI8x16(), v128), + makeBinary(module, BinaryenMulVecI8x16(), v128), + makeBinary(module, BinaryenAddVecI16x8(), v128), + makeBinary(module, BinaryenAddSatSVecI16x8(), v128), + makeBinary(module, BinaryenAddSatUVecI16x8(), v128), + makeBinary(module, BinaryenSubVecI16x8(), v128), + makeBinary(module, BinaryenSubSatSVecI16x8(), v128), + makeBinary(module, BinaryenSubSatUVecI16x8(), v128), + makeBinary(module, BinaryenMulVecI16x8(), v128), + makeBinary(module, BinaryenMinSVecI16x8(), v128), + makeBinary(module, BinaryenMinUVecI16x8(), v128), + makeBinary(module, BinaryenMaxSVecI16x8(), v128), + makeBinary(module, BinaryenMaxUVecI16x8(), v128), + makeBinary(module, BinaryenAddVecI32x4(), v128), + makeBinary(module, BinaryenSubVecI32x4(), v128), + makeBinary(module, BinaryenMulVecI32x4(), v128), + makeBinary(module, BinaryenMinSVecI8x16(), v128), + makeBinary(module, BinaryenMinUVecI8x16(), v128), + makeBinary(module, BinaryenMaxSVecI8x16(), v128), + makeBinary(module, BinaryenMaxUVecI8x16(), v128), + makeBinary(module, BinaryenAddVecI64x2(), v128), + makeBinary(module, BinaryenSubVecI64x2(), v128), + makeBinary(module, BinaryenAddVecF32x4(), v128), + makeBinary(module, BinaryenSubVecF32x4(), v128), + makeBinary(module, BinaryenMulVecF32x4(), v128), + makeBinary(module, BinaryenMinSVecI32x4(), v128), + makeBinary(module, BinaryenMinUVecI32x4(), v128), + makeBinary(module, BinaryenMaxSVecI32x4(), v128), + makeBinary(module, BinaryenMaxUVecI32x4(), v128), + makeBinary(module, BinaryenDotSVecI16x8ToVecI32x4(), v128), + makeBinary(module, BinaryenDivVecF32x4(), v128), + makeBinary(module, BinaryenMinVecF32x4(), v128), + makeBinary(module, BinaryenMaxVecF32x4(), v128), + makeBinary(module, BinaryenAddVecF64x2(), v128), + makeBinary(module, BinaryenSubVecF64x2(), v128), + makeBinary(module, BinaryenMulVecF64x2(), v128), + makeBinary(module, BinaryenDivVecF64x2(), v128), + makeBinary(module, BinaryenMinVecF64x2(), v128), + makeBinary(module, BinaryenMaxVecF64x2(), v128), + makeBinary(module, BinaryenNarrowSVecI16x8ToVecI8x16(), v128), + makeBinary(module, BinaryenNarrowUVecI16x8ToVecI8x16(), v128), + makeBinary(module, BinaryenNarrowSVecI32x4ToVecI16x8(), v128), + makeBinary(module, BinaryenNarrowUVecI32x4ToVecI16x8(), v128), + makeBinary(module, BinaryenSwizzleVec8x16(), v128), // SIMD lane manipulation makeSIMDExtract(module, BinaryenExtractLaneSVecI8x16()), makeSIMDExtract(module, BinaryenExtractLaneUVecI8x16()), @@ -478,12 +546,12 @@ void test_core() { makeSIMDExtract(module, BinaryenExtractLaneVecI64x2()), makeSIMDExtract(module, BinaryenExtractLaneVecF32x4()), makeSIMDExtract(module, BinaryenExtractLaneVecF64x2()), - makeSIMDReplace(module, BinaryenReplaceLaneVecI8x16(), 1), - makeSIMDReplace(module, BinaryenReplaceLaneVecI16x8(), 1), - makeSIMDReplace(module, BinaryenReplaceLaneVecI32x4(), 1), - makeSIMDReplace(module, BinaryenReplaceLaneVecI64x2(), 2), - makeSIMDReplace(module, BinaryenReplaceLaneVecF32x4(), 3), - makeSIMDReplace(module, BinaryenReplaceLaneVecF64x2(), 4), + makeSIMDReplace(module, BinaryenReplaceLaneVecI8x16(), i32), + makeSIMDReplace(module, BinaryenReplaceLaneVecI16x8(), i32), + makeSIMDReplace(module, BinaryenReplaceLaneVecI32x4(), i32), + makeSIMDReplace(module, BinaryenReplaceLaneVecI64x2(), i64), + makeSIMDReplace(module, BinaryenReplaceLaneVecF32x4(), f32), + makeSIMDReplace(module, BinaryenReplaceLaneVecF64x2(), f64), // SIMD shift makeSIMDShift(module, BinaryenShlVecI8x16()), makeSIMDShift(module, BinaryenShrSVecI8x16()), @@ -990,6 +1058,7 @@ void test_tracing() { BinaryenSetAPITracing(1); test_core(); test_relooper(); + test_types(); BinaryenSetAPITracing(0); } diff --git a/test/example/c-api-kitchen-sink.txt b/test/example/c-api-kitchen-sink.txt index 6689185ae..2c58a9777 100644 --- a/test/example/c-api-kitchen-sink.txt +++ b/test/example/c-api-kitchen-sink.txt @@ -1,13 +1,13 @@ -BinaryenTypeNone: 0 -BinaryenTypeInt32: 1 -BinaryenTypeInt64: 2 -BinaryenTypeFloat32: 3 -BinaryenTypeFloat64: 4 -BinaryenTypeVec128: 5 -BinaryenTypeAnyref: 6 -BinaryenTypeExnref: 7 -BinaryenTypeUnreachable: 8 -BinaryenTypeAuto: -1 + // BinaryenTypeNone: 0 + // BinaryenTypeUnreachable: 1 + // BinaryenTypeInt32: 2 + // BinaryenTypeInt64: 3 + // BinaryenTypeFloat32: 4 + // BinaryenTypeFloat64: 5 + // BinaryenTypeVec128: 6 + // BinaryenTypeAnyref: 7 + // BinaryenTypeExnref: 8 + // BinaryenTypeAuto: -1 BinaryenFeatureMVP: 0 BinaryenFeatureAtomics: 1 BinaryenFeatureBulkMemory: 16 @@ -2266,8 +2266,8 @@ int main() { expressions[16] = BinaryenConst(the_module, BinaryenLiteralFloat32(1.3)); expressions[17] = BinaryenConst(the_module, BinaryenLiteralFloat64(3.7)); { - BinaryenType paramTypes[] = { 1, 2, 3, 4 }; - functionTypes[0] = BinaryenAddFunctionType(the_module, "iiIfF", 1, paramTypes, 4); + BinaryenType paramTypes[] = { 2, 3, 4, 5 }; + functionTypes[0] = BinaryenAddFunctionType(the_module, "iiIfF", 2, paramTypes, 4); } expressions[18] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); expressions[19] = BinaryenConst(the_module, BinaryenLiteralInt32(2)); @@ -2286,7 +2286,7 @@ int main() { expressions[32] = BinaryenConst(the_module, BinaryenLiteralInt32(110)); expressions[33] = BinaryenConst(the_module, BinaryenLiteralInt64(111)); { - BinaryenType paramTypes[] = { 1 }; + BinaryenType paramTypes[] = { 2 }; functionTypes[1] = BinaryenAddFunctionType(the_module, "vi", 0, paramTypes, 1); } BinaryenAddEvent(the_module, "a-event", 0, functionTypes[1]); @@ -2295,14 +2295,14 @@ int main() { BinaryenExpressionRef operands[] = { expressions[34] }; expressions[35] = BinaryenThrow(the_module, "a-event", operands, 1); } - expressions[36] = BinaryenPop(the_module, 7); + expressions[36] = BinaryenPop(the_module, 8); expressions[37] = BinaryenLocalSet(the_module, 5, expressions[36]); - expressions[38] = BinaryenLocalGet(the_module, 5, 7); + expressions[38] = BinaryenLocalGet(the_module, 5, 8); expressions[39] = BinaryenBrOnExn(the_module, "try-block", "a-event", expressions[38]); expressions[40] = BinaryenRethrow(the_module, expressions[39]); { BinaryenExpressionRef children[] = { expressions[40] }; - expressions[41] = BinaryenBlock(the_module, "try-block", children, 1, 1); + expressions[41] = BinaryenBlock(the_module, "try-block", children, 1, 2); } expressions[42] = BinaryenDrop(the_module, expressions[41]); { @@ -3820,12 +3820,12 @@ int main() { } { BinaryenExpressionRef operands[] = { expressions[10], expressions[11], expressions[12], expressions[13] }; - expressions[737] = BinaryenCall(the_module, "kitchen()sinker", operands, 4, 1); + expressions[737] = BinaryenCall(the_module, "kitchen()sinker", operands, 4, 2); } expressions[738] = BinaryenUnary(the_module, 20, expressions[737]); { BinaryenExpressionRef operands[] = { expressions[8], expressions[9] }; - expressions[739] = BinaryenCall(the_module, "an-imported", operands, 2, 3); + expressions[739] = BinaryenCall(the_module, "an-imported", operands, 2, 4); } expressions[740] = BinaryenUnary(the_module, 25, expressions[739]); expressions[741] = BinaryenUnary(the_module, 20, expressions[740]); @@ -3835,7 +3835,7 @@ int main() { expressions[743] = BinaryenCallIndirect(the_module, expressions[742], operands, 4, "iiIfF"); } expressions[744] = BinaryenUnary(the_module, 20, expressions[743]); - expressions[745] = BinaryenLocalGet(the_module, 0, 1); + expressions[745] = BinaryenLocalGet(the_module, 0, 2); expressions[746] = BinaryenDrop(the_module, expressions[745]); expressions[747] = BinaryenConst(the_module, BinaryenLiteralInt32(101)); expressions[748] = BinaryenLocalSet(the_module, 0, expressions[747]); @@ -3843,21 +3843,21 @@ int main() { expressions[750] = BinaryenLocalTee(the_module, 0, expressions[749]); expressions[751] = BinaryenDrop(the_module, expressions[750]); expressions[752] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); - expressions[753] = BinaryenLoad(the_module, 4, 0, 0, 0, 1, expressions[752]); + expressions[753] = BinaryenLoad(the_module, 4, 0, 0, 0, 2, expressions[752]); expressions[754] = BinaryenConst(the_module, BinaryenLiteralInt32(8)); - expressions[755] = BinaryenLoad(the_module, 2, 1, 2, 1, 2, expressions[754]); + expressions[755] = BinaryenLoad(the_module, 2, 1, 2, 1, 3, expressions[754]); expressions[756] = BinaryenConst(the_module, BinaryenLiteralInt32(2)); - expressions[757] = BinaryenLoad(the_module, 4, 0, 0, 0, 3, expressions[756]); + expressions[757] = BinaryenLoad(the_module, 4, 0, 0, 0, 4, expressions[756]); expressions[758] = BinaryenConst(the_module, BinaryenLiteralInt32(9)); - expressions[759] = BinaryenLoad(the_module, 8, 0, 2, 8, 4, expressions[758]); - expressions[760] = BinaryenStore(the_module, 4, 0, 0, expressions[30], expressions[31], 1); - expressions[761] = BinaryenStore(the_module, 8, 2, 4, expressions[32], expressions[33], 2); + expressions[759] = BinaryenLoad(the_module, 8, 0, 2, 8, 5, expressions[758]); + expressions[760] = BinaryenStore(the_module, 4, 0, 0, expressions[30], expressions[31], 2); + expressions[761] = BinaryenStore(the_module, 8, 2, 4, expressions[32], expressions[33], 3); expressions[762] = BinaryenSelect(the_module, expressions[27], expressions[28], expressions[29]); expressions[763] = BinaryenConst(the_module, BinaryenLiteralInt32(1337)); expressions[764] = BinaryenReturn(the_module, expressions[763]); { BinaryenExpressionRef operands[] = { expressions[10], expressions[11], expressions[12], expressions[13] }; - expressions[765] = BinaryenReturnCall(the_module, "kitchen()sinker", operands, 4, 1); + expressions[765] = BinaryenReturnCall(the_module, "kitchen()sinker", operands, 4, 2); } expressions[766] = BinaryenConst(the_module, BinaryenLiteralInt32(2449)); { @@ -3865,24 +3865,24 @@ int main() { expressions[767] = BinaryenReturnCallIndirect(the_module, expressions[766], operands, 4, "iiIfF"); } expressions[768] = BinaryenTry(the_module, expressions[35], expressions[43]); - expressions[769] = BinaryenAtomicLoad(the_module, 4, 0, 1, expressions[23]); - expressions[770] = BinaryenAtomicStore(the_module, 4, 0, expressions[23], expressions[769], 1); - expressions[771] = BinaryenAtomicWait(the_module, expressions[23], expressions[23], expressions[33], 1); + expressions[769] = BinaryenAtomicLoad(the_module, 4, 0, 2, expressions[23]); + expressions[770] = BinaryenAtomicStore(the_module, 4, 0, expressions[23], expressions[769], 2); + expressions[771] = BinaryenAtomicWait(the_module, expressions[23], expressions[23], expressions[33], 2); expressions[772] = BinaryenDrop(the_module, expressions[771]); expressions[773] = BinaryenAtomicNotify(the_module, expressions[23], expressions[23]); expressions[774] = BinaryenDrop(the_module, expressions[773]); expressions[775] = BinaryenAtomicFence(the_module); - expressions[776] = BinaryenPop(the_module, 1); + expressions[776] = BinaryenPop(the_module, 2); expressions[777] = BinaryenPush(the_module, expressions[776]); - expressions[778] = BinaryenPop(the_module, 2); + expressions[778] = BinaryenPop(the_module, 3); expressions[779] = BinaryenPush(the_module, expressions[778]); - expressions[780] = BinaryenPop(the_module, 3); + expressions[780] = BinaryenPop(the_module, 4); expressions[781] = BinaryenPush(the_module, expressions[780]); - expressions[782] = BinaryenPop(the_module, 4); + expressions[782] = BinaryenPop(the_module, 5); expressions[783] = BinaryenPush(the_module, expressions[782]); - expressions[784] = BinaryenPop(the_module, 6); + expressions[784] = BinaryenPop(the_module, 7); expressions[785] = BinaryenPush(the_module, expressions[784]); - expressions[786] = BinaryenPop(the_module, 7); + expressions[786] = BinaryenPop(the_module, 8); expressions[787] = BinaryenPush(the_module, expressions[786]); expressions[788] = BinaryenNop(the_module); expressions[789] = BinaryenUnreachable(the_module); @@ -3954,16 +3954,16 @@ int main() { expressions[794] = BinaryenBlock(the_module, "the-body", children, 2, BinaryenTypeAuto()); } { - BinaryenType varTypes[] = { 1, 7 }; + BinaryenType varTypes[] = { 2, 8 }; functions[0] = BinaryenAddFunction(the_module, "kitchen()sinker", functionTypes[0], varTypes, 2, expressions[794]); } expressions[795] = BinaryenConst(the_module, BinaryenLiteralInt32(7)); - globals[0] = BinaryenAddGlobal(the_module, "a-global", 1, 0, expressions[795]); + globals[0] = BinaryenAddGlobal(the_module, "a-global", 2, 0, expressions[795]); expressions[796] = BinaryenConst(the_module, BinaryenLiteralFloat32(7.5)); - globals[1] = BinaryenAddGlobal(the_module, "a-mutable-global", 3, 1, expressions[796]); + globals[1] = BinaryenAddGlobal(the_module, "a-mutable-global", 4, 1, expressions[796]); { - BinaryenType paramTypes[] = { 1, 4 }; - functionTypes[2] = BinaryenAddFunctionType(the_module, "fiF", 3, paramTypes, 2); + BinaryenType paramTypes[] = { 2, 5 }; + functionTypes[2] = BinaryenAddFunctionType(the_module, "fiF", 4, paramTypes, 2); } BinaryenAddFunctionImport(the_module, "an-imported", "module", "base", functionTypes[2]); exports[0] = BinaryenAddFunctionExport(the_module, "kitchen()sinker", "kitchen_sinker"); @@ -5693,7 +5693,7 @@ int main() { functionTypes[0] = BinaryenAddFunctionType(the_module, "v", 0, paramTypes, 0); } { - BinaryenType paramTypes[] = { 1 }; + BinaryenType paramTypes[] = { 2 }; functionTypes[1] = BinaryenAddFunctionType(the_module, "vi", 0, paramTypes, 1); } BinaryenAddFunctionImport(the_module, "check", "module", "check", functionTypes[1]); @@ -5706,7 +5706,7 @@ int main() { relooperBlocks[0] = RelooperAddBlock(the_relooper, expressions[2]); expressions[3] = RelooperRenderAndDispose(the_relooper, relooperBlocks[0], 0); { - BinaryenType varTypes[] = { 1 }; + BinaryenType varTypes[] = { 2 }; functions[0] = BinaryenAddFunction(the_module, "just-one-block", functionTypes[0], varTypes, 1, expressions[3]); } the_relooper = RelooperCreate(the_module); @@ -5725,7 +5725,7 @@ int main() { RelooperAddBranch(relooperBlocks[0], relooperBlocks[1], expressions[0], expressions[0]); expressions[8] = RelooperRenderAndDispose(the_relooper, relooperBlocks[0], 0); { - BinaryenType varTypes[] = { 1 }; + BinaryenType varTypes[] = { 2 }; functions[1] = BinaryenAddFunction(the_module, "two-blocks", functionTypes[0], varTypes, 1, expressions[8]); } the_relooper = RelooperCreate(the_module); @@ -5746,7 +5746,7 @@ int main() { RelooperAddBranch(relooperBlocks[0], relooperBlocks[1], expressions[0], expressions[14]); expressions[15] = RelooperRenderAndDispose(the_relooper, relooperBlocks[0], 0); { - BinaryenType varTypes[] = { 1 }; + BinaryenType varTypes[] = { 2 }; functions[2] = BinaryenAddFunction(the_module, "two-blocks-plus-code", functionTypes[0], varTypes, 1, expressions[15]); } the_relooper = RelooperCreate(the_module); @@ -5766,7 +5766,7 @@ int main() { RelooperAddBranch(relooperBlocks[1], relooperBlocks[0], expressions[0], expressions[0]); expressions[20] = RelooperRenderAndDispose(the_relooper, relooperBlocks[0], 0); { - BinaryenType varTypes[] = { 1 }; + BinaryenType varTypes[] = { 2 }; functions[3] = BinaryenAddFunction(the_module, "loop", functionTypes[0], varTypes, 1, expressions[20]); } the_relooper = RelooperCreate(the_module); @@ -5790,7 +5790,7 @@ int main() { RelooperAddBranch(relooperBlocks[1], relooperBlocks[0], expressions[0], expressions[28]); expressions[29] = RelooperRenderAndDispose(the_relooper, relooperBlocks[0], 0); { - BinaryenType varTypes[] = { 1 }; + BinaryenType varTypes[] = { 2 }; functions[4] = BinaryenAddFunction(the_module, "loop-plus-code", functionTypes[0], varTypes, 1, expressions[29]); } the_relooper = RelooperCreate(the_module); @@ -5817,7 +5817,7 @@ int main() { RelooperAddBranch(relooperBlocks[0], relooperBlocks[2], expressions[0], expressions[0]); expressions[37] = RelooperRenderAndDispose(the_relooper, relooperBlocks[0], 0); { - BinaryenType varTypes[] = { 1 }; + BinaryenType varTypes[] = { 2 }; functions[5] = BinaryenAddFunction(the_module, "split", functionTypes[0], varTypes, 1, expressions[37]); } the_relooper = RelooperCreate(the_module); @@ -5848,7 +5848,7 @@ int main() { RelooperAddBranch(relooperBlocks[0], relooperBlocks[2], expressions[0], expressions[48]); expressions[49] = RelooperRenderAndDispose(the_relooper, relooperBlocks[0], 0); { - BinaryenType varTypes[] = { 1 }; + BinaryenType varTypes[] = { 2 }; functions[6] = BinaryenAddFunction(the_module, "split-plus-code", functionTypes[0], varTypes, 1, expressions[49]); } the_relooper = RelooperCreate(the_module); @@ -5876,7 +5876,7 @@ int main() { RelooperAddBranch(relooperBlocks[1], relooperBlocks[2], expressions[0], expressions[0]); expressions[57] = RelooperRenderAndDispose(the_relooper, relooperBlocks[0], 0); { - BinaryenType varTypes[] = { 1 }; + BinaryenType varTypes[] = { 2 }; functions[7] = BinaryenAddFunction(the_module, "if", functionTypes[0], varTypes, 1, expressions[57]); } the_relooper = RelooperCreate(the_module); @@ -5910,7 +5910,7 @@ int main() { RelooperAddBranch(relooperBlocks[1], relooperBlocks[2], expressions[0], expressions[70]); expressions[71] = RelooperRenderAndDispose(the_relooper, relooperBlocks[0], 0); { - BinaryenType varTypes[] = { 1 }; + BinaryenType varTypes[] = { 2 }; functions[8] = BinaryenAddFunction(the_module, "if-plus-code", functionTypes[0], varTypes, 1, expressions[71]); } the_relooper = RelooperCreate(the_module); @@ -5945,7 +5945,7 @@ int main() { RelooperAddBranch(relooperBlocks[2], relooperBlocks[3], expressions[0], expressions[0]); expressions[81] = RelooperRenderAndDispose(the_relooper, relooperBlocks[0], 0); { - BinaryenType varTypes[] = { 1 }; + BinaryenType varTypes[] = { 2 }; functions[9] = BinaryenAddFunction(the_module, "if-else", functionTypes[0], varTypes, 1, expressions[81]); } the_relooper = RelooperCreate(the_module); @@ -5973,7 +5973,7 @@ int main() { RelooperAddBranch(relooperBlocks[1], relooperBlocks[2], expressions[0], expressions[0]); expressions[89] = RelooperRenderAndDispose(the_relooper, relooperBlocks[0], 0); { - BinaryenType varTypes[] = { 1 }; + BinaryenType varTypes[] = { 2 }; functions[10] = BinaryenAddFunction(the_module, "loop-tail", functionTypes[0], varTypes, 1, expressions[89]); } the_relooper = RelooperCreate(the_module); @@ -6041,7 +6041,7 @@ int main() { RelooperAddBranch(relooperBlocks[5], relooperBlocks[6], expressions[0], expressions[114]); expressions[115] = RelooperRenderAndDispose(the_relooper, relooperBlocks[0], 0); { - BinaryenType varTypes[] = { 1 }; + BinaryenType varTypes[] = { 2 }; functions[11] = BinaryenAddFunction(the_module, "nontrivial-loop-plus-phi-to-head", functionTypes[0], varTypes, 1, expressions[115]); } the_relooper = RelooperCreate(the_module); @@ -6086,7 +6086,7 @@ int main() { } expressions[127] = RelooperRenderAndDispose(the_relooper, relooperBlocks[0], 0); { - BinaryenType varTypes[] = { 1 }; + BinaryenType varTypes[] = { 2 }; functions[12] = BinaryenAddFunction(the_module, "switch", functionTypes[0], varTypes, 1, expressions[127]); } the_relooper = RelooperCreate(the_module); @@ -6115,12 +6115,12 @@ int main() { RelooperAddBranch(relooperBlocks[2], relooperBlocks[1], expressions[0], expressions[0]); expressions[135] = RelooperRenderAndDispose(the_relooper, relooperBlocks[0], 3); { - BinaryenType varTypes[] = { 1, 1, 2, 1, 3, 4, 1 }; + BinaryenType varTypes[] = { 2, 2, 3, 2, 4, 5, 2 }; functions[13] = BinaryenAddFunction(the_module, "duffs-device", functionTypes[0], varTypes, 7, expressions[135]); } { BinaryenType paramTypes[] = { 0 }; - functionTypes[2] = BinaryenAddFunctionType(the_module, "i", 1, paramTypes, 0); + functionTypes[2] = BinaryenAddFunctionType(the_module, "i", 2, paramTypes, 0); } the_relooper = RelooperCreate(the_module); expressions[136] = BinaryenConst(the_module, BinaryenLiteralInt32(42)); @@ -6137,7 +6137,7 @@ int main() { relooperBlocks[0] = RelooperAddBlock(the_relooper, expressions[140]); expressions[141] = RelooperRenderAndDispose(the_relooper, relooperBlocks[0], 0); { - BinaryenType varTypes[] = { 1 }; + BinaryenType varTypes[] = { 2 }; functions[14] = BinaryenAddFunction(the_module, "return", functionTypes[2], varTypes, 1, expressions[141]); } raw: @@ -6621,6 +6621,28 @@ optimized: events.clear(); exports.clear(); relooperBlocks.clear(); + // BinaryenTypeNone: 0 + // BinaryenTypeUnreachable: 1 + // BinaryenTypeInt32: 2 + // BinaryenTypeInt64: 3 + // BinaryenTypeFloat32: 4 + // BinaryenTypeFloat64: 5 + // BinaryenTypeVec128: 6 + // BinaryenTypeAnyref: 7 + // BinaryenTypeExnref: 8 + // BinaryenTypeAuto: -1 + { + BinaryenType t269[] = {2, 2}; + BinaryenTypeCreate(t269, 2); // 9 + } + { + BinaryenType t270[] = {2, 2}; + BinaryenTypeCreate(t270, 2); // 9 + } + { + BinaryenType t271[] = {4, 4}; + BinaryenTypeCreate(t271, 2); // 10 + } return 0; } (module diff --git a/test/example/c-api-relooper-unreachable-if.cpp b/test/example/c-api-relooper-unreachable-if.cpp index 5f7b2e874..1b4b2a1b7 100644 --- a/test/example/c-api-relooper-unreachable-if.cpp +++ b/test/example/c-api-relooper-unreachable-if.cpp @@ -20,9 +20,10 @@ int main() { BinaryenSetMemory(the_module, 256, 256, "memory", segments, segmentPassive, segmentOffsets, segmentSizes, 0, 0); } the_relooper = RelooperCreate(the_module); - expressions[1] = BinaryenLocalGet(the_module, 0, 1); + expressions[1] = BinaryenLocalGet(the_module, 0, BinaryenTypeInt32()); expressions[2] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[3] = BinaryenStore(the_module, 4, 0, 0, expressions[2], expressions[1], 1); + expressions[3] = BinaryenStore( + the_module, 4, 0, 0, expressions[2], expressions[1], BinaryenTypeInt32()); expressions[4] = BinaryenReturn(the_module, expressions[0]); { BinaryenExpressionRef children[] = { expressions[3], expressions[4] }; @@ -30,7 +31,7 @@ int main() { } relooperBlocks[0] = RelooperAddBlock(the_relooper, expressions[5]); { - BinaryenType paramTypes[] = { 0 }; + BinaryenType paramTypes[] = {BinaryenTypeNone()}; functionTypes[0] = BinaryenAddFunctionType(the_module, "rustfn-0-40", 0, paramTypes, 0); } expressions[6] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); @@ -40,14 +41,16 @@ int main() { RelooperAddBranch(relooperBlocks[1], relooperBlocks[0], expressions[0], expressions[0]); expressions[9] = RelooperRenderAndDispose(the_relooper, relooperBlocks[1], 1); { - BinaryenType varTypes[] = { 1, 1, 2 }; + BinaryenType varTypes[] = { + BinaryenTypeInt32(), BinaryenTypeInt32(), BinaryenTypeInt64()}; functions[0] = BinaryenAddFunction(the_module, "tinycore::eh_personality", functionTypes[0], varTypes, 3, expressions[9]); } BinaryenAddFunctionExport(the_module, "tinycore::eh_personality", "tinycore::eh_personality"); the_relooper = RelooperCreate(the_module); - expressions[10] = BinaryenLocalGet(the_module, 0, 1); + expressions[10] = BinaryenLocalGet(the_module, 0, BinaryenTypeInt32()); expressions[11] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[12] = BinaryenStore(the_module, 4, 0, 0, expressions[11], expressions[10], 1); + expressions[12] = BinaryenStore( + the_module, 4, 0, 0, expressions[11], expressions[10], BinaryenTypeInt32()); expressions[13] = BinaryenReturn(the_module, expressions[0]); { BinaryenExpressionRef children[] = { expressions[12], expressions[13] }; @@ -61,7 +64,8 @@ int main() { RelooperAddBranch(relooperBlocks[1], relooperBlocks[0], expressions[0], expressions[0]); expressions[18] = RelooperRenderAndDispose(the_relooper, relooperBlocks[1], 1); { - BinaryenType varTypes[] = { 1, 1, 2 }; + BinaryenType varTypes[] = { + BinaryenTypeInt32(), BinaryenTypeInt32(), BinaryenTypeInt64()}; functions[1] = BinaryenAddFunction(the_module, "tinycore::eh_unwind_resume", functionTypes[0], varTypes, 3, expressions[18]); } BinaryenAddFunctionExport(the_module, "tinycore::eh_unwind_resume", "tinycore::eh_unwind_resume"); @@ -79,7 +83,7 @@ int main() { RelooperAddBranch(relooperBlocks[0], relooperBlocks[1], expressions[0], expressions[0]); RelooperAddBranch(relooperBlocks[1], relooperBlocks[1], expressions[0], expressions[0]); { - BinaryenType paramTypes[] = { 0 }; + BinaryenType paramTypes[] = {BinaryenTypeNone()}; functionTypes[1] = BinaryenAddFunctionType(the_module, "rustfn-0-42", 0, paramTypes, 0); } expressions[21] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); @@ -89,14 +93,16 @@ int main() { RelooperAddBranch(relooperBlocks[2], relooperBlocks[0], expressions[0], expressions[0]); expressions[24] = RelooperRenderAndDispose(the_relooper, relooperBlocks[2], 1); { - BinaryenType varTypes[] = { 1, 1, 2 }; + BinaryenType varTypes[] = { + BinaryenTypeInt32(), BinaryenTypeInt32(), BinaryenTypeInt64()}; functions[2] = BinaryenAddFunction(the_module, "tinycore::panic_fmt", functionTypes[1], varTypes, 3, expressions[24]); } BinaryenAddFunctionExport(the_module, "tinycore::panic_fmt", "tinycore::panic_fmt"); the_relooper = RelooperCreate(the_module); - expressions[25] = BinaryenLocalGet(the_module, 0, 1); + expressions[25] = BinaryenLocalGet(the_module, 0, BinaryenTypeInt32()); expressions[26] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[27] = BinaryenStore(the_module, 4, 0, 0, expressions[26], expressions[25], 1); + expressions[27] = BinaryenStore( + the_module, 4, 0, 0, expressions[26], expressions[25], BinaryenTypeInt32()); expressions[28] = BinaryenReturn(the_module, expressions[0]); { BinaryenExpressionRef children[] = { expressions[27], expressions[28] }; @@ -110,14 +116,16 @@ int main() { RelooperAddBranch(relooperBlocks[1], relooperBlocks[0], expressions[0], expressions[0]); expressions[33] = RelooperRenderAndDispose(the_relooper, relooperBlocks[1], 1); { - BinaryenType varTypes[] = { 1, 1, 2 }; + BinaryenType varTypes[] = { + BinaryenTypeInt32(), BinaryenTypeInt32(), BinaryenTypeInt64()}; functions[3] = BinaryenAddFunction(the_module, "tinycore::rust_eh_register_frames", functionTypes[0], varTypes, 3, expressions[33]); } BinaryenAddFunctionExport(the_module, "tinycore::rust_eh_register_frames", "tinycore::rust_eh_register_frames"); the_relooper = RelooperCreate(the_module); - expressions[34] = BinaryenLocalGet(the_module, 0, 1); + expressions[34] = BinaryenLocalGet(the_module, 0, BinaryenTypeInt32()); expressions[35] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[36] = BinaryenStore(the_module, 4, 0, 0, expressions[35], expressions[34], 1); + expressions[36] = BinaryenStore( + the_module, 4, 0, 0, expressions[35], expressions[34], BinaryenTypeInt32()); expressions[37] = BinaryenReturn(the_module, expressions[0]); { BinaryenExpressionRef children[] = { expressions[36], expressions[37] }; @@ -131,21 +139,22 @@ int main() { RelooperAddBranch(relooperBlocks[1], relooperBlocks[0], expressions[0], expressions[0]); expressions[42] = RelooperRenderAndDispose(the_relooper, relooperBlocks[1], 1); { - BinaryenType varTypes[] = { 1, 1, 2 }; + BinaryenType varTypes[] = { + BinaryenTypeInt32(), BinaryenTypeInt32(), BinaryenTypeInt64()}; functions[4] = BinaryenAddFunction(the_module, "tinycore::rust_eh_unregister_frames", functionTypes[0], varTypes, 3, expressions[42]); } BinaryenAddFunctionExport(the_module, "tinycore::rust_eh_unregister_frames", "tinycore::rust_eh_unregister_frames"); the_relooper = RelooperCreate(the_module); - expressions[43] = BinaryenLocalGet(the_module, 0, 1); + expressions[43] = BinaryenLocalGet(the_module, 0, BinaryenTypeInt32()); expressions[44] = BinaryenLocalSet(the_module, 1, expressions[43]); - expressions[45] = BinaryenLocalGet(the_module, 1, 1); + expressions[45] = BinaryenLocalGet(the_module, 1, BinaryenTypeInt32()); expressions[46] = BinaryenLocalSet(the_module, 2, expressions[45]); { - BinaryenType paramTypes[] = { 1 }; + BinaryenType paramTypes[] = {BinaryenTypeInt32()}; functionTypes[2] = BinaryenAddFunctionType(the_module, "print_i32", 0, paramTypes, 1); } BinaryenAddFunctionImport(the_module, "print_i32", "spectest", "print", functionTypes[2]); - expressions[47] = BinaryenLocalGet(the_module, 2, 1); + expressions[47] = BinaryenLocalGet(the_module, 2, BinaryenTypeInt32()); { BinaryenExpressionRef operands[] = { expressions[47] }; expressions[48] = BinaryenCall(the_module, "print_i32", operands, 1, 0); @@ -155,9 +164,10 @@ int main() { expressions[49] = BinaryenBlock(the_module, "bb0", children, 3, BinaryenTypeAuto()); } relooperBlocks[0] = RelooperAddBlock(the_relooper, expressions[49]); - expressions[50] = BinaryenLocalGet(the_module, 3, 1); + expressions[50] = BinaryenLocalGet(the_module, 3, BinaryenTypeInt32()); expressions[51] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[52] = BinaryenStore(the_module, 4, 0, 0, expressions[51], expressions[50], 1); + expressions[52] = BinaryenStore( + the_module, 4, 0, 0, expressions[51], expressions[50], BinaryenTypeInt32()); expressions[53] = BinaryenReturn(the_module, expressions[0]); { BinaryenExpressionRef children[] = { expressions[52], expressions[53] }; @@ -166,7 +176,7 @@ int main() { relooperBlocks[1] = RelooperAddBlock(the_relooper, expressions[54]); RelooperAddBranch(relooperBlocks[0], relooperBlocks[1], expressions[0], expressions[0]); { - BinaryenType paramTypes[] = { 1 }; + BinaryenType paramTypes[] = {BinaryenTypeInt32()}; functionTypes[3] = BinaryenAddFunctionType(the_module, "rustfn-0-49", 0, paramTypes, 1); } expressions[55] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); @@ -176,25 +186,29 @@ int main() { RelooperAddBranch(relooperBlocks[2], relooperBlocks[0], expressions[0], expressions[0]); expressions[58] = RelooperRenderAndDispose(the_relooper, relooperBlocks[2], 4); { - BinaryenType varTypes[] = { 1, 1, 1, 1, 2 }; + BinaryenType varTypes[] = {BinaryenTypeInt32(), + BinaryenTypeInt32(), + BinaryenTypeInt32(), + BinaryenTypeInt32(), + BinaryenTypeInt64()}; functions[5] = BinaryenAddFunction(the_module, "wasm::print_i32", functionTypes[3], varTypes, 5, expressions[58]); } BinaryenAddFunctionExport(the_module, "wasm::print_i32", "wasm::print_i32"); the_relooper = RelooperCreate(the_module); expressions[59] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); expressions[60] = BinaryenLocalSet(the_module, 0, expressions[59]); - expressions[61] = BinaryenLocalGet(the_module, 0, 1); + expressions[61] = BinaryenLocalGet(the_module, 0, BinaryenTypeInt32()); expressions[62] = BinaryenLocalSet(the_module, 2, expressions[61]); - expressions[63] = BinaryenLocalGet(the_module, 2, 1); + expressions[63] = BinaryenLocalGet(the_module, 2, BinaryenTypeInt32()); expressions[64] = BinaryenConst(the_module, BinaryenLiteralInt32(2)); expressions[65] = BinaryenUnary(the_module, 22, expressions[63]); expressions[66] = BinaryenUnary(the_module, 22, expressions[64]); expressions[67] = BinaryenBinary(the_module, 25, expressions[65], expressions[66]); expressions[68] = BinaryenLocalSet(the_module, 8, expressions[67]); - expressions[69] = BinaryenLocalGet(the_module, 8, 2); + expressions[69] = BinaryenLocalGet(the_module, 8, BinaryenTypeInt64()); expressions[70] = BinaryenUnary(the_module, 24, expressions[69]); expressions[71] = BinaryenConst(the_module, BinaryenLiteralInt64(32)); - expressions[72] = BinaryenLocalGet(the_module, 8, 2); + expressions[72] = BinaryenLocalGet(the_module, 8, BinaryenTypeInt64()); expressions[73] = BinaryenBinary(the_module, 36, expressions[72], expressions[71]); expressions[74] = BinaryenUnary(the_module, 24, expressions[73]); expressions[75] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); @@ -202,40 +216,44 @@ int main() { expressions[77] = BinaryenConst(the_module, BinaryenLiteralInt32(128)); expressions[78] = BinaryenBinary(the_module, 1, expressions[76], expressions[77]); expressions[79] = BinaryenLocalTee(the_module, 3, expressions[78]); - expressions[80] = BinaryenStore(the_module, 4, 0, 0, expressions[75], expressions[79], 1); - expressions[81] = BinaryenLocalGet(the_module, 3, 1); - expressions[82] = BinaryenStore(the_module, 4, 0, 0, expressions[81], expressions[70], 1); - expressions[83] = BinaryenStore(the_module, 4, 4, 0, expressions[81], expressions[74], 1); + expressions[80] = BinaryenStore( + the_module, 4, 0, 0, expressions[75], expressions[79], BinaryenTypeInt32()); + expressions[81] = BinaryenLocalGet(the_module, 3, BinaryenTypeInt32()); + expressions[82] = BinaryenStore( + the_module, 4, 0, 0, expressions[81], expressions[70], BinaryenTypeInt32()); + expressions[83] = BinaryenStore( + the_module, 4, 4, 0, expressions[81], expressions[74], BinaryenTypeInt32()); { BinaryenExpressionRef children[] = { expressions[60], expressions[62], expressions[68], expressions[80], expressions[82], expressions[83] }; expressions[84] = BinaryenBlock(the_module, "bb0", children, 6, BinaryenTypeAuto()); } relooperBlocks[0] = RelooperAddBlock(the_relooper, expressions[84]); - expressions[85] = BinaryenLocalGet(the_module, 3, 1); + expressions[85] = BinaryenLocalGet(the_module, 3, BinaryenTypeInt32()); expressions[86] = BinaryenLoad(the_module, 4, 0, 0, 0, 1, expressions[85]); expressions[87] = BinaryenLocalSet(the_module, 1, expressions[86]); - expressions[88] = BinaryenLocalGet(the_module, 1, 1); + expressions[88] = BinaryenLocalGet(the_module, 1, BinaryenTypeInt32()); expressions[89] = BinaryenLocalSet(the_module, 4, expressions[88]); - expressions[90] = BinaryenLocalGet(the_module, 4, 1); + expressions[90] = BinaryenLocalGet(the_module, 4, BinaryenTypeInt32()); expressions[91] = BinaryenLocalSet(the_module, 5, expressions[90]); - expressions[92] = BinaryenLocalGet(the_module, 6, 1); + expressions[92] = BinaryenLocalGet(the_module, 6, BinaryenTypeInt32()); expressions[93] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[94] = BinaryenStore(the_module, 4, 0, 0, expressions[93], expressions[92], 1); - expressions[95] = BinaryenLocalGet(the_module, 5, 1); + expressions[94] = BinaryenStore( + the_module, 4, 0, 0, expressions[93], expressions[92], BinaryenTypeInt32()); + expressions[95] = BinaryenLocalGet(the_module, 5, BinaryenTypeInt32()); expressions[96] = BinaryenReturn(the_module, expressions[95]); { BinaryenExpressionRef children[] = { expressions[87], expressions[89], expressions[91], expressions[94], expressions[96] }; expressions[97] = BinaryenBlock(the_module, "bb1", children, 5, BinaryenTypeAuto()); } relooperBlocks[1] = RelooperAddBlock(the_relooper, expressions[97]); - expressions[98] = BinaryenLocalGet(the_module, 3, 1); + expressions[98] = BinaryenLocalGet(the_module, 3, BinaryenTypeInt32()); expressions[99] = BinaryenLoad(the_module, 4, 0, 8, 0, 1, expressions[98]); RelooperAddBranch(relooperBlocks[0], relooperBlocks[1], expressions[99], expressions[0]); expressions[100] = BinaryenUnreachable(the_module); relooperBlocks[2] = RelooperAddBlock(the_relooper, expressions[100]); RelooperAddBranch(relooperBlocks[0], relooperBlocks[2], expressions[0], expressions[0]); { - BinaryenType paramTypes[] = { 0 }; + BinaryenType paramTypes[] = {BinaryenTypeNone()}; functionTypes[4] = BinaryenAddFunctionType(the_module, "rustfn-0-54", 1, paramTypes, 0); } expressions[101] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); @@ -245,12 +263,20 @@ int main() { RelooperAddBranch(relooperBlocks[3], relooperBlocks[0], expressions[0], expressions[0]); expressions[104] = RelooperRenderAndDispose(the_relooper, relooperBlocks[3], 7); { - BinaryenType varTypes[] = { 1, 1, 1, 1, 1, 1, 1, 1, 2 }; + BinaryenType varTypes[] = {BinaryenTypeInt32(), + BinaryenTypeInt32(), + BinaryenTypeInt32(), + BinaryenTypeInt32(), + BinaryenTypeInt32(), + BinaryenTypeInt32(), + BinaryenTypeInt32(), + BinaryenTypeInt32(), + BinaryenTypeInt64()}; functions[6] = BinaryenAddFunction(the_module, "real_main", functionTypes[4], varTypes, 9, expressions[104]); } BinaryenAddFunctionExport(the_module, "real_main", "real_main"); the_relooper = RelooperCreate(the_module); - expressions[105] = BinaryenLocalGet(the_module, 0, 1); + expressions[105] = BinaryenLocalGet(the_module, 0, BinaryenTypeInt32()); expressions[106] = BinaryenLocalSet(the_module, 2, expressions[105]); { BinaryenExpressionRef operands[] = { 0 }; @@ -262,16 +288,16 @@ int main() { expressions[109] = BinaryenBlock(the_module, "bb0", children, 2, BinaryenTypeAuto()); } relooperBlocks[0] = RelooperAddBlock(the_relooper, expressions[109]); - expressions[110] = BinaryenLocalGet(the_module, 4, 1); + expressions[110] = BinaryenLocalGet(the_module, 4, BinaryenTypeInt32()); expressions[111] = BinaryenConst(the_module, BinaryenLiteralInt32(3)); expressions[112] = BinaryenUnary(the_module, 22, expressions[110]); expressions[113] = BinaryenUnary(the_module, 22, expressions[111]); expressions[114] = BinaryenBinary(the_module, 25, expressions[112], expressions[113]); expressions[115] = BinaryenLocalSet(the_module, 11, expressions[114]); - expressions[116] = BinaryenLocalGet(the_module, 11, 2); + expressions[116] = BinaryenLocalGet(the_module, 11, BinaryenTypeInt64()); expressions[117] = BinaryenUnary(the_module, 24, expressions[116]); expressions[118] = BinaryenConst(the_module, BinaryenLiteralInt64(32)); - expressions[119] = BinaryenLocalGet(the_module, 11, 2); + expressions[119] = BinaryenLocalGet(the_module, 11, BinaryenTypeInt64()); expressions[120] = BinaryenBinary(the_module, 36, expressions[119], expressions[118]); expressions[121] = BinaryenUnary(the_module, 24, expressions[120]); expressions[122] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); @@ -279,21 +305,39 @@ int main() { expressions[124] = BinaryenConst(the_module, BinaryenLiteralInt32(128)); expressions[125] = BinaryenBinary(the_module, 1, expressions[123], expressions[124]); expressions[126] = BinaryenLocalTee(the_module, 5, expressions[125]); - expressions[127] = BinaryenStore(the_module, 4, 0, 0, expressions[122], expressions[126], 1); - expressions[128] = BinaryenLocalGet(the_module, 5, 1); - expressions[129] = BinaryenStore(the_module, 4, 0, 0, expressions[128], expressions[117], 1); - expressions[130] = BinaryenStore(the_module, 4, 4, 0, expressions[128], expressions[121], 1); + expressions[127] = BinaryenStore(the_module, + 4, + 0, + 0, + expressions[122], + expressions[126], + BinaryenTypeInt32()); + expressions[128] = BinaryenLocalGet(the_module, 5, BinaryenTypeInt32()); + expressions[129] = BinaryenStore(the_module, + 4, + 0, + 0, + expressions[128], + expressions[117], + BinaryenTypeInt32()); + expressions[130] = BinaryenStore(the_module, + 4, + 4, + 0, + expressions[128], + expressions[121], + BinaryenTypeInt32()); { BinaryenExpressionRef children[] = { expressions[115], expressions[127], expressions[129], expressions[130] }; expressions[131] = BinaryenBlock(the_module, "bb1", children, 4, BinaryenTypeAuto()); } relooperBlocks[1] = RelooperAddBlock(the_relooper, expressions[131]); - expressions[132] = BinaryenLocalGet(the_module, 5, 1); + expressions[132] = BinaryenLocalGet(the_module, 5, BinaryenTypeInt32()); expressions[133] = BinaryenLoad(the_module, 4, 0, 0, 0, 1, expressions[132]); expressions[134] = BinaryenLocalSet(the_module, 3, expressions[133]); - expressions[135] = BinaryenLocalGet(the_module, 3, 1); + expressions[135] = BinaryenLocalGet(the_module, 3, BinaryenTypeInt32()); expressions[136] = BinaryenLocalSet(the_module, 6, expressions[135]); - expressions[137] = BinaryenLocalGet(the_module, 6, 1); + expressions[137] = BinaryenLocalGet(the_module, 6, BinaryenTypeInt32()); { BinaryenExpressionRef operands[] = { expressions[137] }; expressions[138] = BinaryenCall(the_module, "wasm::print_i32", operands, 1, 0); @@ -303,14 +347,20 @@ int main() { expressions[139] = BinaryenBlock(the_module, "bb2", children, 3, BinaryenTypeAuto()); } relooperBlocks[2] = RelooperAddBlock(the_relooper, expressions[139]); - expressions[140] = BinaryenLocalGet(the_module, 3, 1); + expressions[140] = BinaryenLocalGet(the_module, 3, BinaryenTypeInt32()); expressions[141] = BinaryenLocalSet(the_module, 7, expressions[140]); - expressions[142] = BinaryenLocalGet(the_module, 7, 1); + expressions[142] = BinaryenLocalGet(the_module, 7, BinaryenTypeInt32()); expressions[143] = BinaryenLocalSet(the_module, 8, expressions[142]); - expressions[144] = BinaryenLocalGet(the_module, 9, 1); + expressions[144] = BinaryenLocalGet(the_module, 9, BinaryenTypeInt32()); expressions[145] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[146] = BinaryenStore(the_module, 4, 0, 0, expressions[145], expressions[144], 1); - expressions[147] = BinaryenLocalGet(the_module, 8, 1); + expressions[146] = BinaryenStore(the_module, + 4, + 0, + 0, + expressions[145], + expressions[144], + BinaryenTypeInt32()); + expressions[147] = BinaryenLocalGet(the_module, 8, BinaryenTypeInt32()); expressions[148] = BinaryenReturn(the_module, expressions[147]); { BinaryenExpressionRef children[] = { expressions[141], expressions[143], expressions[146], expressions[148] }; @@ -318,7 +368,7 @@ int main() { } relooperBlocks[3] = RelooperAddBlock(the_relooper, expressions[149]); RelooperAddBranch(relooperBlocks[0], relooperBlocks[1], expressions[0], expressions[0]); - expressions[150] = BinaryenLocalGet(the_module, 5, 1); + expressions[150] = BinaryenLocalGet(the_module, 5, BinaryenTypeInt32()); expressions[151] = BinaryenLoad(the_module, 4, 0, 8, 0, 1, expressions[150]); RelooperAddBranch(relooperBlocks[1], relooperBlocks[2], expressions[151], expressions[0]); expressions[152] = BinaryenUnreachable(the_module); @@ -326,7 +376,7 @@ int main() { RelooperAddBranch(relooperBlocks[1], relooperBlocks[4], expressions[0], expressions[0]); RelooperAddBranch(relooperBlocks[2], relooperBlocks[3], expressions[0], expressions[0]); { - BinaryenType paramTypes[] = { 1, 1 }; + BinaryenType paramTypes[] = {BinaryenTypeInt32(), BinaryenTypeInt32()}; functionTypes[5] = BinaryenAddFunctionType(the_module, "rustfn-0-57", 1, paramTypes, 2); } expressions[153] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); @@ -336,12 +386,21 @@ int main() { RelooperAddBranch(relooperBlocks[5], relooperBlocks[0], expressions[0], expressions[0]); expressions[156] = RelooperRenderAndDispose(the_relooper, relooperBlocks[5], 10); { - BinaryenType varTypes[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 }; + BinaryenType varTypes[] = {BinaryenTypeInt32(), + BinaryenTypeInt32(), + BinaryenTypeInt32(), + BinaryenTypeInt32(), + BinaryenTypeInt32(), + BinaryenTypeInt32(), + BinaryenTypeInt32(), + BinaryenTypeInt32(), + BinaryenTypeInt32(), + BinaryenTypeInt64()}; functions[7] = BinaryenAddFunction(the_module, "main", functionTypes[5], varTypes, 10, expressions[156]); } BinaryenAddFunctionExport(the_module, "main", "main"); { - BinaryenType paramTypes[] = { 0 }; + BinaryenType paramTypes[] = {BinaryenTypeNone()}; functionTypes[6] = BinaryenAddFunctionType(the_module, "__wasm_start", 0, paramTypes, 0); } { @@ -353,12 +412,19 @@ int main() { } expressions[157] = BinaryenConst(the_module, BinaryenLiteralInt32(65535)); expressions[158] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[159] = BinaryenStore(the_module, 4, 0, 0, expressions[158], expressions[157], 1); + expressions[159] = BinaryenStore(the_module, + 4, + 0, + 0, + expressions[158], + expressions[157], + BinaryenTypeInt32()); expressions[160] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); expressions[161] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); { BinaryenExpressionRef operands[] = { expressions[160], expressions[161] }; - expressions[162] = BinaryenCall(the_module, "main", operands, 2, 1); + expressions[162] = + BinaryenCall(the_module, "main", operands, 2, BinaryenTypeInt32()); } expressions[163] = BinaryenDrop(the_module, expressions[162]); { @@ -367,29 +433,29 @@ int main() { } BinaryenAddFunctionExport(the_module, "__wasm_start", "rust_entry"); { - BinaryenType varTypes[] = { 0 }; + BinaryenType varTypes[] = {BinaryenTypeNone()}; functions[8] = BinaryenAddFunction(the_module, "__wasm_start", functionTypes[6], varTypes, 0, expressions[164]); } BinaryenSetStart(the_module, functions[8]); the_relooper = RelooperCreate(the_module); - expressions[165] = BinaryenLocalGet(the_module, 0, 1); + expressions[165] = BinaryenLocalGet(the_module, 0, BinaryenTypeInt32()); expressions[166] = BinaryenLocalSet(the_module, 2, expressions[165]); - expressions[167] = BinaryenLocalGet(the_module, 1, 1); + expressions[167] = BinaryenLocalGet(the_module, 1, BinaryenTypeInt32()); expressions[168] = BinaryenLocalSet(the_module, 3, expressions[167]); - expressions[169] = BinaryenLocalGet(the_module, 2, 1); + expressions[169] = BinaryenLocalGet(the_module, 2, BinaryenTypeInt32()); expressions[170] = BinaryenLocalSet(the_module, 4, expressions[169]); - expressions[171] = BinaryenLocalGet(the_module, 3, 1); + expressions[171] = BinaryenLocalGet(the_module, 3, BinaryenTypeInt32()); expressions[172] = BinaryenLocalSet(the_module, 5, expressions[171]); - expressions[173] = BinaryenLocalGet(the_module, 4, 1); - expressions[174] = BinaryenLocalGet(the_module, 5, 1); + expressions[173] = BinaryenLocalGet(the_module, 4, BinaryenTypeInt32()); + expressions[174] = BinaryenLocalGet(the_module, 5, BinaryenTypeInt32()); expressions[175] = BinaryenUnary(the_module, 22, expressions[173]); expressions[176] = BinaryenUnary(the_module, 22, expressions[174]); expressions[177] = BinaryenBinary(the_module, 25, expressions[175], expressions[176]); expressions[178] = BinaryenLocalSet(the_module, 10, expressions[177]); - expressions[179] = BinaryenLocalGet(the_module, 10, 2); + expressions[179] = BinaryenLocalGet(the_module, 10, BinaryenTypeInt64()); expressions[180] = BinaryenUnary(the_module, 24, expressions[179]); expressions[181] = BinaryenConst(the_module, BinaryenLiteralInt64(32)); - expressions[182] = BinaryenLocalGet(the_module, 10, 2); + expressions[182] = BinaryenLocalGet(the_module, 10, BinaryenTypeInt64()); expressions[183] = BinaryenBinary(the_module, 36, expressions[182], expressions[181]); expressions[184] = BinaryenUnary(the_module, 24, expressions[183]); expressions[185] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); @@ -397,36 +463,60 @@ int main() { expressions[187] = BinaryenConst(the_module, BinaryenLiteralInt32(128)); expressions[188] = BinaryenBinary(the_module, 1, expressions[186], expressions[187]); expressions[189] = BinaryenLocalTee(the_module, 6, expressions[188]); - expressions[190] = BinaryenStore(the_module, 4, 0, 0, expressions[185], expressions[189], 1); - expressions[191] = BinaryenLocalGet(the_module, 6, 1); - expressions[192] = BinaryenStore(the_module, 4, 0, 0, expressions[191], expressions[180], 1); - expressions[193] = BinaryenStore(the_module, 4, 4, 0, expressions[191], expressions[184], 1); + expressions[190] = BinaryenStore(the_module, + 4, + 0, + 0, + expressions[185], + expressions[189], + BinaryenTypeInt32()); + expressions[191] = BinaryenLocalGet(the_module, 6, BinaryenTypeInt32()); + expressions[192] = BinaryenStore(the_module, + 4, + 0, + 0, + expressions[191], + expressions[180], + BinaryenTypeInt32()); + expressions[193] = BinaryenStore(the_module, + 4, + 4, + 0, + expressions[191], + expressions[184], + BinaryenTypeInt32()); { BinaryenExpressionRef children[] = { expressions[166], expressions[168], expressions[170], expressions[172], expressions[178], expressions[190], expressions[192], expressions[193] }; expressions[194] = BinaryenBlock(the_module, "bb0", children, 8, BinaryenTypeAuto()); } relooperBlocks[0] = RelooperAddBlock(the_relooper, expressions[194]); - expressions[195] = BinaryenLocalGet(the_module, 6, 1); + expressions[195] = BinaryenLocalGet(the_module, 6, BinaryenTypeInt32()); expressions[196] = BinaryenLoad(the_module, 4, 0, 0, 0, 1, expressions[195]); expressions[197] = BinaryenLocalSet(the_module, 7, expressions[196]); - expressions[198] = BinaryenLocalGet(the_module, 8, 1); + expressions[198] = BinaryenLocalGet(the_module, 8, BinaryenTypeInt32()); expressions[199] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[200] = BinaryenStore(the_module, 4, 0, 0, expressions[199], expressions[198], 1); - expressions[201] = BinaryenLocalGet(the_module, 7, 1); + expressions[200] = BinaryenStore(the_module, + 4, + 0, + 0, + expressions[199], + expressions[198], + BinaryenTypeInt32()); + expressions[201] = BinaryenLocalGet(the_module, 7, BinaryenTypeInt32()); expressions[202] = BinaryenReturn(the_module, expressions[201]); { BinaryenExpressionRef children[] = { expressions[197], expressions[200], expressions[202] }; expressions[203] = BinaryenBlock(the_module, "bb1", children, 3, BinaryenTypeAuto()); } relooperBlocks[1] = RelooperAddBlock(the_relooper, expressions[203]); - expressions[204] = BinaryenLocalGet(the_module, 6, 1); + expressions[204] = BinaryenLocalGet(the_module, 6, BinaryenTypeInt32()); expressions[205] = BinaryenLoad(the_module, 4, 0, 8, 0, 1, expressions[204]); RelooperAddBranch(relooperBlocks[0], relooperBlocks[1], expressions[205], expressions[0]); expressions[206] = BinaryenUnreachable(the_module); relooperBlocks[2] = RelooperAddBlock(the_relooper, expressions[206]); RelooperAddBranch(relooperBlocks[0], relooperBlocks[2], expressions[0], expressions[0]); { - BinaryenType paramTypes[] = { 1, 1 }; + BinaryenType paramTypes[] = {BinaryenTypeInt32(), BinaryenTypeInt32()}; functionTypes[7] = BinaryenAddFunctionType(the_module, "rustfn-0-13", 1, paramTypes, 2); } expressions[207] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); @@ -436,22 +526,36 @@ int main() { RelooperAddBranch(relooperBlocks[3], relooperBlocks[0], expressions[0], expressions[0]); expressions[210] = RelooperRenderAndDispose(the_relooper, relooperBlocks[3], 9); { - BinaryenType varTypes[] = { 1, 1, 1, 1, 1, 1, 1, 1, 2 }; + BinaryenType varTypes[] = {BinaryenTypeInt32(), + BinaryenTypeInt32(), + BinaryenTypeInt32(), + BinaryenTypeInt32(), + BinaryenTypeInt32(), + BinaryenTypeInt32(), + BinaryenTypeInt32(), + BinaryenTypeInt32(), + BinaryenTypeInt64()}; functions[9] = BinaryenAddFunction(the_module, "_isize_as_tinycore::Add_::add", functionTypes[7], varTypes, 9, expressions[210]); } BinaryenAddFunctionExport(the_module, "_isize_as_tinycore::Add_::add", "_isize_as_tinycore::Add_::add"); the_relooper = RelooperCreate(the_module); - expressions[211] = BinaryenLocalGet(the_module, 0, 1); + expressions[211] = BinaryenLocalGet(the_module, 0, BinaryenTypeInt32()); expressions[212] = BinaryenLocalSet(the_module, 1, expressions[211]); - expressions[213] = BinaryenLocalGet(the_module, 1, 1); + expressions[213] = BinaryenLocalGet(the_module, 1, BinaryenTypeInt32()); expressions[214] = BinaryenLocalSet(the_module, 2, expressions[213]); - expressions[215] = BinaryenLocalGet(the_module, 2, 1); + expressions[215] = BinaryenLocalGet(the_module, 2, BinaryenTypeInt32()); expressions[216] = BinaryenUnary(the_module, 20, expressions[215]); expressions[217] = BinaryenLocalSet(the_module, 3, expressions[216]); - expressions[218] = BinaryenLocalGet(the_module, 4, 1); + expressions[218] = BinaryenLocalGet(the_module, 4, BinaryenTypeInt32()); expressions[219] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[220] = BinaryenStore(the_module, 4, 0, 0, expressions[219], expressions[218], 1); - expressions[221] = BinaryenLocalGet(the_module, 3, 1); + expressions[220] = BinaryenStore(the_module, + 4, + 0, + 0, + expressions[219], + expressions[218], + BinaryenTypeInt32()); + expressions[221] = BinaryenLocalGet(the_module, 3, BinaryenTypeInt32()); expressions[222] = BinaryenReturn(the_module, expressions[221]); { BinaryenExpressionRef children[] = { expressions[212], expressions[214], expressions[217], expressions[220], expressions[222] }; @@ -459,7 +563,7 @@ int main() { } relooperBlocks[0] = RelooperAddBlock(the_relooper, expressions[223]); { - BinaryenType paramTypes[] = { 1 }; + BinaryenType paramTypes[] = {BinaryenTypeInt32()}; functionTypes[8] = BinaryenAddFunctionType(the_module, "rustfn-0-22", 1, paramTypes, 1); } expressions[224] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); @@ -469,27 +573,38 @@ int main() { RelooperAddBranch(relooperBlocks[1], relooperBlocks[0], expressions[0], expressions[0]); expressions[227] = RelooperRenderAndDispose(the_relooper, relooperBlocks[1], 5); { - BinaryenType varTypes[] = { 1, 1, 1, 1, 1, 2 }; + BinaryenType varTypes[] = {BinaryenTypeInt32(), + BinaryenTypeInt32(), + BinaryenTypeInt32(), + BinaryenTypeInt32(), + BinaryenTypeInt32(), + BinaryenTypeInt64()}; functions[10] = BinaryenAddFunction(the_module, "_bool_as_tinycore::Not_::not", functionTypes[8], varTypes, 6, expressions[227]); } BinaryenAddFunctionExport(the_module, "_bool_as_tinycore::Not_::not", "_bool_as_tinycore::Not_::not"); the_relooper = RelooperCreate(the_module); - expressions[228] = BinaryenLocalGet(the_module, 0, 1); + expressions[228] = BinaryenLocalGet(the_module, 0, BinaryenTypeInt32()); expressions[229] = BinaryenLocalSet(the_module, 2, expressions[228]); - expressions[230] = BinaryenLocalGet(the_module, 1, 1); + expressions[230] = BinaryenLocalGet(the_module, 1, BinaryenTypeInt32()); expressions[231] = BinaryenLocalSet(the_module, 3, expressions[230]); - expressions[232] = BinaryenLocalGet(the_module, 2, 1); + expressions[232] = BinaryenLocalGet(the_module, 2, BinaryenTypeInt32()); expressions[233] = BinaryenLocalSet(the_module, 4, expressions[232]); - expressions[234] = BinaryenLocalGet(the_module, 3, 1); + expressions[234] = BinaryenLocalGet(the_module, 3, BinaryenTypeInt32()); expressions[235] = BinaryenLocalSet(the_module, 5, expressions[234]); - expressions[236] = BinaryenLocalGet(the_module, 4, 1); - expressions[237] = BinaryenLocalGet(the_module, 5, 1); + expressions[236] = BinaryenLocalGet(the_module, 4, BinaryenTypeInt32()); + expressions[237] = BinaryenLocalGet(the_module, 5, BinaryenTypeInt32()); expressions[238] = BinaryenBinary(the_module, 15, expressions[236], expressions[237]); expressions[239] = BinaryenLocalSet(the_module, 6, expressions[238]); - expressions[240] = BinaryenLocalGet(the_module, 7, 1); + expressions[240] = BinaryenLocalGet(the_module, 7, BinaryenTypeInt32()); expressions[241] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[242] = BinaryenStore(the_module, 4, 0, 0, expressions[241], expressions[240], 1); - expressions[243] = BinaryenLocalGet(the_module, 6, 1); + expressions[242] = BinaryenStore(the_module, + 4, + 0, + 0, + expressions[241], + expressions[240], + BinaryenTypeInt32()); + expressions[243] = BinaryenLocalGet(the_module, 6, BinaryenTypeInt32()); expressions[244] = BinaryenReturn(the_module, expressions[243]); { BinaryenExpressionRef children[] = { expressions[229], expressions[231], expressions[233], expressions[235], expressions[239], expressions[242], expressions[244] }; @@ -497,7 +612,7 @@ int main() { } relooperBlocks[0] = RelooperAddBlock(the_relooper, expressions[245]); { - BinaryenType paramTypes[] = { 1, 1 }; + BinaryenType paramTypes[] = {BinaryenTypeInt32(), BinaryenTypeInt32()}; functionTypes[9] = BinaryenAddFunctionType(the_module, "rustfn-0-33", 1, paramTypes, 2); } expressions[246] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); @@ -507,27 +622,40 @@ int main() { RelooperAddBranch(relooperBlocks[1], relooperBlocks[0], expressions[0], expressions[0]); expressions[249] = RelooperRenderAndDispose(the_relooper, relooperBlocks[1], 8); { - BinaryenType varTypes[] = { 1, 1, 1, 1, 1, 1, 1, 2 }; + BinaryenType varTypes[] = {BinaryenTypeInt32(), + BinaryenTypeInt32(), + BinaryenTypeInt32(), + BinaryenTypeInt32(), + BinaryenTypeInt32(), + BinaryenTypeInt32(), + BinaryenTypeInt32(), + BinaryenTypeInt64()}; functions[11] = BinaryenAddFunction(the_module, "_i16_as_tinycore::PartialEq_::eq", functionTypes[9], varTypes, 8, expressions[249]); } BinaryenAddFunctionExport(the_module, "_i16_as_tinycore::PartialEq_::eq", "_i16_as_tinycore::PartialEq_::eq"); the_relooper = RelooperCreate(the_module); - expressions[250] = BinaryenLocalGet(the_module, 0, 1); + expressions[250] = BinaryenLocalGet(the_module, 0, BinaryenTypeInt32()); expressions[251] = BinaryenLocalSet(the_module, 2, expressions[250]); - expressions[252] = BinaryenLocalGet(the_module, 1, 1); + expressions[252] = BinaryenLocalGet(the_module, 1, BinaryenTypeInt32()); expressions[253] = BinaryenLocalSet(the_module, 3, expressions[252]); - expressions[254] = BinaryenLocalGet(the_module, 2, 2); + expressions[254] = BinaryenLocalGet(the_module, 2, BinaryenTypeInt64()); expressions[255] = BinaryenLocalSet(the_module, 4, expressions[254]); - expressions[256] = BinaryenLocalGet(the_module, 3, 2); + expressions[256] = BinaryenLocalGet(the_module, 3, BinaryenTypeInt64()); expressions[257] = BinaryenLocalSet(the_module, 5, expressions[256]); - expressions[258] = BinaryenLocalGet(the_module, 4, 2); - expressions[259] = BinaryenLocalGet(the_module, 5, 2); + expressions[258] = BinaryenLocalGet(the_module, 4, BinaryenTypeInt64()); + expressions[259] = BinaryenLocalGet(the_module, 5, BinaryenTypeInt64()); expressions[260] = BinaryenBinary(the_module, 40, expressions[258], expressions[259]); expressions[261] = BinaryenLocalSet(the_module, 6, expressions[260]); - expressions[262] = BinaryenLocalGet(the_module, 7, 1); + expressions[262] = BinaryenLocalGet(the_module, 7, BinaryenTypeInt32()); expressions[263] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[264] = BinaryenStore(the_module, 4, 0, 0, expressions[263], expressions[262], 1); - expressions[265] = BinaryenLocalGet(the_module, 6, 1); + expressions[264] = BinaryenStore(the_module, + 4, + 0, + 0, + expressions[263], + expressions[262], + BinaryenTypeInt32()); + expressions[265] = BinaryenLocalGet(the_module, 6, BinaryenTypeInt32()); expressions[266] = BinaryenReturn(the_module, expressions[265]); { BinaryenExpressionRef children[] = { expressions[251], expressions[253], expressions[255], expressions[257], expressions[261], expressions[264], expressions[266] }; @@ -535,7 +663,7 @@ int main() { } relooperBlocks[0] = RelooperAddBlock(the_relooper, expressions[267]); { - BinaryenType paramTypes[] = { 1, 1 }; + BinaryenType paramTypes[] = {BinaryenTypeInt32(), BinaryenTypeInt32()}; functionTypes[10] = BinaryenAddFunctionType(the_module, "rustfn-0-37", 1, paramTypes, 2); } expressions[268] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); @@ -545,7 +673,14 @@ int main() { RelooperAddBranch(relooperBlocks[1], relooperBlocks[0], expressions[0], expressions[0]); expressions[271] = RelooperRenderAndDispose(the_relooper, relooperBlocks[1], 8); { - BinaryenType varTypes[] = { 1, 1, 2, 2, 1, 1, 1, 2 }; + BinaryenType varTypes[] = {BinaryenTypeInt32(), + BinaryenTypeInt32(), + BinaryenTypeInt64(), + BinaryenTypeInt64(), + BinaryenTypeInt32(), + BinaryenTypeInt32(), + BinaryenTypeInt32(), + BinaryenTypeInt64()}; functions[12] = BinaryenAddFunction(the_module, "_i64_as_tinycore::PartialEq_::eq", functionTypes[10], varTypes, 8, expressions[271]); } BinaryenAddFunctionExport(the_module, "_i64_as_tinycore::PartialEq_::eq", "_i64_as_tinycore::PartialEq_::eq"); diff --git a/test/example/c-api-unused-mem.cpp b/test/example/c-api-unused-mem.cpp index d625e2b51..03a6746f7 100644 --- a/test/example/c-api-unused-mem.cpp +++ b/test/example/c-api-unused-mem.cpp @@ -26,9 +26,10 @@ int main() { expressions[1] = BinaryenBlock(the_module, "bb0", children, 0, BinaryenTypeAuto()); } relooperBlocks[0] = RelooperAddBlock(the_relooper, expressions[1]); - expressions[2] = BinaryenLocalGet(the_module, 0, 1); + expressions[2] = BinaryenLocalGet(the_module, 0, BinaryenTypeInt32()); expressions[3] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[4] = BinaryenStore(the_module, 4, 0, 0, expressions[3], expressions[2], 1); + expressions[4] = BinaryenStore( + the_module, 4, 0, 0, expressions[3], expressions[2], BinaryenTypeInt32()); expressions[5] = BinaryenReturn(the_module, expressions[0]); { BinaryenExpressionRef children[] = { expressions[4], expressions[5] }; @@ -37,22 +38,24 @@ int main() { relooperBlocks[1] = RelooperAddBlock(the_relooper, expressions[6]); RelooperAddBranch(relooperBlocks[0], relooperBlocks[1], expressions[0], expressions[0]); { - BinaryenType paramTypes[] = { 0 }; + BinaryenType paramTypes[] = {BinaryenTypeNone()}; functionTypes[0] = BinaryenAddFunctionType(the_module, "rustfn-0-3", 0, paramTypes, 0); } expressions[7] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[8] = BinaryenLoad(the_module, 4, 0, 0, 0, 1, expressions[7]); + expressions[8] = + BinaryenLoad(the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[7]); expressions[9] = BinaryenLocalSet(the_module, 0, expressions[8]); relooperBlocks[2] = RelooperAddBlock(the_relooper, expressions[9]); RelooperAddBranch(relooperBlocks[2], relooperBlocks[0], expressions[0], expressions[0]); expressions[10] = RelooperRenderAndDispose(the_relooper, relooperBlocks[2], 1); { - BinaryenType varTypes[] = { 1, 1, 2 }; + BinaryenType varTypes[] = { + BinaryenTypeInt32(), BinaryenTypeInt32(), BinaryenTypeInt64()}; functions[0] = BinaryenAddFunction(the_module, "main", functionTypes[0], varTypes, 3, expressions[10]); } BinaryenAddFunctionExport(the_module, "main", "main"); { - BinaryenType paramTypes[] = { 0 }; + BinaryenType paramTypes[] = {BinaryenTypeNone()}; functionTypes[1] = BinaryenAddFunctionType(the_module, "__wasm_start", 0, paramTypes, 0); } { @@ -64,7 +67,8 @@ int main() { } expressions[11] = BinaryenConst(the_module, BinaryenLiteralInt32(65535)); expressions[12] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[13] = BinaryenStore(the_module, 4, 0, 0, expressions[12], expressions[11], 1); + expressions[13] = BinaryenStore( + the_module, 4, 0, 0, expressions[12], expressions[11], BinaryenTypeInt32()); { BinaryenExpressionRef operands[] = { 0 }; expressions[14] = BinaryenCall(the_module, "main", operands, 0, 0); @@ -75,7 +79,7 @@ int main() { } BinaryenAddFunctionExport(the_module, "__wasm_start", "rust_entry"); { - BinaryenType varTypes[] = { 0 }; + BinaryenType varTypes[] = {BinaryenTypeNone()}; functions[1] = BinaryenAddFunction(the_module, "__wasm_start", functionTypes[1], varTypes, 0, expressions[15]); } BinaryenModuleValidate(the_module); |