diff options
Diffstat (limited to 'src/passes/Print.cpp')
-rw-r--r-- | src/passes/Print.cpp | 46 |
1 files changed, 41 insertions, 5 deletions
diff --git a/src/passes/Print.cpp b/src/passes/Print.cpp index 00b09dea4..6198218d8 100644 --- a/src/passes/Print.cpp +++ b/src/passes/Print.cpp @@ -286,6 +286,12 @@ static std::ostream& printType(std::ostream& o, Type type, Module* wasm) { return o; } +static std::ostream& +printHeapType(std::ostream& o, HeapType type, Module* wasm) { + TypeNamePrinter(o, wasm).print(type); + return o; +} + static std::ostream& printPrefixedTypes(std::ostream& o, const char* prefix, Type type, @@ -1811,7 +1817,7 @@ struct PrintExpressionContents void visitMemoryGrow(MemoryGrow* curr) { printMedium(o, "memory.grow"); } void visitRefNull(RefNull* curr) { printMedium(o, "ref.null "); - TypeNamePrinter(o, wasm).print(curr->type.getHeapType()); + printHeapType(o, curr->type.getHeapType(), wasm); } void visitRefIs(RefIs* curr) { switch (curr->op) { @@ -1881,8 +1887,22 @@ struct PrintExpressionContents printMedium(o, "call_ref"); } } - void visitRefTest(RefTest* curr) { printMedium(o, "ref.test"); } - void visitRefCast(RefCast* curr) { printMedium(o, "ref.cast"); } + void visitRefTest(RefTest* curr) { + if (curr->rtt) { + printMedium(o, "ref.test"); + } else { + printMedium(o, "ref.test_static "); + printHeapType(o, curr->intendedType, wasm); + } + } + void visitRefCast(RefCast* curr) { + if (curr->rtt) { + printMedium(o, "ref.cast"); + } else { + printMedium(o, "ref.cast_static "); + printHeapType(o, curr->intendedType, wasm); + } + } void visitBrOn(BrOn* curr) { switch (curr->op) { case BrOnNull: @@ -1892,10 +1912,26 @@ struct PrintExpressionContents printMedium(o, "br_on_non_null "); break; case BrOnCast: - printMedium(o, "br_on_cast "); + if (curr->rtt) { + printMedium(o, "br_on_cast "); + } else { + printMedium(o, "br_on_cast_static "); + printName(curr->name, o); + o << ' '; + printHeapType(o, curr->intendedType, wasm); + return; + } break; case BrOnCastFail: - printMedium(o, "br_on_cast_fail "); + if (curr->rtt) { + printMedium(o, "br_on_cast_fail "); + } else { + printMedium(o, "br_on_cast_static_fail "); + printName(curr->name, o); + o << ' '; + printHeapType(o, curr->intendedType, wasm); + return; + } break; case BrOnFunc: printMedium(o, "br_on_func "); |