diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/passes/Print.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/passes/Print.cpp b/src/passes/Print.cpp index 0c71afc7b..dc973b208 100644 --- a/src/passes/Print.cpp +++ b/src/passes/Print.cpp @@ -55,6 +55,12 @@ static Name printableLocal(Index index, Function* func) { return name; } +// Printing "unreachable" as a instruction prefix type is not valid in wasm text +// format. Print something else to make it pass. +static Type forceConcrete(Type type) { + return isConcreteType(type) ? type : i32; +} + // Prints the internal contents of an expression: everything but // the children. struct PrintExpressionContents @@ -141,7 +147,7 @@ struct PrintExpressionContents printName(curr->name, o); } void visitLoad(Load* curr) { - prepareColor(o) << printType(curr->type); + prepareColor(o) << printType(forceConcrete(curr->type)); if (curr->isAtomic) { o << ".atomic"; } @@ -167,7 +173,7 @@ struct PrintExpressionContents } } void visitStore(Store* curr) { - prepareColor(o) << printType(curr->valueType); + prepareColor(o) << printType(forceConcrete(curr->valueType)); if (curr->isAtomic) { o << ".atomic"; } @@ -192,10 +198,8 @@ struct PrintExpressionContents } } static void printRMWSize(std::ostream& o, Type type, uint8_t bytes) { - prepareColor(o) << printType(type) << ".atomic.rmw"; - if (type == unreachable) { - o << '?'; - } else if (bytes != getTypeSize(type)) { + prepareColor(o) << printType(forceConcrete(type)) << ".atomic.rmw"; + if (type != unreachable && bytes != getTypeSize(type)) { if (bytes == 1) { o << '8'; } else if (bytes == 2) { @@ -253,7 +257,7 @@ struct PrintExpressionContents } void visitAtomicWait(AtomicWait* curr) { prepareColor(o); - o << printType(curr->expectedType) << ".atomic.wait"; + o << printType(forceConcrete(curr->expectedType)) << ".atomic.wait"; if (curr->offset) { o << " offset=" << curr->offset; } |