summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/wasm-binary.h182
-rw-r--r--src/wasm-ir-builder.h25
-rw-r--r--src/wasm/wasm-binary.cpp5665
-rw-r--r--src/wasm/wasm-ir-builder.cpp34
-rw-r--r--test/br_to_exit.wasm.fromBinary4
-rw-r--r--test/br_to_try.wasm.fromBinary16
-rw-r--r--test/break-to-return.wasm.fromBinary4
-rw-r--r--test/break-within-catch.wasm.fromBinary6
-rw-r--r--test/consume-stacky.wasm.fromBinary6
-rw-r--r--test/elided-br.wasm.fromBinary5
-rw-r--r--test/example/c-api-unused-mem.txt4
-rw-r--r--test/fib-dbg.wasm.fromBinary32
-rw-r--r--test/fn_prolog_epilog.debugInfo.wasm.fromBinary6
-rw-r--r--test/lit/basic/exception-handling-legacy.wast408
-rw-r--r--test/lit/basic/exception-handling-no-gc.wast5
-rw-r--r--test/lit/basic/exception-handling.wast576
-rw-r--r--test/lit/basic/fn_prolog_epilog.debugInfo.wast12
-rw-r--r--test/lit/basic/min.wast28
-rw-r--r--test/lit/basic/polymorphic_stack.wast82
-rw-r--r--test/lit/basic/reference-types.wast228
-rw-r--r--test/lit/basic/reg_switch.wast8
-rw-r--r--test/lit/basic/typed_continuations_resume.wast70
-rw-r--r--test/lit/basic/types-function-references.wast58
-rw-r--r--test/lit/basic/unit.wat226
-rw-r--r--test/lit/basic/unreachable-code.wast30
-rw-r--r--test/lit/basic/untaken-br_if.wast16
-rw-r--r--test/lit/binary/bad-delegate.test17
-rw-r--r--test/lit/binary/declarative-element-use-expr.test8
-rw-r--r--test/lit/binary/delegate-block.test27
-rw-r--r--test/lit/binary/delegate-block.test.wasm (renamed from test/lit/binary/bad-delegate.test.wasm)bin32 -> 32 bytes
-rw-r--r--test/lit/binary/dwarf-multivalue.test16
-rw-r--r--test/lit/binary/stacky-eh-legacy.test19
-rw-r--r--test/lit/binary/stacky-nn-tuple.test228
-rw-r--r--test/lit/blocktype.wast52
-rw-r--r--test/lit/cast-and-recast-tuple.wast381
-rw-r--r--test/lit/cast-and-recast.wast28
-rw-r--r--test/lit/cast-to-basic.wast12
-rw-r--r--test/lit/debug/source-map-stop.wast2
-rw-r--r--test/lit/downgrade-reftypes.wast16
-rw-r--r--test/lit/multivalue-stack-ir.wast6
-rw-r--r--test/lit/multivalue.wast328
-rw-r--r--test/lit/parse-double-unreachable.wast19
-rw-r--r--test/lit/passes/roundtrip-gc.wast6
-rw-r--r--test/lit/passes/roundtrip.wast27
-rw-r--r--test/lit/passes/signature-refining_gto.wat4
-rw-r--r--test/lit/passes/stack-ir-roundtrip-eh-legacy.wast6
-rw-r--r--test/lit/reftypes-without-gc.wast4
-rw-r--r--test/lit/source-map.wast9
-rw-r--r--test/lit/string.as_wtf16.wast98
-rw-r--r--test/lld/em_asm_pthread.wasm.out1899
-rw-r--r--test/passes/O.bin.txt8
-rw-r--r--test/passes/converge_O3_metrics.bin.txt36
-rw-r--r--test/passes/dce_vacuum_remove-unused-names.bin.txt12
-rw-r--r--test/passes/dwarf-local-order.bin.txt32
-rw-r--r--test/passes/dwarf_with_exceptions.bin.txt85
-rw-r--r--test/passes/fannkuch0_dwarf.bin.txt200
-rw-r--r--test/passes/fannkuch3_dwarf.bin.txt232
-rw-r--r--test/passes/fannkuch3_manyopts_dwarf.bin.txt194
-rw-r--r--test/passes/fib2_dwarf.bin.txt8
-rw-r--r--test/passes/fib2_emptylocspan_dwarf.bin.txt8
-rw-r--r--test/passes/fib_nonzero-low-pc_dwarf.bin.txt8
-rw-r--r--test/passes/flatten.bin.txt114
-rw-r--r--test/passes/print.bin.txt8
-rw-r--r--test/passes/print_g.bin.txt8
-rw-r--r--test/passes/print_g_metrics.bin.txt8
-rw-r--r--test/passes/print_g_strip-dwarf.bin.txt8
-rw-r--r--test/passes/reverse_dwarf_abbrevs.bin.txt921
-rw-r--r--test/stacky.wasm.fromBinary6
-rw-r--r--test/try-delegate.wasm.fromBinary32
-rw-r--r--test/unreachable-pops.wasm.fromBinary3
70 files changed, 4972 insertions, 7907 deletions
diff --git a/src/wasm-binary.h b/src/wasm-binary.h
index 59114cdb8..7d928c3e6 100644
--- a/src/wasm-binary.h
+++ b/src/wasm-binary.h
@@ -29,6 +29,7 @@
#include "ir/module-utils.h"
#include "parsing.h"
#include "wasm-builder.h"
+#include "wasm-ir-builder.h"
#include "wasm-traversal.h"
#include "wasm-validator.h"
#include "wasm.h"
@@ -1543,8 +1544,6 @@ public:
Signature getSignatureByTypeIndex(Index index);
Signature getSignatureByFunctionIndex(Index index);
- size_t nextLabel;
-
Name getNextLabel();
// We read the names section first so we know in advance what names various
@@ -1573,67 +1572,19 @@ public:
void readVars();
void setLocalNames(Function& func, Index i);
+ Result<> readInst();
+
void readExports();
// The strings in the strings section (which are referred to by StringConst).
std::vector<Name> strings;
void readStrings();
+ Name getIndexedString();
Expression* readExpression();
void readGlobals();
- struct BreakTarget {
- Name name;
- Type type;
- BreakTarget(Name name, Type type) : name(name), type(type) {}
- };
- std::vector<BreakTarget> breakStack;
- // the names that breaks target. this lets us know if a block has breaks to it
- // or not.
- std::unordered_set<Name> breakTargetNames;
- // the names that delegates target.
- std::unordered_set<Name> exceptionTargetNames;
-
- std::vector<Expression*> expressionStack;
-
- // Control flow structure parsing: these have not just the normal binary
- // data for an instruction, but also some bytes later on like "end" or "else".
- // We must be aware of the connection between those things, for debug info.
- std::vector<Expression*> controlFlowStack;
-
- // Called when we parse the beginning of a control flow structure.
- void startControlFlow(Expression* curr);
-
- // set when we know code is unreachable in the sense of the wasm spec: we are
- // in a block and after an unreachable element. this helps parse stacky wasm
- // code, which can be unsuitable for our IR when unreachable.
- bool unreachableInTheWasmSense;
-
- // set when the current code being processed will not be emitted in the
- // output, which is the case when it is literally unreachable, for example,
- // (block $a
- // (unreachable)
- // (block $b
- // ;; code here is reachable in the wasm sense, even though $b as a whole
- // ;; is not
- // (unreachable)
- // ;; code here is unreachable in the wasm sense
- // )
- // )
- bool willBeIgnored;
-
- BinaryConsts::ASTNodes lastSeparator = BinaryConsts::End;
-
- // process a block-type scope, until an end or else marker, or the end of the
- // function
- void processExpressions();
- void skipUnreachableCode();
-
- void pushExpression(Expression* curr);
- Expression* popExpression();
- Expression* popNonVoidExpression();
- Expression* popTuple(size_t numElems);
- Expression* popTypedExpression(Type type);
+ IRBuilder builder;
// validations that cannot be performed on the Module
void validateBinary();
@@ -1663,127 +1614,12 @@ public:
void readNextDebugLocation();
void readSourceMapHeader();
- // AST reading
- int depth = 0; // only for debugging
-
- BinaryConsts::ASTNodes readExpression(Expression*& curr);
- void pushBlockElements(Block* curr, Type type, size_t start);
- void visitBlock(Block* curr);
-
- // Gets a block of expressions. If it's just one, return that singleton.
- Expression* getBlockOrSingleton(Type type);
-
- BreakTarget getBreakTarget(int32_t offset);
- Name getExceptionTargetName(int32_t offset);
-
Index readMemoryAccess(Address& alignment, Address& offset);
+ std::tuple<Name, Address, Address> getMemarg();
- void visitIf(If* curr);
- void visitLoop(Loop* curr);
- void visitBreak(Break* curr, uint8_t code);
- void visitSwitch(Switch* curr);
- void visitCall(Call* curr);
- void visitCallIndirect(CallIndirect* curr);
- void visitLocalGet(LocalGet* curr);
- void visitLocalSet(LocalSet* curr, uint8_t code);
- void visitGlobalGet(GlobalGet* curr);
- void visitGlobalSet(GlobalSet* curr);
- bool maybeVisitLoad(Expression*& out,
- uint8_t code,
- std::optional<BinaryConsts::ASTNodes> prefix);
- bool maybeVisitStore(Expression*& out,
- uint8_t code,
- std::optional<BinaryConsts::ASTNodes> prefix);
- bool maybeVisitNontrappingTrunc(Expression*& out, uint32_t code);
- bool maybeVisitAtomicRMW(Expression*& out, uint8_t code);
- bool maybeVisitAtomicCmpxchg(Expression*& out, uint8_t code);
- bool maybeVisitAtomicWait(Expression*& out, uint8_t code);
- bool maybeVisitAtomicNotify(Expression*& out, uint8_t code);
- bool maybeVisitAtomicFence(Expression*& out, uint8_t code);
- bool maybeVisitConst(Expression*& out, uint8_t code);
- bool maybeVisitUnary(Expression*& out, uint8_t code);
- bool maybeVisitBinary(Expression*& out, uint8_t code);
- bool maybeVisitTruncSat(Expression*& out, uint32_t code);
- bool maybeVisitSIMDBinary(Expression*& out, uint32_t code);
- bool maybeVisitSIMDUnary(Expression*& out, uint32_t code);
- bool maybeVisitSIMDConst(Expression*& out, uint32_t code);
- bool maybeVisitSIMDStore(Expression*& out, uint32_t code);
- bool maybeVisitSIMDExtract(Expression*& out, uint32_t code);
- bool maybeVisitSIMDReplace(Expression*& out, uint32_t code);
- bool maybeVisitSIMDShuffle(Expression*& out, uint32_t code);
- bool maybeVisitSIMDTernary(Expression*& out, uint32_t code);
- bool maybeVisitSIMDShift(Expression*& out, uint32_t code);
- bool maybeVisitSIMDLoad(Expression*& out, uint32_t code);
- bool maybeVisitSIMDLoadStoreLane(Expression*& out, uint32_t code);
- bool maybeVisitMemoryInit(Expression*& out, uint32_t code);
- bool maybeVisitDataDrop(Expression*& out, uint32_t code);
- bool maybeVisitMemoryCopy(Expression*& out, uint32_t code);
- bool maybeVisitMemoryFill(Expression*& out, uint32_t code);
- bool maybeVisitTableSize(Expression*& out, uint32_t code);
- bool maybeVisitTableGrow(Expression*& out, uint32_t code);
- bool maybeVisitTableFill(Expression*& out, uint32_t code);
- bool maybeVisitTableCopy(Expression*& out, uint32_t code);
- bool maybeVisitTableInit(Expression*& out, uint32_t code);
- bool maybeVisitRefI31(Expression*& out, uint32_t code);
- bool maybeVisitI31Get(Expression*& out, uint32_t code);
- bool maybeVisitRefTest(Expression*& out, uint32_t code);
- bool maybeVisitRefCast(Expression*& out, uint32_t code);
- bool maybeVisitBrOn(Expression*& out, uint32_t code);
- bool maybeVisitStructNew(Expression*& out, uint32_t code);
- bool maybeVisitStructGet(Expression*& out, uint32_t code);
- bool maybeVisitStructSet(Expression*& out, uint32_t code);
- bool maybeVisitArrayNewData(Expression*& out, uint32_t code);
- bool maybeVisitArrayNewElem(Expression*& out, uint32_t code);
- bool maybeVisitArrayNewFixed(Expression*& out, uint32_t code);
- bool maybeVisitArrayGet(Expression*& out, uint32_t code);
- bool maybeVisitArraySet(Expression*& out, uint32_t code);
- bool maybeVisitArrayLen(Expression*& out, uint32_t code);
- bool maybeVisitArrayCopy(Expression*& out, uint32_t code);
- bool maybeVisitArrayFill(Expression*& out, uint32_t code);
- bool maybeVisitArrayInit(Expression*& out, uint32_t code);
- bool maybeVisitStringNew(Expression*& out, uint32_t code);
- bool maybeVisitStringAsWTF16(Expression*& out, uint32_t code);
- bool maybeVisitStringConst(Expression*& out, uint32_t code);
- bool maybeVisitStringMeasure(Expression*& out, uint32_t code);
- bool maybeVisitStringEncode(Expression*& out, uint32_t code);
- bool maybeVisitStringConcat(Expression*& out, uint32_t code);
- bool maybeVisitStringEq(Expression*& out, uint32_t code);
- bool maybeVisitStringWTF16Get(Expression*& out, uint32_t code);
- bool maybeVisitStringSliceWTF(Expression*& out, uint32_t code);
- void visitSelect(Select* curr, uint8_t code);
- void visitReturn(Return* curr);
- void visitMemorySize(MemorySize* curr);
- void visitMemoryGrow(MemoryGrow* curr);
- void visitNop(Nop* curr);
- void visitUnreachable(Unreachable* curr);
- void visitDrop(Drop* curr);
- void visitRefNull(RefNull* curr);
- void visitRefIsNull(RefIsNull* curr);
- void visitRefFunc(RefFunc* curr);
- void visitRefEq(RefEq* curr);
- void visitTableGet(TableGet* curr);
- void visitTableSet(TableSet* curr);
- void visitTryOrTryInBlock(Expression*& out);
- void visitTryTable(TryTable* curr);
- void visitThrow(Throw* curr);
- void visitRethrow(Rethrow* curr);
- void visitThrowRef(ThrowRef* curr);
- void visitCallRef(CallRef* curr);
- void visitRefAsCast(RefCast* curr, uint32_t code);
- void visitRefAs(RefAs* curr, uint8_t code);
- void visitContNew(ContNew* curr);
- void visitContBind(ContBind* curr);
- void visitResume(Resume* curr);
- void visitSuspend(Suspend* curr);
-
- [[noreturn]] void throwError(std::string text);
-
- // Struct/Array instructions have an unnecessary heap type that is just for
- // validation (except for the case of unreachability, but that's not a problem
- // anyhow, we can ignore it there). That is, we also have a reference typed
- // child from which we can infer the type anyhow, and we just need to check
- // that type is the same.
- void validateHeapTypeUsingChild(Expression* child, HeapType heapType);
+ [[noreturn]] void throwError(std::string text) {
+ throw ParseException(text, 0, pos);
+ }
private:
bool hasDWARFSections();
diff --git a/src/wasm-ir-builder.h b/src/wasm-ir-builder.h
index 30e770e28..84ac26979 100644
--- a/src/wasm-ir-builder.h
+++ b/src/wasm-ir-builder.h
@@ -47,6 +47,10 @@ public:
// of instructions after this is called.
Result<Expression*> build();
+ // If the IRBuilder is empty, then it's ready to parse a new self-contained
+ // sequence of instructions.
+ [[nodiscard]] bool empty() { return scopeStack.empty(); }
+
// Call visit() on an existing Expression with its non-child fields
// initialized to initialize the child fields and refinalize it.
Result<> visit(Expression*);
@@ -59,6 +63,15 @@ public:
// pushed instruction.
void setDebugLocation(const std::optional<Function::DebugLocation>&);
+ // Give the builder a pointer to the counter tracking the current location in
+ // the binary. If this pointer is non-null, the builder will record the binary
+ // locations relative to the given code section offset for all instructions
+ // and delimiters inside functions.
+ void setBinaryLocation(size_t* binaryPos, size_t codeSectionOffset) {
+ this->binaryPos = binaryPos;
+ this->codeSectionOffset = codeSectionOffset;
+ }
+
// Set the function used to add scratch locals when constructing an isolated
// sequence of IR.
void setFunction(Function* func) { this->func = func; }
@@ -232,6 +245,11 @@ private:
Function* func = nullptr;
Builder builder;
+ // Used for setting DWARF expression locations.
+ size_t* binaryPos = nullptr;
+ size_t lastBinaryPos = 0;
+ size_t codeSectionOffset = 0;
+
// The location lacks debug info as it was marked as not having it.
struct NoDebug : public std::monostate {};
// The location lacks debug info, but was not marked as not having
@@ -316,6 +334,9 @@ private:
// stack-polymorphic unreachable mode.
bool unreachable = false;
+ // The binary location of the start of the scope, used to set debug info.
+ size_t startPos = 0;
+
ScopeCtx() : scope(NoScope{}) {}
ScopeCtx(Scope scope) : scope(scope) {}
ScopeCtx(Scope scope, Name label, bool labelUsed)
@@ -529,6 +550,10 @@ private:
// Record the original label to handle references to it correctly.
labelDepths[label].push_back(scopeStack.size() + 1);
}
+ if (binaryPos) {
+ scope.startPos = lastBinaryPos;
+ lastBinaryPos = *binaryPos;
+ }
scopeStack.push_back(scope);
}
diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp
index 21842e19b..7ebb401c1 100644
--- a/src/wasm/wasm-binary.cpp
+++ b/src/wasm/wasm-binary.cpp
@@ -23,6 +23,7 @@
#include "ir/names.h"
#include "ir/table-utils.h"
#include "ir/type-updating.h"
+#include "pass.h"
#include "support/bits.h"
#include "support/debug.h"
#include "support/stdckdint.h"
@@ -1739,7 +1740,7 @@ WasmBinaryReader::WasmBinaryReader(Module& wasm,
const std::vector<char>& input)
: wasm(wasm), allocator(wasm.allocator), input(input), sourceMap(nullptr),
nextDebugPos(0), nextDebugLocation{0, 0, 0, std::nullopt},
- nextDebugLocationHasDebugInfo(false), debugLocation() {
+ nextDebugLocationHasDebugInfo(false), debugLocation(), builder(wasm) {
wasm.features = features;
}
@@ -2632,7 +2633,6 @@ void WasmBinaryReader::readImports() {
if (is_shared) {
throwError("Tables may not be shared");
}
-
wasm.addTable(std::move(table));
break;
}
@@ -2699,17 +2699,6 @@ void WasmBinaryReader::readImports() {
numFuncImports = wasm.functions.size();
}
-Name WasmBinaryReader::getNextLabel() {
- requireFunctionContext("getting a label");
- return makeName("label$", nextLabel++);
-}
-
-void WasmBinaryReader::requireFunctionContext(const char* error) {
- if (!currFunction) {
- throwError(std::string("in a non-function context: ") + error);
- }
-}
-
void WasmBinaryReader::setLocalNames(Function& func, Index i) {
if (auto it = localNames.find(i); it != localNames.end()) {
for (auto& [local, name] : it->second) {
@@ -2794,13 +2783,16 @@ void WasmBinaryReader::readFunctions() {
if (numFuncBodies + numFuncImports != wasm.functions.size()) {
throwError("invalid function section size, must equal types");
}
+ if (DWARF) {
+ builder.setBinaryLocation(&pos, codeSectionLocation);
+ }
for (size_t i = 0; i < numFuncBodies; i++) {
auto sizePos = pos;
size_t size = getU32LEB();
if (size == 0) {
throwError("empty function size");
}
- endOfFunction = pos + size;
+ Index endOfFunction = pos + size;
auto& func = wasm.functions[numFuncImports + i];
currFunction = func.get();
@@ -2819,49 +2811,38 @@ void WasmBinaryReader::readFunctions() {
func->prologLocation = debugLocation;
{
- // process the function body
- nextLabel = 0;
- willBeIgnored = false;
- // process body
- assert(breakStack.empty());
- assert(breakTargetNames.empty());
- assert(exceptionTargetNames.empty());
- assert(expressionStack.empty());
- assert(controlFlowStack.empty());
- assert(depth == 0);
- // Even if we are skipping function bodies we need to not skip the start
- // function. That contains important code for wasm-emscripten-finalize in
- // the form of pthread-related segment initializations. As this is just
- // one function, it doesn't add significant time, so the optimization of
- // skipping bodies is still very useful.
+ // Process the function body. Even if we are skipping function bodies we
+ // need to not skip the start function. That contains important code for
+ // wasm-emscripten-finalize in the form of pthread-related segment
+ // initializations. As this is just one function, it doesn't add
+ // significant time, so the optimization of skipping bodies is still very
+ // useful.
auto currFunctionIndex = wasm.functions.size();
bool isStart = startIndex == currFunctionIndex;
- if (!skipFunctionBodies || isStart) {
- func->body = getBlockOrSingleton(func->getResults());
- } else {
+ if (skipFunctionBodies && !isStart) {
// When skipping the function body we need to put something valid in
// their place so we validate. An unreachable is always acceptable
// there.
func->body = Builder(wasm).makeUnreachable();
-
// Skip reading the contents.
pos = endOfFunction;
- }
- assert(depth == 0);
- assert(breakStack.empty());
- assert(breakTargetNames.empty());
- if (!exceptionTargetNames.empty()) {
- // A delegate index existed that did not end up referring to any valid
- // outer try-catch (we remove valid ones from exceptionTargetNames as we
- // go).
- throwError("exceptionTargetNames not empty - invalid delegate");
- }
- if (!expressionStack.empty()) {
- throwError("stack not empty on function exit");
- }
- assert(controlFlowStack.empty());
- if (pos != endOfFunction) {
- throwError("binary offset at function exit not at expected location");
+ } else {
+ auto start = builder.visitFunctionStart(func.get());
+ if (auto* err = start.getErr()) {
+ throwError(err->msg);
+ }
+ while (pos < endOfFunction) {
+ auto inst = readInst();
+ if (auto* err = inst.getErr()) {
+ throwError(err->msg);
+ }
+ }
+ if (pos != endOfFunction) {
+ throwError("function overflowed its bounds");
+ }
+ if (!builder.empty()) {
+ throwError("expected function end");
+ }
}
}
@@ -2897,6 +2878,1370 @@ void WasmBinaryReader::readVars() {
}
}
+Result<> WasmBinaryReader::readInst() {
+ readNextDebugLocation();
+ if (debugLocation.size()) {
+ builder.setDebugLocation(*debugLocation.begin());
+ }
+ uint8_t code = getInt8();
+ switch (code) {
+ case BinaryConsts::Block:
+ return builder.makeBlock(Name(), getType());
+ case BinaryConsts::If:
+ return builder.makeIf(Name(), getType());
+ case BinaryConsts::Loop:
+ return builder.makeLoop(Name(), getType());
+ case BinaryConsts::Br:
+ return builder.makeBreak(getU32LEB(), false);
+ case BinaryConsts::BrIf:
+ return builder.makeBreak(getU32LEB(), true);
+ case BinaryConsts::BrTable: {
+ auto numTargets = getU32LEB();
+ std::vector<Index> labels(numTargets);
+ for (Index i = 0; i < numTargets; ++i) {
+ labels[i] = getU32LEB();
+ }
+ return builder.makeSwitch(labels, getU32LEB());
+ }
+ case BinaryConsts::CallFunction:
+ case BinaryConsts::RetCallFunction:
+ return builder.makeCall(getFunctionName(getU32LEB()),
+ code == BinaryConsts::RetCallFunction);
+ case BinaryConsts::CallIndirect:
+ case BinaryConsts::RetCallIndirect: {
+ auto type = getIndexedHeapType();
+ auto table = getTableName(getU32LEB());
+ return builder.makeCallIndirect(
+ table, type, code == BinaryConsts::RetCallIndirect);
+ }
+ case BinaryConsts::LocalGet:
+ return builder.makeLocalGet(getU32LEB());
+ case BinaryConsts::LocalSet:
+ return builder.makeLocalSet(getU32LEB());
+ case BinaryConsts::LocalTee:
+ return builder.makeLocalTee(getU32LEB());
+ case BinaryConsts::GlobalGet:
+ return builder.makeGlobalGet(getGlobalName(getU32LEB()));
+ case BinaryConsts::GlobalSet:
+ return builder.makeGlobalSet(getGlobalName(getU32LEB()));
+ case BinaryConsts::Select:
+ return builder.makeSelect(std::nullopt);
+ case BinaryConsts::SelectWithType: {
+ auto numTypes = getU32LEB();
+ std::vector<Type> types;
+ for (Index i = 0; i < numTypes; ++i) {
+ auto t = getType();
+ if (!t.isConcrete()) {
+ return Err{"bad select type"};
+ }
+ types.push_back(t);
+ }
+ return builder.makeSelect(Type(types));
+ }
+ case BinaryConsts::Return:
+ return builder.makeReturn();
+ case BinaryConsts::Nop:
+ return builder.makeNop();
+ case BinaryConsts::Unreachable:
+ return builder.makeUnreachable();
+ case BinaryConsts::Drop:
+ return builder.makeDrop();
+ case BinaryConsts::End:
+ return builder.visitEnd();
+ case BinaryConsts::Else:
+ return builder.visitElse();
+ case BinaryConsts::Catch_Legacy:
+ return builder.visitCatch(getTagName(getU32LEB()));
+ case BinaryConsts::CatchAll_Legacy:
+ return builder.visitCatchAll();
+ case BinaryConsts::Delegate:
+ return builder.visitDelegate(getU32LEB());
+ case BinaryConsts::RefNull:
+ return builder.makeRefNull(getHeapType());
+ case BinaryConsts::RefIsNull:
+ return builder.makeRefIsNull();
+ case BinaryConsts::RefFunc:
+ return builder.makeRefFunc(getFunctionName(getU32LEB()));
+ case BinaryConsts::RefEq:
+ return builder.makeRefEq();
+ case BinaryConsts::RefAsNonNull:
+ return builder.makeRefAs(RefAsNonNull);
+ case BinaryConsts::BrOnNull:
+ return builder.makeBrOn(getU32LEB(), BrOnNull);
+ case BinaryConsts::BrOnNonNull:
+ return builder.makeBrOn(getU32LEB(), BrOnNonNull);
+ case BinaryConsts::TableGet:
+ return builder.makeTableGet(getTableName(getU32LEB()));
+ case BinaryConsts::TableSet:
+ return builder.makeTableSet(getTableName(getU32LEB()));
+ case BinaryConsts::Try:
+ return builder.makeTry(Name(), getType());
+ case BinaryConsts::TryTable: {
+ auto type = getType();
+ std::vector<Name> tags;
+ std::vector<Index> labels;
+ std::vector<bool> isRefs;
+ auto numHandlers = getU32LEB();
+ for (Index i = 0; i < numHandlers; ++i) {
+ uint8_t code = getInt8();
+ if (code == BinaryConsts::Catch || code == BinaryConsts::CatchRef) {
+ tags.push_back(getTagName(getU32LEB()));
+ } else {
+ tags.push_back(Name());
+ }
+ labels.push_back(getU32LEB());
+ isRefs.push_back(code == BinaryConsts::CatchRef ||
+ code == BinaryConsts::CatchAllRef);
+ }
+ return builder.makeTryTable(Name(), type, tags, labels, isRefs);
+ }
+ case BinaryConsts::Throw:
+ return builder.makeThrow(getTagName(getU32LEB()));
+ case BinaryConsts::Rethrow:
+ return builder.makeRethrow(getU32LEB());
+ case BinaryConsts::ThrowRef:
+ return builder.makeThrowRef();
+ case BinaryConsts::MemorySize:
+ return builder.makeMemorySize(getMemoryName(getU32LEB()));
+ case BinaryConsts::MemoryGrow:
+ return builder.makeMemoryGrow(getMemoryName(getU32LEB()));
+ case BinaryConsts::CallRef:
+ case BinaryConsts::RetCallRef:
+ return builder.makeCallRef(getIndexedHeapType(),
+ code == BinaryConsts::RetCallRef);
+ case BinaryConsts::ContBind: {
+ auto before = getIndexedHeapType();
+ auto after = getIndexedHeapType();
+ return builder.makeContBind(before, after);
+ }
+ case BinaryConsts::ContNew:
+ return builder.makeContNew(getIndexedHeapType());
+ case BinaryConsts::Resume: {
+ auto type = getIndexedHeapType();
+ std::vector<Name> tags;
+ std::vector<Index> labels;
+ auto numHandlers = getU32LEB();
+ for (Index i = 0; i < numHandlers; ++i) {
+ tags.push_back(getTagName(getU32LEB()));
+ labels.push_back(getU32LEB());
+ }
+ return builder.makeResume(type, tags, labels);
+ }
+ case BinaryConsts::Suspend:
+ return builder.makeSuspend(getTagName(getU32LEB()));
+
+#define BINARY_INT(code) \
+ case BinaryConsts::I32##code: \
+ return builder.makeBinary(code##Int32); \
+ case BinaryConsts::I64##code: \
+ return builder.makeBinary(code##Int64);
+#define BINARY_FLOAT(code) \
+ case BinaryConsts::F32##code: \
+ return builder.makeBinary(code##Float32); \
+ case BinaryConsts::F64##code: \
+ return builder.makeBinary(code##Float64);
+#define BINARY_NUM(code) \
+ BINARY_INT(code) \
+ BINARY_FLOAT(code)
+
+ BINARY_NUM(Add);
+ BINARY_NUM(Sub);
+ BINARY_NUM(Mul);
+ BINARY_INT(DivS);
+ BINARY_INT(DivU);
+ BINARY_INT(RemS);
+ BINARY_INT(RemU);
+ BINARY_INT(And);
+ BINARY_INT(Or);
+ BINARY_INT(Xor);
+ BINARY_INT(Shl);
+ BINARY_INT(ShrU);
+ BINARY_INT(ShrS);
+ BINARY_INT(RotL);
+ BINARY_INT(RotR);
+ BINARY_FLOAT(Div);
+ BINARY_FLOAT(CopySign);
+ BINARY_FLOAT(Min);
+ BINARY_FLOAT(Max);
+ BINARY_NUM(Eq);
+ BINARY_NUM(Ne);
+ BINARY_INT(LtS);
+ BINARY_INT(LtU);
+ BINARY_INT(LeS);
+ BINARY_INT(LeU);
+ BINARY_INT(GtS);
+ BINARY_INT(GtU);
+ BINARY_INT(GeS);
+ BINARY_INT(GeU);
+ BINARY_FLOAT(Lt);
+ BINARY_FLOAT(Le);
+ BINARY_FLOAT(Gt);
+ BINARY_FLOAT(Ge);
+
+#define UNARY_INT(code) \
+ case BinaryConsts::I32##code: \
+ return builder.makeUnary(code##Int32); \
+ case BinaryConsts::I64##code: \
+ return builder.makeUnary(code##Int64);
+#define UNARY_FLOAT(code) \
+ case BinaryConsts::F32##code: \
+ return builder.makeUnary(code##Float32); \
+ case BinaryConsts::F64##code: \
+ return builder.makeUnary(code##Float64);
+
+ UNARY_INT(Clz);
+ UNARY_INT(Ctz);
+ UNARY_INT(Popcnt);
+ UNARY_INT(EqZ);
+ UNARY_FLOAT(Neg);
+ UNARY_FLOAT(Abs);
+ UNARY_FLOAT(Ceil);
+ UNARY_FLOAT(Floor);
+ // UNARY_FLOAT(NearestInt);
+ case BinaryConsts::F32NearestInt:
+ return builder.makeUnary(NearestFloat32);
+ case BinaryConsts::F64NearestInt:
+ return builder.makeUnary(NearestFloat64);
+ UNARY_FLOAT(Sqrt);
+
+ case BinaryConsts::F32UConvertI32:
+ return builder.makeUnary(ConvertUInt32ToFloat32);
+ case BinaryConsts::F64UConvertI32:
+ return builder.makeUnary(ConvertUInt32ToFloat64);
+ case BinaryConsts::F32SConvertI32:
+ return builder.makeUnary(ConvertSInt32ToFloat32);
+ case BinaryConsts::F64SConvertI32:
+ return builder.makeUnary(ConvertSInt32ToFloat64);
+ case BinaryConsts::F32UConvertI64:
+ return builder.makeUnary(ConvertUInt64ToFloat32);
+ case BinaryConsts::F64UConvertI64:
+ return builder.makeUnary(ConvertUInt64ToFloat64);
+ case BinaryConsts::F32SConvertI64:
+ return builder.makeUnary(ConvertSInt64ToFloat32);
+ case BinaryConsts::F64SConvertI64:
+ return builder.makeUnary(ConvertSInt64ToFloat64);
+ case BinaryConsts::I64SExtendI32:
+ return builder.makeUnary(ExtendSInt32);
+ case BinaryConsts::I64UExtendI32:
+ return builder.makeUnary(ExtendUInt32);
+ case BinaryConsts::I32WrapI64:
+ return builder.makeUnary(WrapInt64);
+ case BinaryConsts::I32UTruncF32:
+ return builder.makeUnary(TruncUFloat32ToInt32);
+ case BinaryConsts::I32UTruncF64:
+ return builder.makeUnary(TruncUFloat64ToInt32);
+ case BinaryConsts::I32STruncF32:
+ return builder.makeUnary(TruncSFloat32ToInt32);
+ case BinaryConsts::I32STruncF64:
+ return builder.makeUnary(TruncSFloat64ToInt32);
+ case BinaryConsts::I64UTruncF32:
+ return builder.makeUnary(TruncUFloat32ToInt64);
+ case BinaryConsts::I64UTruncF64:
+ return builder.makeUnary(TruncUFloat64ToInt64);
+ case BinaryConsts::I64STruncF32:
+ return builder.makeUnary(TruncSFloat32ToInt64);
+ case BinaryConsts::I64STruncF64:
+ return builder.makeUnary(TruncSFloat64ToInt64);
+ case BinaryConsts::F32Trunc:
+ return builder.makeUnary(TruncFloat32);
+ case BinaryConsts::F64Trunc:
+ return builder.makeUnary(TruncFloat64);
+ case BinaryConsts::F32DemoteI64:
+ return builder.makeUnary(DemoteFloat64);
+ case BinaryConsts::F64PromoteF32:
+ return builder.makeUnary(PromoteFloat32);
+ case BinaryConsts::I32ReinterpretF32:
+ return builder.makeUnary(ReinterpretFloat32);
+ case BinaryConsts::I64ReinterpretF64:
+ return builder.makeUnary(ReinterpretFloat64);
+ case BinaryConsts::F32ReinterpretI32:
+ return builder.makeUnary(ReinterpretInt32);
+ case BinaryConsts::F64ReinterpretI64:
+ return builder.makeUnary(ReinterpretInt64);
+ case BinaryConsts::I32ExtendS8:
+ return builder.makeUnary(ExtendS8Int32);
+ case BinaryConsts::I32ExtendS16:
+ return builder.makeUnary(ExtendS16Int32);
+ case BinaryConsts::I64ExtendS8:
+ return builder.makeUnary(ExtendS8Int64);
+ case BinaryConsts::I64ExtendS16:
+ return builder.makeUnary(ExtendS16Int64);
+ case BinaryConsts::I64ExtendS32:
+ return builder.makeUnary(ExtendS32Int64);
+ case BinaryConsts::I32Const:
+ return builder.makeConst(Literal(getS32LEB()));
+ case BinaryConsts::I64Const:
+ return builder.makeConst(Literal(getS64LEB()));
+ case BinaryConsts::F32Const:
+ return builder.makeConst(getFloat32Literal());
+ case BinaryConsts::F64Const:
+ return builder.makeConst(getFloat64Literal());
+ case BinaryConsts::I32LoadMem8S: {
+ auto [mem, align, offset] = getMemarg();
+ return builder.makeLoad(1, true, offset, align, Type::i32, mem);
+ }
+ case BinaryConsts::I32LoadMem8U: {
+ auto [mem, align, offset] = getMemarg();
+ return builder.makeLoad(1, false, offset, align, Type::i32, mem);
+ }
+ case BinaryConsts::I32LoadMem16S: {
+ auto [mem, align, offset] = getMemarg();
+ return builder.makeLoad(2, true, offset, align, Type::i32, mem);
+ }
+ case BinaryConsts::I32LoadMem16U: {
+ auto [mem, align, offset] = getMemarg();
+ return builder.makeLoad(2, false, offset, align, Type::i32, mem);
+ }
+ case BinaryConsts::I32LoadMem: {
+ auto [mem, align, offset] = getMemarg();
+ return builder.makeLoad(4, false, offset, align, Type::i32, mem);
+ }
+ case BinaryConsts::I64LoadMem8S: {
+ auto [mem, align, offset] = getMemarg();
+ return builder.makeLoad(1, true, offset, align, Type::i64, mem);
+ }
+ case BinaryConsts::I64LoadMem8U: {
+ auto [mem, align, offset] = getMemarg();
+ return builder.makeLoad(1, false, offset, align, Type::i64, mem);
+ }
+ case BinaryConsts::I64LoadMem16S: {
+ auto [mem, align, offset] = getMemarg();
+ return builder.makeLoad(2, true, offset, align, Type::i64, mem);
+ }
+ case BinaryConsts::I64LoadMem16U: {
+ auto [mem, align, offset] = getMemarg();
+ return builder.makeLoad(2, false, offset, align, Type::i64, mem);
+ }
+ case BinaryConsts::I64LoadMem32S: {
+ auto [mem, align, offset] = getMemarg();
+ return builder.makeLoad(4, true, offset, align, Type::i64, mem);
+ }
+ case BinaryConsts::I64LoadMem32U: {
+ auto [mem, align, offset] = getMemarg();
+ return builder.makeLoad(4, false, offset, align, Type::i64, mem);
+ }
+ case BinaryConsts::I64LoadMem: {
+ auto [mem, align, offset] = getMemarg();
+ return builder.makeLoad(8, false, offset, align, Type::i64, mem);
+ }
+ case BinaryConsts::F32LoadMem: {
+ auto [mem, align, offset] = getMemarg();
+ return builder.makeLoad(4, false, offset, align, Type::f32, mem);
+ }
+ case BinaryConsts::F64LoadMem: {
+ auto [mem, align, offset] = getMemarg();
+ return builder.makeLoad(8, false, offset, align, Type::f64, mem);
+ }
+ case BinaryConsts::I32StoreMem8: {
+ auto [mem, align, offset] = getMemarg();
+ return builder.makeStore(1, offset, align, Type::i32, mem);
+ }
+ case BinaryConsts::I32StoreMem16: {
+ auto [mem, align, offset] = getMemarg();
+ return builder.makeStore(2, offset, align, Type::i32, mem);
+ }
+ case BinaryConsts::I32StoreMem: {
+ auto [mem, align, offset] = getMemarg();
+ return builder.makeStore(4, offset, align, Type::i32, mem);
+ }
+ case BinaryConsts::I64StoreMem8: {
+ auto [mem, align, offset] = getMemarg();
+ return builder.makeStore(1, offset, align, Type::i64, mem);
+ }
+ case BinaryConsts::I64StoreMem16: {
+ auto [mem, align, offset] = getMemarg();
+ return builder.makeStore(2, offset, align, Type::i64, mem);
+ }
+ case BinaryConsts::I64StoreMem32: {
+ auto [mem, align, offset] = getMemarg();
+ return builder.makeStore(4, offset, align, Type::i64, mem);
+ }
+ case BinaryConsts::I64StoreMem: {
+ auto [mem, align, offset] = getMemarg();
+ return builder.makeStore(8, offset, align, Type::i64, mem);
+ }
+ case BinaryConsts::F32StoreMem: {
+ auto [mem, align, offset] = getMemarg();
+ return builder.makeStore(4, offset, align, Type::f32, mem);
+ }
+ case BinaryConsts::F64StoreMem: {
+ auto [mem, align, offset] = getMemarg();
+ return builder.makeStore(8, offset, align, Type::f64, mem);
+ }
+ case BinaryConsts::AtomicPrefix: {
+ auto op = getU32LEB();
+ switch (op) {
+ case BinaryConsts::I32AtomicLoad8U: {
+ // TODO: pass align through for validation.
+ auto [mem, align, offset] = getMemarg();
+ return builder.makeAtomicLoad(1, offset, Type::i32, mem);
+ }
+ case BinaryConsts::I32AtomicLoad16U: {
+ auto [mem, align, offset] = getMemarg();
+ return builder.makeAtomicLoad(2, offset, Type::i32, mem);
+ }
+ case BinaryConsts::I32AtomicLoad: {
+ auto [mem, align, offset] = getMemarg();
+ return builder.makeAtomicLoad(4, offset, Type::i32, mem);
+ }
+ case BinaryConsts::I64AtomicLoad8U: {
+ auto [mem, align, offset] = getMemarg();
+ return builder.makeAtomicLoad(1, offset, Type::i64, mem);
+ }
+ case BinaryConsts::I64AtomicLoad16U: {
+ auto [mem, align, offset] = getMemarg();
+ return builder.makeAtomicLoad(2, offset, Type::i64, mem);
+ }
+ case BinaryConsts::I64AtomicLoad32U: {
+ auto [mem, align, offset] = getMemarg();
+ return builder.makeAtomicLoad(4, offset, Type::i64, mem);
+ }
+ case BinaryConsts::I64AtomicLoad: {
+ auto [mem, align, offset] = getMemarg();
+ return builder.makeAtomicLoad(8, offset, Type::i64, mem);
+ }
+ case BinaryConsts::I32AtomicStore8: {
+ auto [mem, align, offset] = getMemarg();
+ return builder.makeAtomicStore(1, offset, Type::i32, mem);
+ }
+ case BinaryConsts::I32AtomicStore16: {
+ auto [mem, align, offset] = getMemarg();
+ return builder.makeAtomicStore(2, offset, Type::i32, mem);
+ }
+ case BinaryConsts::I32AtomicStore: {
+ auto [mem, align, offset] = getMemarg();
+ return builder.makeAtomicStore(4, offset, Type::i32, mem);
+ }
+ case BinaryConsts::I64AtomicStore8: {
+ auto [mem, align, offset] = getMemarg();
+ return builder.makeAtomicStore(1, offset, Type::i64, mem);
+ }
+ case BinaryConsts::I64AtomicStore16: {
+ auto [mem, align, offset] = getMemarg();
+ return builder.makeAtomicStore(2, offset, Type::i64, mem);
+ }
+ case BinaryConsts::I64AtomicStore32: {
+ auto [mem, align, offset] = getMemarg();
+ return builder.makeAtomicStore(4, offset, Type::i64, mem);
+ }
+ case BinaryConsts::I64AtomicStore: {
+ auto [mem, align, offset] = getMemarg();
+ return builder.makeAtomicStore(8, offset, Type::i64, mem);
+ }
+
+#define RMW(op) \
+ case BinaryConsts::I32AtomicRMW##op: { \
+ auto [mem, align, offset] = getMemarg(); \
+ return builder.makeAtomicRMW(RMW##op, 4, offset, Type::i32, mem); \
+ } \
+ case BinaryConsts::I32AtomicRMW##op##8U: { \
+ auto [mem, align, offset] = getMemarg(); \
+ return builder.makeAtomicRMW(RMW##op, 1, offset, Type::i32, mem); \
+ } \
+ case BinaryConsts::I32AtomicRMW##op##16U: { \
+ auto [mem, align, offset] = getMemarg(); \
+ return builder.makeAtomicRMW(RMW##op, 2, offset, Type::i32, mem); \
+ } \
+ case BinaryConsts::I64AtomicRMW##op: { \
+ auto [mem, align, offset] = getMemarg(); \
+ return builder.makeAtomicRMW(RMW##op, 8, offset, Type::i64, mem); \
+ } \
+ case BinaryConsts::I64AtomicRMW##op##8U: { \
+ auto [mem, align, offset] = getMemarg(); \
+ return builder.makeAtomicRMW(RMW##op, 1, offset, Type::i64, mem); \
+ } \
+ case BinaryConsts::I64AtomicRMW##op##16U: { \
+ auto [mem, align, offset] = getMemarg(); \
+ return builder.makeAtomicRMW(RMW##op, 2, offset, Type::i64, mem); \
+ } \
+ case BinaryConsts::I64AtomicRMW##op##32U: { \
+ auto [mem, align, offset] = getMemarg(); \
+ return builder.makeAtomicRMW(RMW##op, 4, offset, Type::i64, mem); \
+ }
+
+ RMW(Add);
+ RMW(Sub);
+ RMW(And);
+ RMW(Or);
+ RMW(Xor);
+ RMW(Xchg);
+
+ case BinaryConsts::I32AtomicCmpxchg: {
+ auto [mem, align, offset] = getMemarg();
+ return builder.makeAtomicCmpxchg(4, offset, Type::i32, mem);
+ }
+ case BinaryConsts::I32AtomicCmpxchg8U: {
+ auto [mem, align, offset] = getMemarg();
+ return builder.makeAtomicCmpxchg(1, offset, Type::i32, mem);
+ }
+ case BinaryConsts::I32AtomicCmpxchg16U: {
+ auto [mem, align, offset] = getMemarg();
+ return builder.makeAtomicCmpxchg(2, offset, Type::i32, mem);
+ }
+ case BinaryConsts::I64AtomicCmpxchg: {
+ auto [mem, align, offset] = getMemarg();
+ return builder.makeAtomicCmpxchg(8, offset, Type::i64, mem);
+ }
+ case BinaryConsts::I64AtomicCmpxchg8U: {
+ auto [mem, align, offset] = getMemarg();
+ return builder.makeAtomicCmpxchg(1, offset, Type::i64, mem);
+ }
+ case BinaryConsts::I64AtomicCmpxchg16U: {
+ auto [mem, align, offset] = getMemarg();
+ return builder.makeAtomicCmpxchg(2, offset, Type::i64, mem);
+ }
+ case BinaryConsts::I64AtomicCmpxchg32U: {
+ auto [mem, align, offset] = getMemarg();
+ return builder.makeAtomicCmpxchg(4, offset, Type::i64, mem);
+ }
+ case BinaryConsts::I32AtomicWait: {
+ auto [mem, align, offset] = getMemarg();
+ return builder.makeAtomicWait(Type::i32, offset, mem);
+ }
+ case BinaryConsts::I64AtomicWait: {
+ auto [mem, align, offset] = getMemarg();
+ return builder.makeAtomicWait(Type::i64, offset, mem);
+ }
+ case BinaryConsts::AtomicNotify: {
+ auto [mem, align, offset] = getMemarg();
+ return builder.makeAtomicNotify(offset, mem);
+ }
+ case BinaryConsts::AtomicFence:
+ if (getInt8() != 0) {
+ return Err{"expected 0x00 byte immediate on atomic.fence"};
+ }
+ return builder.makeAtomicFence();
+ }
+ return Err{"unknown atomic operation"};
+ }
+ case BinaryConsts::MiscPrefix: {
+ auto op = getU32LEB();
+ switch (op) {
+ case BinaryConsts::I32STruncSatF32:
+ return builder.makeUnary(TruncSatSFloat32ToInt32);
+ case BinaryConsts::I32UTruncSatF32:
+ return builder.makeUnary(TruncSatUFloat32ToInt32);
+ case BinaryConsts::I32STruncSatF64:
+ return builder.makeUnary(TruncSatSFloat64ToInt32);
+ case BinaryConsts::I32UTruncSatF64:
+ return builder.makeUnary(TruncSatUFloat64ToInt32);
+ case BinaryConsts::I64STruncSatF32:
+ return builder.makeUnary(TruncSatSFloat32ToInt64);
+ case BinaryConsts::I64UTruncSatF32:
+ return builder.makeUnary(TruncSatUFloat32ToInt64);
+ case BinaryConsts::I64STruncSatF64:
+ return builder.makeUnary(TruncSatSFloat64ToInt64);
+ case BinaryConsts::I64UTruncSatF64:
+ return builder.makeUnary(TruncSatUFloat64ToInt64);
+ case BinaryConsts::MemoryInit: {
+ auto data = getDataName(getU32LEB());
+ auto mem = getMemoryName(getU32LEB());
+ return builder.makeMemoryInit(data, mem);
+ }
+ case BinaryConsts::DataDrop:
+ return builder.makeDataDrop(getDataName(getU32LEB()));
+ case BinaryConsts::MemoryCopy: {
+ auto dest = getMemoryName(getU32LEB());
+ auto src = getMemoryName(getU32LEB());
+ return builder.makeMemoryCopy(dest, src);
+ }
+ case BinaryConsts::MemoryFill:
+ return builder.makeMemoryFill(getMemoryName(getU32LEB()));
+ case BinaryConsts::TableSize:
+ return builder.makeTableSize(getTableName(getU32LEB()));
+ case BinaryConsts::TableGrow:
+ return builder.makeTableGrow(getTableName(getU32LEB()));
+ case BinaryConsts::TableFill:
+ return builder.makeTableFill(getTableName(getU32LEB()));
+ case BinaryConsts::TableCopy: {
+ auto dest = getTableName(getU32LEB());
+ auto src = getTableName(getU32LEB());
+ return builder.makeTableCopy(dest, src);
+ }
+ case BinaryConsts::TableInit: {
+ auto elem = getElemName(getU32LEB());
+ auto table = getTableName(getU32LEB());
+ return builder.makeTableInit(elem, table);
+ }
+ case BinaryConsts::F32_F16LoadMem: {
+ auto [mem, align, offset] = getMemarg();
+ return builder.makeLoad(2, false, offset, align, Type::f32, mem);
+ }
+ case BinaryConsts::F32_F16StoreMem: {
+ auto [mem, align, offset] = getMemarg();
+ return builder.makeStore(2, offset, align, Type::f32, mem);
+ }
+ }
+ return Err{"unknown misc operation"};
+ }
+ case BinaryConsts::SIMDPrefix: {
+ auto op = getU32LEB();
+ switch (op) {
+ case BinaryConsts::I8x16Eq:
+ return builder.makeBinary(EqVecI8x16);
+ case BinaryConsts::I8x16Ne:
+ return builder.makeBinary(NeVecI8x16);
+ case BinaryConsts::I8x16LtS:
+ return builder.makeBinary(LtSVecI8x16);
+ case BinaryConsts::I8x16LtU:
+ return builder.makeBinary(LtUVecI8x16);
+ case BinaryConsts::I8x16GtS:
+ return builder.makeBinary(GtSVecI8x16);
+ case BinaryConsts::I8x16GtU:
+ return builder.makeBinary(GtUVecI8x16);
+ case BinaryConsts::I8x16LeS:
+ return builder.makeBinary(LeSVecI8x16);
+ case BinaryConsts::I8x16LeU:
+ return builder.makeBinary(LeUVecI8x16);
+ case BinaryConsts::I8x16GeS:
+ return builder.makeBinary(GeSVecI8x16);
+ case BinaryConsts::I8x16GeU:
+ return builder.makeBinary(GeUVecI8x16);
+ case BinaryConsts::I16x8Eq:
+ return builder.makeBinary(EqVecI16x8);
+ case BinaryConsts::I16x8Ne:
+ return builder.makeBinary(NeVecI16x8);
+ case BinaryConsts::I16x8LtS:
+ return builder.makeBinary(LtSVecI16x8);
+ case BinaryConsts::I16x8LtU:
+ return builder.makeBinary(LtUVecI16x8);
+ case BinaryConsts::I16x8GtS:
+ return builder.makeBinary(GtSVecI16x8);
+ case BinaryConsts::I16x8GtU:
+ return builder.makeBinary(GtUVecI16x8);
+ case BinaryConsts::I16x8LeS:
+ return builder.makeBinary(LeSVecI16x8);
+ case BinaryConsts::I16x8LeU:
+ return builder.makeBinary(LeUVecI16x8);
+ case BinaryConsts::I16x8GeS:
+ return builder.makeBinary(GeSVecI16x8);
+ case BinaryConsts::I16x8GeU:
+ return builder.makeBinary(GeUVecI16x8);
+ case BinaryConsts::I32x4Eq:
+ return builder.makeBinary(EqVecI32x4);
+ case BinaryConsts::I32x4Ne:
+ return builder.makeBinary(NeVecI32x4);
+ case BinaryConsts::I32x4LtS:
+ return builder.makeBinary(LtSVecI32x4);
+ case BinaryConsts::I32x4LtU:
+ return builder.makeBinary(LtUVecI32x4);
+ case BinaryConsts::I32x4GtS:
+ return builder.makeBinary(GtSVecI32x4);
+ case BinaryConsts::I32x4GtU:
+ return builder.makeBinary(GtUVecI32x4);
+ case BinaryConsts::I32x4LeS:
+ return builder.makeBinary(LeSVecI32x4);
+ case BinaryConsts::I32x4LeU:
+ return builder.makeBinary(LeUVecI32x4);
+ case BinaryConsts::I32x4GeS:
+ return builder.makeBinary(GeSVecI32x4);
+ case BinaryConsts::I32x4GeU:
+ return builder.makeBinary(GeUVecI32x4);
+ case BinaryConsts::I64x2Eq:
+ return builder.makeBinary(EqVecI64x2);
+ case BinaryConsts::I64x2Ne:
+ return builder.makeBinary(NeVecI64x2);
+ case BinaryConsts::I64x2LtS:
+ return builder.makeBinary(LtSVecI64x2);
+ case BinaryConsts::I64x2GtS:
+ return builder.makeBinary(GtSVecI64x2);
+ case BinaryConsts::I64x2LeS:
+ return builder.makeBinary(LeSVecI64x2);
+ case BinaryConsts::I64x2GeS:
+ return builder.makeBinary(GeSVecI64x2);
+ case BinaryConsts::F16x8Eq:
+ return builder.makeBinary(EqVecF16x8);
+ case BinaryConsts::F16x8Ne:
+ return builder.makeBinary(NeVecF16x8);
+ case BinaryConsts::F16x8Lt:
+ return builder.makeBinary(LtVecF16x8);
+ case BinaryConsts::F16x8Gt:
+ return builder.makeBinary(GtVecF16x8);
+ case BinaryConsts::F16x8Le:
+ return builder.makeBinary(LeVecF16x8);
+ case BinaryConsts::F16x8Ge:
+ return builder.makeBinary(GeVecF16x8);
+ case BinaryConsts::F32x4Eq:
+ return builder.makeBinary(EqVecF32x4);
+ case BinaryConsts::F32x4Ne:
+ return builder.makeBinary(NeVecF32x4);
+ case BinaryConsts::F32x4Lt:
+ return builder.makeBinary(LtVecF32x4);
+ case BinaryConsts::F32x4Gt:
+ return builder.makeBinary(GtVecF32x4);
+ case BinaryConsts::F32x4Le:
+ return builder.makeBinary(LeVecF32x4);
+ case BinaryConsts::F32x4Ge:
+ return builder.makeBinary(GeVecF32x4);
+ case BinaryConsts::F64x2Eq:
+ return builder.makeBinary(EqVecF64x2);
+ case BinaryConsts::F64x2Ne:
+ return builder.makeBinary(NeVecF64x2);
+ case BinaryConsts::F64x2Lt:
+ return builder.makeBinary(LtVecF64x2);
+ case BinaryConsts::F64x2Gt:
+ return builder.makeBinary(GtVecF64x2);
+ case BinaryConsts::F64x2Le:
+ return builder.makeBinary(LeVecF64x2);
+ case BinaryConsts::F64x2Ge:
+ return builder.makeBinary(GeVecF64x2);
+ case BinaryConsts::V128And:
+ return builder.makeBinary(AndVec128);
+ case BinaryConsts::V128Or:
+ return builder.makeBinary(OrVec128);
+ case BinaryConsts::V128Xor:
+ return builder.makeBinary(XorVec128);
+ case BinaryConsts::V128Andnot:
+ return builder.makeBinary(AndNotVec128);
+ case BinaryConsts::I8x16Add:
+ return builder.makeBinary(AddVecI8x16);
+ case BinaryConsts::I8x16AddSatS:
+ return builder.makeBinary(AddSatSVecI8x16);
+ case BinaryConsts::I8x16AddSatU:
+ return builder.makeBinary(AddSatUVecI8x16);
+ case BinaryConsts::I8x16Sub:
+ return builder.makeBinary(SubVecI8x16);
+ case BinaryConsts::I8x16SubSatS:
+ return builder.makeBinary(SubSatSVecI8x16);
+ case BinaryConsts::I8x16SubSatU:
+ return builder.makeBinary(SubSatUVecI8x16);
+ case BinaryConsts::I8x16MinS:
+ return builder.makeBinary(MinSVecI8x16);
+ case BinaryConsts::I8x16MinU:
+ return builder.makeBinary(MinUVecI8x16);
+ case BinaryConsts::I8x16MaxS:
+ return builder.makeBinary(MaxSVecI8x16);
+ case BinaryConsts::I8x16MaxU:
+ return builder.makeBinary(MaxUVecI8x16);
+ case BinaryConsts::I8x16AvgrU:
+ return builder.makeBinary(AvgrUVecI8x16);
+ case BinaryConsts::I16x8Add:
+ return builder.makeBinary(AddVecI16x8);
+ case BinaryConsts::I16x8AddSatS:
+ return builder.makeBinary(AddSatSVecI16x8);
+ case BinaryConsts::I16x8AddSatU:
+ return builder.makeBinary(AddSatUVecI16x8);
+ case BinaryConsts::I16x8Sub:
+ return builder.makeBinary(SubVecI16x8);
+ case BinaryConsts::I16x8SubSatS:
+ return builder.makeBinary(SubSatSVecI16x8);
+ case BinaryConsts::I16x8SubSatU:
+ return builder.makeBinary(SubSatUVecI16x8);
+ case BinaryConsts::I16x8Mul:
+ return builder.makeBinary(MulVecI16x8);
+ case BinaryConsts::I16x8MinS:
+ return builder.makeBinary(MinSVecI16x8);
+ case BinaryConsts::I16x8MinU:
+ return builder.makeBinary(MinUVecI16x8);
+ case BinaryConsts::I16x8MaxS:
+ return builder.makeBinary(MaxSVecI16x8);
+ case BinaryConsts::I16x8MaxU:
+ return builder.makeBinary(MaxUVecI16x8);
+ case BinaryConsts::I16x8AvgrU:
+ return builder.makeBinary(AvgrUVecI16x8);
+ case BinaryConsts::I16x8Q15MulrSatS:
+ return builder.makeBinary(Q15MulrSatSVecI16x8);
+ case BinaryConsts::I16x8ExtmulLowI8x16S:
+ return builder.makeBinary(ExtMulLowSVecI16x8);
+ case BinaryConsts::I16x8ExtmulHighI8x16S:
+ return builder.makeBinary(ExtMulHighSVecI16x8);
+ case BinaryConsts::I16x8ExtmulLowI8x16U:
+ return builder.makeBinary(ExtMulLowUVecI16x8);
+ case BinaryConsts::I16x8ExtmulHighI8x16U:
+ return builder.makeBinary(ExtMulHighUVecI16x8);
+ case BinaryConsts::I32x4Add:
+ return builder.makeBinary(AddVecI32x4);
+ case BinaryConsts::I32x4Sub:
+ return builder.makeBinary(SubVecI32x4);
+ case BinaryConsts::I32x4Mul:
+ return builder.makeBinary(MulVecI32x4);
+ case BinaryConsts::I32x4MinS:
+ return builder.makeBinary(MinSVecI32x4);
+ case BinaryConsts::I32x4MinU:
+ return builder.makeBinary(MinUVecI32x4);
+ case BinaryConsts::I32x4MaxS:
+ return builder.makeBinary(MaxSVecI32x4);
+ case BinaryConsts::I32x4MaxU:
+ return builder.makeBinary(MaxUVecI32x4);
+ case BinaryConsts::I32x4DotI16x8S:
+ return builder.makeBinary(DotSVecI16x8ToVecI32x4);
+ case BinaryConsts::I32x4ExtmulLowI16x8S:
+ return builder.makeBinary(ExtMulLowSVecI32x4);
+ case BinaryConsts::I32x4ExtmulHighI16x8S:
+ return builder.makeBinary(ExtMulHighSVecI32x4);
+ case BinaryConsts::I32x4ExtmulLowI16x8U:
+ return builder.makeBinary(ExtMulLowUVecI32x4);
+ case BinaryConsts::I32x4ExtmulHighI16x8U:
+ return builder.makeBinary(ExtMulHighUVecI32x4);
+ case BinaryConsts::I64x2Add:
+ return builder.makeBinary(AddVecI64x2);
+ case BinaryConsts::I64x2Sub:
+ return builder.makeBinary(SubVecI64x2);
+ case BinaryConsts::I64x2Mul:
+ return builder.makeBinary(MulVecI64x2);
+ case BinaryConsts::I64x2ExtmulLowI32x4S:
+ return builder.makeBinary(ExtMulLowSVecI64x2);
+ case BinaryConsts::I64x2ExtmulHighI32x4S:
+ return builder.makeBinary(ExtMulHighSVecI64x2);
+ case BinaryConsts::I64x2ExtmulLowI32x4U:
+ return builder.makeBinary(ExtMulLowUVecI64x2);
+ case BinaryConsts::I64x2ExtmulHighI32x4U:
+ return builder.makeBinary(ExtMulHighUVecI64x2);
+ case BinaryConsts::F16x8Add:
+ return builder.makeBinary(AddVecF16x8);
+ case BinaryConsts::F16x8Sub:
+ return builder.makeBinary(SubVecF16x8);
+ case BinaryConsts::F16x8Mul:
+ return builder.makeBinary(MulVecF16x8);
+ case BinaryConsts::F16x8Div:
+ return builder.makeBinary(DivVecF16x8);
+ case BinaryConsts::F16x8Min:
+ return builder.makeBinary(MinVecF16x8);
+ case BinaryConsts::F16x8Max:
+ return builder.makeBinary(MaxVecF16x8);
+ case BinaryConsts::F16x8Pmin:
+ return builder.makeBinary(PMinVecF16x8);
+ case BinaryConsts::F16x8Pmax:
+ return builder.makeBinary(PMaxVecF16x8);
+ case BinaryConsts::F32x4Add:
+ return builder.makeBinary(AddVecF32x4);
+ case BinaryConsts::F32x4Sub:
+ return builder.makeBinary(SubVecF32x4);
+ case BinaryConsts::F32x4Mul:
+ return builder.makeBinary(MulVecF32x4);
+ case BinaryConsts::F32x4Div:
+ return builder.makeBinary(DivVecF32x4);
+ case BinaryConsts::F32x4Min:
+ return builder.makeBinary(MinVecF32x4);
+ case BinaryConsts::F32x4Max:
+ return builder.makeBinary(MaxVecF32x4);
+ case BinaryConsts::F32x4Pmin:
+ return builder.makeBinary(PMinVecF32x4);
+ case BinaryConsts::F32x4Pmax:
+ return builder.makeBinary(PMaxVecF32x4);
+ case BinaryConsts::F64x2Add:
+ return builder.makeBinary(AddVecF64x2);
+ case BinaryConsts::F64x2Sub:
+ return builder.makeBinary(SubVecF64x2);
+ case BinaryConsts::F64x2Mul:
+ return builder.makeBinary(MulVecF64x2);
+ case BinaryConsts::F64x2Div:
+ return builder.makeBinary(DivVecF64x2);
+ case BinaryConsts::F64x2Min:
+ return builder.makeBinary(MinVecF64x2);
+ case BinaryConsts::F64x2Max:
+ return builder.makeBinary(MaxVecF64x2);
+ case BinaryConsts::F64x2Pmin:
+ return builder.makeBinary(PMinVecF64x2);
+ case BinaryConsts::F64x2Pmax:
+ return builder.makeBinary(PMaxVecF64x2);
+ case BinaryConsts::I8x16NarrowI16x8S:
+ return builder.makeBinary(NarrowSVecI16x8ToVecI8x16);
+ case BinaryConsts::I8x16NarrowI16x8U:
+ return builder.makeBinary(NarrowUVecI16x8ToVecI8x16);
+ case BinaryConsts::I16x8NarrowI32x4S:
+ return builder.makeBinary(NarrowSVecI32x4ToVecI16x8);
+ case BinaryConsts::I16x8NarrowI32x4U:
+ return builder.makeBinary(NarrowUVecI32x4ToVecI16x8);
+ case BinaryConsts::I8x16Swizzle:
+ return builder.makeBinary(SwizzleVecI8x16);
+ case BinaryConsts::I8x16RelaxedSwizzle:
+ return builder.makeBinary(RelaxedSwizzleVecI8x16);
+ case BinaryConsts::F32x4RelaxedMin:
+ return builder.makeBinary(RelaxedMinVecF32x4);
+ case BinaryConsts::F32x4RelaxedMax:
+ return builder.makeBinary(RelaxedMaxVecF32x4);
+ case BinaryConsts::F64x2RelaxedMin:
+ return builder.makeBinary(RelaxedMinVecF64x2);
+ case BinaryConsts::F64x2RelaxedMax:
+ return builder.makeBinary(RelaxedMaxVecF64x2);
+ case BinaryConsts::I16x8RelaxedQ15MulrS:
+ return builder.makeBinary(RelaxedQ15MulrSVecI16x8);
+ case BinaryConsts::I16x8DotI8x16I7x16S:
+ return builder.makeBinary(DotI8x16I7x16SToVecI16x8);
+ case BinaryConsts::I8x16Splat:
+ return builder.makeUnary(SplatVecI8x16);
+ case BinaryConsts::I16x8Splat:
+ return builder.makeUnary(SplatVecI16x8);
+ case BinaryConsts::I32x4Splat:
+ return builder.makeUnary(SplatVecI32x4);
+ case BinaryConsts::I64x2Splat:
+ return builder.makeUnary(SplatVecI64x2);
+ case BinaryConsts::F16x8Splat:
+ return builder.makeUnary(SplatVecF16x8);
+ case BinaryConsts::F32x4Splat:
+ return builder.makeUnary(SplatVecF32x4);
+ case BinaryConsts::F64x2Splat:
+ return builder.makeUnary(SplatVecF64x2);
+ case BinaryConsts::V128Not:
+ return builder.makeUnary(NotVec128);
+ case BinaryConsts::V128AnyTrue:
+ return builder.makeUnary(AnyTrueVec128);
+ case BinaryConsts::I8x16Popcnt:
+ return builder.makeUnary(PopcntVecI8x16);
+ case BinaryConsts::I8x16Abs:
+ return builder.makeUnary(AbsVecI8x16);
+ case BinaryConsts::I8x16Neg:
+ return builder.makeUnary(NegVecI8x16);
+ case BinaryConsts::I8x16AllTrue:
+ return builder.makeUnary(AllTrueVecI8x16);
+ case BinaryConsts::I8x16Bitmask:
+ return builder.makeUnary(BitmaskVecI8x16);
+ case BinaryConsts::I16x8Abs:
+ return builder.makeUnary(AbsVecI16x8);
+ case BinaryConsts::I16x8Neg:
+ return builder.makeUnary(NegVecI16x8);
+ case BinaryConsts::I16x8AllTrue:
+ return builder.makeUnary(AllTrueVecI16x8);
+ case BinaryConsts::I16x8Bitmask:
+ return builder.makeUnary(BitmaskVecI16x8);
+ case BinaryConsts::I32x4Abs:
+ return builder.makeUnary(AbsVecI32x4);
+ case BinaryConsts::I32x4Neg:
+ return builder.makeUnary(NegVecI32x4);
+ case BinaryConsts::I32x4AllTrue:
+ return builder.makeUnary(AllTrueVecI32x4);
+ case BinaryConsts::I32x4Bitmask:
+ return builder.makeUnary(BitmaskVecI32x4);
+ case BinaryConsts::I64x2Abs:
+ return builder.makeUnary(AbsVecI64x2);
+ case BinaryConsts::I64x2Neg:
+ return builder.makeUnary(NegVecI64x2);
+ case BinaryConsts::I64x2AllTrue:
+ return builder.makeUnary(AllTrueVecI64x2);
+ case BinaryConsts::I64x2Bitmask:
+ return builder.makeUnary(BitmaskVecI64x2);
+ case BinaryConsts::F16x8Abs:
+ return builder.makeUnary(AbsVecF16x8);
+ case BinaryConsts::F16x8Neg:
+ return builder.makeUnary(NegVecF16x8);
+ case BinaryConsts::F16x8Sqrt:
+ return builder.makeUnary(SqrtVecF16x8);
+ case BinaryConsts::F16x8Ceil:
+ return builder.makeUnary(CeilVecF16x8);
+ case BinaryConsts::F16x8Floor:
+ return builder.makeUnary(FloorVecF16x8);
+ case BinaryConsts::F16x8Trunc:
+ return builder.makeUnary(TruncVecF16x8);
+ case BinaryConsts::F16x8Nearest:
+ return builder.makeUnary(NearestVecF16x8);
+ case BinaryConsts::F32x4Abs:
+ return builder.makeUnary(AbsVecF32x4);
+ case BinaryConsts::F32x4Neg:
+ return builder.makeUnary(NegVecF32x4);
+ case BinaryConsts::F32x4Sqrt:
+ return builder.makeUnary(SqrtVecF32x4);
+ case BinaryConsts::F32x4Ceil:
+ return builder.makeUnary(CeilVecF32x4);
+ case BinaryConsts::F32x4Floor:
+ return builder.makeUnary(FloorVecF32x4);
+ case BinaryConsts::F32x4Trunc:
+ return builder.makeUnary(TruncVecF32x4);
+ case BinaryConsts::F32x4Nearest:
+ return builder.makeUnary(NearestVecF32x4);
+ case BinaryConsts::F64x2Abs:
+ return builder.makeUnary(AbsVecF64x2);
+ case BinaryConsts::F64x2Neg:
+ return builder.makeUnary(NegVecF64x2);
+ case BinaryConsts::F64x2Sqrt:
+ return builder.makeUnary(SqrtVecF64x2);
+ case BinaryConsts::F64x2Ceil:
+ return builder.makeUnary(CeilVecF64x2);
+ case BinaryConsts::F64x2Floor:
+ return builder.makeUnary(FloorVecF64x2);
+ case BinaryConsts::F64x2Trunc:
+ return builder.makeUnary(TruncVecF64x2);
+ case BinaryConsts::F64x2Nearest:
+ return builder.makeUnary(NearestVecF64x2);
+ case BinaryConsts::I16x8ExtaddPairwiseI8x16S:
+ return builder.makeUnary(ExtAddPairwiseSVecI8x16ToI16x8);
+ case BinaryConsts::I16x8ExtaddPairwiseI8x16U:
+ return builder.makeUnary(ExtAddPairwiseUVecI8x16ToI16x8);
+ case BinaryConsts::I32x4ExtaddPairwiseI16x8S:
+ return builder.makeUnary(ExtAddPairwiseSVecI16x8ToI32x4);
+ case BinaryConsts::I32x4ExtaddPairwiseI16x8U:
+ return builder.makeUnary(ExtAddPairwiseUVecI16x8ToI32x4);
+ case BinaryConsts::I32x4TruncSatF32x4S:
+ return builder.makeUnary(TruncSatSVecF32x4ToVecI32x4);
+ case BinaryConsts::I32x4TruncSatF32x4U:
+ return builder.makeUnary(TruncSatUVecF32x4ToVecI32x4);
+ case BinaryConsts::F32x4ConvertI32x4S:
+ return builder.makeUnary(ConvertSVecI32x4ToVecF32x4);
+ case BinaryConsts::F32x4ConvertI32x4U:
+ return builder.makeUnary(ConvertUVecI32x4ToVecF32x4);
+ case BinaryConsts::I16x8ExtendLowI8x16S:
+ return builder.makeUnary(ExtendLowSVecI8x16ToVecI16x8);
+ case BinaryConsts::I16x8ExtendHighI8x16S:
+ return builder.makeUnary(ExtendHighSVecI8x16ToVecI16x8);
+ case BinaryConsts::I16x8ExtendLowI8x16U:
+ return builder.makeUnary(ExtendLowUVecI8x16ToVecI16x8);
+ case BinaryConsts::I16x8ExtendHighI8x16U:
+ return builder.makeUnary(ExtendHighUVecI8x16ToVecI16x8);
+ case BinaryConsts::I32x4ExtendLowI16x8S:
+ return builder.makeUnary(ExtendLowSVecI16x8ToVecI32x4);
+ case BinaryConsts::I32x4ExtendHighI16x8S:
+ return builder.makeUnary(ExtendHighSVecI16x8ToVecI32x4);
+ case BinaryConsts::I32x4ExtendLowI16x8U:
+ return builder.makeUnary(ExtendLowUVecI16x8ToVecI32x4);
+ case BinaryConsts::I32x4ExtendHighI16x8U:
+ return builder.makeUnary(ExtendHighUVecI16x8ToVecI32x4);
+ case BinaryConsts::I64x2ExtendLowI32x4S:
+ return builder.makeUnary(ExtendLowSVecI32x4ToVecI64x2);
+ case BinaryConsts::I64x2ExtendHighI32x4S:
+ return builder.makeUnary(ExtendHighSVecI32x4ToVecI64x2);
+ case BinaryConsts::I64x2ExtendLowI32x4U:
+ return builder.makeUnary(ExtendLowUVecI32x4ToVecI64x2);
+ case BinaryConsts::I64x2ExtendHighI32x4U:
+ return builder.makeUnary(ExtendHighUVecI32x4ToVecI64x2);
+ case BinaryConsts::F64x2ConvertLowI32x4S:
+ return builder.makeUnary(ConvertLowSVecI32x4ToVecF64x2);
+ case BinaryConsts::F64x2ConvertLowI32x4U:
+ return builder.makeUnary(ConvertLowUVecI32x4ToVecF64x2);
+ case BinaryConsts::I32x4TruncSatF64x2SZero:
+ return builder.makeUnary(TruncSatZeroSVecF64x2ToVecI32x4);
+ case BinaryConsts::I32x4TruncSatF64x2UZero:
+ return builder.makeUnary(TruncSatZeroUVecF64x2ToVecI32x4);
+ case BinaryConsts::F32x4DemoteF64x2Zero:
+ return builder.makeUnary(DemoteZeroVecF64x2ToVecF32x4);
+ case BinaryConsts::F64x2PromoteLowF32x4:
+ return builder.makeUnary(PromoteLowVecF32x4ToVecF64x2);
+ case BinaryConsts::I32x4RelaxedTruncF32x4S:
+ return builder.makeUnary(RelaxedTruncSVecF32x4ToVecI32x4);
+ case BinaryConsts::I32x4RelaxedTruncF32x4U:
+ return builder.makeUnary(RelaxedTruncUVecF32x4ToVecI32x4);
+ case BinaryConsts::I32x4RelaxedTruncF64x2SZero:
+ return builder.makeUnary(RelaxedTruncZeroSVecF64x2ToVecI32x4);
+ case BinaryConsts::I32x4RelaxedTruncF64x2UZero:
+ return builder.makeUnary(RelaxedTruncZeroUVecF64x2ToVecI32x4);
+ case BinaryConsts::I16x8TruncSatF16x8S:
+ return builder.makeUnary(TruncSatSVecF16x8ToVecI16x8);
+ case BinaryConsts::I16x8TruncSatF16x8U:
+ return builder.makeUnary(TruncSatUVecF16x8ToVecI16x8);
+ case BinaryConsts::F16x8ConvertI16x8S:
+ return builder.makeUnary(ConvertSVecI16x8ToVecF16x8);
+ case BinaryConsts::F16x8ConvertI16x8U:
+ return builder.makeUnary(ConvertUVecI16x8ToVecF16x8);
+ case BinaryConsts::I8x16ExtractLaneS:
+ return builder.makeSIMDExtract(ExtractLaneSVecI8x16,
+ getLaneIndex(16));
+ case BinaryConsts::I8x16ExtractLaneU:
+ return builder.makeSIMDExtract(ExtractLaneUVecI8x16,
+ getLaneIndex(16));
+ case BinaryConsts::I16x8ExtractLaneS:
+ return builder.makeSIMDExtract(ExtractLaneSVecI16x8, getLaneIndex(8));
+ case BinaryConsts::I16x8ExtractLaneU:
+ return builder.makeSIMDExtract(ExtractLaneUVecI16x8, getLaneIndex(8));
+ case BinaryConsts::I32x4ExtractLane:
+ return builder.makeSIMDExtract(ExtractLaneVecI32x4, getLaneIndex(4));
+ case BinaryConsts::I64x2ExtractLane:
+ return builder.makeSIMDExtract(ExtractLaneVecI64x2, getLaneIndex(2));
+ case BinaryConsts::F16x8ExtractLane:
+ return builder.makeSIMDExtract(ExtractLaneVecF16x8, getLaneIndex(8));
+ case BinaryConsts::F32x4ExtractLane:
+ return builder.makeSIMDExtract(ExtractLaneVecF32x4, getLaneIndex(4));
+ case BinaryConsts::F64x2ExtractLane:
+ return builder.makeSIMDExtract(ExtractLaneVecF64x2, getLaneIndex(2));
+ case BinaryConsts::I8x16ReplaceLane:
+ return builder.makeSIMDReplace(ReplaceLaneVecI8x16, getLaneIndex(16));
+ case BinaryConsts::I16x8ReplaceLane:
+ return builder.makeSIMDReplace(ReplaceLaneVecI16x8, getLaneIndex(8));
+ case BinaryConsts::I32x4ReplaceLane:
+ return builder.makeSIMDReplace(ReplaceLaneVecI32x4, getLaneIndex(4));
+ case BinaryConsts::I64x2ReplaceLane:
+ return builder.makeSIMDReplace(ReplaceLaneVecI64x2, getLaneIndex(2));
+ case BinaryConsts::F16x8ReplaceLane:
+ return builder.makeSIMDReplace(ReplaceLaneVecF16x8, getLaneIndex(8));
+ case BinaryConsts::F32x4ReplaceLane:
+ return builder.makeSIMDReplace(ReplaceLaneVecF32x4, getLaneIndex(4));
+ case BinaryConsts::F64x2ReplaceLane:
+ return builder.makeSIMDReplace(ReplaceLaneVecF64x2, getLaneIndex(2));
+ case BinaryConsts::I8x16Shuffle: {
+ std::array<uint8_t, 16> lanes;
+ for (Index i = 0; i < 16; ++i) {
+ lanes[i] = getLaneIndex(32);
+ }
+ return builder.makeSIMDShuffle(lanes);
+ }
+ case BinaryConsts::V128Bitselect:
+ return builder.makeSIMDTernary(Bitselect);
+ case BinaryConsts::I8x16Laneselect:
+ return builder.makeSIMDTernary(LaneselectI8x16);
+ case BinaryConsts::I16x8Laneselect:
+ return builder.makeSIMDTernary(LaneselectI16x8);
+ case BinaryConsts::I32x4Laneselect:
+ return builder.makeSIMDTernary(LaneselectI32x4);
+ case BinaryConsts::I64x2Laneselect:
+ return builder.makeSIMDTernary(LaneselectI64x2);
+ case BinaryConsts::F16x8RelaxedMadd:
+ return builder.makeSIMDTernary(RelaxedMaddVecF16x8);
+ case BinaryConsts::F16x8RelaxedNmadd:
+ return builder.makeSIMDTernary(RelaxedNmaddVecF16x8);
+ case BinaryConsts::F32x4RelaxedMadd:
+ return builder.makeSIMDTernary(RelaxedMaddVecF32x4);
+ case BinaryConsts::F32x4RelaxedNmadd:
+ return builder.makeSIMDTernary(RelaxedNmaddVecF32x4);
+ case BinaryConsts::F64x2RelaxedMadd:
+ return builder.makeSIMDTernary(RelaxedMaddVecF64x2);
+ case BinaryConsts::F64x2RelaxedNmadd:
+ return builder.makeSIMDTernary(RelaxedNmaddVecF64x2);
+ case BinaryConsts::I32x4DotI8x16I7x16AddS:
+ return builder.makeSIMDTernary(DotI8x16I7x16AddSToVecI32x4);
+ case BinaryConsts::I8x16Shl:
+ return builder.makeSIMDShift(ShlVecI8x16);
+ case BinaryConsts::I8x16ShrS:
+ return builder.makeSIMDShift(ShrSVecI8x16);
+ case BinaryConsts::I8x16ShrU:
+ return builder.makeSIMDShift(ShrUVecI8x16);
+ case BinaryConsts::I16x8Shl:
+ return builder.makeSIMDShift(ShlVecI16x8);
+ case BinaryConsts::I16x8ShrS:
+ return builder.makeSIMDShift(ShrSVecI16x8);
+ case BinaryConsts::I16x8ShrU:
+ return builder.makeSIMDShift(ShrUVecI16x8);
+ case BinaryConsts::I32x4Shl:
+ return builder.makeSIMDShift(ShlVecI32x4);
+ case BinaryConsts::I32x4ShrS:
+ return builder.makeSIMDShift(ShrSVecI32x4);
+ case BinaryConsts::I32x4ShrU:
+ return builder.makeSIMDShift(ShrUVecI32x4);
+ case BinaryConsts::I64x2Shl:
+ return builder.makeSIMDShift(ShlVecI64x2);
+ case BinaryConsts::I64x2ShrS:
+ return builder.makeSIMDShift(ShrSVecI64x2);
+ case BinaryConsts::I64x2ShrU:
+ return builder.makeSIMDShift(ShrUVecI64x2);
+ case BinaryConsts::V128Const:
+ return builder.makeConst(getVec128Literal());
+ case BinaryConsts::V128Store: {
+ auto [mem, align, offset] = getMemarg();
+ return builder.makeStore(16, offset, align, Type::v128, mem);
+ }
+ case BinaryConsts::V128Load: {
+ auto [mem, align, offset] = getMemarg();
+ return builder.makeLoad(16, false, offset, align, Type::v128, mem);
+ }
+ case BinaryConsts::V128Load8Splat: {
+ auto [mem, align, offset] = getMemarg();
+ return builder.makeSIMDLoad(Load8SplatVec128, offset, align, mem);
+ }
+ case BinaryConsts::V128Load16Splat: {
+ auto [mem, align, offset] = getMemarg();
+ return builder.makeSIMDLoad(Load16SplatVec128, offset, align, mem);
+ }
+ case BinaryConsts::V128Load32Splat: {
+ auto [mem, align, offset] = getMemarg();
+ return builder.makeSIMDLoad(Load32SplatVec128, offset, align, mem);
+ }
+ case BinaryConsts::V128Load64Splat: {
+ auto [mem, align, offset] = getMemarg();
+ return builder.makeSIMDLoad(Load64SplatVec128, offset, align, mem);
+ }
+ case BinaryConsts::V128Load8x8S: {
+ auto [mem, align, offset] = getMemarg();
+ return builder.makeSIMDLoad(Load8x8SVec128, offset, align, mem);
+ }
+ case BinaryConsts::V128Load8x8U: {
+ auto [mem, align, offset] = getMemarg();
+ return builder.makeSIMDLoad(Load8x8UVec128, offset, align, mem);
+ }
+ case BinaryConsts::V128Load16x4S: {
+ auto [mem, align, offset] = getMemarg();
+ return builder.makeSIMDLoad(Load16x4SVec128, offset, align, mem);
+ }
+ case BinaryConsts::V128Load16x4U: {
+ auto [mem, align, offset] = getMemarg();
+ return builder.makeSIMDLoad(Load16x4UVec128, offset, align, mem);
+ }
+ case BinaryConsts::V128Load32x2S: {
+ auto [mem, align, offset] = getMemarg();
+ return builder.makeSIMDLoad(Load32x2SVec128, offset, align, mem);
+ }
+ case BinaryConsts::V128Load32x2U: {
+ auto [mem, align, offset] = getMemarg();
+ return builder.makeSIMDLoad(Load32x2UVec128, offset, align, mem);
+ }
+ case BinaryConsts::V128Load32Zero: {
+ auto [mem, align, offset] = getMemarg();
+ return builder.makeSIMDLoad(Load32ZeroVec128, offset, align, mem);
+ }
+ case BinaryConsts::V128Load64Zero: {
+ auto [mem, align, offset] = getMemarg();
+ return builder.makeSIMDLoad(Load64ZeroVec128, offset, align, mem);
+ }
+ case BinaryConsts::V128Load8Lane: {
+ auto [mem, align, offset] = getMemarg();
+ return builder.makeSIMDLoadStoreLane(
+ Load8LaneVec128, offset, align, getLaneIndex(16), mem);
+ }
+ case BinaryConsts::V128Load16Lane: {
+ auto [mem, align, offset] = getMemarg();
+ return builder.makeSIMDLoadStoreLane(
+ Load16LaneVec128, offset, align, getLaneIndex(8), mem);
+ }
+ case BinaryConsts::V128Load32Lane: {
+ auto [mem, align, offset] = getMemarg();
+ return builder.makeSIMDLoadStoreLane(
+ Load32LaneVec128, offset, align, getLaneIndex(4), mem);
+ }
+ case BinaryConsts::V128Load64Lane: {
+ auto [mem, align, offset] = getMemarg();
+ return builder.makeSIMDLoadStoreLane(
+ Load64LaneVec128, offset, align, getLaneIndex(2), mem);
+ }
+ case BinaryConsts::V128Store8Lane: {
+ auto [mem, align, offset] = getMemarg();
+ return builder.makeSIMDLoadStoreLane(
+ Store8LaneVec128, offset, align, getLaneIndex(16), mem);
+ }
+ case BinaryConsts::V128Store16Lane: {
+ auto [mem, align, offset] = getMemarg();
+ return builder.makeSIMDLoadStoreLane(
+ Store16LaneVec128, offset, align, getLaneIndex(8), mem);
+ }
+ case BinaryConsts::V128Store32Lane: {
+ auto [mem, align, offset] = getMemarg();
+ return builder.makeSIMDLoadStoreLane(
+ Store32LaneVec128, offset, align, getLaneIndex(4), mem);
+ }
+ case BinaryConsts::V128Store64Lane: {
+ auto [mem, align, offset] = getMemarg();
+ return builder.makeSIMDLoadStoreLane(
+ Store64LaneVec128, offset, align, getLaneIndex(2), mem);
+ }
+ }
+ return Err{"unknown SIMD operation"};
+ }
+ case BinaryConsts::GCPrefix: {
+ auto op = getU32LEB();
+ switch (op) {
+ case BinaryConsts::RefI31:
+ return builder.makeRefI31(Unshared);
+ case BinaryConsts::RefI31Shared:
+ return builder.makeRefI31(Shared);
+ case BinaryConsts::I31GetS:
+ return builder.makeI31Get(true);
+ case BinaryConsts::I31GetU:
+ return builder.makeI31Get(false);
+ case BinaryConsts::RefTest:
+ return builder.makeRefTest(Type(getHeapType(), NonNullable));
+ case BinaryConsts::RefTestNull:
+ return builder.makeRefTest(Type(getHeapType(), Nullable));
+ case BinaryConsts::RefCast:
+ return builder.makeRefCast(Type(getHeapType(), NonNullable));
+ case BinaryConsts::RefCastNull:
+ return builder.makeRefCast(Type(getHeapType(), Nullable));
+ case BinaryConsts::BrOnCast:
+ case BinaryConsts::BrOnCastFail: {
+ auto flags = getInt8();
+ auto label = getU32LEB();
+ auto in = Type(getHeapType(), (flags & 1) ? Nullable : NonNullable);
+ auto cast = Type(getHeapType(), (flags & 2) ? Nullable : NonNullable);
+ auto kind = op == BinaryConsts::BrOnCast ? BrOnCast : BrOnCastFail;
+ return builder.makeBrOn(label, kind, in, cast);
+ }
+ case BinaryConsts::StructNew:
+ return builder.makeStructNew(getIndexedHeapType());
+ case BinaryConsts::StructNewDefault:
+ return builder.makeStructNewDefault(getIndexedHeapType());
+ case BinaryConsts::StructGet:
+ case BinaryConsts::StructGetS:
+ case BinaryConsts::StructGetU: {
+ auto type = getIndexedHeapType();
+ auto field = getU32LEB();
+ return builder.makeStructGet(
+ type, field, op == BinaryConsts::StructGetS);
+ }
+ case BinaryConsts::StructSet: {
+ auto type = getIndexedHeapType();
+ auto field = getU32LEB();
+ return builder.makeStructSet(type, field);
+ }
+ case BinaryConsts::ArrayNew:
+ return builder.makeArrayNew(getIndexedHeapType());
+ case BinaryConsts::ArrayNewDefault:
+ return builder.makeArrayNewDefault(getIndexedHeapType());
+ case BinaryConsts::ArrayNewFixed: {
+ auto type = getIndexedHeapType();
+ auto arity = getU32LEB();
+ return builder.makeArrayNewFixed(type, arity);
+ }
+ case BinaryConsts::ArrayNewData: {
+ auto type = getIndexedHeapType();
+ auto data = getDataName(getU32LEB());
+ return builder.makeArrayNewData(type, data);
+ }
+ case BinaryConsts::ArrayNewElem: {
+ auto type = getIndexedHeapType();
+ auto elem = getElemName(getU32LEB());
+ return builder.makeArrayNewElem(type, elem);
+ }
+ case BinaryConsts::ArrayGet:
+ case BinaryConsts::ArrayGetU:
+ return builder.makeArrayGet(getIndexedHeapType(), false);
+ case BinaryConsts::ArrayGetS:
+ return builder.makeArrayGet(getIndexedHeapType(), true);
+ case BinaryConsts::ArraySet:
+ return builder.makeArraySet(getIndexedHeapType());
+ case BinaryConsts::ArrayLen:
+ return builder.makeArrayLen();
+ case BinaryConsts::ArrayCopy: {
+ auto dest = getIndexedHeapType();
+ auto src = getIndexedHeapType();
+ return builder.makeArrayCopy(dest, src);
+ }
+ case BinaryConsts::ArrayFill:
+ return builder.makeArrayFill(getIndexedHeapType());
+ case BinaryConsts::ArrayInitData: {
+ auto type = getIndexedHeapType();
+ auto data = getDataName(getU32LEB());
+ return builder.makeArrayInitData(type, data);
+ }
+ case BinaryConsts::ArrayInitElem: {
+ auto type = getIndexedHeapType();
+ auto elem = getElemName(getU32LEB());
+ return builder.makeArrayInitElem(type, elem);
+ }
+ case BinaryConsts::StringNewLossyUTF8Array:
+ return builder.makeStringNew(StringNewLossyUTF8Array);
+ case BinaryConsts::StringNewWTF16Array:
+ return builder.makeStringNew(StringNewWTF16Array);
+ case BinaryConsts::StringFromCodePoint:
+ return builder.makeStringNew(StringNewFromCodePoint);
+ case BinaryConsts::StringAsWTF16:
+ // This turns into nothing because we do not represent stringviews in
+ // the IR.
+ return Ok{};
+ case BinaryConsts::StringConst:
+ return builder.makeStringConst(getIndexedString());
+ case BinaryConsts::StringMeasureUTF8:
+ return builder.makeStringMeasure(StringMeasureUTF8);
+ case BinaryConsts::StringMeasureWTF16:
+ return builder.makeStringMeasure(StringMeasureWTF16);
+ case BinaryConsts::StringEncodeLossyUTF8Array:
+ return builder.makeStringEncode(StringEncodeLossyUTF8Array);
+ case BinaryConsts::StringEncodeWTF16Array:
+ return builder.makeStringEncode(StringEncodeWTF16Array);
+ case BinaryConsts::StringConcat:
+ return builder.makeStringConcat();
+ case BinaryConsts::StringEq:
+ return builder.makeStringEq(StringEqEqual);
+ case BinaryConsts::StringCompare:
+ return builder.makeStringEq(StringEqCompare);
+ case BinaryConsts::StringViewWTF16GetCodePoint:
+ return builder.makeStringWTF16Get();
+ case BinaryConsts::StringViewWTF16Slice:
+ return builder.makeStringSliceWTF();
+ case BinaryConsts::AnyConvertExtern:
+ return builder.makeRefAs(AnyConvertExtern);
+ case BinaryConsts::ExternConvertAny:
+ return builder.makeRefAs(ExternConvertAny);
+ }
+ return Err{"unknown GC operation"};
+ }
+ }
+ return Err{"unknown operation"};
+}
+
void WasmBinaryReader::readExports() {
size_t num = getU32LEB();
std::unordered_set<Name> names;
@@ -3169,14 +4514,19 @@ void WasmBinaryReader::readNextDebugLocation() {
}
Expression* WasmBinaryReader::readExpression() {
- assert(depth == 0);
- processExpressions();
- if (expressionStack.size() != 1) {
- throwError("expected to read a single expression");
+ assert(builder.empty());
+ while (input[pos] != BinaryConsts::End) {
+ auto inst = readInst();
+ if (auto* err = inst.getErr()) {
+ throwError(err->msg);
+ }
}
- auto* ret = popExpression();
- assert(depth == 0);
- return ret;
+ ++pos;
+ auto expr = builder.build();
+ if (auto* err = expr.getErr()) {
+ throwError(err->msg);
+ }
+ return *expr;
}
void WasmBinaryReader::readStrings() {
@@ -3197,6 +4547,14 @@ void WasmBinaryReader::readStrings() {
}
}
+Name WasmBinaryReader::getIndexedString() {
+ auto index = getU32LEB();
+ if (index >= strings.size()) {
+ throwError("bad string index");
+ }
+ return strings[index];
+}
+
void WasmBinaryReader::readGlobals() {
size_t num = getU32LEB();
auto numImports = wasm.globals.size();
@@ -3224,184 +4582,6 @@ void WasmBinaryReader::readGlobals() {
}
}
-void WasmBinaryReader::processExpressions() {
- unreachableInTheWasmSense = false;
- while (1) {
- Expression* curr;
- auto ret = readExpression(curr);
- if (!curr) {
- lastSeparator = ret;
- return;
- }
- pushExpression(curr);
- if (curr->type == Type::unreachable) {
- // Once we see something unreachable, we don't want to add anything else
- // to the stack, as it could be stacky code that is non-representable in
- // our AST. but we do need to skip it.
- // If there is nothing else here, just stop. Otherwise, go into
- // unreachable mode. peek to see what to do.
- if (pos == endOfFunction) {
- throwError("Reached function end without seeing End opcode");
- }
- if (!more()) {
- throwError("unexpected end of input");
- }
- auto peek = input[pos];
- if (peek == BinaryConsts::End || peek == BinaryConsts::Else ||
- peek == BinaryConsts::Catch_Legacy ||
- peek == BinaryConsts::CatchAll_Legacy ||
- peek == BinaryConsts::Delegate) {
- lastSeparator = BinaryConsts::ASTNodes(peek);
- // Read the byte we peeked at. No new instruction is generated for it.
- Expression* dummy = nullptr;
- readExpression(dummy);
- assert(!dummy);
- return;
- } else {
- skipUnreachableCode();
- return;
- }
- }
- }
-}
-
-void WasmBinaryReader::skipUnreachableCode() {
- // preserve the stack, and restore it. it contains the instruction that made
- // us unreachable, and we can ignore anything after it. things after it may
- // pop, we want to undo that
- auto savedStack = expressionStack;
- // note we are entering unreachable code, and note what the state as before so
- // we can restore it
- auto before = willBeIgnored;
- willBeIgnored = true;
- // clear the stack. nothing should be popped from there anyhow, just stuff
- // can be pushed and then popped. Popping past the top of the stack will
- // result in uneachables being returned
- expressionStack.clear();
- while (1) {
- // set the unreachableInTheWasmSense flag each time, as sub-blocks may set
- // and unset it
- unreachableInTheWasmSense = true;
- Expression* curr;
- auto ret = readExpression(curr);
- if (!curr) {
- lastSeparator = ret;
- unreachableInTheWasmSense = false;
- willBeIgnored = before;
- expressionStack = savedStack;
- return;
- }
- if (curr->type == Type::unreachable) {
- // Nothing before this unreachable should be available to future
- // expressions. They will get `(unreachable)`s if they try to pop past
- // this point.
- expressionStack.clear();
- } else {
- pushExpression(curr);
- }
- }
-}
-
-void WasmBinaryReader::pushExpression(Expression* curr) {
- auto type = curr->type;
- if (type.isTuple()) {
- // Store tuple to local and push individual extracted values.
- Builder builder(wasm);
- requireFunctionContext("pushExpression-tuple");
- Index tuple = builder.addVar(currFunction, type);
- expressionStack.push_back(builder.makeLocalSet(tuple, curr));
- for (Index i = 0; i < type.size(); ++i) {
- expressionStack.push_back(
- builder.makeTupleExtract(builder.makeLocalGet(tuple, type), i));
- }
- } else {
- expressionStack.push_back(curr);
- }
-}
-
-Expression* WasmBinaryReader::popExpression() {
- if (expressionStack.empty()) {
- if (unreachableInTheWasmSense) {
- // in unreachable code, trying to pop past the polymorphic stack
- // area results in receiving unreachables
- return allocator.alloc<Unreachable>();
- }
- throwError(
- "attempted pop from empty stack / beyond block start boundary at " +
- std::to_string(pos));
- }
- // the stack is not empty, and we would not be going out of the current block
- auto ret = expressionStack.back();
- assert(!ret->type.isTuple());
- expressionStack.pop_back();
- return ret;
-}
-
-Expression* WasmBinaryReader::popNonVoidExpression() {
- auto* ret = popExpression();
- if (ret->type != Type::none) {
- return ret;
- }
- // we found a void, so this is stacky code that we must handle carefully
- Builder builder(wasm);
- // add elements until we find a non-void
- std::vector<Expression*> expressions;
- expressions.push_back(ret);
- while (1) {
- auto* curr = popExpression();
- expressions.push_back(curr);
- if (curr->type != Type::none) {
- break;
- }
- }
- auto* block = builder.makeBlock();
- while (!expressions.empty()) {
- block->list.push_back(expressions.back());
- expressions.pop_back();
- }
- requireFunctionContext("popping void where we need a new local");
- auto type = block->list[0]->type;
- if (type.isConcrete()) {
- auto local = builder.addVar(currFunction, type);
- block->list[0] = builder.makeLocalSet(local, block->list[0]);
- block->list.push_back(builder.makeLocalGet(local, type));
- } else {
- assert(type == Type::unreachable);
- // nothing to do here - unreachable anyhow
- }
- block->finalize();
- return block;
-}
-
-Expression* WasmBinaryReader::popTuple(size_t numElems) {
- Builder builder(wasm);
- std::vector<Expression*> elements;
- elements.resize(numElems);
- for (size_t i = 0; i < numElems; i++) {
- auto* elem = popNonVoidExpression();
- if (elem->type == Type::unreachable) {
- // All the previously-popped items cannot be reached, so ignore them. We
- // cannot continue popping because there might not be enough items on the
- // expression stack after an unreachable expression. Any remaining
- // elements can stay unperturbed on the stack and will be explicitly
- // dropped by some parent call to pushBlockElements.
- return elem;
- }
- elements[numElems - i - 1] = elem;
- }
- return Builder(wasm).makeTupleMake(std::move(elements));
-}
-
-Expression* WasmBinaryReader::popTypedExpression(Type type) {
- if (type.isSingle()) {
- return popNonVoidExpression();
- } else if (type.isTuple()) {
- return popTuple(type.size());
- } else {
- WASM_UNREACHABLE("Invalid popped type");
- }
-}
-
void WasmBinaryReader::validateBinary() {
if (hasDataCount && wasm.dataSegments.size() != dataCount) {
throwError("Number of segments does not agree with DataCount section");
@@ -3587,7 +4767,6 @@ void WasmBinaryReader::readElementSegments() {
segmentData.push_back(refFunc);
}
}
-
wasm.addElementSegment(std::move(segment));
}
}
@@ -3977,756 +5156,6 @@ void WasmBinaryReader::readDylink0(size_t payloadLen) {
}
}
-BinaryConsts::ASTNodes WasmBinaryReader::readExpression(Expression*& curr) {
- if (pos == endOfFunction) {
- throwError("Reached function end without seeing End opcode");
- }
- readNextDebugLocation();
- std::set<Function::DebugLocation> currDebugLocation;
- if (debugLocation.size()) {
- currDebugLocation.insert(*debugLocation.begin());
- }
- size_t startPos = pos;
- uint8_t code = getInt8();
- switch (code) {
- case BinaryConsts::Block:
- visitBlock((curr = allocator.alloc<Block>())->cast<Block>());
- break;
- case BinaryConsts::If:
- visitIf((curr = allocator.alloc<If>())->cast<If>());
- break;
- case BinaryConsts::Loop:
- visitLoop((curr = allocator.alloc<Loop>())->cast<Loop>());
- break;
- case BinaryConsts::Br:
- case BinaryConsts::BrIf:
- visitBreak((curr = allocator.alloc<Break>())->cast<Break>(), code);
- break; // code distinguishes br from br_if
- case BinaryConsts::BrTable:
- visitSwitch((curr = allocator.alloc<Switch>())->cast<Switch>());
- break;
- case BinaryConsts::CallFunction:
- visitCall((curr = allocator.alloc<Call>())->cast<Call>());
- break;
- case BinaryConsts::CallIndirect:
- visitCallIndirect(
- (curr = allocator.alloc<CallIndirect>())->cast<CallIndirect>());
- break;
- case BinaryConsts::RetCallFunction: {
- auto call = allocator.alloc<Call>();
- call->isReturn = true;
- curr = call;
- visitCall(call);
- break;
- }
- case BinaryConsts::RetCallIndirect: {
- auto call = allocator.alloc<CallIndirect>();
- call->isReturn = true;
- curr = call;
- visitCallIndirect(call);
- break;
- }
- case BinaryConsts::LocalGet:
- visitLocalGet((curr = allocator.alloc<LocalGet>())->cast<LocalGet>());
- break;
- case BinaryConsts::LocalTee:
- case BinaryConsts::LocalSet:
- visitLocalSet((curr = allocator.alloc<LocalSet>())->cast<LocalSet>(),
- code);
- break;
- case BinaryConsts::GlobalGet:
- visitGlobalGet((curr = allocator.alloc<GlobalGet>())->cast<GlobalGet>());
- break;
- case BinaryConsts::GlobalSet:
- visitGlobalSet((curr = allocator.alloc<GlobalSet>())->cast<GlobalSet>());
- break;
- case BinaryConsts::Select:
- case BinaryConsts::SelectWithType:
- visitSelect((curr = allocator.alloc<Select>())->cast<Select>(), code);
- break;
- case BinaryConsts::Return:
- visitReturn((curr = allocator.alloc<Return>())->cast<Return>());
- break;
- case BinaryConsts::Nop:
- visitNop((curr = allocator.alloc<Nop>())->cast<Nop>());
- break;
- case BinaryConsts::Unreachable:
- visitUnreachable(
- (curr = allocator.alloc<Unreachable>())->cast<Unreachable>());
- break;
- case BinaryConsts::Drop:
- visitDrop((curr = allocator.alloc<Drop>())->cast<Drop>());
- break;
- case BinaryConsts::End:
- curr = nullptr;
- // Pop the current control flow structure off the stack. If there is none
- // then this is the "end" of the function itself, which also emits an
- // "end" byte.
- if (!controlFlowStack.empty()) {
- controlFlowStack.pop_back();
- }
- break;
- case BinaryConsts::Else:
- case BinaryConsts::Catch_Legacy:
- case BinaryConsts::CatchAll_Legacy: {
- curr = nullptr;
- if (DWARF && currFunction) {
- assert(!controlFlowStack.empty());
- auto currControlFlow = controlFlowStack.back();
- BinaryLocation delimiterId;
- if (currControlFlow->is<If>()) {
- delimiterId = BinaryLocations::Else;
- } else {
- // Both Catch and CatchAll can simply append to the list as we go, as
- // we visit them in the right order in the binary, and like the binary
- // we store the CatchAll at the end.
- delimiterId =
- currFunction->delimiterLocations[currControlFlow].size();
- }
- currFunction->delimiterLocations[currControlFlow][delimiterId] =
- startPos - codeSectionLocation;
- }
- break;
- }
- case BinaryConsts::Delegate: {
- curr = nullptr;
- if (DWARF && currFunction) {
- assert(!controlFlowStack.empty());
- controlFlowStack.pop_back();
- }
- break;
- }
- case BinaryConsts::RefNull:
- visitRefNull((curr = allocator.alloc<RefNull>())->cast<RefNull>());
- break;
- case BinaryConsts::RefIsNull:
- visitRefIsNull((curr = allocator.alloc<RefIsNull>())->cast<RefIsNull>());
- break;
- case BinaryConsts::RefFunc:
- visitRefFunc((curr = allocator.alloc<RefFunc>())->cast<RefFunc>());
- break;
- case BinaryConsts::RefEq:
- visitRefEq((curr = allocator.alloc<RefEq>())->cast<RefEq>());
- break;
- case BinaryConsts::RefAsNonNull:
- visitRefAs((curr = allocator.alloc<RefAs>())->cast<RefAs>(), code);
- break;
- case BinaryConsts::BrOnNull:
- maybeVisitBrOn(curr, code);
- break;
- case BinaryConsts::BrOnNonNull:
- maybeVisitBrOn(curr, code);
- break;
- case BinaryConsts::TableGet:
- visitTableGet((curr = allocator.alloc<TableGet>())->cast<TableGet>());
- break;
- case BinaryConsts::TableSet:
- visitTableSet((curr = allocator.alloc<TableSet>())->cast<TableSet>());
- break;
- case BinaryConsts::Try:
- visitTryOrTryInBlock(curr);
- break;
- case BinaryConsts::TryTable:
- visitTryTable((curr = allocator.alloc<TryTable>())->cast<TryTable>());
- break;
- case BinaryConsts::Throw:
- visitThrow((curr = allocator.alloc<Throw>())->cast<Throw>());
- break;
- case BinaryConsts::Rethrow:
- visitRethrow((curr = allocator.alloc<Rethrow>())->cast<Rethrow>());
- break;
- case BinaryConsts::ThrowRef:
- visitThrowRef((curr = allocator.alloc<ThrowRef>())->cast<ThrowRef>());
- break;
- case BinaryConsts::MemorySize: {
- auto size = allocator.alloc<MemorySize>();
- curr = size;
- visitMemorySize(size);
- break;
- }
- case BinaryConsts::MemoryGrow: {
- auto grow = allocator.alloc<MemoryGrow>();
- curr = grow;
- visitMemoryGrow(grow);
- break;
- }
- case BinaryConsts::CallRef:
- case BinaryConsts::RetCallRef: {
- auto call = allocator.alloc<CallRef>();
- call->isReturn = code == BinaryConsts::RetCallRef;
- curr = call;
- visitCallRef(call);
- break;
- }
- case BinaryConsts::ContBind: {
- visitContBind((curr = allocator.alloc<ContBind>())->cast<ContBind>());
- break;
- }
- case BinaryConsts::ContNew: {
- auto contNew = allocator.alloc<ContNew>();
- curr = contNew;
- visitContNew(contNew);
- break;
- }
- case BinaryConsts::Resume: {
- visitResume((curr = allocator.alloc<Resume>())->cast<Resume>());
- break;
- }
- case BinaryConsts::Suspend: {
- visitSuspend((curr = allocator.alloc<Suspend>())->cast<Suspend>());
- break;
- }
- case BinaryConsts::AtomicPrefix: {
- code = static_cast<uint8_t>(getU32LEB());
- if (maybeVisitLoad(curr, code, BinaryConsts::AtomicPrefix)) {
- break;
- }
- if (maybeVisitStore(curr, code, BinaryConsts::AtomicPrefix)) {
- break;
- }
- if (maybeVisitAtomicRMW(curr, code)) {
- break;
- }
- if (maybeVisitAtomicCmpxchg(curr, code)) {
- break;
- }
- if (maybeVisitAtomicWait(curr, code)) {
- break;
- }
- if (maybeVisitAtomicNotify(curr, code)) {
- break;
- }
- if (maybeVisitAtomicFence(curr, code)) {
- break;
- }
- throwError("invalid code after atomic prefix: " + std::to_string(code));
- break;
- }
- case BinaryConsts::MiscPrefix: {
- auto opcode = getU32LEB();
- if (maybeVisitTruncSat(curr, opcode)) {
- break;
- }
- if (maybeVisitMemoryInit(curr, opcode)) {
- break;
- }
- if (maybeVisitDataDrop(curr, opcode)) {
- break;
- }
- if (maybeVisitMemoryCopy(curr, opcode)) {
- break;
- }
- if (maybeVisitMemoryFill(curr, opcode)) {
- break;
- }
- if (maybeVisitTableSize(curr, opcode)) {
- break;
- }
- if (maybeVisitTableGrow(curr, opcode)) {
- break;
- }
- if (maybeVisitTableFill(curr, opcode)) {
- break;
- }
- if (maybeVisitTableCopy(curr, opcode)) {
- break;
- }
- if (maybeVisitTableInit(curr, opcode)) {
- break;
- }
- if (maybeVisitLoad(curr, opcode, BinaryConsts::MiscPrefix)) {
- break;
- }
- if (maybeVisitStore(curr, opcode, BinaryConsts::MiscPrefix)) {
- break;
- }
- throwError("invalid code after misc prefix: " + std::to_string(opcode));
- break;
- }
- case BinaryConsts::SIMDPrefix: {
- auto opcode = getU32LEB();
- if (maybeVisitSIMDBinary(curr, opcode)) {
- break;
- }
- if (maybeVisitSIMDUnary(curr, opcode)) {
- break;
- }
- if (maybeVisitSIMDConst(curr, opcode)) {
- break;
- }
- if (maybeVisitSIMDStore(curr, opcode)) {
- break;
- }
- if (maybeVisitSIMDExtract(curr, opcode)) {
- break;
- }
- if (maybeVisitSIMDReplace(curr, opcode)) {
- break;
- }
- if (maybeVisitSIMDShuffle(curr, opcode)) {
- break;
- }
- if (maybeVisitSIMDTernary(curr, opcode)) {
- break;
- }
- if (maybeVisitSIMDShift(curr, opcode)) {
- break;
- }
- if (maybeVisitSIMDLoad(curr, opcode)) {
- break;
- }
- if (maybeVisitSIMDLoadStoreLane(curr, opcode)) {
- break;
- }
- throwError("invalid code after SIMD prefix: " + std::to_string(opcode));
- break;
- }
- case BinaryConsts::GCPrefix: {
- auto opcode = getU32LEB();
- if (maybeVisitRefI31(curr, opcode)) {
- break;
- }
- if (maybeVisitI31Get(curr, opcode)) {
- break;
- }
- if (maybeVisitRefTest(curr, opcode)) {
- break;
- }
- if (maybeVisitRefCast(curr, opcode)) {
- break;
- }
- if (maybeVisitBrOn(curr, opcode)) {
- break;
- }
- if (maybeVisitStructNew(curr, opcode)) {
- break;
- }
- if (maybeVisitStructGet(curr, opcode)) {
- break;
- }
- if (maybeVisitStructSet(curr, opcode)) {
- break;
- }
- if (maybeVisitArrayNewData(curr, opcode)) {
- break;
- }
- if (maybeVisitArrayNewElem(curr, opcode)) {
- break;
- }
- if (maybeVisitArrayNewFixed(curr, opcode)) {
- break;
- }
- if (maybeVisitArrayGet(curr, opcode)) {
- break;
- }
- if (maybeVisitArraySet(curr, opcode)) {
- break;
- }
- if (maybeVisitArrayLen(curr, opcode)) {
- break;
- }
- if (maybeVisitArrayCopy(curr, opcode)) {
- break;
- }
- if (maybeVisitArrayFill(curr, opcode)) {
- break;
- }
- if (maybeVisitArrayInit(curr, opcode)) {
- break;
- }
- if (maybeVisitStringNew(curr, opcode)) {
- break;
- }
- if (maybeVisitStringAsWTF16(curr, opcode)) {
- break;
- }
- if (maybeVisitStringConst(curr, opcode)) {
- break;
- }
- if (maybeVisitStringMeasure(curr, opcode)) {
- break;
- }
- if (maybeVisitStringEncode(curr, opcode)) {
- break;
- }
- if (maybeVisitStringConcat(curr, opcode)) {
- break;
- }
- if (maybeVisitStringEq(curr, opcode)) {
- break;
- }
- if (maybeVisitStringWTF16Get(curr, opcode)) {
- break;
- }
- if (maybeVisitStringSliceWTF(curr, opcode)) {
- break;
- }
- if (opcode == BinaryConsts::AnyConvertExtern ||
- opcode == BinaryConsts::ExternConvertAny) {
- visitRefAs((curr = allocator.alloc<RefAs>())->cast<RefAs>(), opcode);
- break;
- }
- throwError("invalid code after GC prefix: " + std::to_string(opcode));
- break;
- }
- default: {
- // otherwise, the code is a subcode TODO: optimize
- if (maybeVisitBinary(curr, code)) {
- break;
- }
- if (maybeVisitUnary(curr, code)) {
- break;
- }
- if (maybeVisitConst(curr, code)) {
- break;
- }
- if (maybeVisitLoad(curr, code, /*prefix=*/std::nullopt)) {
- break;
- }
- if (maybeVisitStore(curr, code, /*prefix=*/std::nullopt)) {
- break;
- }
- throwError("bad node code " + std::to_string(code));
- break;
- }
- }
- if (curr) {
- if (currDebugLocation.size()) {
- requireFunctionContext("debugLocation");
- currFunction->debugLocations[curr] = *currDebugLocation.begin();
- }
- if (DWARF && currFunction) {
- currFunction->expressionLocations[curr] =
- BinaryLocations::Span{BinaryLocation(startPos - codeSectionLocation),
- BinaryLocation(pos - codeSectionLocation)};
- }
- }
- return BinaryConsts::ASTNodes(code);
-}
-
-void WasmBinaryReader::startControlFlow(Expression* curr) {
- if (DWARF && currFunction) {
- controlFlowStack.push_back(curr);
- }
-}
-
-void WasmBinaryReader::pushBlockElements(Block* curr, Type type, size_t start) {
- assert(start <= expressionStack.size());
- // The results of this block are the last values pushed to the expressionStack
- Expression* results = nullptr;
- if (type.isConcrete()) {
- results = popTypedExpression(type);
- }
- if (expressionStack.size() < start) {
- throwError("Block requires more values than are available");
- }
- // Everything else on the stack after `start` is either a none-type expression
- // or a concretely-type expression that is implicitly dropped due to
- // unreachability at the end of the block, like this:
- //
- // block i32
- // i32.const 1
- // i32.const 2
- // i32.const 3
- // return
- // end
- //
- // The first two const elements will be emitted as drops in the block (the
- // optimizer can remove them, of course, but in general we may need dropped
- // items here as they may have side effects).
- //
- for (size_t i = start; i < expressionStack.size(); ++i) {
- auto* item = expressionStack[i];
- if (item->type.isConcrete()) {
- item = Builder(wasm).makeDrop(item);
- }
- curr->list.push_back(item);
- }
- expressionStack.resize(start);
- if (results != nullptr) {
- curr->list.push_back(results);
- }
-}
-
-void WasmBinaryReader::visitBlock(Block* curr) {
- startControlFlow(curr);
- // special-case Block and de-recurse nested blocks in their first position, as
- // that is a common pattern that can be very highly nested.
- std::vector<Block*> stack;
- // Track start positions for all blocks except for the outermost block, which
- // is already handled in the caller.
- std::vector<size_t> startPosStack;
- size_t startPos = -1;
- while (1) {
- curr->type = getType();
- curr->name = getNextLabel();
- breakStack.push_back({curr->name, curr->type});
- stack.push_back(curr);
- if (startPos != size_t(-1)) {
- startPosStack.push_back(startPos);
- }
- if (more() && input[pos] == BinaryConsts::Block) {
- // a recursion
- startPos = pos;
- readNextDebugLocation();
- curr = allocator.alloc<Block>();
- startControlFlow(curr);
- pos++;
- if (debugLocation.size()) {
- requireFunctionContext("block-debugLocation");
- currFunction->debugLocations[curr] = *debugLocation.begin();
- }
- continue;
- } else {
- // end of recursion
- break;
- }
- }
- Block* last = nullptr;
- while (stack.size() > 0) {
- curr = stack.back();
- stack.pop_back();
- if (startPosStack.empty()) {
- startPos = -1;
- } else {
- startPos = startPosStack.back();
- startPosStack.pop_back();
- }
- // everything after this, that is left when we see the marker, is ours
- size_t start = expressionStack.size();
- if (last) {
- // the previous block is our first-position element
- pushExpression(last);
- }
- last = curr;
- processExpressions();
- size_t end = expressionStack.size();
- if (end < start) {
- throwError("block cannot pop from outside");
- }
- pushBlockElements(curr, curr->type, start);
- curr->finalize(curr->type,
- breakTargetNames.find(curr->name) != breakTargetNames.end()
- ? Block::HasBreak
- : Block::NoBreak);
- breakStack.pop_back();
- breakTargetNames.erase(curr->name);
-
- if (DWARF && currFunction && startPos != size_t(-1)) {
- currFunction->expressionLocations[curr] =
- BinaryLocations::Span{BinaryLocation(startPos - codeSectionLocation),
- BinaryLocation(pos - codeSectionLocation)};
- }
- }
-}
-
-// Gets a block of expressions. If it's just one, return that singleton.
-Expression* WasmBinaryReader::getBlockOrSingleton(Type type) {
- Name label = getNextLabel();
- breakStack.push_back({label, type});
- auto start = expressionStack.size();
-
- processExpressions();
- size_t end = expressionStack.size();
- if (end < start) {
- throwError("block cannot pop from outside");
- }
- breakStack.pop_back();
- auto* block = allocator.alloc<Block>();
- pushBlockElements(block, type, start);
- block->name = label;
- block->finalize(type);
- // maybe we don't need a block here?
- if (breakTargetNames.find(block->name) == breakTargetNames.end() &&
- exceptionTargetNames.find(block->name) == exceptionTargetNames.end()) {
- block->name = Name();
- if (block->list.size() == 1) {
- return block->list[0];
- }
- }
- breakTargetNames.erase(block->name);
- return block;
-}
-
-void WasmBinaryReader::visitIf(If* curr) {
- startControlFlow(curr);
- curr->type = getType();
- curr->condition = popNonVoidExpression();
- curr->ifTrue = getBlockOrSingleton(curr->type);
- if (lastSeparator == BinaryConsts::Else) {
- curr->ifFalse = getBlockOrSingleton(curr->type);
- }
- curr->finalize(curr->type);
- if (lastSeparator != BinaryConsts::End) {
- throwError("if should end with End");
- }
-}
-
-void WasmBinaryReader::visitLoop(Loop* curr) {
- startControlFlow(curr);
- curr->type = getType();
- curr->name = getNextLabel();
- breakStack.push_back({curr->name, Type::none});
- // find the expressions in the block, and create the body
- // a loop may have a list of instructions in wasm, much like
- // a block, but it only has a label at the top of the loop,
- // so even if we need a block (if there is more than 1
- // expression) we never need a label on the block.
- auto start = expressionStack.size();
- processExpressions();
- size_t end = expressionStack.size();
- if (start > end) {
- throwError("block cannot pop from outside");
- }
- if (end - start == 1) {
- curr->body = popExpression();
- } else {
- auto* block = allocator.alloc<Block>();
- pushBlockElements(block, curr->type, start);
- block->finalize(curr->type);
- curr->body = block;
- }
- breakStack.pop_back();
- breakTargetNames.erase(curr->name);
- curr->finalize(curr->type);
-}
-
-WasmBinaryReader::BreakTarget WasmBinaryReader::getBreakTarget(int32_t offset) {
- if (breakStack.size() < 1 + size_t(offset)) {
- throwError("bad breakindex (low)");
- }
- size_t index = breakStack.size() - 1 - offset;
- if (index >= breakStack.size()) {
- throwError("bad breakindex (high)");
- }
- auto& ret = breakStack[index];
- // if the break is in literally unreachable code, then we will not emit it
- // anyhow, so do not note that the target has breaks to it
- if (!willBeIgnored) {
- breakTargetNames.insert(ret.name);
- }
- return ret;
-}
-
-Name WasmBinaryReader::getExceptionTargetName(int32_t offset) {
- // We always start parsing a function by creating a block label and pushing it
- // in breakStack in getBlockOrSingleton, so if a 'delegate''s target is that
- // block, it does not mean it targets that block; it throws to the caller.
- if (breakStack.size() - 1 == size_t(offset)) {
- return DELEGATE_CALLER_TARGET;
- }
- size_t index = breakStack.size() - 1 - offset;
- if (index > breakStack.size()) {
- throwError("bad try index (high)");
- }
- auto& ret = breakStack[index];
- // if the delegate/rethrow is in literally unreachable code, then we will not
- // emit it anyhow, so do not note that the target has a reference to it
- if (!willBeIgnored) {
- exceptionTargetNames.insert(ret.name);
- }
- return ret.name;
-}
-
-void WasmBinaryReader::visitBreak(Break* curr, uint8_t code) {
- BreakTarget target = getBreakTarget(getU32LEB());
- curr->name = target.name;
- if (code == BinaryConsts::BrIf) {
- curr->condition = popNonVoidExpression();
- }
- if (target.type.isConcrete()) {
- curr->value = popTypedExpression(target.type);
- }
- curr->finalize();
-}
-
-void WasmBinaryReader::visitSwitch(Switch* curr) {
- curr->condition = popNonVoidExpression();
- auto numTargets = getU32LEB();
- for (size_t i = 0; i < numTargets; i++) {
- curr->targets.push_back(getBreakTarget(getU32LEB()).name);
- }
- auto defaultTarget = getBreakTarget(getU32LEB());
- curr->default_ = defaultTarget.name;
- if (defaultTarget.type.isConcrete()) {
- curr->value = popTypedExpression(defaultTarget.type);
- }
- curr->finalize();
-}
-
-void WasmBinaryReader::visitCall(Call* curr) {
- auto index = getU32LEB();
- auto sig = getSignatureByFunctionIndex(index);
- auto num = sig.params.size();
- curr->operands.resize(num);
- for (size_t i = 0; i < num; i++) {
- curr->operands[num - i - 1] = popNonVoidExpression();
- }
- curr->type = sig.results;
- curr->target = getFunctionName(index);
- curr->finalize();
-}
-
-void WasmBinaryReader::visitCallIndirect(CallIndirect* curr) {
- auto index = getU32LEB();
- curr->heapType = getTypeByIndex(index);
- Index tableIdx = getU32LEB();
- // TODO: Handle error cases where `heapType` is not a signature?
- auto num = curr->heapType.getSignature().params.size();
- curr->operands.resize(num);
- curr->target = popNonVoidExpression();
- for (size_t i = 0; i < num; i++) {
- curr->operands[num - i - 1] = popNonVoidExpression();
- }
- curr->table = getTableName(tableIdx);
- curr->finalize();
-}
-
-void WasmBinaryReader::visitLocalGet(LocalGet* curr) {
- requireFunctionContext("local.get");
- curr->index = getU32LEB();
- if (curr->index >= currFunction->getNumLocals()) {
- throwError("bad local.get index");
- }
- curr->type = currFunction->getLocalType(curr->index);
- curr->finalize();
-}
-
-void WasmBinaryReader::visitLocalSet(LocalSet* curr, uint8_t code) {
- requireFunctionContext("local.set outside of function");
- curr->index = getU32LEB();
- if (curr->index >= currFunction->getNumLocals()) {
- throwError("bad local.set index");
- }
- curr->value = popNonVoidExpression();
- if (code == BinaryConsts::LocalTee) {
- curr->makeTee(currFunction->getLocalType(curr->index));
- } else {
- curr->makeSet();
- }
- curr->finalize();
-}
-
-void WasmBinaryReader::visitGlobalGet(GlobalGet* curr) {
- auto index = getU32LEB();
- if (index >= wasm.globals.size()) {
- throwError("invalid global index");
- }
- auto* global = wasm.globals[index].get();
- curr->name = global->name;
- curr->type = global->type;
-}
-
-void WasmBinaryReader::visitGlobalSet(GlobalSet* curr) {
- auto index = getU32LEB();
- if (index >= wasm.globals.size()) {
- throwError("invalid global index");
- }
- curr->name = wasm.globals[index]->name;
- curr->value = popNonVoidExpression();
- curr->finalize();
-}
-
Index WasmBinaryReader::readMemoryAccess(Address& alignment, Address& offset) {
auto rawAlignment = getU32LEB();
bool hasMemIdx = false;
@@ -4756,3267 +5185,11 @@ Index WasmBinaryReader::readMemoryAccess(Address& alignment, Address& offset) {
return memIdx;
}
-bool WasmBinaryReader::maybeVisitLoad(
- Expression*& out,
- uint8_t code,
- std::optional<BinaryConsts::ASTNodes> prefix) {
- Load* curr;
- auto allocate = [&]() { curr = allocator.alloc<Load>(); };
- if (!prefix) {
- switch (code) {
- case BinaryConsts::I32LoadMem8S:
- allocate();
- curr->bytes = 1;
- curr->type = Type::i32;
- curr->signed_ = true;
- break;
- case BinaryConsts::I32LoadMem8U:
- allocate();
- curr->bytes = 1;
- curr->type = Type::i32;
- break;
- case BinaryConsts::I32LoadMem16S:
- allocate();
- curr->bytes = 2;
- curr->type = Type::i32;
- curr->signed_ = true;
- break;
- case BinaryConsts::I32LoadMem16U:
- allocate();
- curr->bytes = 2;
- curr->type = Type::i32;
- break;
- case BinaryConsts::I32LoadMem:
- allocate();
- curr->bytes = 4;
- curr->type = Type::i32;
- break;
- case BinaryConsts::I64LoadMem8S:
- allocate();
- curr->bytes = 1;
- curr->type = Type::i64;
- curr->signed_ = true;
- break;
- case BinaryConsts::I64LoadMem8U:
- allocate();
- curr->bytes = 1;
- curr->type = Type::i64;
- break;
- case BinaryConsts::I64LoadMem16S:
- allocate();
- curr->bytes = 2;
- curr->type = Type::i64;
- curr->signed_ = true;
- break;
- case BinaryConsts::I64LoadMem16U:
- allocate();
- curr->bytes = 2;
- curr->type = Type::i64;
- break;
- case BinaryConsts::I64LoadMem32S:
- allocate();
- curr->bytes = 4;
- curr->type = Type::i64;
- curr->signed_ = true;
- break;
- case BinaryConsts::I64LoadMem32U:
- allocate();
- curr->bytes = 4;
- curr->type = Type::i64;
- break;
- case BinaryConsts::I64LoadMem:
- allocate();
- curr->bytes = 8;
- curr->type = Type::i64;
- break;
- case BinaryConsts::F32LoadMem:
- allocate();
- curr->bytes = 4;
- curr->type = Type::f32;
- break;
- case BinaryConsts::F64LoadMem:
- allocate();
- curr->bytes = 8;
- curr->type = Type::f64;
- break;
- default:
- return false;
- }
- } else if (prefix == BinaryConsts::AtomicPrefix) {
- switch (code) {
- case BinaryConsts::I32AtomicLoad8U:
- allocate();
- curr->bytes = 1;
- curr->type = Type::i32;
- break;
- case BinaryConsts::I32AtomicLoad16U:
- allocate();
- curr->bytes = 2;
- curr->type = Type::i32;
- break;
- case BinaryConsts::I32AtomicLoad:
- allocate();
- curr->bytes = 4;
- curr->type = Type::i32;
- break;
- case BinaryConsts::I64AtomicLoad8U:
- allocate();
- curr->bytes = 1;
- curr->type = Type::i64;
- break;
- case BinaryConsts::I64AtomicLoad16U:
- allocate();
- curr->bytes = 2;
- curr->type = Type::i64;
- break;
- case BinaryConsts::I64AtomicLoad32U:
- allocate();
- curr->bytes = 4;
- curr->type = Type::i64;
- break;
- case BinaryConsts::I64AtomicLoad:
- allocate();
- curr->bytes = 8;
- curr->type = Type::i64;
- break;
- default:
- return false;
- }
- } else if (prefix == BinaryConsts::MiscPrefix) {
- switch (code) {
- case BinaryConsts::F32_F16LoadMem:
- allocate();
- curr->bytes = 2;
- curr->type = Type::f32;
- break;
- default:
- return false;
- }
- } else {
- return false;
- }
-
- curr->isAtomic = prefix == BinaryConsts::AtomicPrefix;
- Index memIdx = readMemoryAccess(curr->align, curr->offset);
- curr->memory = getMemoryName(memIdx);
- curr->ptr = popNonVoidExpression();
- curr->finalize();
- out = curr;
- return true;
-}
-
-bool WasmBinaryReader::maybeVisitStore(
- Expression*& out,
- uint8_t code,
- std::optional<BinaryConsts::ASTNodes> prefix) {
- Store* curr;
- if (!prefix) {
- switch (code) {
- case BinaryConsts::I32StoreMem8:
- curr = allocator.alloc<Store>();
- curr->bytes = 1;
- curr->valueType = Type::i32;
- break;
- case BinaryConsts::I32StoreMem16:
- curr = allocator.alloc<Store>();
- curr->bytes = 2;
- curr->valueType = Type::i32;
- break;
- case BinaryConsts::I32StoreMem:
- curr = allocator.alloc<Store>();
- curr->bytes = 4;
- curr->valueType = Type::i32;
- break;
- case BinaryConsts::I64StoreMem8:
- curr = allocator.alloc<Store>();
- curr->bytes = 1;
- curr->valueType = Type::i64;
- break;
- case BinaryConsts::I64StoreMem16:
- curr = allocator.alloc<Store>();
- curr->bytes = 2;
- curr->valueType = Type::i64;
- break;
- case BinaryConsts::I64StoreMem32:
- curr = allocator.alloc<Store>();
- curr->bytes = 4;
- curr->valueType = Type::i64;
- break;
- case BinaryConsts::I64StoreMem:
- curr = allocator.alloc<Store>();
- curr->bytes = 8;
- curr->valueType = Type::i64;
- break;
- case BinaryConsts::F32StoreMem:
- curr = allocator.alloc<Store>();
- curr->bytes = 4;
- curr->valueType = Type::f32;
- break;
- case BinaryConsts::F64StoreMem:
- curr = allocator.alloc<Store>();
- curr->bytes = 8;
- curr->valueType = Type::f64;
- break;
- default:
- return false;
- }
- } else if (prefix == BinaryConsts::AtomicPrefix) {
- switch (code) {
- case BinaryConsts::I32AtomicStore8:
- curr = allocator.alloc<Store>();
- curr->bytes = 1;
- curr->valueType = Type::i32;
- break;
- case BinaryConsts::I32AtomicStore16:
- curr = allocator.alloc<Store>();
- curr->bytes = 2;
- curr->valueType = Type::i32;
- break;
- case BinaryConsts::I32AtomicStore:
- curr = allocator.alloc<Store>();
- curr->bytes = 4;
- curr->valueType = Type::i32;
- break;
- case BinaryConsts::I64AtomicStore8:
- curr = allocator.alloc<Store>();
- curr->bytes = 1;
- curr->valueType = Type::i64;
- break;
- case BinaryConsts::I64AtomicStore16:
- curr = allocator.alloc<Store>();
- curr->bytes = 2;
- curr->valueType = Type::i64;
- break;
- case BinaryConsts::I64AtomicStore32:
- curr = allocator.alloc<Store>();
- curr->bytes = 4;
- curr->valueType = Type::i64;
- break;
- case BinaryConsts::I64AtomicStore:
- curr = allocator.alloc<Store>();
- curr->bytes = 8;
- curr->valueType = Type::i64;
- break;
- default:
- return false;
- }
- } else if (prefix == BinaryConsts::MiscPrefix) {
- switch (code) {
- case BinaryConsts::F32_F16StoreMem:
- curr = allocator.alloc<Store>();
- curr->bytes = 2;
- curr->valueType = Type::f32;
- break;
- default:
- return false;
- }
- } else {
- return false;
- }
-
- curr->isAtomic = prefix == BinaryConsts::AtomicPrefix;
- Index memIdx = readMemoryAccess(curr->align, curr->offset);
- curr->memory = getMemoryName(memIdx);
- curr->value = popNonVoidExpression();
- curr->ptr = popNonVoidExpression();
- curr->finalize();
- out = curr;
- return true;
-}
-
-bool WasmBinaryReader::maybeVisitAtomicRMW(Expression*& out, uint8_t code) {
- if (code < BinaryConsts::AtomicRMWOps_Begin ||
- code > BinaryConsts::AtomicRMWOps_End) {
- return false;
- }
- auto* curr = allocator.alloc<AtomicRMW>();
-
- // Set curr to the given opcode, type and size.
-#define SET(opcode, optype, size) \
- curr->op = RMW##opcode; \
- curr->type = optype; \
- curr->bytes = size
-
- // Handle the cases for all the valid types for a particular opcode
-#define SET_FOR_OP(Op) \
- case BinaryConsts::I32AtomicRMW##Op: \
- SET(Op, Type::i32, 4); \
- break; \
- case BinaryConsts::I32AtomicRMW##Op##8U: \
- SET(Op, Type::i32, 1); \
- break; \
- case BinaryConsts::I32AtomicRMW##Op##16U: \
- SET(Op, Type::i32, 2); \
- break; \
- case BinaryConsts::I64AtomicRMW##Op: \
- SET(Op, Type::i64, 8); \
- break; \
- case BinaryConsts::I64AtomicRMW##Op##8U: \
- SET(Op, Type::i64, 1); \
- break; \
- case BinaryConsts::I64AtomicRMW##Op##16U: \
- SET(Op, Type::i64, 2); \
- break; \
- case BinaryConsts::I64AtomicRMW##Op##32U: \
- SET(Op, Type::i64, 4); \
- break;
-
- switch (code) {
- SET_FOR_OP(Add);
- SET_FOR_OP(Sub);
- SET_FOR_OP(And);
- SET_FOR_OP(Or);
- SET_FOR_OP(Xor);
- SET_FOR_OP(Xchg);
- default:
- WASM_UNREACHABLE("unexpected opcode");
- }
-#undef SET_FOR_OP
-#undef SET
-
- Address readAlign;
- Index memIdx = readMemoryAccess(readAlign, curr->offset);
- curr->memory = getMemoryName(memIdx);
- if (readAlign != curr->bytes) {
- throwError("Align of AtomicRMW must match size");
- }
- curr->value = popNonVoidExpression();
- curr->ptr = popNonVoidExpression();
- curr->finalize();
- out = curr;
- return true;
-}
-
-bool WasmBinaryReader::maybeVisitAtomicCmpxchg(Expression*& out, uint8_t code) {
- if (code < BinaryConsts::AtomicCmpxchgOps_Begin ||
- code > BinaryConsts::AtomicCmpxchgOps_End) {
- return false;
- }
- auto* curr = allocator.alloc<AtomicCmpxchg>();
-
- // Set curr to the given type and size.
-#define SET(optype, size) \
- curr->type = optype; \
- curr->bytes = size
-
- switch (code) {
- case BinaryConsts::I32AtomicCmpxchg:
- SET(Type::i32, 4);
- break;
- case BinaryConsts::I64AtomicCmpxchg:
- SET(Type::i64, 8);
- break;
- case BinaryConsts::I32AtomicCmpxchg8U:
- SET(Type::i32, 1);
- break;
- case BinaryConsts::I32AtomicCmpxchg16U:
- SET(Type::i32, 2);
- break;
- case BinaryConsts::I64AtomicCmpxchg8U:
- SET(Type::i64, 1);
- break;
- case BinaryConsts::I64AtomicCmpxchg16U:
- SET(Type::i64, 2);
- break;
- case BinaryConsts::I64AtomicCmpxchg32U:
- SET(Type::i64, 4);
- break;
- default:
- WASM_UNREACHABLE("unexpected opcode");
- }
-
- Address readAlign;
- Index memIdx = readMemoryAccess(readAlign, curr->offset);
- curr->memory = getMemoryName(memIdx);
- if (readAlign != curr->bytes) {
- throwError("Align of AtomicCpxchg must match size");
- }
- curr->replacement = popNonVoidExpression();
- curr->expected = popNonVoidExpression();
- curr->ptr = popNonVoidExpression();
- curr->finalize();
- out = curr;
- return true;
-}
-
-bool WasmBinaryReader::maybeVisitAtomicWait(Expression*& out, uint8_t code) {
- if (code < BinaryConsts::I32AtomicWait ||
- code > BinaryConsts::I64AtomicWait) {
- return false;
- }
- auto* curr = allocator.alloc<AtomicWait>();
-
- switch (code) {
- case BinaryConsts::I32AtomicWait:
- curr->expectedType = Type::i32;
- break;
- case BinaryConsts::I64AtomicWait:
- curr->expectedType = Type::i64;
- break;
- default:
- WASM_UNREACHABLE("unexpected opcode");
- }
- curr->type = Type::i32;
- curr->timeout = popNonVoidExpression();
- curr->expected = popNonVoidExpression();
- curr->ptr = popNonVoidExpression();
- Address readAlign;
- Index memIdx = readMemoryAccess(readAlign, curr->offset);
- curr->memory = getMemoryName(memIdx);
- if (readAlign != curr->expectedType.getByteSize()) {
- throwError("Align of AtomicWait must match size");
- }
- curr->finalize();
- out = curr;
- return true;
-}
-
-bool WasmBinaryReader::maybeVisitAtomicNotify(Expression*& out, uint8_t code) {
- if (code != BinaryConsts::AtomicNotify) {
- return false;
- }
- auto* curr = allocator.alloc<AtomicNotify>();
-
- curr->type = Type::i32;
- curr->notifyCount = popNonVoidExpression();
- curr->ptr = popNonVoidExpression();
- Address readAlign;
- Index memIdx = readMemoryAccess(readAlign, curr->offset);
- curr->memory = getMemoryName(memIdx);
- if (readAlign != curr->type.getByteSize()) {
- throwError("Align of AtomicNotify must match size");
- }
- curr->finalize();
- out = curr;
- return true;
-}
-
-bool WasmBinaryReader::maybeVisitAtomicFence(Expression*& out, uint8_t code) {
- if (code != BinaryConsts::AtomicFence) {
- return false;
- }
- auto* curr = allocator.alloc<AtomicFence>();
- curr->order = getU32LEB();
- curr->finalize();
- out = curr;
- return true;
-}
-
-bool WasmBinaryReader::maybeVisitConst(Expression*& out, uint8_t code) {
- Const* curr;
- switch (code) {
- case BinaryConsts::I32Const:
- curr = allocator.alloc<Const>();
- curr->value = Literal(getS32LEB());
- break;
- case BinaryConsts::I64Const:
- curr = allocator.alloc<Const>();
- curr->value = Literal(getS64LEB());
- break;
- case BinaryConsts::F32Const:
- curr = allocator.alloc<Const>();
- curr->value = getFloat32Literal();
- break;
- case BinaryConsts::F64Const:
- curr = allocator.alloc<Const>();
- curr->value = getFloat64Literal();
- break;
- default:
- return false;
- }
- curr->type = curr->value.type;
- out = curr;
-
- return true;
-}
-
-bool WasmBinaryReader::maybeVisitUnary(Expression*& out, uint8_t code) {
- Unary* curr;
- switch (code) {
- case BinaryConsts::I32Clz:
- curr = allocator.alloc<Unary>();
- curr->op = ClzInt32;
- break;
- case BinaryConsts::I64Clz:
- curr = allocator.alloc<Unary>();
- curr->op = ClzInt64;
- break;
- case BinaryConsts::I32Ctz:
- curr = allocator.alloc<Unary>();
- curr->op = CtzInt32;
- break;
- case BinaryConsts::I64Ctz:
- curr = allocator.alloc<Unary>();
- curr->op = CtzInt64;
- break;
- case BinaryConsts::I32Popcnt:
- curr = allocator.alloc<Unary>();
- curr->op = PopcntInt32;
- break;
- case BinaryConsts::I64Popcnt:
- curr = allocator.alloc<Unary>();
- curr->op = PopcntInt64;
- break;
- case BinaryConsts::I32EqZ:
- curr = allocator.alloc<Unary>();
- curr->op = EqZInt32;
- break;
- case BinaryConsts::I64EqZ:
- curr = allocator.alloc<Unary>();
- curr->op = EqZInt64;
- break;
- case BinaryConsts::F32Neg:
- curr = allocator.alloc<Unary>();
- curr->op = NegFloat32;
- break;
- case BinaryConsts::F64Neg:
- curr = allocator.alloc<Unary>();
- curr->op = NegFloat64;
- break;
- case BinaryConsts::F32Abs:
- curr = allocator.alloc<Unary>();
- curr->op = AbsFloat32;
- break;
- case BinaryConsts::F64Abs:
- curr = allocator.alloc<Unary>();
- curr->op = AbsFloat64;
- break;
- case BinaryConsts::F32Ceil:
- curr = allocator.alloc<Unary>();
- curr->op = CeilFloat32;
- break;
- case BinaryConsts::F64Ceil:
- curr = allocator.alloc<Unary>();
- curr->op = CeilFloat64;
- break;
- case BinaryConsts::F32Floor:
- curr = allocator.alloc<Unary>();
- curr->op = FloorFloat32;
- break;
- case BinaryConsts::F64Floor:
- curr = allocator.alloc<Unary>();
- curr->op = FloorFloat64;
- break;
- case BinaryConsts::F32NearestInt:
- curr = allocator.alloc<Unary>();
- curr->op = NearestFloat32;
- break;
- case BinaryConsts::F64NearestInt:
- curr = allocator.alloc<Unary>();
- curr->op = NearestFloat64;
- break;
- case BinaryConsts::F32Sqrt:
- curr = allocator.alloc<Unary>();
- curr->op = SqrtFloat32;
- break;
- case BinaryConsts::F64Sqrt:
- curr = allocator.alloc<Unary>();
- curr->op = SqrtFloat64;
- break;
- case BinaryConsts::F32UConvertI32:
- curr = allocator.alloc<Unary>();
- curr->op = ConvertUInt32ToFloat32;
- break;
- case BinaryConsts::F64UConvertI32:
- curr = allocator.alloc<Unary>();
- curr->op = ConvertUInt32ToFloat64;
- break;
- case BinaryConsts::F32SConvertI32:
- curr = allocator.alloc<Unary>();
- curr->op = ConvertSInt32ToFloat32;
- break;
- case BinaryConsts::F64SConvertI32:
- curr = allocator.alloc<Unary>();
- curr->op = ConvertSInt32ToFloat64;
- break;
- case BinaryConsts::F32UConvertI64:
- curr = allocator.alloc<Unary>();
- curr->op = ConvertUInt64ToFloat32;
- break;
- case BinaryConsts::F64UConvertI64:
- curr = allocator.alloc<Unary>();
- curr->op = ConvertUInt64ToFloat64;
- break;
- case BinaryConsts::F32SConvertI64:
- curr = allocator.alloc<Unary>();
- curr->op = ConvertSInt64ToFloat32;
- break;
- case BinaryConsts::F64SConvertI64:
- curr = allocator.alloc<Unary>();
- curr->op = ConvertSInt64ToFloat64;
- break;
-
- case BinaryConsts::I64SExtendI32:
- curr = allocator.alloc<Unary>();
- curr->op = ExtendSInt32;
- break;
- case BinaryConsts::I64UExtendI32:
- curr = allocator.alloc<Unary>();
- curr->op = ExtendUInt32;
- break;
- case BinaryConsts::I32WrapI64:
- curr = allocator.alloc<Unary>();
- curr->op = WrapInt64;
- break;
-
- case BinaryConsts::I32UTruncF32:
- curr = allocator.alloc<Unary>();
- curr->op = TruncUFloat32ToInt32;
- break;
- case BinaryConsts::I32UTruncF64:
- curr = allocator.alloc<Unary>();
- curr->op = TruncUFloat64ToInt32;
- break;
- case BinaryConsts::I32STruncF32:
- curr = allocator.alloc<Unary>();
- curr->op = TruncSFloat32ToInt32;
- break;
- case BinaryConsts::I32STruncF64:
- curr = allocator.alloc<Unary>();
- curr->op = TruncSFloat64ToInt32;
- break;
- case BinaryConsts::I64UTruncF32:
- curr = allocator.alloc<Unary>();
- curr->op = TruncUFloat32ToInt64;
- break;
- case BinaryConsts::I64UTruncF64:
- curr = allocator.alloc<Unary>();
- curr->op = TruncUFloat64ToInt64;
- break;
- case BinaryConsts::I64STruncF32:
- curr = allocator.alloc<Unary>();
- curr->op = TruncSFloat32ToInt64;
- break;
- case BinaryConsts::I64STruncF64:
- curr = allocator.alloc<Unary>();
- curr->op = TruncSFloat64ToInt64;
- break;
-
- case BinaryConsts::F32Trunc:
- curr = allocator.alloc<Unary>();
- curr->op = TruncFloat32;
- break;
- case BinaryConsts::F64Trunc:
- curr = allocator.alloc<Unary>();
- curr->op = TruncFloat64;
- break;
-
- case BinaryConsts::F32DemoteI64:
- curr = allocator.alloc<Unary>();
- curr->op = DemoteFloat64;
- break;
- case BinaryConsts::F64PromoteF32:
- curr = allocator.alloc<Unary>();
- curr->op = PromoteFloat32;
- break;
- case BinaryConsts::I32ReinterpretF32:
- curr = allocator.alloc<Unary>();
- curr->op = ReinterpretFloat32;
- break;
- case BinaryConsts::I64ReinterpretF64:
- curr = allocator.alloc<Unary>();
- curr->op = ReinterpretFloat64;
- break;
- case BinaryConsts::F32ReinterpretI32:
- curr = allocator.alloc<Unary>();
- curr->op = ReinterpretInt32;
- break;
- case BinaryConsts::F64ReinterpretI64:
- curr = allocator.alloc<Unary>();
- curr->op = ReinterpretInt64;
- break;
-
- case BinaryConsts::I32ExtendS8:
- curr = allocator.alloc<Unary>();
- curr->op = ExtendS8Int32;
- break;
- case BinaryConsts::I32ExtendS16:
- curr = allocator.alloc<Unary>();
- curr->op = ExtendS16Int32;
- break;
- case BinaryConsts::I64ExtendS8:
- curr = allocator.alloc<Unary>();
- curr->op = ExtendS8Int64;
- break;
- case BinaryConsts::I64ExtendS16:
- curr = allocator.alloc<Unary>();
- curr->op = ExtendS16Int64;
- break;
- case BinaryConsts::I64ExtendS32:
- curr = allocator.alloc<Unary>();
- curr->op = ExtendS32Int64;
- break;
-
- default:
- return false;
- }
- curr->value = popNonVoidExpression();
- curr->finalize();
- out = curr;
- return true;
-}
-
-bool WasmBinaryReader::maybeVisitTruncSat(Expression*& out, uint32_t code) {
- Unary* curr;
- switch (code) {
- case BinaryConsts::I32STruncSatF32:
- curr = allocator.alloc<Unary>();
- curr->op = TruncSatSFloat32ToInt32;
- break;
- case BinaryConsts::I32UTruncSatF32:
- curr = allocator.alloc<Unary>();
- curr->op = TruncSatUFloat32ToInt32;
- break;
- case BinaryConsts::I32STruncSatF64:
- curr = allocator.alloc<Unary>();
- curr->op = TruncSatSFloat64ToInt32;
- break;
- case BinaryConsts::I32UTruncSatF64:
- curr = allocator.alloc<Unary>();
- curr->op = TruncSatUFloat64ToInt32;
- break;
- case BinaryConsts::I64STruncSatF32:
- curr = allocator.alloc<Unary>();
- curr->op = TruncSatSFloat32ToInt64;
- break;
- case BinaryConsts::I64UTruncSatF32:
- curr = allocator.alloc<Unary>();
- curr->op = TruncSatUFloat32ToInt64;
- break;
- case BinaryConsts::I64STruncSatF64:
- curr = allocator.alloc<Unary>();
- curr->op = TruncSatSFloat64ToInt64;
- break;
- case BinaryConsts::I64UTruncSatF64:
- curr = allocator.alloc<Unary>();
- curr->op = TruncSatUFloat64ToInt64;
- break;
- default:
- return false;
- }
- curr->value = popNonVoidExpression();
- curr->finalize();
- out = curr;
- return true;
-}
-
-bool WasmBinaryReader::maybeVisitMemoryInit(Expression*& out, uint32_t code) {
- if (code != BinaryConsts::MemoryInit) {
- return false;
- }
- auto* curr = allocator.alloc<MemoryInit>();
- curr->size = popNonVoidExpression();
- curr->offset = popNonVoidExpression();
- curr->dest = popNonVoidExpression();
- Index segIdx = getU32LEB();
- curr->segment = getDataName(segIdx);
- Index memIdx = getU32LEB();
- curr->memory = getMemoryName(memIdx);
- curr->finalize();
- out = curr;
- return true;
-}
-
-bool WasmBinaryReader::maybeVisitDataDrop(Expression*& out, uint32_t code) {
- if (code != BinaryConsts::DataDrop) {
- return false;
- }
- auto* curr = allocator.alloc<DataDrop>();
- Index segIdx = getU32LEB();
- curr->segment = getDataName(segIdx);
- curr->finalize();
- out = curr;
- return true;
-}
-
-bool WasmBinaryReader::maybeVisitMemoryCopy(Expression*& out, uint32_t code) {
- if (code != BinaryConsts::MemoryCopy) {
- return false;
- }
- auto* curr = allocator.alloc<MemoryCopy>();
- curr->size = popNonVoidExpression();
- curr->source = popNonVoidExpression();
- curr->dest = popNonVoidExpression();
- Index destIdx = getU32LEB();
- Index sourceIdx = getU32LEB();
- curr->finalize();
- curr->destMemory = getMemoryName(destIdx);
- curr->sourceMemory = getMemoryName(sourceIdx);
- out = curr;
- return true;
-}
-
-bool WasmBinaryReader::maybeVisitMemoryFill(Expression*& out, uint32_t code) {
- if (code != BinaryConsts::MemoryFill) {
- return false;
- }
- auto* curr = allocator.alloc<MemoryFill>();
- curr->size = popNonVoidExpression();
- curr->value = popNonVoidExpression();
- curr->dest = popNonVoidExpression();
- Index memIdx = getU32LEB();
- curr->finalize();
- curr->memory = getMemoryName(memIdx);
- out = curr;
- return true;
-}
-
-bool WasmBinaryReader::maybeVisitTableSize(Expression*& out, uint32_t code) {
- if (code != BinaryConsts::TableSize) {
- return false;
- }
- Index tableIdx = getU32LEB();
- if (tableIdx >= wasm.tables.size()) {
- throwError("bad table index");
- }
- auto* curr = allocator.alloc<TableSize>();
- if (getTable(tableIdx)->is64()) {
- curr->type = Type::i64;
- }
- curr->table = getTableName(tableIdx);
- curr->finalize();
- out = curr;
- return true;
-}
-
-bool WasmBinaryReader::maybeVisitTableGrow(Expression*& out, uint32_t code) {
- if (code != BinaryConsts::TableGrow) {
- return false;
- }
- Index tableIdx = getU32LEB();
- if (tableIdx >= wasm.tables.size()) {
- throwError("bad table index");
- }
- auto* curr = allocator.alloc<TableGrow>();
- curr->delta = popNonVoidExpression();
- curr->value = popNonVoidExpression();
- if (getTable(tableIdx)->is64()) {
- curr->type = Type::i64;
- }
- curr->table = getTableName(tableIdx);
- curr->finalize();
- out = curr;
- return true;
-}
-
-bool WasmBinaryReader::maybeVisitTableFill(Expression*& out, uint32_t code) {
- if (code != BinaryConsts::TableFill) {
- return false;
- }
- Index tableIdx = getU32LEB();
- if (tableIdx >= wasm.tables.size()) {
- throwError("bad table index");
- }
- auto* size = popNonVoidExpression();
- auto* value = popNonVoidExpression();
- auto* dest = popNonVoidExpression();
- auto* ret = Builder(wasm).makeTableFill(Name(), dest, value, size);
- ret->table = getTableName(tableIdx);
- out = ret;
- return true;
-}
-
-bool WasmBinaryReader::maybeVisitTableCopy(Expression*& out, uint32_t code) {
- if (code != BinaryConsts::TableCopy) {
- return false;
- }
- Index destTableIdx = getU32LEB();
- if (destTableIdx >= wasm.tables.size()) {
- throwError("bad table index");
- }
- Index sourceTableIdx = getU32LEB();
- if (sourceTableIdx >= wasm.tables.size()) {
- throwError("bad table index");
- }
- auto* size = popNonVoidExpression();
- auto* source = popNonVoidExpression();
- auto* dest = popNonVoidExpression();
- auto* ret = Builder(wasm).makeTableCopy(dest, source, size, Name(), Name());
- ret->destTable = getTableName(destTableIdx);
- ret->sourceTable = getTableName(sourceTableIdx);
- out = ret;
- return true;
-}
-
-bool WasmBinaryReader::maybeVisitTableInit(Expression*& out, uint32_t code) {
- if (code != BinaryConsts::TableInit) {
- return false;
- }
- auto* curr = allocator.alloc<TableInit>();
- curr->size = popNonVoidExpression();
- curr->offset = popNonVoidExpression();
- curr->dest = popNonVoidExpression();
- Index segIdx = getU32LEB();
- curr->segment = getElemName(segIdx);
- Index tableIdx = getU32LEB();
- curr->table = getTableName(tableIdx);
- curr->finalize();
- out = curr;
- return true;
-}
-
-bool WasmBinaryReader::maybeVisitBinary(Expression*& out, uint8_t code) {
- Binary* curr;
-#define INT_TYPED_CODE(code) \
- { \
- case BinaryConsts::I32##code: \
- curr = allocator.alloc<Binary>(); \
- curr->op = code##Int32; \
- break; \
- case BinaryConsts::I64##code: \
- curr = allocator.alloc<Binary>(); \
- curr->op = code##Int64; \
- break; \
- }
-#define FLOAT_TYPED_CODE(code) \
- { \
- case BinaryConsts::F32##code: \
- curr = allocator.alloc<Binary>(); \
- curr->op = code##Float32; \
- break; \
- case BinaryConsts::F64##code: \
- curr = allocator.alloc<Binary>(); \
- curr->op = code##Float64; \
- break; \
- }
-#define TYPED_CODE(code) \
- { \
- INT_TYPED_CODE(code) \
- FLOAT_TYPED_CODE(code) \
- }
-
- switch (code) {
- TYPED_CODE(Add);
- TYPED_CODE(Sub);
- TYPED_CODE(Mul);
- INT_TYPED_CODE(DivS);
- INT_TYPED_CODE(DivU);
- INT_TYPED_CODE(RemS);
- INT_TYPED_CODE(RemU);
- INT_TYPED_CODE(And);
- INT_TYPED_CODE(Or);
- INT_TYPED_CODE(Xor);
- INT_TYPED_CODE(Shl);
- INT_TYPED_CODE(ShrU);
- INT_TYPED_CODE(ShrS);
- INT_TYPED_CODE(RotL);
- INT_TYPED_CODE(RotR);
- FLOAT_TYPED_CODE(Div);
- FLOAT_TYPED_CODE(CopySign);
- FLOAT_TYPED_CODE(Min);
- FLOAT_TYPED_CODE(Max);
- TYPED_CODE(Eq);
- TYPED_CODE(Ne);
- INT_TYPED_CODE(LtS);
- INT_TYPED_CODE(LtU);
- INT_TYPED_CODE(LeS);
- INT_TYPED_CODE(LeU);
- INT_TYPED_CODE(GtS);
- INT_TYPED_CODE(GtU);
- INT_TYPED_CODE(GeS);
- INT_TYPED_CODE(GeU);
- FLOAT_TYPED_CODE(Lt);
- FLOAT_TYPED_CODE(Le);
- FLOAT_TYPED_CODE(Gt);
- FLOAT_TYPED_CODE(Ge);
- default:
- return false;
- }
- curr->right = popNonVoidExpression();
- curr->left = popNonVoidExpression();
- curr->finalize();
- out = curr;
- return true;
-#undef TYPED_CODE
-#undef INT_TYPED_CODE
-#undef FLOAT_TYPED_CODE
-}
-
-bool WasmBinaryReader::maybeVisitSIMDBinary(Expression*& out, uint32_t code) {
- Binary* curr;
- switch (code) {
- case BinaryConsts::I8x16Eq:
- curr = allocator.alloc<Binary>();
- curr->op = EqVecI8x16;
- break;
- case BinaryConsts::I8x16Ne:
- curr = allocator.alloc<Binary>();
- curr->op = NeVecI8x16;
- break;
- case BinaryConsts::I8x16LtS:
- curr = allocator.alloc<Binary>();
- curr->op = LtSVecI8x16;
- break;
- case BinaryConsts::I8x16LtU:
- curr = allocator.alloc<Binary>();
- curr->op = LtUVecI8x16;
- break;
- case BinaryConsts::I8x16GtS:
- curr = allocator.alloc<Binary>();
- curr->op = GtSVecI8x16;
- break;
- case BinaryConsts::I8x16GtU:
- curr = allocator.alloc<Binary>();
- curr->op = GtUVecI8x16;
- break;
- case BinaryConsts::I8x16LeS:
- curr = allocator.alloc<Binary>();
- curr->op = LeSVecI8x16;
- break;
- case BinaryConsts::I8x16LeU:
- curr = allocator.alloc<Binary>();
- curr->op = LeUVecI8x16;
- break;
- case BinaryConsts::I8x16GeS:
- curr = allocator.alloc<Binary>();
- curr->op = GeSVecI8x16;
- break;
- case BinaryConsts::I8x16GeU:
- curr = allocator.alloc<Binary>();
- curr->op = GeUVecI8x16;
- break;
- case BinaryConsts::I16x8Eq:
- curr = allocator.alloc<Binary>();
- curr->op = EqVecI16x8;
- break;
- case BinaryConsts::I16x8Ne:
- curr = allocator.alloc<Binary>();
- curr->op = NeVecI16x8;
- break;
- case BinaryConsts::I16x8LtS:
- curr = allocator.alloc<Binary>();
- curr->op = LtSVecI16x8;
- break;
- case BinaryConsts::I16x8LtU:
- curr = allocator.alloc<Binary>();
- curr->op = LtUVecI16x8;
- break;
- case BinaryConsts::I16x8GtS:
- curr = allocator.alloc<Binary>();
- curr->op = GtSVecI16x8;
- break;
- case BinaryConsts::I16x8GtU:
- curr = allocator.alloc<Binary>();
- curr->op = GtUVecI16x8;
- break;
- case BinaryConsts::I16x8LeS:
- curr = allocator.alloc<Binary>();
- curr->op = LeSVecI16x8;
- break;
- case BinaryConsts::I16x8LeU:
- curr = allocator.alloc<Binary>();
- curr->op = LeUVecI16x8;
- break;
- case BinaryConsts::I16x8GeS:
- curr = allocator.alloc<Binary>();
- curr->op = GeSVecI16x8;
- break;
- case BinaryConsts::I16x8GeU:
- curr = allocator.alloc<Binary>();
- curr->op = GeUVecI16x8;
- break;
- case BinaryConsts::I32x4Eq:
- curr = allocator.alloc<Binary>();
- curr->op = EqVecI32x4;
- break;
- case BinaryConsts::I32x4Ne:
- curr = allocator.alloc<Binary>();
- curr->op = NeVecI32x4;
- break;
- case BinaryConsts::I32x4LtS:
- curr = allocator.alloc<Binary>();
- curr->op = LtSVecI32x4;
- break;
- case BinaryConsts::I32x4LtU:
- curr = allocator.alloc<Binary>();
- curr->op = LtUVecI32x4;
- break;
- case BinaryConsts::I32x4GtS:
- curr = allocator.alloc<Binary>();
- curr->op = GtSVecI32x4;
- break;
- case BinaryConsts::I32x4GtU:
- curr = allocator.alloc<Binary>();
- curr->op = GtUVecI32x4;
- break;
- case BinaryConsts::I32x4LeS:
- curr = allocator.alloc<Binary>();
- curr->op = LeSVecI32x4;
- break;
- case BinaryConsts::I32x4LeU:
- curr = allocator.alloc<Binary>();
- curr->op = LeUVecI32x4;
- break;
- case BinaryConsts::I32x4GeS:
- curr = allocator.alloc<Binary>();
- curr->op = GeSVecI32x4;
- break;
- case BinaryConsts::I32x4GeU:
- curr = allocator.alloc<Binary>();
- curr->op = GeUVecI32x4;
- break;
- case BinaryConsts::I64x2Eq:
- curr = allocator.alloc<Binary>();
- curr->op = EqVecI64x2;
- break;
- case BinaryConsts::I64x2Ne:
- curr = allocator.alloc<Binary>();
- curr->op = NeVecI64x2;
- break;
- case BinaryConsts::I64x2LtS:
- curr = allocator.alloc<Binary>();
- curr->op = LtSVecI64x2;
- break;
- case BinaryConsts::I64x2GtS:
- curr = allocator.alloc<Binary>();
- curr->op = GtSVecI64x2;
- break;
- case BinaryConsts::I64x2LeS:
- curr = allocator.alloc<Binary>();
- curr->op = LeSVecI64x2;
- break;
- case BinaryConsts::I64x2GeS:
- curr = allocator.alloc<Binary>();
- curr->op = GeSVecI64x2;
- break;
- case BinaryConsts::F16x8Eq:
- curr = allocator.alloc<Binary>();
- curr->op = EqVecF16x8;
- break;
- case BinaryConsts::F16x8Ne:
- curr = allocator.alloc<Binary>();
- curr->op = NeVecF16x8;
- break;
- case BinaryConsts::F16x8Lt:
- curr = allocator.alloc<Binary>();
- curr->op = LtVecF16x8;
- break;
- case BinaryConsts::F16x8Gt:
- curr = allocator.alloc<Binary>();
- curr->op = GtVecF16x8;
- break;
- case BinaryConsts::F16x8Le:
- curr = allocator.alloc<Binary>();
- curr->op = LeVecF16x8;
- break;
- case BinaryConsts::F16x8Ge:
- curr = allocator.alloc<Binary>();
- curr->op = GeVecF16x8;
- break;
- case BinaryConsts::F32x4Eq:
- curr = allocator.alloc<Binary>();
- curr->op = EqVecF32x4;
- break;
- case BinaryConsts::F32x4Ne:
- curr = allocator.alloc<Binary>();
- curr->op = NeVecF32x4;
- break;
- case BinaryConsts::F32x4Lt:
- curr = allocator.alloc<Binary>();
- curr->op = LtVecF32x4;
- break;
- case BinaryConsts::F32x4Gt:
- curr = allocator.alloc<Binary>();
- curr->op = GtVecF32x4;
- break;
- case BinaryConsts::F32x4Le:
- curr = allocator.alloc<Binary>();
- curr->op = LeVecF32x4;
- break;
- case BinaryConsts::F32x4Ge:
- curr = allocator.alloc<Binary>();
- curr->op = GeVecF32x4;
- break;
- case BinaryConsts::F64x2Eq:
- curr = allocator.alloc<Binary>();
- curr->op = EqVecF64x2;
- break;
- case BinaryConsts::F64x2Ne:
- curr = allocator.alloc<Binary>();
- curr->op = NeVecF64x2;
- break;
- case BinaryConsts::F64x2Lt:
- curr = allocator.alloc<Binary>();
- curr->op = LtVecF64x2;
- break;
- case BinaryConsts::F64x2Gt:
- curr = allocator.alloc<Binary>();
- curr->op = GtVecF64x2;
- break;
- case BinaryConsts::F64x2Le:
- curr = allocator.alloc<Binary>();
- curr->op = LeVecF64x2;
- break;
- case BinaryConsts::F64x2Ge:
- curr = allocator.alloc<Binary>();
- curr->op = GeVecF64x2;
- break;
- case BinaryConsts::V128And:
- curr = allocator.alloc<Binary>();
- curr->op = AndVec128;
- break;
- case BinaryConsts::V128Or:
- curr = allocator.alloc<Binary>();
- curr->op = OrVec128;
- break;
- case BinaryConsts::V128Xor:
- curr = allocator.alloc<Binary>();
- curr->op = XorVec128;
- break;
- case BinaryConsts::V128Andnot:
- curr = allocator.alloc<Binary>();
- curr->op = AndNotVec128;
- break;
- case BinaryConsts::I8x16Add:
- curr = allocator.alloc<Binary>();
- curr->op = AddVecI8x16;
- break;
- case BinaryConsts::I8x16AddSatS:
- curr = allocator.alloc<Binary>();
- curr->op = AddSatSVecI8x16;
- break;
- case BinaryConsts::I8x16AddSatU:
- curr = allocator.alloc<Binary>();
- curr->op = AddSatUVecI8x16;
- break;
- case BinaryConsts::I8x16Sub:
- curr = allocator.alloc<Binary>();
- curr->op = SubVecI8x16;
- break;
- case BinaryConsts::I8x16SubSatS:
- curr = allocator.alloc<Binary>();
- curr->op = SubSatSVecI8x16;
- break;
- case BinaryConsts::I8x16SubSatU:
- curr = allocator.alloc<Binary>();
- curr->op = SubSatUVecI8x16;
- break;
- case BinaryConsts::I8x16MinS:
- curr = allocator.alloc<Binary>();
- curr->op = MinSVecI8x16;
- break;
- case BinaryConsts::I8x16MinU:
- curr = allocator.alloc<Binary>();
- curr->op = MinUVecI8x16;
- break;
- case BinaryConsts::I8x16MaxS:
- curr = allocator.alloc<Binary>();
- curr->op = MaxSVecI8x16;
- break;
- case BinaryConsts::I8x16MaxU:
- curr = allocator.alloc<Binary>();
- curr->op = MaxUVecI8x16;
- break;
- case BinaryConsts::I8x16AvgrU:
- curr = allocator.alloc<Binary>();
- curr->op = AvgrUVecI8x16;
- break;
- case BinaryConsts::I16x8Add:
- curr = allocator.alloc<Binary>();
- curr->op = AddVecI16x8;
- break;
- case BinaryConsts::I16x8AddSatS:
- curr = allocator.alloc<Binary>();
- curr->op = AddSatSVecI16x8;
- break;
- case BinaryConsts::I16x8AddSatU:
- curr = allocator.alloc<Binary>();
- curr->op = AddSatUVecI16x8;
- break;
- case BinaryConsts::I16x8Sub:
- curr = allocator.alloc<Binary>();
- curr->op = SubVecI16x8;
- break;
- case BinaryConsts::I16x8SubSatS:
- curr = allocator.alloc<Binary>();
- curr->op = SubSatSVecI16x8;
- break;
- case BinaryConsts::I16x8SubSatU:
- curr = allocator.alloc<Binary>();
- curr->op = SubSatUVecI16x8;
- break;
- case BinaryConsts::I16x8Mul:
- curr = allocator.alloc<Binary>();
- curr->op = MulVecI16x8;
- break;
- case BinaryConsts::I16x8MinS:
- curr = allocator.alloc<Binary>();
- curr->op = MinSVecI16x8;
- break;
- case BinaryConsts::I16x8MinU:
- curr = allocator.alloc<Binary>();
- curr->op = MinUVecI16x8;
- break;
- case BinaryConsts::I16x8MaxS:
- curr = allocator.alloc<Binary>();
- curr->op = MaxSVecI16x8;
- break;
- case BinaryConsts::I16x8MaxU:
- curr = allocator.alloc<Binary>();
- curr->op = MaxUVecI16x8;
- break;
- case BinaryConsts::I16x8AvgrU:
- curr = allocator.alloc<Binary>();
- curr->op = AvgrUVecI16x8;
- break;
- case BinaryConsts::I16x8Q15MulrSatS:
- curr = allocator.alloc<Binary>();
- curr->op = Q15MulrSatSVecI16x8;
- break;
- case BinaryConsts::I16x8ExtmulLowI8x16S:
- curr = allocator.alloc<Binary>();
- curr->op = ExtMulLowSVecI16x8;
- break;
- case BinaryConsts::I16x8ExtmulHighI8x16S:
- curr = allocator.alloc<Binary>();
- curr->op = ExtMulHighSVecI16x8;
- break;
- case BinaryConsts::I16x8ExtmulLowI8x16U:
- curr = allocator.alloc<Binary>();
- curr->op = ExtMulLowUVecI16x8;
- break;
- case BinaryConsts::I16x8ExtmulHighI8x16U:
- curr = allocator.alloc<Binary>();
- curr->op = ExtMulHighUVecI16x8;
- break;
- case BinaryConsts::I32x4Add:
- curr = allocator.alloc<Binary>();
- curr->op = AddVecI32x4;
- break;
- case BinaryConsts::I32x4Sub:
- curr = allocator.alloc<Binary>();
- curr->op = SubVecI32x4;
- break;
- case BinaryConsts::I32x4Mul:
- curr = allocator.alloc<Binary>();
- curr->op = MulVecI32x4;
- break;
- case BinaryConsts::I32x4MinS:
- curr = allocator.alloc<Binary>();
- curr->op = MinSVecI32x4;
- break;
- case BinaryConsts::I32x4MinU:
- curr = allocator.alloc<Binary>();
- curr->op = MinUVecI32x4;
- break;
- case BinaryConsts::I32x4MaxS:
- curr = allocator.alloc<Binary>();
- curr->op = MaxSVecI32x4;
- break;
- case BinaryConsts::I32x4MaxU:
- curr = allocator.alloc<Binary>();
- curr->op = MaxUVecI32x4;
- break;
- case BinaryConsts::I32x4DotI16x8S:
- curr = allocator.alloc<Binary>();
- curr->op = DotSVecI16x8ToVecI32x4;
- break;
- case BinaryConsts::I32x4ExtmulLowI16x8S:
- curr = allocator.alloc<Binary>();
- curr->op = ExtMulLowSVecI32x4;
- break;
- case BinaryConsts::I32x4ExtmulHighI16x8S:
- curr = allocator.alloc<Binary>();
- curr->op = ExtMulHighSVecI32x4;
- break;
- case BinaryConsts::I32x4ExtmulLowI16x8U:
- curr = allocator.alloc<Binary>();
- curr->op = ExtMulLowUVecI32x4;
- break;
- case BinaryConsts::I32x4ExtmulHighI16x8U:
- curr = allocator.alloc<Binary>();
- curr->op = ExtMulHighUVecI32x4;
- break;
- case BinaryConsts::I64x2Add:
- curr = allocator.alloc<Binary>();
- curr->op = AddVecI64x2;
- break;
- case BinaryConsts::I64x2Sub:
- curr = allocator.alloc<Binary>();
- curr->op = SubVecI64x2;
- break;
- case BinaryConsts::I64x2Mul:
- curr = allocator.alloc<Binary>();
- curr->op = MulVecI64x2;
- break;
- case BinaryConsts::I64x2ExtmulLowI32x4S:
- curr = allocator.alloc<Binary>();
- curr->op = ExtMulLowSVecI64x2;
- break;
- case BinaryConsts::I64x2ExtmulHighI32x4S:
- curr = allocator.alloc<Binary>();
- curr->op = ExtMulHighSVecI64x2;
- break;
- case BinaryConsts::I64x2ExtmulLowI32x4U:
- curr = allocator.alloc<Binary>();
- curr->op = ExtMulLowUVecI64x2;
- break;
- case BinaryConsts::I64x2ExtmulHighI32x4U:
- curr = allocator.alloc<Binary>();
- curr->op = ExtMulHighUVecI64x2;
- break;
- case BinaryConsts::F16x8Add:
- curr = allocator.alloc<Binary>();
- curr->op = AddVecF16x8;
- break;
- case BinaryConsts::F16x8Sub:
- curr = allocator.alloc<Binary>();
- curr->op = SubVecF16x8;
- break;
- case BinaryConsts::F16x8Mul:
- curr = allocator.alloc<Binary>();
- curr->op = MulVecF16x8;
- break;
- case BinaryConsts::F16x8Div:
- curr = allocator.alloc<Binary>();
- curr->op = DivVecF16x8;
- break;
- case BinaryConsts::F16x8Min:
- curr = allocator.alloc<Binary>();
- curr->op = MinVecF16x8;
- break;
- case BinaryConsts::F16x8Max:
- curr = allocator.alloc<Binary>();
- curr->op = MaxVecF16x8;
- break;
- case BinaryConsts::F16x8Pmin:
- curr = allocator.alloc<Binary>();
- curr->op = PMinVecF16x8;
- break;
- case BinaryConsts::F16x8Pmax:
- curr = allocator.alloc<Binary>();
- curr->op = PMaxVecF16x8;
- break;
- case BinaryConsts::F32x4Add:
- curr = allocator.alloc<Binary>();
- curr->op = AddVecF32x4;
- break;
- case BinaryConsts::F32x4Sub:
- curr = allocator.alloc<Binary>();
- curr->op = SubVecF32x4;
- break;
- case BinaryConsts::F32x4Mul:
- curr = allocator.alloc<Binary>();
- curr->op = MulVecF32x4;
- break;
- case BinaryConsts::F32x4Div:
- curr = allocator.alloc<Binary>();
- curr->op = DivVecF32x4;
- break;
- case BinaryConsts::F32x4Min:
- curr = allocator.alloc<Binary>();
- curr->op = MinVecF32x4;
- break;
- case BinaryConsts::F32x4Max:
- curr = allocator.alloc<Binary>();
- curr->op = MaxVecF32x4;
- break;
- case BinaryConsts::F32x4Pmin:
- curr = allocator.alloc<Binary>();
- curr->op = PMinVecF32x4;
- break;
- case BinaryConsts::F32x4Pmax:
- curr = allocator.alloc<Binary>();
- curr->op = PMaxVecF32x4;
- break;
- case BinaryConsts::F64x2Add:
- curr = allocator.alloc<Binary>();
- curr->op = AddVecF64x2;
- break;
- case BinaryConsts::F64x2Sub:
- curr = allocator.alloc<Binary>();
- curr->op = SubVecF64x2;
- break;
- case BinaryConsts::F64x2Mul:
- curr = allocator.alloc<Binary>();
- curr->op = MulVecF64x2;
- break;
- case BinaryConsts::F64x2Div:
- curr = allocator.alloc<Binary>();
- curr->op = DivVecF64x2;
- break;
- case BinaryConsts::F64x2Min:
- curr = allocator.alloc<Binary>();
- curr->op = MinVecF64x2;
- break;
- case BinaryConsts::F64x2Max:
- curr = allocator.alloc<Binary>();
- curr->op = MaxVecF64x2;
- break;
- case BinaryConsts::F64x2Pmin:
- curr = allocator.alloc<Binary>();
- curr->op = PMinVecF64x2;
- break;
- case BinaryConsts::F64x2Pmax:
- curr = allocator.alloc<Binary>();
- curr->op = PMaxVecF64x2;
- break;
- case BinaryConsts::I8x16NarrowI16x8S:
- curr = allocator.alloc<Binary>();
- curr->op = NarrowSVecI16x8ToVecI8x16;
- break;
- case BinaryConsts::I8x16NarrowI16x8U:
- curr = allocator.alloc<Binary>();
- curr->op = NarrowUVecI16x8ToVecI8x16;
- break;
- case BinaryConsts::I16x8NarrowI32x4S:
- curr = allocator.alloc<Binary>();
- curr->op = NarrowSVecI32x4ToVecI16x8;
- break;
- case BinaryConsts::I16x8NarrowI32x4U:
- curr = allocator.alloc<Binary>();
- curr->op = NarrowUVecI32x4ToVecI16x8;
- break;
- case BinaryConsts::I8x16Swizzle:
- curr = allocator.alloc<Binary>();
- curr->op = SwizzleVecI8x16;
- break;
- case BinaryConsts::I8x16RelaxedSwizzle:
- curr = allocator.alloc<Binary>();
- curr->op = RelaxedSwizzleVecI8x16;
- break;
- case BinaryConsts::F32x4RelaxedMin:
- curr = allocator.alloc<Binary>();
- curr->op = RelaxedMinVecF32x4;
- break;
- case BinaryConsts::F32x4RelaxedMax:
- curr = allocator.alloc<Binary>();
- curr->op = RelaxedMaxVecF32x4;
- break;
- case BinaryConsts::F64x2RelaxedMin:
- curr = allocator.alloc<Binary>();
- curr->op = RelaxedMinVecF64x2;
- break;
- case BinaryConsts::F64x2RelaxedMax:
- curr = allocator.alloc<Binary>();
- curr->op = RelaxedMaxVecF64x2;
- break;
- case BinaryConsts::I16x8RelaxedQ15MulrS:
- curr = allocator.alloc<Binary>();
- curr->op = RelaxedQ15MulrSVecI16x8;
- break;
- case BinaryConsts::I16x8DotI8x16I7x16S:
- curr = allocator.alloc<Binary>();
- curr->op = DotI8x16I7x16SToVecI16x8;
- break;
- default:
- return false;
- }
- curr->right = popNonVoidExpression();
- curr->left = popNonVoidExpression();
- curr->finalize();
- out = curr;
- return true;
-}
-bool WasmBinaryReader::maybeVisitSIMDUnary(Expression*& out, uint32_t code) {
- Unary* curr;
- switch (code) {
- case BinaryConsts::I8x16Splat:
- curr = allocator.alloc<Unary>();
- curr->op = SplatVecI8x16;
- break;
- case BinaryConsts::I16x8Splat:
- curr = allocator.alloc<Unary>();
- curr->op = SplatVecI16x8;
- break;
- case BinaryConsts::I32x4Splat:
- curr = allocator.alloc<Unary>();
- curr->op = SplatVecI32x4;
- break;
- case BinaryConsts::I64x2Splat:
- curr = allocator.alloc<Unary>();
- curr->op = SplatVecI64x2;
- break;
- case BinaryConsts::F16x8Splat:
- curr = allocator.alloc<Unary>();
- curr->op = SplatVecF16x8;
- break;
- case BinaryConsts::F32x4Splat:
- curr = allocator.alloc<Unary>();
- curr->op = SplatVecF32x4;
- break;
- case BinaryConsts::F64x2Splat:
- curr = allocator.alloc<Unary>();
- curr->op = SplatVecF64x2;
- break;
- case BinaryConsts::V128Not:
- curr = allocator.alloc<Unary>();
- curr->op = NotVec128;
- break;
- case BinaryConsts::V128AnyTrue:
- curr = allocator.alloc<Unary>();
- curr->op = AnyTrueVec128;
- break;
- case BinaryConsts::I8x16Popcnt:
- curr = allocator.alloc<Unary>();
- curr->op = PopcntVecI8x16;
- break;
- case BinaryConsts::I8x16Abs:
- curr = allocator.alloc<Unary>();
- curr->op = AbsVecI8x16;
- break;
- case BinaryConsts::I8x16Neg:
- curr = allocator.alloc<Unary>();
- curr->op = NegVecI8x16;
- break;
- case BinaryConsts::I8x16AllTrue:
- curr = allocator.alloc<Unary>();
- curr->op = AllTrueVecI8x16;
- break;
- case BinaryConsts::I8x16Bitmask:
- curr = allocator.alloc<Unary>();
- curr->op = BitmaskVecI8x16;
- break;
- case BinaryConsts::I16x8Abs:
- curr = allocator.alloc<Unary>();
- curr->op = AbsVecI16x8;
- break;
- case BinaryConsts::I16x8Neg:
- curr = allocator.alloc<Unary>();
- curr->op = NegVecI16x8;
- break;
- case BinaryConsts::I16x8AllTrue:
- curr = allocator.alloc<Unary>();
- curr->op = AllTrueVecI16x8;
- break;
- case BinaryConsts::I16x8Bitmask:
- curr = allocator.alloc<Unary>();
- curr->op = BitmaskVecI16x8;
- break;
- case BinaryConsts::I32x4Abs:
- curr = allocator.alloc<Unary>();
- curr->op = AbsVecI32x4;
- break;
- case BinaryConsts::I32x4Neg:
- curr = allocator.alloc<Unary>();
- curr->op = NegVecI32x4;
- break;
- case BinaryConsts::I32x4AllTrue:
- curr = allocator.alloc<Unary>();
- curr->op = AllTrueVecI32x4;
- break;
- case BinaryConsts::I32x4Bitmask:
- curr = allocator.alloc<Unary>();
- curr->op = BitmaskVecI32x4;
- break;
- case BinaryConsts::I64x2Abs:
- curr = allocator.alloc<Unary>();
- curr->op = AbsVecI64x2;
- break;
- case BinaryConsts::I64x2Neg:
- curr = allocator.alloc<Unary>();
- curr->op = NegVecI64x2;
- break;
- case BinaryConsts::I64x2AllTrue:
- curr = allocator.alloc<Unary>();
- curr->op = AllTrueVecI64x2;
- break;
- case BinaryConsts::I64x2Bitmask:
- curr = allocator.alloc<Unary>();
- curr->op = BitmaskVecI64x2;
- break;
- case BinaryConsts::F16x8Abs:
- curr = allocator.alloc<Unary>();
- curr->op = AbsVecF16x8;
- break;
- case BinaryConsts::F16x8Neg:
- curr = allocator.alloc<Unary>();
- curr->op = NegVecF16x8;
- break;
- case BinaryConsts::F16x8Sqrt:
- curr = allocator.alloc<Unary>();
- curr->op = SqrtVecF16x8;
- break;
- case BinaryConsts::F16x8Ceil:
- curr = allocator.alloc<Unary>();
- curr->op = CeilVecF16x8;
- break;
- case BinaryConsts::F16x8Floor:
- curr = allocator.alloc<Unary>();
- curr->op = FloorVecF16x8;
- break;
- case BinaryConsts::F16x8Trunc:
- curr = allocator.alloc<Unary>();
- curr->op = TruncVecF16x8;
- break;
- case BinaryConsts::F16x8Nearest:
- curr = allocator.alloc<Unary>();
- curr->op = NearestVecF16x8;
- break;
- case BinaryConsts::F32x4Abs:
- curr = allocator.alloc<Unary>();
- curr->op = AbsVecF32x4;
- break;
- case BinaryConsts::F32x4Neg:
- curr = allocator.alloc<Unary>();
- curr->op = NegVecF32x4;
- break;
- case BinaryConsts::F32x4Sqrt:
- curr = allocator.alloc<Unary>();
- curr->op = SqrtVecF32x4;
- break;
- case BinaryConsts::F32x4Ceil:
- curr = allocator.alloc<Unary>();
- curr->op = CeilVecF32x4;
- break;
- case BinaryConsts::F32x4Floor:
- curr = allocator.alloc<Unary>();
- curr->op = FloorVecF32x4;
- break;
- case BinaryConsts::F32x4Trunc:
- curr = allocator.alloc<Unary>();
- curr->op = TruncVecF32x4;
- break;
- case BinaryConsts::F32x4Nearest:
- curr = allocator.alloc<Unary>();
- curr->op = NearestVecF32x4;
- break;
- case BinaryConsts::F64x2Abs:
- curr = allocator.alloc<Unary>();
- curr->op = AbsVecF64x2;
- break;
- case BinaryConsts::F64x2Neg:
- curr = allocator.alloc<Unary>();
- curr->op = NegVecF64x2;
- break;
- case BinaryConsts::F64x2Sqrt:
- curr = allocator.alloc<Unary>();
- curr->op = SqrtVecF64x2;
- break;
- case BinaryConsts::F64x2Ceil:
- curr = allocator.alloc<Unary>();
- curr->op = CeilVecF64x2;
- break;
- case BinaryConsts::F64x2Floor:
- curr = allocator.alloc<Unary>();
- curr->op = FloorVecF64x2;
- break;
- case BinaryConsts::F64x2Trunc:
- curr = allocator.alloc<Unary>();
- curr->op = TruncVecF64x2;
- break;
- case BinaryConsts::F64x2Nearest:
- curr = allocator.alloc<Unary>();
- curr->op = NearestVecF64x2;
- break;
- case BinaryConsts::I16x8ExtaddPairwiseI8x16S:
- curr = allocator.alloc<Unary>();
- curr->op = ExtAddPairwiseSVecI8x16ToI16x8;
- break;
- case BinaryConsts::I16x8ExtaddPairwiseI8x16U:
- curr = allocator.alloc<Unary>();
- curr->op = ExtAddPairwiseUVecI8x16ToI16x8;
- break;
- case BinaryConsts::I32x4ExtaddPairwiseI16x8S:
- curr = allocator.alloc<Unary>();
- curr->op = ExtAddPairwiseSVecI16x8ToI32x4;
- break;
- case BinaryConsts::I32x4ExtaddPairwiseI16x8U:
- curr = allocator.alloc<Unary>();
- curr->op = ExtAddPairwiseUVecI16x8ToI32x4;
- break;
- case BinaryConsts::I32x4TruncSatF32x4S:
- curr = allocator.alloc<Unary>();
- curr->op = TruncSatSVecF32x4ToVecI32x4;
- break;
- case BinaryConsts::I32x4TruncSatF32x4U:
- curr = allocator.alloc<Unary>();
- curr->op = TruncSatUVecF32x4ToVecI32x4;
- break;
- case BinaryConsts::F32x4ConvertI32x4S:
- curr = allocator.alloc<Unary>();
- curr->op = ConvertSVecI32x4ToVecF32x4;
- break;
- case BinaryConsts::F32x4ConvertI32x4U:
- curr = allocator.alloc<Unary>();
- curr->op = ConvertUVecI32x4ToVecF32x4;
- break;
- case BinaryConsts::I16x8ExtendLowI8x16S:
- curr = allocator.alloc<Unary>();
- curr->op = ExtendLowSVecI8x16ToVecI16x8;
- break;
- case BinaryConsts::I16x8ExtendHighI8x16S:
- curr = allocator.alloc<Unary>();
- curr->op = ExtendHighSVecI8x16ToVecI16x8;
- break;
- case BinaryConsts::I16x8ExtendLowI8x16U:
- curr = allocator.alloc<Unary>();
- curr->op = ExtendLowUVecI8x16ToVecI16x8;
- break;
- case BinaryConsts::I16x8ExtendHighI8x16U:
- curr = allocator.alloc<Unary>();
- curr->op = ExtendHighUVecI8x16ToVecI16x8;
- break;
- case BinaryConsts::I32x4ExtendLowI16x8S:
- curr = allocator.alloc<Unary>();
- curr->op = ExtendLowSVecI16x8ToVecI32x4;
- break;
- case BinaryConsts::I32x4ExtendHighI16x8S:
- curr = allocator.alloc<Unary>();
- curr->op = ExtendHighSVecI16x8ToVecI32x4;
- break;
- case BinaryConsts::I32x4ExtendLowI16x8U:
- curr = allocator.alloc<Unary>();
- curr->op = ExtendLowUVecI16x8ToVecI32x4;
- break;
- case BinaryConsts::I32x4ExtendHighI16x8U:
- curr = allocator.alloc<Unary>();
- curr->op = ExtendHighUVecI16x8ToVecI32x4;
- break;
- case BinaryConsts::I64x2ExtendLowI32x4S:
- curr = allocator.alloc<Unary>();
- curr->op = ExtendLowSVecI32x4ToVecI64x2;
- break;
- case BinaryConsts::I64x2ExtendHighI32x4S:
- curr = allocator.alloc<Unary>();
- curr->op = ExtendHighSVecI32x4ToVecI64x2;
- break;
- case BinaryConsts::I64x2ExtendLowI32x4U:
- curr = allocator.alloc<Unary>();
- curr->op = ExtendLowUVecI32x4ToVecI64x2;
- break;
- case BinaryConsts::I64x2ExtendHighI32x4U:
- curr = allocator.alloc<Unary>();
- curr->op = ExtendHighUVecI32x4ToVecI64x2;
- break;
- case BinaryConsts::F64x2ConvertLowI32x4S:
- curr = allocator.alloc<Unary>();
- curr->op = ConvertLowSVecI32x4ToVecF64x2;
- break;
- case BinaryConsts::F64x2ConvertLowI32x4U:
- curr = allocator.alloc<Unary>();
- curr->op = ConvertLowUVecI32x4ToVecF64x2;
- break;
- case BinaryConsts::I32x4TruncSatF64x2SZero:
- curr = allocator.alloc<Unary>();
- curr->op = TruncSatZeroSVecF64x2ToVecI32x4;
- break;
- case BinaryConsts::I32x4TruncSatF64x2UZero:
- curr = allocator.alloc<Unary>();
- curr->op = TruncSatZeroUVecF64x2ToVecI32x4;
- break;
- case BinaryConsts::F32x4DemoteF64x2Zero:
- curr = allocator.alloc<Unary>();
- curr->op = DemoteZeroVecF64x2ToVecF32x4;
- break;
- case BinaryConsts::F64x2PromoteLowF32x4:
- curr = allocator.alloc<Unary>();
- curr->op = PromoteLowVecF32x4ToVecF64x2;
- break;
- case BinaryConsts::I32x4RelaxedTruncF32x4S:
- curr = allocator.alloc<Unary>();
- curr->op = RelaxedTruncSVecF32x4ToVecI32x4;
- break;
- case BinaryConsts::I32x4RelaxedTruncF32x4U:
- curr = allocator.alloc<Unary>();
- curr->op = RelaxedTruncUVecF32x4ToVecI32x4;
- break;
- case BinaryConsts::I32x4RelaxedTruncF64x2SZero:
- curr = allocator.alloc<Unary>();
- curr->op = RelaxedTruncZeroSVecF64x2ToVecI32x4;
- break;
- case BinaryConsts::I32x4RelaxedTruncF64x2UZero:
- curr = allocator.alloc<Unary>();
- curr->op = RelaxedTruncZeroUVecF64x2ToVecI32x4;
- break;
- case BinaryConsts::I16x8TruncSatF16x8S:
- curr = allocator.alloc<Unary>();
- curr->op = TruncSatSVecF16x8ToVecI16x8;
- break;
- case BinaryConsts::I16x8TruncSatF16x8U:
- curr = allocator.alloc<Unary>();
- curr->op = TruncSatUVecF16x8ToVecI16x8;
- break;
- case BinaryConsts::F16x8ConvertI16x8S:
- curr = allocator.alloc<Unary>();
- curr->op = ConvertSVecI16x8ToVecF16x8;
- break;
- case BinaryConsts::F16x8ConvertI16x8U:
- curr = allocator.alloc<Unary>();
- curr->op = ConvertUVecI16x8ToVecF16x8;
- break;
- default:
- return false;
- }
- curr->value = popNonVoidExpression();
- curr->finalize();
- out = curr;
- return true;
-}
-
-bool WasmBinaryReader::maybeVisitSIMDConst(Expression*& out, uint32_t code) {
- if (code != BinaryConsts::V128Const) {
- return false;
- }
- auto* curr = allocator.alloc<Const>();
- curr->value = getVec128Literal();
- curr->finalize();
- out = curr;
- return true;
-}
-
-bool WasmBinaryReader::maybeVisitSIMDStore(Expression*& out, uint32_t code) {
- if (code != BinaryConsts::V128Store) {
- return false;
- }
- auto* curr = allocator.alloc<Store>();
- curr->bytes = 16;
- curr->valueType = Type::v128;
- Index memIdx = readMemoryAccess(curr->align, curr->offset);
- curr->memory = getMemoryName(memIdx);
- curr->isAtomic = false;
- curr->value = popNonVoidExpression();
- curr->ptr = popNonVoidExpression();
- curr->finalize();
- out = curr;
- return true;
-}
-
-bool WasmBinaryReader::maybeVisitSIMDExtract(Expression*& out, uint32_t code) {
- SIMDExtract* curr;
- switch (code) {
- case BinaryConsts::I8x16ExtractLaneS:
- curr = allocator.alloc<SIMDExtract>();
- curr->op = ExtractLaneSVecI8x16;
- curr->index = getLaneIndex(16);
- break;
- case BinaryConsts::I8x16ExtractLaneU:
- curr = allocator.alloc<SIMDExtract>();
- curr->op = ExtractLaneUVecI8x16;
- curr->index = getLaneIndex(16);
- break;
- case BinaryConsts::I16x8ExtractLaneS:
- curr = allocator.alloc<SIMDExtract>();
- curr->op = ExtractLaneSVecI16x8;
- curr->index = getLaneIndex(8);
- break;
- case BinaryConsts::I16x8ExtractLaneU:
- curr = allocator.alloc<SIMDExtract>();
- curr->op = ExtractLaneUVecI16x8;
- curr->index = getLaneIndex(8);
- break;
- case BinaryConsts::I32x4ExtractLane:
- curr = allocator.alloc<SIMDExtract>();
- curr->op = ExtractLaneVecI32x4;
- curr->index = getLaneIndex(4);
- break;
- case BinaryConsts::I64x2ExtractLane:
- curr = allocator.alloc<SIMDExtract>();
- curr->op = ExtractLaneVecI64x2;
- curr->index = getLaneIndex(2);
- break;
- case BinaryConsts::F16x8ExtractLane:
- curr = allocator.alloc<SIMDExtract>();
- curr->op = ExtractLaneVecF16x8;
- curr->index = getLaneIndex(8);
- break;
- case BinaryConsts::F32x4ExtractLane:
- curr = allocator.alloc<SIMDExtract>();
- curr->op = ExtractLaneVecF32x4;
- curr->index = getLaneIndex(4);
- break;
- case BinaryConsts::F64x2ExtractLane:
- curr = allocator.alloc<SIMDExtract>();
- curr->op = ExtractLaneVecF64x2;
- curr->index = getLaneIndex(2);
- break;
- default:
- return false;
- }
- curr->vec = popNonVoidExpression();
- curr->finalize();
- out = curr;
- return true;
-}
-
-bool WasmBinaryReader::maybeVisitSIMDReplace(Expression*& out, uint32_t code) {
- SIMDReplace* curr;
- switch (code) {
- case BinaryConsts::I8x16ReplaceLane:
- curr = allocator.alloc<SIMDReplace>();
- curr->op = ReplaceLaneVecI8x16;
- curr->index = getLaneIndex(16);
- break;
- case BinaryConsts::I16x8ReplaceLane:
- curr = allocator.alloc<SIMDReplace>();
- curr->op = ReplaceLaneVecI16x8;
- curr->index = getLaneIndex(8);
- break;
- case BinaryConsts::I32x4ReplaceLane:
- curr = allocator.alloc<SIMDReplace>();
- curr->op = ReplaceLaneVecI32x4;
- curr->index = getLaneIndex(4);
- break;
- case BinaryConsts::I64x2ReplaceLane:
- curr = allocator.alloc<SIMDReplace>();
- curr->op = ReplaceLaneVecI64x2;
- curr->index = getLaneIndex(2);
- break;
- case BinaryConsts::F16x8ReplaceLane:
- curr = allocator.alloc<SIMDReplace>();
- curr->op = ReplaceLaneVecF16x8;
- curr->index = getLaneIndex(8);
- break;
- case BinaryConsts::F32x4ReplaceLane:
- curr = allocator.alloc<SIMDReplace>();
- curr->op = ReplaceLaneVecF32x4;
- curr->index = getLaneIndex(4);
- break;
- case BinaryConsts::F64x2ReplaceLane:
- curr = allocator.alloc<SIMDReplace>();
- curr->op = ReplaceLaneVecF64x2;
- curr->index = getLaneIndex(2);
- break;
- default:
- return false;
- }
- curr->value = popNonVoidExpression();
- curr->vec = popNonVoidExpression();
- curr->finalize();
- out = curr;
- return true;
-}
-
-bool WasmBinaryReader::maybeVisitSIMDShuffle(Expression*& out, uint32_t code) {
- if (code != BinaryConsts::I8x16Shuffle) {
- return false;
- }
- auto* curr = allocator.alloc<SIMDShuffle>();
- for (auto i = 0; i < 16; ++i) {
- curr->mask[i] = getLaneIndex(32);
- }
- curr->right = popNonVoidExpression();
- curr->left = popNonVoidExpression();
- curr->finalize();
- out = curr;
- return true;
-}
-
-bool WasmBinaryReader::maybeVisitSIMDTernary(Expression*& out, uint32_t code) {
- SIMDTernary* curr;
- switch (code) {
- case BinaryConsts::V128Bitselect:
- curr = allocator.alloc<SIMDTernary>();
- curr->op = Bitselect;
- break;
- case BinaryConsts::I8x16Laneselect:
- curr = allocator.alloc<SIMDTernary>();
- curr->op = LaneselectI8x16;
- break;
- case BinaryConsts::I16x8Laneselect:
- curr = allocator.alloc<SIMDTernary>();
- curr->op = LaneselectI16x8;
- break;
- case BinaryConsts::I32x4Laneselect:
- curr = allocator.alloc<SIMDTernary>();
- curr->op = LaneselectI32x4;
- break;
- case BinaryConsts::I64x2Laneselect:
- curr = allocator.alloc<SIMDTernary>();
- curr->op = LaneselectI64x2;
- break;
- case BinaryConsts::F16x8RelaxedMadd:
- curr = allocator.alloc<SIMDTernary>();
- curr->op = RelaxedMaddVecF16x8;
- break;
- case BinaryConsts::F16x8RelaxedNmadd:
- curr = allocator.alloc<SIMDTernary>();
- curr->op = RelaxedNmaddVecF16x8;
- break;
- case BinaryConsts::F32x4RelaxedMadd:
- curr = allocator.alloc<SIMDTernary>();
- curr->op = RelaxedMaddVecF32x4;
- break;
- case BinaryConsts::F32x4RelaxedNmadd:
- curr = allocator.alloc<SIMDTernary>();
- curr->op = RelaxedNmaddVecF32x4;
- break;
- case BinaryConsts::F64x2RelaxedMadd:
- curr = allocator.alloc<SIMDTernary>();
- curr->op = RelaxedMaddVecF64x2;
- break;
- case BinaryConsts::F64x2RelaxedNmadd:
- curr = allocator.alloc<SIMDTernary>();
- curr->op = RelaxedNmaddVecF64x2;
- break;
- case BinaryConsts::I32x4DotI8x16I7x16AddS:
- curr = allocator.alloc<SIMDTernary>();
- curr->op = DotI8x16I7x16AddSToVecI32x4;
- break;
- default:
- return false;
- }
- curr->c = popNonVoidExpression();
- curr->b = popNonVoidExpression();
- curr->a = popNonVoidExpression();
- curr->finalize();
- out = curr;
- return true;
-}
-
-bool WasmBinaryReader::maybeVisitSIMDShift(Expression*& out, uint32_t code) {
- SIMDShift* curr;
- switch (code) {
- case BinaryConsts::I8x16Shl:
- curr = allocator.alloc<SIMDShift>();
- curr->op = ShlVecI8x16;
- break;
- case BinaryConsts::I8x16ShrS:
- curr = allocator.alloc<SIMDShift>();
- curr->op = ShrSVecI8x16;
- break;
- case BinaryConsts::I8x16ShrU:
- curr = allocator.alloc<SIMDShift>();
- curr->op = ShrUVecI8x16;
- break;
- case BinaryConsts::I16x8Shl:
- curr = allocator.alloc<SIMDShift>();
- curr->op = ShlVecI16x8;
- break;
- case BinaryConsts::I16x8ShrS:
- curr = allocator.alloc<SIMDShift>();
- curr->op = ShrSVecI16x8;
- break;
- case BinaryConsts::I16x8ShrU:
- curr = allocator.alloc<SIMDShift>();
- curr->op = ShrUVecI16x8;
- break;
- case BinaryConsts::I32x4Shl:
- curr = allocator.alloc<SIMDShift>();
- curr->op = ShlVecI32x4;
- break;
- case BinaryConsts::I32x4ShrS:
- curr = allocator.alloc<SIMDShift>();
- curr->op = ShrSVecI32x4;
- break;
- case BinaryConsts::I32x4ShrU:
- curr = allocator.alloc<SIMDShift>();
- curr->op = ShrUVecI32x4;
- break;
- case BinaryConsts::I64x2Shl:
- curr = allocator.alloc<SIMDShift>();
- curr->op = ShlVecI64x2;
- break;
- case BinaryConsts::I64x2ShrS:
- curr = allocator.alloc<SIMDShift>();
- curr->op = ShrSVecI64x2;
- break;
- case BinaryConsts::I64x2ShrU:
- curr = allocator.alloc<SIMDShift>();
- curr->op = ShrUVecI64x2;
- break;
- default:
- return false;
- }
- curr->shift = popNonVoidExpression();
- curr->vec = popNonVoidExpression();
- curr->finalize();
- out = curr;
- return true;
-}
-
-bool WasmBinaryReader::maybeVisitSIMDLoad(Expression*& out, uint32_t code) {
- if (code == BinaryConsts::V128Load) {
- auto* curr = allocator.alloc<Load>();
- curr->type = Type::v128;
- curr->bytes = 16;
- Index memIdx = readMemoryAccess(curr->align, curr->offset);
- curr->memory = getMemoryName(memIdx);
- curr->isAtomic = false;
- curr->ptr = popNonVoidExpression();
- curr->finalize();
- out = curr;
- return true;
- }
- SIMDLoad* curr;
- switch (code) {
- case BinaryConsts::V128Load8Splat:
- curr = allocator.alloc<SIMDLoad>();
- curr->op = Load8SplatVec128;
- break;
- case BinaryConsts::V128Load16Splat:
- curr = allocator.alloc<SIMDLoad>();
- curr->op = Load16SplatVec128;
- break;
- case BinaryConsts::V128Load32Splat:
- curr = allocator.alloc<SIMDLoad>();
- curr->op = Load32SplatVec128;
- break;
- case BinaryConsts::V128Load64Splat:
- curr = allocator.alloc<SIMDLoad>();
- curr->op = Load64SplatVec128;
- break;
- case BinaryConsts::V128Load8x8S:
- curr = allocator.alloc<SIMDLoad>();
- curr->op = Load8x8SVec128;
- break;
- case BinaryConsts::V128Load8x8U:
- curr = allocator.alloc<SIMDLoad>();
- curr->op = Load8x8UVec128;
- break;
- case BinaryConsts::V128Load16x4S:
- curr = allocator.alloc<SIMDLoad>();
- curr->op = Load16x4SVec128;
- break;
- case BinaryConsts::V128Load16x4U:
- curr = allocator.alloc<SIMDLoad>();
- curr->op = Load16x4UVec128;
- break;
- case BinaryConsts::V128Load32x2S:
- curr = allocator.alloc<SIMDLoad>();
- curr->op = Load32x2SVec128;
- break;
- case BinaryConsts::V128Load32x2U:
- curr = allocator.alloc<SIMDLoad>();
- curr->op = Load32x2UVec128;
- break;
- case BinaryConsts::V128Load32Zero:
- curr = allocator.alloc<SIMDLoad>();
- curr->op = Load32ZeroVec128;
- break;
- case BinaryConsts::V128Load64Zero:
- curr = allocator.alloc<SIMDLoad>();
- curr->op = Load64ZeroVec128;
- break;
- default:
- return false;
- }
- Index memIdx = readMemoryAccess(curr->align, curr->offset);
- curr->memory = getMemoryName(memIdx);
- curr->ptr = popNonVoidExpression();
- curr->finalize();
- out = curr;
- return true;
-}
-
-bool WasmBinaryReader::maybeVisitSIMDLoadStoreLane(Expression*& out,
- uint32_t code) {
- SIMDLoadStoreLaneOp op;
- size_t lanes;
- switch (code) {
- case BinaryConsts::V128Load8Lane:
- op = Load8LaneVec128;
- lanes = 16;
- break;
- case BinaryConsts::V128Load16Lane:
- op = Load16LaneVec128;
- lanes = 8;
- break;
- case BinaryConsts::V128Load32Lane:
- op = Load32LaneVec128;
- lanes = 4;
- break;
- case BinaryConsts::V128Load64Lane:
- op = Load64LaneVec128;
- lanes = 2;
- break;
- case BinaryConsts::V128Store8Lane:
- op = Store8LaneVec128;
- lanes = 16;
- break;
- case BinaryConsts::V128Store16Lane:
- op = Store16LaneVec128;
- lanes = 8;
- break;
- case BinaryConsts::V128Store32Lane:
- op = Store32LaneVec128;
- lanes = 4;
- break;
- case BinaryConsts::V128Store64Lane:
- op = Store64LaneVec128;
- lanes = 2;
- break;
- default:
- return false;
- }
- auto* curr = allocator.alloc<SIMDLoadStoreLane>();
- curr->op = op;
- Index memIdx = readMemoryAccess(curr->align, curr->offset);
- curr->memory = getMemoryName(memIdx);
- curr->index = getLaneIndex(lanes);
- curr->vec = popNonVoidExpression();
- curr->ptr = popNonVoidExpression();
- curr->finalize();
- out = curr;
- return true;
-}
-
-void WasmBinaryReader::visitSelect(Select* curr, uint8_t code) {
- Type annotated = Type::none;
- if (code == BinaryConsts::SelectWithType) {
- size_t numTypes = getU32LEB();
- std::vector<Type> types;
- for (size_t i = 0; i < numTypes; i++) {
- auto t = getType();
- if (!t.isConcrete()) {
- throwError("bad select type");
- }
- types.push_back(t);
- }
- annotated = Type(types);
- }
- curr->condition = popNonVoidExpression();
- curr->ifFalse = popNonVoidExpression();
- curr->ifTrue = popNonVoidExpression();
- curr->finalize();
- if (code == BinaryConsts::SelectWithType &&
- !Type::isSubType(curr->type, annotated)) {
- throwError("select type does not match annotation");
- }
-}
-
-void WasmBinaryReader::visitReturn(Return* curr) {
- requireFunctionContext("return");
- Type type = currFunction->getResults();
- if (type.isConcrete()) {
- curr->value = popTypedExpression(type);
- }
- curr->finalize();
-}
-
-void WasmBinaryReader::visitMemorySize(MemorySize* curr) {
- Index index = getU32LEB();
- if (getMemory(index)->is64()) {
- curr->type = Type::i64;
- }
- curr->memory = getMemoryName(index);
- curr->finalize();
-}
-
-void WasmBinaryReader::visitMemoryGrow(MemoryGrow* curr) {
- curr->delta = popNonVoidExpression();
- Index index = getU32LEB();
- if (getMemory(index)->is64()) {
- curr->type = Type::i64;
- }
- curr->memory = getMemoryName(index);
-}
-
-void WasmBinaryReader::visitNop(Nop* curr) {}
-
-void WasmBinaryReader::visitUnreachable(Unreachable* curr) {}
-
-void WasmBinaryReader::visitDrop(Drop* curr) {
- curr->value = popNonVoidExpression();
- curr->finalize();
-}
-
-void WasmBinaryReader::visitRefNull(RefNull* curr) {
- curr->finalize(getHeapType().getBottom());
-}
-
-void WasmBinaryReader::visitRefIsNull(RefIsNull* curr) {
- curr->value = popNonVoidExpression();
- curr->finalize();
-}
-
-void WasmBinaryReader::visitRefFunc(RefFunc* curr) {
- Index index = getU32LEB();
- curr->func = getFunctionName(index);
- // To support typed function refs, we give the reference not just a general
- // funcref, but a specific subtype with the actual signature.
- curr->finalize(Type(getTypeByFunctionIndex(index), NonNullable));
-}
-
-void WasmBinaryReader::visitRefEq(RefEq* curr) {
- curr->right = popNonVoidExpression();
- curr->left = popNonVoidExpression();
- curr->finalize();
-}
-
-void WasmBinaryReader::visitTableGet(TableGet* curr) {
- Index tableIdx = getU32LEB();
- if (tableIdx >= wasm.tables.size()) {
- throwError("bad table index");
- }
- curr->index = popNonVoidExpression();
- curr->type = wasm.tables[tableIdx]->type;
- curr->table = getTableName(tableIdx);
- curr->finalize();
-}
-
-void WasmBinaryReader::visitTableSet(TableSet* curr) {
- Index tableIdx = getU32LEB();
- if (tableIdx >= wasm.tables.size()) {
- throwError("bad table index");
- }
- curr->value = popNonVoidExpression();
- curr->index = popNonVoidExpression();
- curr->table = getTableName(tableIdx);
- curr->finalize();
-}
-
-void WasmBinaryReader::visitTryOrTryInBlock(Expression*& out) {
- auto* curr = allocator.alloc<Try>();
- startControlFlow(curr);
- // For simplicity of implementation, like if scopes, we create a hidden block
- // within each try-body and catch-body, and let branches target those inner
- // blocks instead.
- curr->type = getType();
- curr->body = getBlockOrSingleton(curr->type);
-
- Builder builder(wasm);
- // A nameless label shared by all catch body blocks
- Name catchLabel = getNextLabel();
- breakStack.push_back({catchLabel, curr->type});
-
- auto readCatchBody = [&](Type tagType) {
- auto start = expressionStack.size();
- if (tagType != Type::none) {
- pushExpression(builder.makePop(tagType));
- }
- processExpressions();
- size_t end = expressionStack.size();
- if (start > end) {
- throwError("block cannot pop from outside");
- }
- if (end - start == 1) {
- curr->catchBodies.push_back(popExpression());
- } else {
- auto* block = allocator.alloc<Block>();
- pushBlockElements(block, curr->type, start);
- block->finalize(curr->type);
- curr->catchBodies.push_back(block);
- }
- };
-
- // We cannot immediately update tagRefs in the loop below, as catchTags is
- // being grown, an so references would get invalidated. Store the indexes
- // here, then do that later.
- std::vector<Index> tagIndexes;
-
- while (lastSeparator == BinaryConsts::Catch_Legacy ||
- lastSeparator == BinaryConsts::CatchAll_Legacy) {
- if (lastSeparator == BinaryConsts::Catch_Legacy) {
- auto index = getU32LEB();
- if (index >= wasm.tags.size()) {
- throwError("bad tag index");
- }
- tagIndexes.push_back(index);
- auto* tag = wasm.tags[index].get();
- curr->catchTags.push_back(tag->name);
- readCatchBody(tag->sig.params);
- } else { // catch_all
- if (curr->hasCatchAll()) {
- throwError("there should be at most one 'catch_all' clause per try");
- }
- readCatchBody(Type::none);
- }
- }
- breakStack.pop_back();
-
- for (Index i = 0; i < tagIndexes.size(); i++) {
- curr->catchTags[i] = getTagName(tagIndexes[i]);
- }
-
- if (lastSeparator == BinaryConsts::Delegate) {
- curr->delegateTarget = getExceptionTargetName(getU32LEB());
- }
-
- // For simplicity, we ensure that try's labels can only be targeted by
- // delegates and rethrows, and delegates/rethrows can only target try's
- // labels. (If they target blocks or loops, it is a validation failure.)
- // Because we create an inner block within each try and catch body, if any
- // delegate/rethrow targets those inner blocks, we should make them target the
- // try's label instead.
- curr->name = getNextLabel();
- if (auto* block = curr->body->dynCast<Block>()) {
- if (block->name.is()) {
- if (exceptionTargetNames.find(block->name) !=
- exceptionTargetNames.end()) {
- BranchUtils::replaceExceptionTargets(block, block->name, curr->name);
- exceptionTargetNames.erase(block->name);
- }
- }
- }
- if (exceptionTargetNames.find(catchLabel) != exceptionTargetNames.end()) {
- for (auto* catchBody : curr->catchBodies) {
- BranchUtils::replaceExceptionTargets(catchBody, catchLabel, curr->name);
- }
- exceptionTargetNames.erase(catchLabel);
- }
-
- // If catch bodies contained stacky code, 'pop's can be nested within a block.
- // Fix that up.
- EHUtils::handleBlockNestedPop(curr, currFunction, wasm);
- curr->finalize(curr->type);
-
- // For simplicity, we create an inner block within the catch body too, but the
- // one within the 'catch' *must* be omitted when we write out the binary back
- // later, because the 'catch' instruction pushes a value onto the stack and
- // the inner block does not support block input parameters without multivalue
- // support.
- // try
- // ...
- // catch $e ;; Pushes value(s) onto the stack
- // block ;; Inner block. Should be deleted when writing binary!
- // use the pushed value
- // end
- // end
- //
- // But when input binary code is like
- // try
- // ...
- // catch $e
- // br 0
- // end
- //
- // 'br 0' accidentally happens to target the inner block, creating code like
- // this in Binaryen IR, making the inner block not deletable, resulting in a
- // validation error:
- // (try
- // ...
- // (catch $e
- // (block $label0 ;; Cannot be deleted, because there's a branch to this
- // ...
- // (br $label0)
- // )
- // )
- // )
- //
- // When this happens, we fix this by creating a block that wraps the whole
- // try-catch, and making the branches target that block instead, like this:
- // (block $label ;; New enclosing block, new target for the branch
- // (try
- // ...
- // (catch $e
- // (block ;; Now this can be deleted when writing binary
- // ...
- // (br $label)
- // )
- // )
- // )
- // )
- if (breakTargetNames.find(catchLabel) == breakTargetNames.end()) {
- out = curr;
- } else {
- // Create a new block that encloses the whole try-catch
- auto* block = builder.makeBlock(catchLabel, curr);
- out = block;
- }
- breakTargetNames.erase(catchLabel);
-}
-
-void WasmBinaryReader::visitTryTable(TryTable* curr) {
-
- // For simplicity of implementation, like if scopes, we create a hidden block
- // within each try-body, and let branches target those inner blocks instead.
- curr->type = getType();
- auto numCatches = getU32LEB();
- // We cannot immediately update tagRefs in the loop below, as catchTags is
- // being grown, an so references would get invalidated. Store the indexes
- // here, then do that later.
- std::vector<Index> tagIndexes;
-
- for (size_t i = 0; i < numCatches; i++) {
- uint8_t code = getInt8();
- if (code == BinaryConsts::Catch || code == BinaryConsts::CatchRef) {
- auto index = getU32LEB();
- if (index >= wasm.tags.size()) {
- throwError("bad tag index");
- }
- tagIndexes.push_back(index);
- auto* tag = wasm.tags[index].get();
- curr->catchTags.push_back(tag->name);
- } else {
- tagIndexes.push_back(-1); // unused
- curr->catchTags.push_back(Name());
- }
- curr->catchDests.push_back(getBreakTarget(getU32LEB()).name);
- curr->catchRefs.push_back(code == BinaryConsts::CatchRef ||
- code == BinaryConsts::CatchAllRef);
- }
-
- for (Index i = 0; i < tagIndexes.size(); i++) {
- if (curr->catchTags[i]) {
- curr->catchTags[i] = getTagName(tagIndexes[i]);
- }
- }
-
- // catch_*** clauses should refer to block labels without entering the try
- // scope. So we do this after reading catch clauses.
- startControlFlow(curr);
- curr->body = getBlockOrSingleton(curr->type);
- curr->finalize(curr->type, &wasm);
-}
-
-void WasmBinaryReader::visitThrow(Throw* curr) {
- auto index = getU32LEB();
- if (index >= wasm.tags.size()) {
- throwError("bad tag index");
- }
- auto* tag = wasm.tags[index].get();
- curr->tag = tag->name;
- size_t num = tag->sig.params.size();
- curr->operands.resize(num);
- for (size_t i = 0; i < num; i++) {
- curr->operands[num - i - 1] = popNonVoidExpression();
- }
- curr->finalize();
-}
-
-void WasmBinaryReader::visitRethrow(Rethrow* curr) {
- curr->target = getExceptionTargetName(getU32LEB());
- // This special target is valid only for delegates
- if (curr->target == DELEGATE_CALLER_TARGET) {
- throwError(std::string("rethrow target cannot use internal name ") +
- DELEGATE_CALLER_TARGET.toString());
- }
- curr->finalize();
-}
-
-void WasmBinaryReader::visitThrowRef(ThrowRef* curr) {
- curr->exnref = popNonVoidExpression();
- curr->finalize();
-}
-
-void WasmBinaryReader::visitCallRef(CallRef* curr) {
- curr->target = popNonVoidExpression();
- HeapType heapType = getTypeByIndex(getU32LEB());
- if (!Type::isSubType(curr->target->type, Type(heapType, Nullable))) {
- throwError("Call target has invalid type: " +
- curr->target->type.toString());
- }
- if (!heapType.isSignature()) {
- throwError("Invalid reference type for a call_ref: " + heapType.toString());
- }
- auto sig = heapType.getSignature();
- auto num = sig.params.size();
- curr->operands.resize(num);
- for (size_t i = 0; i < num; i++) {
- curr->operands[num - i - 1] = popNonVoidExpression();
- }
- // If the target has bottom type, we won't be able to infer the correct type
- // from it, so set the type manually to be safe.
- curr->type = sig.results;
- curr->finalize();
-}
-
-bool WasmBinaryReader::maybeVisitRefI31(Expression*& out, uint32_t code) {
- Shareability share;
- switch (code) {
- case BinaryConsts::RefI31:
- share = Unshared;
- break;
- case BinaryConsts::RefI31Shared:
- share = Shared;
- break;
- default:
- return false;
- }
- auto* value = popNonVoidExpression();
- out = Builder(wasm).makeRefI31(value, share);
- return true;
-}
-
-bool WasmBinaryReader::maybeVisitI31Get(Expression*& out, uint32_t code) {
- I31Get* curr;
- switch (code) {
- case BinaryConsts::I31GetS:
- curr = allocator.alloc<I31Get>();
- curr->signed_ = true;
- break;
- case BinaryConsts::I31GetU:
- curr = allocator.alloc<I31Get>();
- curr->signed_ = false;
- break;
- default:
- return false;
- }
- curr->i31 = popNonVoidExpression();
- curr->finalize();
- out = curr;
- return true;
-}
-
-bool WasmBinaryReader::maybeVisitRefTest(Expression*& out, uint32_t code) {
- if (code == BinaryConsts::RefTest || code == BinaryConsts::RefTestNull) {
- auto castType = getHeapType();
- auto nullability =
- (code == BinaryConsts::RefTestNull) ? Nullable : NonNullable;
- auto* ref = popNonVoidExpression();
- out = Builder(wasm).makeRefTest(ref, Type(castType, nullability));
- return true;
- }
- return false;
-}
-
-bool WasmBinaryReader::maybeVisitRefCast(Expression*& out, uint32_t code) {
- if (code == BinaryConsts::RefCast || code == BinaryConsts::RefCastNull) {
- auto heapType = getHeapType();
- auto nullability = code == BinaryConsts::RefCast ? NonNullable : Nullable;
- auto type = Type(heapType, nullability);
- auto* ref = popNonVoidExpression();
- out = Builder(wasm).makeRefCast(ref, type);
- return true;
- }
- return false;
-}
-
-bool WasmBinaryReader::maybeVisitBrOn(Expression*& out, uint32_t code) {
- Type castType = Type::none;
- BrOnOp op;
- switch (code) {
- case BinaryConsts::BrOnNull:
- op = BrOnNull;
- break;
- case BinaryConsts::BrOnNonNull:
- op = BrOnNonNull;
- break;
- case BinaryConsts::BrOnCast:
- op = BrOnCast;
- break;
- case BinaryConsts::BrOnCastFail:
- op = BrOnCastFail;
- break;
- default:
- return false;
- }
- bool isCast =
- code == BinaryConsts::BrOnCast || code == BinaryConsts::BrOnCastFail;
- uint8_t flags = 0;
- if (isCast) {
- flags = getInt8();
- }
- auto name = getBreakTarget(getU32LEB()).name;
- auto* ref = popNonVoidExpression();
- if (!ref->type.isRef() && ref->type != Type::unreachable) {
- throwError("bad input type for br_on*");
- }
- if (isCast) {
- auto inputNullability = (flags & 1) ? Nullable : NonNullable;
- auto castNullability = (flags & 2) ? Nullable : NonNullable;
- auto inputHeapType = getHeapType();
- auto castHeapType = getHeapType();
- castType = Type(castHeapType, castNullability);
- auto inputType = Type(inputHeapType, inputNullability);
- if (!Type::isSubType(castType, inputType)) {
- throwError("br_on_cast* cast type must be subtype of input type");
- }
- if (!Type::isSubType(ref->type, inputType)) {
- throwError(std::string("Invalid reference type for ") +
- ((op == BrOnCast) ? "br_on_cast" : "br_on_cast_fail"));
- }
- }
- out = Builder(wasm).makeBrOn(op, name, ref, castType);
- return true;
-}
-
-bool WasmBinaryReader::maybeVisitStructNew(Expression*& out, uint32_t code) {
- if (code == BinaryConsts::StructNew ||
- code == BinaryConsts::StructNewDefault) {
- auto heapType = getIndexedHeapType();
- if (!heapType.isStruct()) {
- throwError("Expected struct heaptype");
- }
- std::vector<Expression*> operands;
- if (code == BinaryConsts::StructNew) {
- auto numOperands = heapType.getStruct().fields.size();
- operands.resize(numOperands);
- for (Index i = 0; i < numOperands; i++) {
- operands[numOperands - i - 1] = popNonVoidExpression();
- }
- }
- out = Builder(wasm).makeStructNew(heapType, operands);
- return true;
- }
- return false;
-}
-
-bool WasmBinaryReader::maybeVisitStructGet(Expression*& out, uint32_t code) {
- bool signed_ = false;
- switch (code) {
- case BinaryConsts::StructGet:
- case BinaryConsts::StructGetU:
- break;
- case BinaryConsts::StructGetS:
- signed_ = true;
- break;
- default:
- return false;
- }
- auto heapType = getIndexedHeapType();
- if (!heapType.isStruct()) {
- throwError("Expected struct heaptype");
- }
- auto index = getU32LEB();
- if (index >= heapType.getStruct().fields.size()) {
- throwError("Struct field index out of bounds");
- }
- auto type = heapType.getStruct().fields[index].type;
- auto ref = popNonVoidExpression();
- validateHeapTypeUsingChild(ref, heapType);
- out = Builder(wasm).makeStructGet(index, ref, type, signed_);
- return true;
-}
-
-bool WasmBinaryReader::maybeVisitStructSet(Expression*& out, uint32_t code) {
- if (code != BinaryConsts::StructSet) {
- return false;
- }
- auto* curr = allocator.alloc<StructSet>();
- auto heapType = getIndexedHeapType();
- if (!heapType.isStruct()) {
- throwError("Expected struct heaptype");
- }
- curr->index = getU32LEB();
- curr->value = popNonVoidExpression();
- curr->ref = popNonVoidExpression();
- validateHeapTypeUsingChild(curr->ref, heapType);
- curr->finalize();
- out = curr;
- return true;
-}
-
-bool WasmBinaryReader::maybeVisitArrayNewData(Expression*& out, uint32_t code) {
- if (code == BinaryConsts::ArrayNew || code == BinaryConsts::ArrayNewDefault) {
- auto heapType = getIndexedHeapType();
- if (!heapType.isArray()) {
- throwError("Expected array heaptype");
- }
- auto* size = popNonVoidExpression();
- Expression* init = nullptr;
- if (code == BinaryConsts::ArrayNew) {
- init = popNonVoidExpression();
- }
- out = Builder(wasm).makeArrayNew(heapType, size, init);
- return true;
- }
- return false;
-}
-
-bool WasmBinaryReader::maybeVisitArrayNewElem(Expression*& out, uint32_t code) {
- if (code == BinaryConsts::ArrayNewData ||
- code == BinaryConsts::ArrayNewElem) {
- auto isData = code == BinaryConsts::ArrayNewData;
- auto heapType = getIndexedHeapType();
- if (!heapType.isArray()) {
- throwError("Expected array heaptype");
- }
- auto segIdx = getU32LEB();
- auto* size = popNonVoidExpression();
- auto* offset = popNonVoidExpression();
- if (isData) {
- auto* curr = Builder(wasm).makeArrayNewData(
- heapType, getDataName(segIdx), offset, size);
- out = curr;
- } else {
- auto* curr = Builder(wasm).makeArrayNewElem(
- heapType, getElemName(segIdx), offset, size);
- out = curr;
- }
- return true;
- }
- return false;
-}
-
-bool WasmBinaryReader::maybeVisitArrayNewFixed(Expression*& out,
- uint32_t code) {
- if (code == BinaryConsts::ArrayNewFixed) {
- auto heapType = getIndexedHeapType();
- if (!heapType.isArray()) {
- throwError("Expected array heaptype");
- }
- auto size = getU32LEB();
- std::vector<Expression*> values(size);
- for (size_t i = 0; i < size; i++) {
- values[size - i - 1] = popNonVoidExpression();
- }
- out = Builder(wasm).makeArrayNewFixed(heapType, values);
- return true;
- }
- return false;
-}
-
-bool WasmBinaryReader::maybeVisitArrayGet(Expression*& out, uint32_t code) {
- bool signed_ = false;
- switch (code) {
- case BinaryConsts::ArrayGet:
- case BinaryConsts::ArrayGetU:
- break;
- case BinaryConsts::ArrayGetS:
- signed_ = true;
- break;
- default:
- return false;
- }
- auto heapType = getIndexedHeapType();
- if (!heapType.isArray()) {
- throwError("Expected array heaptype");
- }
- auto type = heapType.getArray().element.type;
- auto* index = popNonVoidExpression();
- auto* ref = popNonVoidExpression();
- validateHeapTypeUsingChild(ref, heapType);
- out = Builder(wasm).makeArrayGet(ref, index, type, signed_);
- return true;
-}
-
-bool WasmBinaryReader::maybeVisitArraySet(Expression*& out, uint32_t code) {
- if (code != BinaryConsts::ArraySet) {
- return false;
- }
- auto heapType = getIndexedHeapType();
- if (!heapType.isArray()) {
- throwError("Expected array heaptype");
- }
- auto* value = popNonVoidExpression();
- auto* index = popNonVoidExpression();
- auto* ref = popNonVoidExpression();
- validateHeapTypeUsingChild(ref, heapType);
- out = Builder(wasm).makeArraySet(ref, index, value);
- return true;
-}
-
-bool WasmBinaryReader::maybeVisitArrayLen(Expression*& out, uint32_t code) {
- if (code != BinaryConsts::ArrayLen) {
- return false;
- }
- auto* ref = popNonVoidExpression();
- out = Builder(wasm).makeArrayLen(ref);
- return true;
-}
-
-bool WasmBinaryReader::maybeVisitArrayCopy(Expression*& out, uint32_t code) {
- if (code != BinaryConsts::ArrayCopy) {
- return false;
- }
- auto destHeapType = getIndexedHeapType();
- if (!destHeapType.isArray()) {
- throwError("Expected array heaptype");
- }
- auto srcHeapType = getIndexedHeapType();
- if (!srcHeapType.isArray()) {
- throwError("Expected array heaptype");
- }
- auto* length = popNonVoidExpression();
- auto* srcIndex = popNonVoidExpression();
- auto* srcRef = popNonVoidExpression();
- auto* destIndex = popNonVoidExpression();
- auto* destRef = popNonVoidExpression();
- validateHeapTypeUsingChild(destRef, destHeapType);
- validateHeapTypeUsingChild(srcRef, srcHeapType);
- out =
- Builder(wasm).makeArrayCopy(destRef, destIndex, srcRef, srcIndex, length);
- return true;
-}
-
-bool WasmBinaryReader::maybeVisitArrayFill(Expression*& out, uint32_t code) {
- if (code != BinaryConsts::ArrayFill) {
- return false;
- }
- auto heapType = getIndexedHeapType();
- if (!heapType.isArray()) {
- throwError("Expected array heaptype");
- }
- auto* size = popNonVoidExpression();
- auto* value = popNonVoidExpression();
- auto* index = popNonVoidExpression();
- auto* ref = popNonVoidExpression();
- validateHeapTypeUsingChild(ref, heapType);
- out = Builder(wasm).makeArrayFill(ref, index, value, size);
- return true;
-}
-
-bool WasmBinaryReader::maybeVisitArrayInit(Expression*& out, uint32_t code) {
- bool isData = true;
- switch (code) {
- case BinaryConsts::ArrayInitData:
- break;
- case BinaryConsts::ArrayInitElem:
- isData = false;
- break;
- default:
- return false;
- }
- auto heapType = getIndexedHeapType();
- if (!heapType.isArray()) {
- throwError("Expected array heaptype");
- }
- Index segIdx = getU32LEB();
- auto* size = popNonVoidExpression();
- auto* offset = popNonVoidExpression();
- auto* index = popNonVoidExpression();
- auto* ref = popNonVoidExpression();
- validateHeapTypeUsingChild(ref, heapType);
- if (isData) {
- auto* curr = Builder(wasm).makeArrayInitData(
- getDataName(segIdx), ref, index, offset, size);
- out = curr;
- } else {
- auto* curr = Builder(wasm).makeArrayInitElem(
- getElemName(segIdx), ref, index, offset, size);
- out = curr;
- }
- return true;
-}
-
-bool WasmBinaryReader::maybeVisitStringNew(Expression*& out, uint32_t code) {
- StringNewOp op;
- if (code == BinaryConsts::StringNewLossyUTF8Array) {
- op = StringNewLossyUTF8Array;
- } else if (code == BinaryConsts::StringNewWTF16Array) {
- op = StringNewWTF16Array;
- } else if (code == BinaryConsts::StringFromCodePoint) {
- out = Builder(wasm).makeStringNew(StringNewFromCodePoint,
- popNonVoidExpression());
- return true;
- } else {
- return false;
- }
- Expression* end = popNonVoidExpression();
- Expression* start = popNonVoidExpression();
- auto* ref = popNonVoidExpression();
- out = Builder(wasm).makeStringNew(op, ref, start, end);
- return true;
-}
-
-bool WasmBinaryReader::maybeVisitStringAsWTF16(Expression*& out,
- uint32_t code) {
- if (code != BinaryConsts::StringAsWTF16) {
- return false;
- }
- // Accept but ignore `string.as_wtf16`, parsing the next expression in its
- // place. We do not support this instruction in the IR, but we need to accept
- // it in the parser because it is emitted as part of the instruction sequence
- // for `stringview_wtf16.get_codeunit` and `stringview_wtf16.slice`.
- readExpression(out);
- return true;
-}
-
-bool WasmBinaryReader::maybeVisitStringConst(Expression*& out, uint32_t code) {
- if (code != BinaryConsts::StringConst) {
- return false;
- }
- auto index = getU32LEB();
- if (index >= strings.size()) {
- throwError("bad string index");
- }
- out = Builder(wasm).makeStringConst(strings[index]);
- return true;
-}
-
-bool WasmBinaryReader::maybeVisitStringMeasure(Expression*& out,
- uint32_t code) {
- StringMeasureOp op;
- if (code == BinaryConsts::StringMeasureUTF8) {
- op = StringMeasureUTF8;
- } else if (code == BinaryConsts::StringMeasureWTF16) {
- op = StringMeasureWTF16;
- } else {
- return false;
- }
- auto* ref = popNonVoidExpression();
- out = Builder(wasm).makeStringMeasure(op, ref);
- return true;
-}
-
-bool WasmBinaryReader::maybeVisitStringEncode(Expression*& out, uint32_t code) {
- StringEncodeOp op;
- if (code == BinaryConsts::StringEncodeLossyUTF8Array) {
- op = StringEncodeLossyUTF8Array;
- } else if (code == BinaryConsts::StringEncodeWTF16Array) {
- op = StringEncodeWTF16Array;
- } else {
- return false;
- }
- auto* start = popNonVoidExpression();
- auto* ptr = popNonVoidExpression();
- auto* ref = popNonVoidExpression();
- out = Builder(wasm).makeStringEncode(op, ref, ptr, start);
- return true;
-}
-
-bool WasmBinaryReader::maybeVisitStringConcat(Expression*& out, uint32_t code) {
- if (code != BinaryConsts::StringConcat) {
- return false;
- }
- auto* right = popNonVoidExpression();
- auto* left = popNonVoidExpression();
- out = Builder(wasm).makeStringConcat(left, right);
- return true;
-}
-
-bool WasmBinaryReader::maybeVisitStringEq(Expression*& out, uint32_t code) {
- StringEqOp op;
- if (code == BinaryConsts::StringEq) {
- op = StringEqEqual;
- } else if (code == BinaryConsts::StringCompare) {
- op = StringEqCompare;
- } else {
- return false;
- }
- auto* right = popNonVoidExpression();
- auto* left = popNonVoidExpression();
- out = Builder(wasm).makeStringEq(op, left, right);
- return true;
-}
-
-bool WasmBinaryReader::maybeVisitStringWTF16Get(Expression*& out,
- uint32_t code) {
- if (code != BinaryConsts::StringViewWTF16GetCodePoint) {
- return false;
- }
- auto* pos = popNonVoidExpression();
- auto* ref = popNonVoidExpression();
- out = Builder(wasm).makeStringWTF16Get(ref, pos);
- return true;
-}
-
-bool WasmBinaryReader::maybeVisitStringSliceWTF(Expression*& out,
- uint32_t code) {
- if (code != BinaryConsts::StringViewWTF16Slice) {
- return false;
- }
- auto* end = popNonVoidExpression();
- auto* start = popNonVoidExpression();
- auto* ref = popNonVoidExpression();
- out = Builder(wasm).makeStringSliceWTF(ref, start, end);
- return true;
-}
-
-void WasmBinaryReader::visitRefAs(RefAs* curr, uint8_t code) {
- switch (code) {
- case BinaryConsts::RefAsNonNull:
- curr->op = RefAsNonNull;
- break;
- case BinaryConsts::AnyConvertExtern:
- curr->op = AnyConvertExtern;
- break;
- case BinaryConsts::ExternConvertAny:
- curr->op = ExternConvertAny;
- break;
- default:
- WASM_UNREACHABLE("invalid code for ref.as_*");
- }
- curr->value = popNonVoidExpression();
- if (!curr->value->type.isRef() && curr->value->type != Type::unreachable) {
- throwError("bad input type for ref.as: " + curr->value->type.toString());
- }
- curr->finalize();
-}
-
-void WasmBinaryReader::visitContBind(ContBind* curr) {
-
- auto contTypeBeforeIndex = getU32LEB();
- curr->contTypeBefore = getTypeByIndex(contTypeBeforeIndex);
-
- auto contTypeAfterIndex = getU32LEB();
- curr->contTypeAfter = getTypeByIndex(contTypeAfterIndex);
-
- for (auto& ct : {curr->contTypeBefore, curr->contTypeAfter}) {
- if (!ct.isContinuation()) {
- throwError("non-continuation type in cont.bind instruction " +
- ct.toString());
- }
- }
-
- curr->cont = popNonVoidExpression();
-
- size_t paramsBefore =
- curr->contTypeBefore.getContinuation().type.getSignature().params.size();
- size_t paramsAfter =
- curr->contTypeAfter.getContinuation().type.getSignature().params.size();
- if (paramsBefore < paramsAfter) {
- throwError("incompatible continuation types in cont.bind: source type " +
- curr->contTypeBefore.toString() +
- " has fewer parameters than destination " +
- curr->contTypeAfter.toString());
- }
- size_t numArgs = paramsBefore - paramsAfter;
- curr->operands.resize(numArgs);
- for (size_t i = 0; i < numArgs; i++) {
- curr->operands[numArgs - i - 1] = popNonVoidExpression();
- }
-
- curr->finalize();
-}
-
-void WasmBinaryReader::visitContNew(ContNew* curr) {
-
- auto contTypeIndex = getU32LEB();
- curr->contType = getTypeByIndex(contTypeIndex);
- if (!curr->contType.isContinuation()) {
- throwError("non-continuation type in cont.new instruction " +
- curr->contType.toString());
- }
-
- curr->func = popNonVoidExpression();
- curr->finalize();
-}
-
-void WasmBinaryReader::visitResume(Resume* curr) {
-
- auto contTypeIndex = getU32LEB();
- curr->contType = getTypeByIndex(contTypeIndex);
- if (!curr->contType.isContinuation()) {
- throwError("non-continuation type in resume instruction " +
- curr->contType.toString());
- }
-
- auto numHandlers = getU32LEB();
-
- // We *must* bring the handlerTags vector to an appropriate size to ensure
- // that we do not invalidate the pointers we add to tagRefs. They need to stay
- // valid until processNames ran.
- curr->handlerTags.resize(numHandlers);
- curr->handlerBlocks.resize(numHandlers);
-
- for (size_t i = 0; i < numHandlers; i++) {
- auto tagIndex = getU32LEB();
- auto tag = getTagName(tagIndex);
-
- auto handlerIndex = getU32LEB();
- auto handler = getBreakTarget(handlerIndex).name;
-
- curr->handlerTags[i] = tag;
- curr->handlerBlocks[i] = handler;
- }
-
- curr->cont = popNonVoidExpression();
-
- auto numArgs =
- curr->contType.getContinuation().type.getSignature().params.size();
- curr->operands.resize(numArgs);
- for (size_t i = 0; i < numArgs; i++) {
- curr->operands[numArgs - i - 1] = popNonVoidExpression();
- }
-
- curr->finalize(&wasm);
-}
-
-void WasmBinaryReader::visitSuspend(Suspend* curr) {
-
- auto tagIndex = getU32LEB();
- if (tagIndex >= wasm.tags.size()) {
- throwError("bad tag index");
- }
- auto* tag = wasm.tags[tagIndex].get();
- curr->tag = tag->name;
-
- auto numArgs = tag->sig.params.size();
- curr->operands.resize(numArgs);
- for (size_t i = 0; i < numArgs; i++) {
- curr->operands[numArgs - i - 1] = popNonVoidExpression();
- }
-
- curr->finalize(&wasm);
-}
-
-void WasmBinaryReader::throwError(std::string text) {
- throw ParseException(text, 0, pos);
-}
-
-void WasmBinaryReader::validateHeapTypeUsingChild(Expression* child,
- HeapType heapType) {
- if (child->type == Type::unreachable) {
- return;
- }
- if (!child->type.isRef() ||
- !HeapType::isSubType(child->type.getHeapType(), heapType)) {
- throwError("bad heap type: expected " + heapType.toString() +
- " but found " + child->type.toString());
- }
+// TODO: make this the only version
+std::tuple<Name, Address, Address> WasmBinaryReader::getMemarg() {
+ Address alignment, offset;
+ auto memIdx = readMemoryAccess(alignment, offset);
+ return {getMemoryName(memIdx), alignment, offset};
}
} // namespace wasm
diff --git a/src/wasm/wasm-ir-builder.cpp b/src/wasm/wasm-ir-builder.cpp
index 54cd0149e..fcb1fc48d 100644
--- a/src/wasm/wasm-ir-builder.cpp
+++ b/src/wasm/wasm-ir-builder.cpp
@@ -150,6 +150,12 @@ void IRBuilder::push(Expression* expr) {
scope.exprStack.push_back(expr);
applyDebugLoc(expr);
+ if (binaryPos && func && lastBinaryPos != *binaryPos) {
+ func->expressionLocations[expr] =
+ BinaryLocations::Span{BinaryLocation(lastBinaryPos - codeSectionOffset),
+ BinaryLocation(*binaryPos - codeSectionOffset)};
+ lastBinaryPos = *binaryPos;
+ }
DBG(std::cerr << "After pushing " << ShallowExpression{expr} << ":\n");
DBG(dump());
@@ -708,6 +714,11 @@ Result<> IRBuilder::visitFunctionStart(Function* func) {
debugLoc = CanReceiveDebug();
scopeStack.push_back(ScopeCtx::makeFunc(func));
this->func = func;
+
+ if (binaryPos) {
+ lastBinaryPos = *binaryPos;
+ }
+
return Ok{};
}
@@ -841,6 +852,12 @@ Result<> IRBuilder::visitElse() {
auto expr = finishScope();
CHECK_ERR(expr);
iff->ifTrue = *expr;
+
+ if (binaryPos && func) {
+ func->delimiterLocations[iff][BinaryLocations::Else] =
+ lastBinaryPos - codeSectionOffset;
+ }
+
pushScope(ScopeCtx::makeElse(iff, originalLabel, label, labelUsed));
return Ok{};
}
@@ -868,6 +885,12 @@ Result<> IRBuilder::visitCatch(Name tag) {
tryy->catchBodies.push_back(*expr);
}
tryy->catchTags.push_back(tag);
+
+ if (binaryPos && func) {
+ auto& delimiterLocs = func->delimiterLocations[tryy];
+ delimiterLocs[delimiterLocs.size()] = lastBinaryPos - codeSectionOffset;
+ }
+
pushScope(
ScopeCtx::makeCatch(tryy, originalLabel, label, labelUsed, branchLabel));
// Push a pop for the exception payload if necessary.
@@ -878,6 +901,7 @@ Result<> IRBuilder::visitCatch(Name tag) {
scopeStack[0].notePop();
push(builder.makePop(params));
}
+
return Ok{};
}
@@ -903,6 +927,12 @@ Result<> IRBuilder::visitCatchAll() {
} else {
tryy->catchBodies.push_back(*expr);
}
+
+ if (binaryPos && func) {
+ auto& delimiterLocs = func->delimiterLocations[tryy];
+ delimiterLocs[delimiterLocs.size()] = lastBinaryPos - codeSectionOffset;
+ }
+
pushScope(
ScopeCtx::makeCatchAll(tryy, originalLabel, label, labelUsed, branchLabel));
return Ok{};
@@ -980,6 +1010,10 @@ Result<> IRBuilder::visitEnd() {
return block;
};
+ // The binary position we record for the block instruction should start at the
+ // beginning of the block, not at the beginning of the `end`.
+ lastBinaryPos = scope.startPos;
+
if (auto* func = scope.getFunction()) {
func->body = maybeWrapForLabel(*expr);
labelDepths.clear();
diff --git a/test/br_to_exit.wasm.fromBinary b/test/br_to_exit.wasm.fromBinary
index faee4e21b..a25acc937 100644
--- a/test/br_to_exit.wasm.fromBinary
+++ b/test/br_to_exit.wasm.fromBinary
@@ -1,8 +1,8 @@
(module
(type $0 (func))
(func $0
- (block $label$0
- (br $label$0)
+ (block $label
+ (br $label)
)
)
)
diff --git a/test/br_to_try.wasm.fromBinary b/test/br_to_try.wasm.fromBinary
index 4a1f7be37..a3bed8ee0 100644
--- a/test/br_to_try.wasm.fromBinary
+++ b/test/br_to_try.wasm.fromBinary
@@ -3,15 +3,15 @@
(type $1 (func))
(tag $tag$0 (param i32))
(func $0
- (try $label$3
- (do
- (block $label$1
- (br $label$1)
+ (block $label
+ (try
+ (do
+ (br $label)
)
- )
- (catch $tag$0
- (drop
- (pop i32)
+ (catch $tag$0
+ (drop
+ (pop i32)
+ )
)
)
)
diff --git a/test/break-to-return.wasm.fromBinary b/test/break-to-return.wasm.fromBinary
index d9c1f4fdd..8492cb007 100644
--- a/test/break-to-return.wasm.fromBinary
+++ b/test/break-to-return.wasm.fromBinary
@@ -3,8 +3,8 @@
(memory $0 256 256)
(export "add" (func $0))
(func $0 (param $0 i32) (param $1 i32) (result i32)
- (block $label$0 (result i32)
- (br $label$0
+ (block $label (result i32)
+ (br $label
(i32.add
(local.get $0)
(local.get $1)
diff --git a/test/break-within-catch.wasm.fromBinary b/test/break-within-catch.wasm.fromBinary
index 3fe738104..7d151f48c 100644
--- a/test/break-within-catch.wasm.fromBinary
+++ b/test/break-within-catch.wasm.fromBinary
@@ -3,8 +3,8 @@
(type $1 (func))
(tag $tag$0 (param i32))
(func $0
- (block $label$2
- (try $label$3
+ (block $label
+ (try
(do
(nop)
)
@@ -12,7 +12,7 @@
(drop
(pop i32)
)
- (br $label$2)
+ (br $label)
)
)
)
diff --git a/test/consume-stacky.wasm.fromBinary b/test/consume-stacky.wasm.fromBinary
index 25cc9a541..76ec73d7b 100644
--- a/test/consume-stacky.wasm.fromBinary
+++ b/test/consume-stacky.wasm.fromBinary
@@ -2,15 +2,15 @@
(type $0 (func (result i32)))
(memory $0 1 1)
(func $0 (result i32)
- (local $0 i32)
- (local.set $0
+ (local $scratch i32)
+ (local.set $scratch
(i32.const 1)
)
(i32.store
(i32.const 2)
(i32.const 3)
)
- (local.get $0)
+ (local.get $scratch)
)
)
diff --git a/test/elided-br.wasm.fromBinary b/test/elided-br.wasm.fromBinary
index 04ec30dfb..24331dbb5 100644
--- a/test/elided-br.wasm.fromBinary
+++ b/test/elided-br.wasm.fromBinary
@@ -1,8 +1,11 @@
(module
(type $0 (func))
(func $0
- (block $label$1
+ (block $block
(unreachable)
+ (block
+ (br $block)
+ )
)
)
)
diff --git a/test/example/c-api-unused-mem.txt b/test/example/c-api-unused-mem.txt
index 36d0a9a6b..48ea5982f 100644
--- a/test/example/c-api-unused-mem.txt
+++ b/test/example/c-api-unused-mem.txt
@@ -47,13 +47,13 @@
(local $0 i32)
(local $1 i32)
(local $2 i64)
- (block $label$1
+ (block $block
(local.set $0
(i32.load
(i32.const 0)
)
)
- (br $label$1)
+ (br $block)
)
(i32.store
(i32.const 0)
diff --git a/test/fib-dbg.wasm.fromBinary b/test/fib-dbg.wasm.fromBinary
index f1b263234..58c86ec71 100644
--- a/test/fib-dbg.wasm.fromBinary
+++ b/test/fib-dbg.wasm.fromBinary
@@ -50,7 +50,7 @@
(export "stackAlloc" (func $stackAlloc))
(func $stackAlloc (param $0 i32) (result i32)
(local $1 i32)
- (block $label$1
+ (block
(local.set $1
(global.get $global$3)
)
@@ -72,7 +72,9 @@
(return
(local.get $1)
)
+ (unreachable)
)
+ (unreachable)
)
(func $stackSave (result i32)
(return
@@ -85,13 +87,11 @@
)
)
(func $establishStackSpace (param $0 i32) (param $1 i32)
- (block $label$1
- (global.set $global$3
- (local.get $0)
- )
- (global.set $global$4
- (local.get $1)
- )
+ (global.set $global$3
+ (local.get $0)
+ )
+ (global.set $global$4
+ (local.get $1)
)
)
(func $setThrew (param $0 i32) (param $1 i32)
@@ -122,7 +122,7 @@
(local $9 i32)
(local $10 i32)
(local $11 i32)
- (block $label$1
+ (block
(local.set $11
(global.get $global$3)
)
@@ -158,8 +158,8 @@
)
)
;;@ fib.c:8:0
- (loop $label$4
- (block $label$5
+ (loop $label
+ (block $block
;;@ fib.c:4:0
(local.set $3
(i32.add
@@ -188,7 +188,7 @@
(local.set $4
(local.get $3)
)
- (br $label$5)
+ (br $block)
)
(else
(local.set $2
@@ -206,15 +206,21 @@
)
)
;;@ fib.c:3:0
- (br $label$4)
+ (br $label)
)
)
;;@ fib.c:8:0
(return
(local.get $4)
)
+ ;;@ fib.c:8:0
+ (unreachable)
+ ;;@ fib.c:8:0
+ (unreachable)
)
;;@ fib.c:8:0
+ (unreachable)
+ ;;@ fib.c:8:0
)
(func $runPostSets
(local $0 i32)
diff --git a/test/fn_prolog_epilog.debugInfo.wasm.fromBinary b/test/fn_prolog_epilog.debugInfo.wasm.fromBinary
index ff96a6a47..73b8d1d42 100644
--- a/test/fn_prolog_epilog.debugInfo.wasm.fromBinary
+++ b/test/fn_prolog_epilog.debugInfo.wasm.fromBinary
@@ -4,10 +4,10 @@
(func $0
(nop)
;;@ src.cpp:2:1
- (block $label$1
+ (block
;;@ src.cpp:2:2
- (block $label$2
- (br $label$2)
+ (block $block
+ (br $block)
)
)
;;@ src.cpp:3:1
diff --git a/test/lit/basic/exception-handling-legacy.wast b/test/lit/basic/exception-handling-legacy.wast
index 70cc3f5bc..791745b69 100644
--- a/test/lit/basic/exception-handling-legacy.wast
+++ b/test/lit/basic/exception-handling-legacy.wast
@@ -76,7 +76,7 @@
;; CHECK-TEXT-NEXT: )
;; CHECK-TEXT-NEXT: )
;; CHECK-BIN: (func $simple-try-catch (type $0)
- ;; CHECK-BIN-NEXT: (try $label$3
+ ;; CHECK-BIN-NEXT: (try
;; CHECK-BIN-NEXT: (do
;; CHECK-BIN-NEXT: (throw $e-i32
;; CHECK-BIN-NEXT: (i32.const 0)
@@ -124,9 +124,10 @@
;; CHECK-BIN: (func $try-catch-multivalue-tag (type $0)
;; CHECK-BIN-NEXT: (local $x i32)
;; CHECK-BIN-NEXT: (local $1 i64)
- ;; CHECK-BIN-NEXT: (local $2 (tuple i32 i64))
- ;; CHECK-BIN-NEXT: (local $3 i32)
- ;; CHECK-BIN-NEXT: (try $label$3
+ ;; CHECK-BIN-NEXT: (local $scratch (tuple i32 i64))
+ ;; CHECK-BIN-NEXT: (local $scratch_3 i32)
+ ;; CHECK-BIN-NEXT: (local $4 (tuple i32 i64))
+ ;; CHECK-BIN-NEXT: (try
;; CHECK-BIN-NEXT: (do
;; CHECK-BIN-NEXT: (throw $e-i32-i64
;; CHECK-BIN-NEXT: (i32.const 0)
@@ -134,26 +135,30 @@
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (catch $e-i32-i64
- ;; CHECK-BIN-NEXT: (local.set $2
+ ;; CHECK-BIN-NEXT: (local.set $4
;; CHECK-BIN-NEXT: (pop (tuple i32 i64))
;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: (local.set $x
- ;; CHECK-BIN-NEXT: (block (result i32)
- ;; CHECK-BIN-NEXT: (local.set $3
- ;; CHECK-BIN-NEXT: (tuple.extract 2 0
- ;; CHECK-BIN-NEXT: (local.get $2)
+ ;; CHECK-BIN-NEXT: (block
+ ;; CHECK-BIN-NEXT: (local.set $x
+ ;; CHECK-BIN-NEXT: (block (result i32)
+ ;; CHECK-BIN-NEXT: (local.set $scratch_3
+ ;; CHECK-BIN-NEXT: (tuple.extract 2 0
+ ;; CHECK-BIN-NEXT: (local.tee $scratch
+ ;; CHECK-BIN-NEXT: (local.get $4)
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: (local.set $1
- ;; CHECK-BIN-NEXT: (tuple.extract 2 1
- ;; CHECK-BIN-NEXT: (local.get $2)
+ ;; CHECK-BIN-NEXT: (local.set $1
+ ;; CHECK-BIN-NEXT: (tuple.extract 2 1
+ ;; CHECK-BIN-NEXT: (local.get $scratch)
+ ;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (local.get $scratch_3)
;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: (local.get $3)
;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: (drop
- ;; CHECK-BIN-NEXT: (local.get $x)
+ ;; CHECK-BIN-NEXT: (drop
+ ;; CHECK-BIN-NEXT: (local.get $x)
+ ;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
@@ -190,18 +195,19 @@
;; CHECK-TEXT-NEXT: )
;; CHECK-TEXT-NEXT: )
;; CHECK-BIN: (func $try-with-block-label (type $0)
- ;; CHECK-BIN-NEXT: (block $label$1
- ;; CHECK-BIN-NEXT: (try $label$4
+ ;; CHECK-BIN-NEXT: (block $block
+ ;; CHECK-BIN-NEXT: (try
;; CHECK-BIN-NEXT: (do
- ;; CHECK-BIN-NEXT: (br $label$1)
+ ;; CHECK-BIN-NEXT: (br $block)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (catch $e-i32
;; CHECK-BIN-NEXT: (drop
;; CHECK-BIN-NEXT: (pop i32)
;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: (br $label$1)
+ ;; CHECK-BIN-NEXT: (br $block)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (unreachable)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
(func $try-with-block-label
@@ -228,7 +234,7 @@
;; CHECK-TEXT-NEXT: )
;; CHECK-TEXT-NEXT: )
;; CHECK-BIN: (func $empty-try-body (type $0)
- ;; CHECK-BIN-NEXT: (try $label$3
+ ;; CHECK-BIN-NEXT: (try
;; CHECK-BIN-NEXT: (do
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (catch $e-i32
@@ -263,7 +269,7 @@
;; CHECK-TEXT-NEXT: )
;; CHECK-TEXT-NEXT: )
;; CHECK-BIN: (func $multiple-insts-within-try-and-catch-bodies (type $0)
- ;; CHECK-BIN-NEXT: (try $label$3
+ ;; CHECK-BIN-NEXT: (try
;; CHECK-BIN-NEXT: (do
;; CHECK-BIN-NEXT: (call $foo)
;; CHECK-BIN-NEXT: (call $bar)
@@ -311,7 +317,7 @@
;; CHECK-TEXT-NEXT: )
;; CHECK-TEXT-NEXT: )
;; CHECK-BIN: (func $multiple-catches (type $0)
- ;; CHECK-BIN-NEXT: (try $label$3
+ ;; CHECK-BIN-NEXT: (try
;; CHECK-BIN-NEXT: (do
;; CHECK-BIN-NEXT: (throw $e-i32
;; CHECK-BIN-NEXT: (i32.const 0)
@@ -355,7 +361,7 @@
;; CHECK-TEXT-NEXT: )
;; CHECK-TEXT-NEXT: )
;; CHECK-BIN: (func $catch-all (type $0)
- ;; CHECK-BIN-NEXT: (try $label$3
+ ;; CHECK-BIN-NEXT: (try
;; CHECK-BIN-NEXT: (do
;; CHECK-BIN-NEXT: (throw $e-i32
;; CHECK-BIN-NEXT: (i32.const 0)
@@ -398,7 +404,7 @@
;; CHECK-TEXT-NEXT: )
;; CHECK-TEXT-NEXT: )
;; CHECK-BIN: (func $catch-and-catch-all-together (type $0)
- ;; CHECK-BIN-NEXT: (try $label$3
+ ;; CHECK-BIN-NEXT: (try
;; CHECK-BIN-NEXT: (do
;; CHECK-BIN-NEXT: (throw $e-i32
;; CHECK-BIN-NEXT: (i32.const 0)
@@ -480,9 +486,9 @@
;; CHECK-TEXT-NEXT: )
;; CHECK-TEXT-NEXT: )
;; CHECK-BIN: (func $nested-try-catch (type $0)
- ;; CHECK-BIN-NEXT: (try $label$9
+ ;; CHECK-BIN-NEXT: (try
;; CHECK-BIN-NEXT: (do
- ;; CHECK-BIN-NEXT: (try $label$4
+ ;; CHECK-BIN-NEXT: (try
;; CHECK-BIN-NEXT: (do
;; CHECK-BIN-NEXT: (throw $e-i32
;; CHECK-BIN-NEXT: (i32.const 0)
@@ -503,7 +509,7 @@
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (catch_all
- ;; CHECK-BIN-NEXT: (try $label$8
+ ;; CHECK-BIN-NEXT: (try
;; CHECK-BIN-NEXT: (do
;; CHECK-BIN-NEXT: (throw $e-i32
;; CHECK-BIN-NEXT: (i32.const 0)
@@ -560,13 +566,14 @@
;; CHECK-TEXT-NEXT: )
;; CHECK-TEXT-NEXT: )
;; CHECK-BIN: (func $catchless-delegateless-try (type $0)
- ;; CHECK-BIN-NEXT: (try $label$3
+ ;; CHECK-BIN-NEXT: (try
;; CHECK-BIN-NEXT: (do
;; CHECK-BIN-NEXT: (throw $e-i32
;; CHECK-BIN-NEXT: (i32.const 0)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (unreachable)
;; CHECK-BIN-NEXT: )
(func $catchless-delegateless-try
(try
@@ -597,21 +604,19 @@
;; CHECK-TEXT-NEXT: )
;; CHECK-TEXT-NEXT: )
;; CHECK-BIN: (func $inner-delegate-target-outer-catch (type $0)
- ;; CHECK-BIN-NEXT: (try $label$9
+ ;; CHECK-BIN-NEXT: (try $label
;; CHECK-BIN-NEXT: (do
- ;; CHECK-BIN-NEXT: (block $label$1
- ;; CHECK-BIN-NEXT: (try $label$4
- ;; CHECK-BIN-NEXT: (do
- ;; CHECK-BIN-NEXT: (call $foo)
- ;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: (delegate $label$9)
+ ;; CHECK-BIN-NEXT: (try
+ ;; CHECK-BIN-NEXT: (do
+ ;; CHECK-BIN-NEXT: (call $foo)
;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: (try $label$7
- ;; CHECK-BIN-NEXT: (do
- ;; CHECK-BIN-NEXT: (call $foo)
- ;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: (delegate $label$9)
+ ;; CHECK-BIN-NEXT: (delegate $label)
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (try
+ ;; CHECK-BIN-NEXT: (do
+ ;; CHECK-BIN-NEXT: (call $foo)
;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (delegate $label)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (catch_all
@@ -665,26 +670,24 @@
;; CHECK-TEXT-NEXT: )
;; CHECK-TEXT-NEXT: )
;; CHECK-BIN: (func $branch-and-delegate-target-same-try-label (type $0)
- ;; CHECK-BIN-NEXT: (block $label$1
- ;; CHECK-BIN-NEXT: (try $label$10
+ ;; CHECK-BIN-NEXT: (block $block
+ ;; CHECK-BIN-NEXT: (try $label
;; CHECK-BIN-NEXT: (do
- ;; CHECK-BIN-NEXT: (block $label$2
- ;; CHECK-BIN-NEXT: (try $label$5
- ;; CHECK-BIN-NEXT: (do
- ;; CHECK-BIN-NEXT: (br_if $label$1
- ;; CHECK-BIN-NEXT: (i32.const 1)
- ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (try
+ ;; CHECK-BIN-NEXT: (do
+ ;; CHECK-BIN-NEXT: (br_if $block
+ ;; CHECK-BIN-NEXT: (i32.const 1)
;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: (delegate $label$10)
;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: (try $label$8
- ;; CHECK-BIN-NEXT: (do
- ;; CHECK-BIN-NEXT: (br_if $label$1
- ;; CHECK-BIN-NEXT: (i32.const 1)
- ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (delegate $label)
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (try
+ ;; CHECK-BIN-NEXT: (do
+ ;; CHECK-BIN-NEXT: (br_if $block
+ ;; CHECK-BIN-NEXT: (i32.const 1)
;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: (delegate $label$10)
;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (delegate $label)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (catch_all
@@ -731,15 +734,13 @@
;; CHECK-TEXT-NEXT: )
;; CHECK-TEXT-NEXT: )
;; CHECK-BIN: (func $inner-delegate-target-outer-delegate (type $0)
- ;; CHECK-BIN-NEXT: (try $label$6
+ ;; CHECK-BIN-NEXT: (try $label
;; CHECK-BIN-NEXT: (do
- ;; CHECK-BIN-NEXT: (block $label$1
- ;; CHECK-BIN-NEXT: (try $label$4
- ;; CHECK-BIN-NEXT: (do
- ;; CHECK-BIN-NEXT: (call $foo)
- ;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: (delegate $label$6)
+ ;; CHECK-BIN-NEXT: (try
+ ;; CHECK-BIN-NEXT: (do
+ ;; CHECK-BIN-NEXT: (call $foo)
;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (delegate $label)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (delegate 0)
@@ -770,7 +771,7 @@
;; CHECK-TEXT-NEXT: )
;; CHECK-TEXT-NEXT: )
;; CHECK-BIN: (func $empty-catch-body (type $0)
- ;; CHECK-BIN-NEXT: (try $label$3
+ ;; CHECK-BIN-NEXT: (try
;; CHECK-BIN-NEXT: (do
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (catch $e-empty
@@ -802,7 +803,7 @@
;; CHECK-TEXT-NEXT: )
;; CHECK-TEXT-NEXT: )
;; CHECK-BIN: (func $try-catch-rethrow (type $0)
- ;; CHECK-BIN-NEXT: (try $label$3
+ ;; CHECK-BIN-NEXT: (try $label
;; CHECK-BIN-NEXT: (do
;; CHECK-BIN-NEXT: (call $foo)
;; CHECK-BIN-NEXT: )
@@ -810,10 +811,10 @@
;; CHECK-BIN-NEXT: (drop
;; CHECK-BIN-NEXT: (pop i32)
;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: (rethrow $label$3)
+ ;; CHECK-BIN-NEXT: (rethrow $label)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (catch_all
- ;; CHECK-BIN-NEXT: (rethrow $label$3)
+ ;; CHECK-BIN-NEXT: (rethrow $label)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
@@ -852,8 +853,8 @@
;; CHECK-TEXT-NEXT: )
;; CHECK-TEXT-NEXT: )
;; CHECK-BIN: (func $branch-and-rethrow-target-same-try-label (type $0)
- ;; CHECK-BIN-NEXT: (block $label$1
- ;; CHECK-BIN-NEXT: (try $label$4
+ ;; CHECK-BIN-NEXT: (block $block
+ ;; CHECK-BIN-NEXT: (try $label
;; CHECK-BIN-NEXT: (do
;; CHECK-BIN-NEXT: (call $foo)
;; CHECK-BIN-NEXT: )
@@ -861,10 +862,10 @@
;; CHECK-BIN-NEXT: (drop
;; CHECK-BIN-NEXT: (pop i32)
;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: (rethrow $label$4)
+ ;; CHECK-BIN-NEXT: (rethrow $label)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (catch_all
- ;; CHECK-BIN-NEXT: (br $label$1)
+ ;; CHECK-BIN-NEXT: (br $block)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
@@ -913,12 +914,12 @@
;; CHECK-TEXT-NEXT: )
;; CHECK-TEXT-NEXT: )
;; CHECK-BIN: (func $nested-rethrow (type $0)
- ;; CHECK-BIN-NEXT: (try $label$6
+ ;; CHECK-BIN-NEXT: (try $label
;; CHECK-BIN-NEXT: (do
;; CHECK-BIN-NEXT: (call $foo)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (catch_all
- ;; CHECK-BIN-NEXT: (try $label$5
+ ;; CHECK-BIN-NEXT: (try
;; CHECK-BIN-NEXT: (do
;; CHECK-BIN-NEXT: (call $foo)
;; CHECK-BIN-NEXT: )
@@ -926,10 +927,10 @@
;; CHECK-BIN-NEXT: (drop
;; CHECK-BIN-NEXT: (pop i32)
;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: (rethrow $label$6)
+ ;; CHECK-BIN-NEXT: (rethrow $label)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (catch_all
- ;; CHECK-BIN-NEXT: (rethrow $label$6)
+ ;; CHECK-BIN-NEXT: (rethrow $label)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
@@ -986,12 +987,12 @@
;; CHECK-TEXT-NEXT: )
;; CHECK-TEXT-NEXT: )
;; CHECK-BIN: (func $rnested-rethrow-with-interleaving-block (type $0)
- ;; CHECK-BIN-NEXT: (try $label$7
+ ;; CHECK-BIN-NEXT: (try $label
;; CHECK-BIN-NEXT: (do
;; CHECK-BIN-NEXT: (call $foo)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (catch_all
- ;; CHECK-BIN-NEXT: (try $label$6
+ ;; CHECK-BIN-NEXT: (try
;; CHECK-BIN-NEXT: (do
;; CHECK-BIN-NEXT: (call $foo)
;; CHECK-BIN-NEXT: )
@@ -999,12 +1000,13 @@
;; CHECK-BIN-NEXT: (drop
;; CHECK-BIN-NEXT: (pop i32)
;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: (block $label$5
- ;; CHECK-BIN-NEXT: (rethrow $label$7)
+ ;; CHECK-BIN-NEXT: (block
+ ;; CHECK-BIN-NEXT: (rethrow $label)
;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (unreachable)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (catch_all
- ;; CHECK-BIN-NEXT: (rethrow $label$7)
+ ;; CHECK-BIN-NEXT: (rethrow $label)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
@@ -1068,28 +1070,28 @@
;; CHECK-TEXT-NEXT: )
;; CHECK-TEXT-NEXT: )
;; CHECK-BIN: (func $rethrow-within-nested-try-part (type $0)
- ;; CHECK-BIN-NEXT: (try $label$6
+ ;; CHECK-BIN-NEXT: (try $label
;; CHECK-BIN-NEXT: (do
;; CHECK-BIN-NEXT: (call $foo)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (catch_all
- ;; CHECK-BIN-NEXT: (try $label$5
+ ;; CHECK-BIN-NEXT: (try
;; CHECK-BIN-NEXT: (do
- ;; CHECK-BIN-NEXT: (rethrow $label$6)
+ ;; CHECK-BIN-NEXT: (rethrow $label)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (catch_all
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: (try $label$12
+ ;; CHECK-BIN-NEXT: (try $label1
;; CHECK-BIN-NEXT: (do
;; CHECK-BIN-NEXT: (call $foo)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (catch_all
- ;; CHECK-BIN-NEXT: (try $label$11
+ ;; CHECK-BIN-NEXT: (try
;; CHECK-BIN-NEXT: (do
- ;; CHECK-BIN-NEXT: (rethrow $label$12)
+ ;; CHECK-BIN-NEXT: (rethrow $label1)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (catch_all
;; CHECK-BIN-NEXT: )
@@ -1147,7 +1149,7 @@
;; CHECK-TEXT-NEXT: )
;; CHECK-TEXT-NEXT: )
;; CHECK-BIN: (func $pop-within-if-condition (type $0)
- ;; CHECK-BIN-NEXT: (try $label$5
+ ;; CHECK-BIN-NEXT: (try
;; CHECK-BIN-NEXT: (do
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (catch $e-i32
@@ -1197,7 +1199,7 @@
;; CHECK-TEXT-NEXT: )
;; CHECK-TEXT-NEXT: )
;; CHECK-BIN: (func $pop-can-be-supertype (type $0)
- ;; CHECK-BIN-NEXT: (try $label$3
+ ;; CHECK-BIN-NEXT: (try
;; CHECK-BIN-NEXT: (do
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (catch $e-eqref
@@ -1233,20 +1235,20 @@
;; CHECK-TEXT-NEXT: )
;; CHECK-TEXT-NEXT: )
;; CHECK-BIN: (func $catchless-try-with-inner-delegate (type $0)
- ;; CHECK-BIN-NEXT: (try $label$6
+ ;; CHECK-BIN-NEXT: (try $label
;; CHECK-BIN-NEXT: (do
- ;; CHECK-BIN-NEXT: (block $label$1
- ;; CHECK-BIN-NEXT: (try $label$4
- ;; CHECK-BIN-NEXT: (do
- ;; CHECK-BIN-NEXT: (throw $e-i32
- ;; CHECK-BIN-NEXT: (i32.const 0)
- ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (try
+ ;; CHECK-BIN-NEXT: (do
+ ;; CHECK-BIN-NEXT: (throw $e-i32
+ ;; CHECK-BIN-NEXT: (i32.const 0)
;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: (delegate $label$6)
;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (delegate $label)
;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (unreachable)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (unreachable)
;; CHECK-BIN-NEXT: )
(func $catchless-try-with-inner-delegate
(try $label$0
@@ -1276,10 +1278,10 @@
;; CHECK-TEXT-NEXT: (nop)
;; CHECK-TEXT-NEXT: )
;; CHECK-BIN: (func $nested-delegate-within-block (type $0)
- ;; CHECK-BIN-NEXT: (block $label$1
- ;; CHECK-BIN-NEXT: (block $label$2
+ ;; CHECK-BIN-NEXT: (block
+ ;; CHECK-BIN-NEXT: (block
;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: (try $label$5
+ ;; CHECK-BIN-NEXT: (try
;; CHECK-BIN-NEXT: (do
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (delegate 1)
@@ -1327,7 +1329,7 @@
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG: (func $2 (type $0)
-;; CHECK-BIN-NODEBUG-NEXT: (try $label$3
+;; CHECK-BIN-NODEBUG-NEXT: (try
;; CHECK-BIN-NODEBUG-NEXT: (do
;; CHECK-BIN-NODEBUG-NEXT: (throw $tag$0
;; CHECK-BIN-NODEBUG-NEXT: (i32.const 0)
@@ -1344,9 +1346,10 @@
;; CHECK-BIN-NODEBUG: (func $3 (type $0)
;; CHECK-BIN-NODEBUG-NEXT: (local $0 i32)
;; CHECK-BIN-NODEBUG-NEXT: (local $1 i64)
-;; CHECK-BIN-NODEBUG-NEXT: (local $2 (tuple i32 i64))
-;; CHECK-BIN-NODEBUG-NEXT: (local $3 i32)
-;; CHECK-BIN-NODEBUG-NEXT: (try $label$3
+;; CHECK-BIN-NODEBUG-NEXT: (local $scratch (tuple i32 i64))
+;; CHECK-BIN-NODEBUG-NEXT: (local $scratch_3 i32)
+;; CHECK-BIN-NODEBUG-NEXT: (local $4 (tuple i32 i64))
+;; CHECK-BIN-NODEBUG-NEXT: (try
;; CHECK-BIN-NODEBUG-NEXT: (do
;; CHECK-BIN-NODEBUG-NEXT: (throw $tag$2
;; CHECK-BIN-NODEBUG-NEXT: (i32.const 0)
@@ -1354,49 +1357,54 @@
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (catch $tag$2
-;; CHECK-BIN-NODEBUG-NEXT: (local.set $2
+;; CHECK-BIN-NODEBUG-NEXT: (local.set $4
;; CHECK-BIN-NODEBUG-NEXT: (pop (tuple i32 i64))
;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: (local.set $0
-;; CHECK-BIN-NODEBUG-NEXT: (block (result i32)
-;; CHECK-BIN-NODEBUG-NEXT: (local.set $3
-;; CHECK-BIN-NODEBUG-NEXT: (tuple.extract 2 0
-;; CHECK-BIN-NODEBUG-NEXT: (local.get $2)
+;; CHECK-BIN-NODEBUG-NEXT: (block
+;; CHECK-BIN-NODEBUG-NEXT: (local.set $0
+;; CHECK-BIN-NODEBUG-NEXT: (block (result i32)
+;; CHECK-BIN-NODEBUG-NEXT: (local.set $scratch_3
+;; CHECK-BIN-NODEBUG-NEXT: (tuple.extract 2 0
+;; CHECK-BIN-NODEBUG-NEXT: (local.tee $scratch
+;; CHECK-BIN-NODEBUG-NEXT: (local.get $4)
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: (local.set $1
-;; CHECK-BIN-NODEBUG-NEXT: (tuple.extract 2 1
-;; CHECK-BIN-NODEBUG-NEXT: (local.get $2)
+;; CHECK-BIN-NODEBUG-NEXT: (local.set $1
+;; CHECK-BIN-NODEBUG-NEXT: (tuple.extract 2 1
+;; CHECK-BIN-NODEBUG-NEXT: (local.get $scratch)
+;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (local.get $scratch_3)
;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: (local.get $3)
;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: (drop
-;; CHECK-BIN-NODEBUG-NEXT: (local.get $0)
+;; CHECK-BIN-NODEBUG-NEXT: (drop
+;; CHECK-BIN-NODEBUG-NEXT: (local.get $0)
+;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG: (func $4 (type $0)
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$1
-;; CHECK-BIN-NODEBUG-NEXT: (try $label$4
+;; CHECK-BIN-NODEBUG-NEXT: (block $block
+;; CHECK-BIN-NODEBUG-NEXT: (try
;; CHECK-BIN-NODEBUG-NEXT: (do
-;; CHECK-BIN-NODEBUG-NEXT: (br $label$1)
+;; CHECK-BIN-NODEBUG-NEXT: (br $block)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (catch $tag$0
;; CHECK-BIN-NODEBUG-NEXT: (drop
;; CHECK-BIN-NODEBUG-NEXT: (pop i32)
;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: (br $label$1)
+;; CHECK-BIN-NODEBUG-NEXT: (br $block)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (unreachable)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG: (func $5 (type $0)
-;; CHECK-BIN-NODEBUG-NEXT: (try $label$3
+;; CHECK-BIN-NODEBUG-NEXT: (try
;; CHECK-BIN-NODEBUG-NEXT: (do
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (catch $tag$0
@@ -1408,7 +1416,7 @@
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG: (func $6 (type $0)
-;; CHECK-BIN-NODEBUG-NEXT: (try $label$3
+;; CHECK-BIN-NODEBUG-NEXT: (try
;; CHECK-BIN-NODEBUG-NEXT: (do
;; CHECK-BIN-NODEBUG-NEXT: (call $0)
;; CHECK-BIN-NODEBUG-NEXT: (call $1)
@@ -1424,7 +1432,7 @@
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG: (func $7 (type $0)
-;; CHECK-BIN-NODEBUG-NEXT: (try $label$3
+;; CHECK-BIN-NODEBUG-NEXT: (try
;; CHECK-BIN-NODEBUG-NEXT: (do
;; CHECK-BIN-NODEBUG-NEXT: (throw $tag$0
;; CHECK-BIN-NODEBUG-NEXT: (i32.const 0)
@@ -1444,7 +1452,7 @@
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG: (func $8 (type $0)
-;; CHECK-BIN-NODEBUG-NEXT: (try $label$3
+;; CHECK-BIN-NODEBUG-NEXT: (try
;; CHECK-BIN-NODEBUG-NEXT: (do
;; CHECK-BIN-NODEBUG-NEXT: (throw $tag$0
;; CHECK-BIN-NODEBUG-NEXT: (i32.const 0)
@@ -1456,7 +1464,7 @@
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG: (func $9 (type $0)
-;; CHECK-BIN-NODEBUG-NEXT: (try $label$3
+;; CHECK-BIN-NODEBUG-NEXT: (try
;; CHECK-BIN-NODEBUG-NEXT: (do
;; CHECK-BIN-NODEBUG-NEXT: (throw $tag$0
;; CHECK-BIN-NODEBUG-NEXT: (i32.const 0)
@@ -1480,9 +1488,9 @@
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG: (func $10 (type $0)
-;; CHECK-BIN-NODEBUG-NEXT: (try $label$9
+;; CHECK-BIN-NODEBUG-NEXT: (try
;; CHECK-BIN-NODEBUG-NEXT: (do
-;; CHECK-BIN-NODEBUG-NEXT: (try $label$4
+;; CHECK-BIN-NODEBUG-NEXT: (try
;; CHECK-BIN-NODEBUG-NEXT: (do
;; CHECK-BIN-NODEBUG-NEXT: (throw $tag$0
;; CHECK-BIN-NODEBUG-NEXT: (i32.const 0)
@@ -1503,7 +1511,7 @@
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (catch_all
-;; CHECK-BIN-NODEBUG-NEXT: (try $label$8
+;; CHECK-BIN-NODEBUG-NEXT: (try
;; CHECK-BIN-NODEBUG-NEXT: (do
;; CHECK-BIN-NODEBUG-NEXT: (throw $tag$0
;; CHECK-BIN-NODEBUG-NEXT: (i32.const 0)
@@ -1522,31 +1530,30 @@
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG: (func $11 (type $0)
-;; CHECK-BIN-NODEBUG-NEXT: (try $label$3
+;; CHECK-BIN-NODEBUG-NEXT: (try
;; CHECK-BIN-NODEBUG-NEXT: (do
;; CHECK-BIN-NODEBUG-NEXT: (throw $tag$0
;; CHECK-BIN-NODEBUG-NEXT: (i32.const 0)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (unreachable)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG: (func $12 (type $0)
-;; CHECK-BIN-NODEBUG-NEXT: (try $label$9
+;; CHECK-BIN-NODEBUG-NEXT: (try $label
;; CHECK-BIN-NODEBUG-NEXT: (do
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$1
-;; CHECK-BIN-NODEBUG-NEXT: (try $label$4
-;; CHECK-BIN-NODEBUG-NEXT: (do
-;; CHECK-BIN-NODEBUG-NEXT: (call $0)
-;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: (delegate $label$9)
+;; CHECK-BIN-NODEBUG-NEXT: (try
+;; CHECK-BIN-NODEBUG-NEXT: (do
+;; CHECK-BIN-NODEBUG-NEXT: (call $0)
;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: (try $label$7
-;; CHECK-BIN-NODEBUG-NEXT: (do
-;; CHECK-BIN-NODEBUG-NEXT: (call $0)
-;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: (delegate $label$9)
+;; CHECK-BIN-NODEBUG-NEXT: (delegate $label)
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (try
+;; CHECK-BIN-NODEBUG-NEXT: (do
+;; CHECK-BIN-NODEBUG-NEXT: (call $0)
;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (delegate $label)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (catch_all
@@ -1555,26 +1562,24 @@
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG: (func $13 (type $0)
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$1
-;; CHECK-BIN-NODEBUG-NEXT: (try $label$10
+;; CHECK-BIN-NODEBUG-NEXT: (block $block
+;; CHECK-BIN-NODEBUG-NEXT: (try $label
;; CHECK-BIN-NODEBUG-NEXT: (do
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$2
-;; CHECK-BIN-NODEBUG-NEXT: (try $label$5
-;; CHECK-BIN-NODEBUG-NEXT: (do
-;; CHECK-BIN-NODEBUG-NEXT: (br_if $label$1
-;; CHECK-BIN-NODEBUG-NEXT: (i32.const 1)
-;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (try
+;; CHECK-BIN-NODEBUG-NEXT: (do
+;; CHECK-BIN-NODEBUG-NEXT: (br_if $block
+;; CHECK-BIN-NODEBUG-NEXT: (i32.const 1)
;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: (delegate $label$10)
;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: (try $label$8
-;; CHECK-BIN-NODEBUG-NEXT: (do
-;; CHECK-BIN-NODEBUG-NEXT: (br_if $label$1
-;; CHECK-BIN-NODEBUG-NEXT: (i32.const 1)
-;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (delegate $label)
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (try
+;; CHECK-BIN-NODEBUG-NEXT: (do
+;; CHECK-BIN-NODEBUG-NEXT: (br_if $block
+;; CHECK-BIN-NODEBUG-NEXT: (i32.const 1)
;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: (delegate $label$10)
;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (delegate $label)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (catch_all
@@ -1584,15 +1589,13 @@
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG: (func $14 (type $0)
-;; CHECK-BIN-NODEBUG-NEXT: (try $label$6
+;; CHECK-BIN-NODEBUG-NEXT: (try $label
;; CHECK-BIN-NODEBUG-NEXT: (do
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$1
-;; CHECK-BIN-NODEBUG-NEXT: (try $label$4
-;; CHECK-BIN-NODEBUG-NEXT: (do
-;; CHECK-BIN-NODEBUG-NEXT: (call $0)
-;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: (delegate $label$6)
+;; CHECK-BIN-NODEBUG-NEXT: (try
+;; CHECK-BIN-NODEBUG-NEXT: (do
+;; CHECK-BIN-NODEBUG-NEXT: (call $0)
;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (delegate $label)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (delegate 0)
@@ -1600,7 +1603,7 @@
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG: (func $15 (type $0)
-;; CHECK-BIN-NODEBUG-NEXT: (try $label$3
+;; CHECK-BIN-NODEBUG-NEXT: (try
;; CHECK-BIN-NODEBUG-NEXT: (do
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (catch $tag$4
@@ -1609,7 +1612,7 @@
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG: (func $16 (type $0)
-;; CHECK-BIN-NODEBUG-NEXT: (try $label$3
+;; CHECK-BIN-NODEBUG-NEXT: (try $label
;; CHECK-BIN-NODEBUG-NEXT: (do
;; CHECK-BIN-NODEBUG-NEXT: (call $0)
;; CHECK-BIN-NODEBUG-NEXT: )
@@ -1617,17 +1620,17 @@
;; CHECK-BIN-NODEBUG-NEXT: (drop
;; CHECK-BIN-NODEBUG-NEXT: (pop i32)
;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: (rethrow $label$3)
+;; CHECK-BIN-NODEBUG-NEXT: (rethrow $label)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (catch_all
-;; CHECK-BIN-NODEBUG-NEXT: (rethrow $label$3)
+;; CHECK-BIN-NODEBUG-NEXT: (rethrow $label)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG: (func $17 (type $0)
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$1
-;; CHECK-BIN-NODEBUG-NEXT: (try $label$4
+;; CHECK-BIN-NODEBUG-NEXT: (block $block
+;; CHECK-BIN-NODEBUG-NEXT: (try $label
;; CHECK-BIN-NODEBUG-NEXT: (do
;; CHECK-BIN-NODEBUG-NEXT: (call $0)
;; CHECK-BIN-NODEBUG-NEXT: )
@@ -1635,22 +1638,22 @@
;; CHECK-BIN-NODEBUG-NEXT: (drop
;; CHECK-BIN-NODEBUG-NEXT: (pop i32)
;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: (rethrow $label$4)
+;; CHECK-BIN-NODEBUG-NEXT: (rethrow $label)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (catch_all
-;; CHECK-BIN-NODEBUG-NEXT: (br $label$1)
+;; CHECK-BIN-NODEBUG-NEXT: (br $block)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG: (func $18 (type $0)
-;; CHECK-BIN-NODEBUG-NEXT: (try $label$6
+;; CHECK-BIN-NODEBUG-NEXT: (try $label
;; CHECK-BIN-NODEBUG-NEXT: (do
;; CHECK-BIN-NODEBUG-NEXT: (call $0)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (catch_all
-;; CHECK-BIN-NODEBUG-NEXT: (try $label$5
+;; CHECK-BIN-NODEBUG-NEXT: (try
;; CHECK-BIN-NODEBUG-NEXT: (do
;; CHECK-BIN-NODEBUG-NEXT: (call $0)
;; CHECK-BIN-NODEBUG-NEXT: )
@@ -1658,10 +1661,10 @@
;; CHECK-BIN-NODEBUG-NEXT: (drop
;; CHECK-BIN-NODEBUG-NEXT: (pop i32)
;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: (rethrow $label$6)
+;; CHECK-BIN-NODEBUG-NEXT: (rethrow $label)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (catch_all
-;; CHECK-BIN-NODEBUG-NEXT: (rethrow $label$6)
+;; CHECK-BIN-NODEBUG-NEXT: (rethrow $label)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
@@ -1669,12 +1672,12 @@
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG: (func $19 (type $0)
-;; CHECK-BIN-NODEBUG-NEXT: (try $label$7
+;; CHECK-BIN-NODEBUG-NEXT: (try $label
;; CHECK-BIN-NODEBUG-NEXT: (do
;; CHECK-BIN-NODEBUG-NEXT: (call $0)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (catch_all
-;; CHECK-BIN-NODEBUG-NEXT: (try $label$6
+;; CHECK-BIN-NODEBUG-NEXT: (try
;; CHECK-BIN-NODEBUG-NEXT: (do
;; CHECK-BIN-NODEBUG-NEXT: (call $0)
;; CHECK-BIN-NODEBUG-NEXT: )
@@ -1682,12 +1685,13 @@
;; CHECK-BIN-NODEBUG-NEXT: (drop
;; CHECK-BIN-NODEBUG-NEXT: (pop i32)
;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$5
-;; CHECK-BIN-NODEBUG-NEXT: (rethrow $label$7)
+;; CHECK-BIN-NODEBUG-NEXT: (block
+;; CHECK-BIN-NODEBUG-NEXT: (rethrow $label)
;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (unreachable)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (catch_all
-;; CHECK-BIN-NODEBUG-NEXT: (rethrow $label$7)
+;; CHECK-BIN-NODEBUG-NEXT: (rethrow $label)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
@@ -1695,28 +1699,28 @@
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG: (func $20 (type $0)
-;; CHECK-BIN-NODEBUG-NEXT: (try $label$6
+;; CHECK-BIN-NODEBUG-NEXT: (try $label
;; CHECK-BIN-NODEBUG-NEXT: (do
;; CHECK-BIN-NODEBUG-NEXT: (call $0)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (catch_all
-;; CHECK-BIN-NODEBUG-NEXT: (try $label$5
+;; CHECK-BIN-NODEBUG-NEXT: (try
;; CHECK-BIN-NODEBUG-NEXT: (do
-;; CHECK-BIN-NODEBUG-NEXT: (rethrow $label$6)
+;; CHECK-BIN-NODEBUG-NEXT: (rethrow $label)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (catch_all
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: (try $label$12
+;; CHECK-BIN-NODEBUG-NEXT: (try $label1
;; CHECK-BIN-NODEBUG-NEXT: (do
;; CHECK-BIN-NODEBUG-NEXT: (call $0)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (catch_all
-;; CHECK-BIN-NODEBUG-NEXT: (try $label$11
+;; CHECK-BIN-NODEBUG-NEXT: (try
;; CHECK-BIN-NODEBUG-NEXT: (do
-;; CHECK-BIN-NODEBUG-NEXT: (rethrow $label$12)
+;; CHECK-BIN-NODEBUG-NEXT: (rethrow $label1)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (catch_all
;; CHECK-BIN-NODEBUG-NEXT: )
@@ -1726,7 +1730,7 @@
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG: (func $21 (type $0)
-;; CHECK-BIN-NODEBUG-NEXT: (try $label$5
+;; CHECK-BIN-NODEBUG-NEXT: (try
;; CHECK-BIN-NODEBUG-NEXT: (do
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (catch $tag$0
@@ -1746,7 +1750,7 @@
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG: (func $22 (type $0)
-;; CHECK-BIN-NODEBUG-NEXT: (try $label$3
+;; CHECK-BIN-NODEBUG-NEXT: (try
;; CHECK-BIN-NODEBUG-NEXT: (do
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (catch $tag$3
@@ -1758,27 +1762,27 @@
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG: (func $23 (type $0)
-;; CHECK-BIN-NODEBUG-NEXT: (try $label$6
+;; CHECK-BIN-NODEBUG-NEXT: (try $label
;; CHECK-BIN-NODEBUG-NEXT: (do
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$1
-;; CHECK-BIN-NODEBUG-NEXT: (try $label$4
-;; CHECK-BIN-NODEBUG-NEXT: (do
-;; CHECK-BIN-NODEBUG-NEXT: (throw $tag$0
-;; CHECK-BIN-NODEBUG-NEXT: (i32.const 0)
-;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (try
+;; CHECK-BIN-NODEBUG-NEXT: (do
+;; CHECK-BIN-NODEBUG-NEXT: (throw $tag$0
+;; CHECK-BIN-NODEBUG-NEXT: (i32.const 0)
;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: (delegate $label$6)
;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (delegate $label)
;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (unreachable)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (unreachable)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG: (func $24 (type $0)
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$1
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$2
+;; CHECK-BIN-NODEBUG-NEXT: (block
+;; CHECK-BIN-NODEBUG-NEXT: (block
;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: (try $label$5
+;; CHECK-BIN-NODEBUG-NEXT: (try
;; CHECK-BIN-NODEBUG-NEXT: (do
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (delegate 1)
diff --git a/test/lit/basic/exception-handling-no-gc.wast b/test/lit/basic/exception-handling-no-gc.wast
index 4ab0708c4..611853a93 100644
--- a/test/lit/basic/exception-handling-no-gc.wast
+++ b/test/lit/basic/exception-handling-no-gc.wast
@@ -7,10 +7,11 @@
(module
;; CHECK: (func $test (result exnref)
- ;; CHECK-NEXT: (block $label$1 (result exnref)
- ;; CHECK-NEXT: (try_table (catch_all_ref $label$1)
+ ;; CHECK-NEXT: (block $block (result exnref)
+ ;; CHECK-NEXT: (try_table (catch_all_ref $block)
;; CHECK-NEXT: (unreachable)
;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (unreachable)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $test (result exnref)
diff --git a/test/lit/basic/exception-handling.wast b/test/lit/basic/exception-handling.wast
index 97be09c04..41c10f631 100644
--- a/test/lit/basic/exception-handling.wast
+++ b/test/lit/basic/exception-handling.wast
@@ -147,6 +147,7 @@
;; CHECK-BIN-NEXT: (try_table
;; CHECK-BIN-NEXT: (throw $e-empty)
;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (unreachable)
;; CHECK-BIN-NEXT: )
(func $catchless-try-table
(try_table)
@@ -165,12 +166,13 @@
;; CHECK-TEXT-NEXT: )
;; CHECK-TEXT-NEXT: )
;; CHECK-BIN: (func $simple-try-table-and-throw (type $4) (result i32)
- ;; CHECK-BIN-NEXT: (block $label$1 (result i32)
- ;; CHECK-BIN-NEXT: (try_table (catch $e-i32 $label$1)
+ ;; CHECK-BIN-NEXT: (block $block (result i32)
+ ;; CHECK-BIN-NEXT: (try_table (catch $e-i32 $block)
;; CHECK-BIN-NEXT: (throw $e-i32
;; CHECK-BIN-NEXT: (i32.const 0)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (unreachable)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
(func $simple-try-table-and-throw (result i32)
@@ -194,12 +196,13 @@
;; CHECK-TEXT-NEXT: )
;; CHECK-BIN: (func $try-table-and-throw-ref (type $0)
;; CHECK-BIN-NEXT: (throw_ref
- ;; CHECK-BIN-NEXT: (block $label$1 (result exnref)
- ;; CHECK-BIN-NEXT: (try_table (catch_all_ref $label$1)
+ ;; CHECK-BIN-NEXT: (block $block (result exnref)
+ ;; CHECK-BIN-NEXT: (try_table (catch_all_ref $block)
;; CHECK-BIN-NEXT: (throw $e-i64
;; CHECK-BIN-NEXT: (i64.const 0)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (unreachable)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
@@ -233,65 +236,64 @@
;; CHECK-TEXT-NEXT: )
;; CHECK-TEXT-NEXT: )
;; CHECK-BIN: (func $try-table-multivalue-tag (type $0)
- ;; CHECK-BIN-NEXT: (local $0 (tuple i32 i64))
- ;; CHECK-BIN-NEXT: (local $1 i32)
- ;; CHECK-BIN-NEXT: (local $2 (tuple i32 i64 exnref))
- ;; CHECK-BIN-NEXT: (local $3 i64)
- ;; CHECK-BIN-NEXT: (local $4 i32)
- ;; CHECK-BIN-NEXT: (block $label$1
- ;; CHECK-BIN-NEXT: (local.set $2
- ;; CHECK-BIN-NEXT: (block $label$2 (type $2) (result i32 i64 exnref)
- ;; CHECK-BIN-NEXT: (local.set $0
- ;; CHECK-BIN-NEXT: (block $label$3 (type $1) (result i32 i64)
- ;; CHECK-BIN-NEXT: (try_table (catch $e-i32-i64 $label$3) (catch_ref $e-i32-i64 $label$2)
- ;; CHECK-BIN-NEXT: (throw $e-i32-i64
- ;; CHECK-BIN-NEXT: (i32.const 0)
- ;; CHECK-BIN-NEXT: (i64.const 0)
- ;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: (drop
- ;; CHECK-BIN-NEXT: (block (result i32)
- ;; CHECK-BIN-NEXT: (local.set $1
- ;; CHECK-BIN-NEXT: (tuple.extract 2 0
- ;; CHECK-BIN-NEXT: (local.get $0)
- ;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: (drop
- ;; CHECK-BIN-NEXT: (tuple.extract 2 1
- ;; CHECK-BIN-NEXT: (local.get $0)
- ;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: (local.get $1)
- ;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: (br $label$1)
- ;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (local $scratch (tuple i32 i64))
+ ;; CHECK-BIN-NEXT: (local $scratch_1 i32)
+ ;; CHECK-BIN-NEXT: (local $scratch_2 (tuple i32 i64 exnref))
+ ;; CHECK-BIN-NEXT: (local $scratch_3 i64)
+ ;; CHECK-BIN-NEXT: (local $scratch_4 i32)
+ ;; CHECK-BIN-NEXT: (block $block2
;; CHECK-BIN-NEXT: (drop
;; CHECK-BIN-NEXT: (block (result i32)
- ;; CHECK-BIN-NEXT: (local.set $4
+ ;; CHECK-BIN-NEXT: (local.set $scratch_4
;; CHECK-BIN-NEXT: (tuple.extract 3 0
- ;; CHECK-BIN-NEXT: (local.get $2)
+ ;; CHECK-BIN-NEXT: (local.tee $scratch_2
+ ;; CHECK-BIN-NEXT: (block $block1 (type $2) (result i32 i64 exnref)
+ ;; CHECK-BIN-NEXT: (drop
+ ;; CHECK-BIN-NEXT: (block (result i32)
+ ;; CHECK-BIN-NEXT: (local.set $scratch_1
+ ;; CHECK-BIN-NEXT: (tuple.extract 2 0
+ ;; CHECK-BIN-NEXT: (local.tee $scratch
+ ;; CHECK-BIN-NEXT: (block $block (type $1) (result i32 i64)
+ ;; CHECK-BIN-NEXT: (try_table (catch $e-i32-i64 $block) (catch_ref $e-i32-i64 $block1)
+ ;; CHECK-BIN-NEXT: (throw $e-i32-i64
+ ;; CHECK-BIN-NEXT: (i32.const 0)
+ ;; CHECK-BIN-NEXT: (i64.const 0)
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (unreachable)
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (drop
+ ;; CHECK-BIN-NEXT: (tuple.extract 2 1
+ ;; CHECK-BIN-NEXT: (local.get $scratch)
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (local.get $scratch_1)
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (br $block2)
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (drop
;; CHECK-BIN-NEXT: (block (result i64)
- ;; CHECK-BIN-NEXT: (local.set $3
+ ;; CHECK-BIN-NEXT: (local.set $scratch_3
;; CHECK-BIN-NEXT: (tuple.extract 3 1
- ;; CHECK-BIN-NEXT: (local.get $2)
+ ;; CHECK-BIN-NEXT: (local.get $scratch_2)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (drop
;; CHECK-BIN-NEXT: (tuple.extract 3 2
- ;; CHECK-BIN-NEXT: (local.get $2)
+ ;; CHECK-BIN-NEXT: (local.get $scratch_2)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: (local.get $3)
+ ;; CHECK-BIN-NEXT: (local.get $scratch_3)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: (local.get $4)
+ ;; CHECK-BIN-NEXT: (local.get $scratch_4)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
@@ -338,25 +340,25 @@
;; CHECK-TEXT-NEXT: )
;; CHECK-TEXT-NEXT: )
;; CHECK-BIN: (func $try-table-all-catch-clauses-empty-tag (type $0)
- ;; CHECK-BIN-NEXT: (block $label$1
- ;; CHECK-BIN-NEXT: (block $label$2
+ ;; CHECK-BIN-NEXT: (block $block4
+ ;; CHECK-BIN-NEXT: (block $block
;; CHECK-BIN-NEXT: (drop
- ;; CHECK-BIN-NEXT: (block $label$3 (result exnref)
- ;; CHECK-BIN-NEXT: (block $label$4
+ ;; CHECK-BIN-NEXT: (block $block1 (result exnref)
+ ;; CHECK-BIN-NEXT: (block $block2
;; CHECK-BIN-NEXT: (throw_ref
- ;; CHECK-BIN-NEXT: (block $label$5 (result exnref)
- ;; CHECK-BIN-NEXT: (try_table (catch $e-empty $label$2) (catch_ref $e-empty $label$3) (catch_all $label$4) (catch_all_ref $label$5)
+ ;; CHECK-BIN-NEXT: (block $block3 (result exnref)
+ ;; CHECK-BIN-NEXT: (try_table (catch $e-empty $block) (catch_ref $e-empty $block1) (catch_all $block2) (catch_all_ref $block3)
;; CHECK-BIN-NEXT: (call $foo)
;; CHECK-BIN-NEXT: (call $foo)
;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: (br $label$1)
+ ;; CHECK-BIN-NEXT: (br $block4)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: (br $label$1)
+ ;; CHECK-BIN-NEXT: (br $block4)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: (br $label$1)
+ ;; CHECK-BIN-NEXT: (br $block4)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
@@ -415,43 +417,42 @@
;; CHECK-TEXT-NEXT: )
;; CHECK-TEXT-NEXT: )
;; CHECK-BIN: (func $try-table-all-catch-clauses-i32-tag (type $0)
- ;; CHECK-BIN-NEXT: (local $0 (tuple i32 exnref))
- ;; CHECK-BIN-NEXT: (local $1 i32)
- ;; CHECK-BIN-NEXT: (block $label$1
+ ;; CHECK-BIN-NEXT: (local $scratch (tuple i32 exnref))
+ ;; CHECK-BIN-NEXT: (local $scratch_1 i32)
+ ;; CHECK-BIN-NEXT: (block $block4
;; CHECK-BIN-NEXT: (drop
- ;; CHECK-BIN-NEXT: (block $label$2 (result i32)
- ;; CHECK-BIN-NEXT: (local.set $0
- ;; CHECK-BIN-NEXT: (block $label$3 (type $5) (result i32 exnref)
- ;; CHECK-BIN-NEXT: (block $label$4
- ;; CHECK-BIN-NEXT: (throw_ref
- ;; CHECK-BIN-NEXT: (block $label$5 (result exnref)
- ;; CHECK-BIN-NEXT: (try_table (catch $e-i32 $label$2) (catch_ref $e-i32 $label$3) (catch_all $label$4) (catch_all_ref $label$5)
- ;; CHECK-BIN-NEXT: (call $foo)
- ;; CHECK-BIN-NEXT: (call $foo)
- ;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: (br $label$1)
- ;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: (br $label$1)
- ;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (block $block (result i32)
;; CHECK-BIN-NEXT: (drop
;; CHECK-BIN-NEXT: (block (result i32)
- ;; CHECK-BIN-NEXT: (local.set $1
+ ;; CHECK-BIN-NEXT: (local.set $scratch_1
;; CHECK-BIN-NEXT: (tuple.extract 2 0
- ;; CHECK-BIN-NEXT: (local.get $0)
+ ;; CHECK-BIN-NEXT: (local.tee $scratch
+ ;; CHECK-BIN-NEXT: (block $block1 (type $5) (result i32 exnref)
+ ;; CHECK-BIN-NEXT: (block $block2
+ ;; CHECK-BIN-NEXT: (throw_ref
+ ;; CHECK-BIN-NEXT: (block $block3 (result exnref)
+ ;; CHECK-BIN-NEXT: (try_table (catch $e-i32 $block) (catch_ref $e-i32 $block1) (catch_all $block2) (catch_all_ref $block3)
+ ;; CHECK-BIN-NEXT: (call $foo)
+ ;; CHECK-BIN-NEXT: (call $foo)
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (br $block4)
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (br $block4)
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (drop
;; CHECK-BIN-NEXT: (tuple.extract 2 1
- ;; CHECK-BIN-NEXT: (local.get $0)
+ ;; CHECK-BIN-NEXT: (local.get $scratch)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: (local.get $1)
+ ;; CHECK-BIN-NEXT: (local.get $scratch_1)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: (br $label$1)
+ ;; CHECK-BIN-NEXT: (br $block4)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
@@ -513,71 +514,69 @@
;; CHECK-TEXT-NEXT: )
;; CHECK-TEXT-NEXT: )
;; CHECK-BIN: (func $try-table-all-catch-clauses-multivalue-tag (type $0)
- ;; CHECK-BIN-NEXT: (local $0 (tuple i32 i64 exnref))
- ;; CHECK-BIN-NEXT: (local $1 i64)
- ;; CHECK-BIN-NEXT: (local $2 i32)
- ;; CHECK-BIN-NEXT: (local $3 (tuple i32 i64))
- ;; CHECK-BIN-NEXT: (local $4 i32)
- ;; CHECK-BIN-NEXT: (block $label$1
- ;; CHECK-BIN-NEXT: (local.set $3
- ;; CHECK-BIN-NEXT: (block $label$2 (type $1) (result i32 i64)
- ;; CHECK-BIN-NEXT: (local.set $0
- ;; CHECK-BIN-NEXT: (block $label$3 (type $2) (result i32 i64 exnref)
- ;; CHECK-BIN-NEXT: (block $label$4
- ;; CHECK-BIN-NEXT: (throw_ref
- ;; CHECK-BIN-NEXT: (block $label$5 (result exnref)
- ;; CHECK-BIN-NEXT: (try_table (catch $e-i32-i64 $label$2) (catch_ref $e-i32-i64 $label$3) (catch_all $label$4) (catch_all_ref $label$5)
- ;; CHECK-BIN-NEXT: (call $foo)
- ;; CHECK-BIN-NEXT: (call $foo)
- ;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: (br $label$1)
- ;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: (br $label$1)
- ;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: (drop
- ;; CHECK-BIN-NEXT: (block (result i32)
- ;; CHECK-BIN-NEXT: (local.set $2
- ;; CHECK-BIN-NEXT: (tuple.extract 3 0
- ;; CHECK-BIN-NEXT: (local.get $0)
- ;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: (drop
- ;; CHECK-BIN-NEXT: (block (result i64)
- ;; CHECK-BIN-NEXT: (local.set $1
- ;; CHECK-BIN-NEXT: (tuple.extract 3 1
- ;; CHECK-BIN-NEXT: (local.get $0)
- ;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (local $scratch (tuple i32 i64 exnref))
+ ;; CHECK-BIN-NEXT: (local $scratch_1 i64)
+ ;; CHECK-BIN-NEXT: (local $scratch_2 i32)
+ ;; CHECK-BIN-NEXT: (local $scratch_3 (tuple i32 i64))
+ ;; CHECK-BIN-NEXT: (local $scratch_4 i32)
+ ;; CHECK-BIN-NEXT: (block $block4
+ ;; CHECK-BIN-NEXT: (drop
+ ;; CHECK-BIN-NEXT: (block (result i32)
+ ;; CHECK-BIN-NEXT: (local.set $scratch_4
+ ;; CHECK-BIN-NEXT: (tuple.extract 2 0
+ ;; CHECK-BIN-NEXT: (local.tee $scratch_3
+ ;; CHECK-BIN-NEXT: (block $block (type $1) (result i32 i64)
;; CHECK-BIN-NEXT: (drop
- ;; CHECK-BIN-NEXT: (tuple.extract 3 2
- ;; CHECK-BIN-NEXT: (local.get $0)
+ ;; CHECK-BIN-NEXT: (block (result i32)
+ ;; CHECK-BIN-NEXT: (local.set $scratch_2
+ ;; CHECK-BIN-NEXT: (tuple.extract 3 0
+ ;; CHECK-BIN-NEXT: (local.tee $scratch
+ ;; CHECK-BIN-NEXT: (block $block1 (type $2) (result i32 i64 exnref)
+ ;; CHECK-BIN-NEXT: (block $block2
+ ;; CHECK-BIN-NEXT: (throw_ref
+ ;; CHECK-BIN-NEXT: (block $block3 (result exnref)
+ ;; CHECK-BIN-NEXT: (try_table (catch $e-i32-i64 $block) (catch_ref $e-i32-i64 $block1) (catch_all $block2) (catch_all_ref $block3)
+ ;; CHECK-BIN-NEXT: (call $foo)
+ ;; CHECK-BIN-NEXT: (call $foo)
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (br $block4)
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (br $block4)
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (drop
+ ;; CHECK-BIN-NEXT: (block (result i64)
+ ;; CHECK-BIN-NEXT: (local.set $scratch_1
+ ;; CHECK-BIN-NEXT: (tuple.extract 3 1
+ ;; CHECK-BIN-NEXT: (local.get $scratch)
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (drop
+ ;; CHECK-BIN-NEXT: (tuple.extract 3 2
+ ;; CHECK-BIN-NEXT: (local.get $scratch)
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (local.get $scratch_1)
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (local.get $scratch_2)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: (local.get $1)
+ ;; CHECK-BIN-NEXT: (br $block4)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: (local.get $2)
- ;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: (br $label$1)
- ;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: (drop
- ;; CHECK-BIN-NEXT: (block (result i32)
- ;; CHECK-BIN-NEXT: (local.set $4
- ;; CHECK-BIN-NEXT: (tuple.extract 2 0
- ;; CHECK-BIN-NEXT: (local.get $3)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (drop
;; CHECK-BIN-NEXT: (tuple.extract 2 1
- ;; CHECK-BIN-NEXT: (local.get $3)
+ ;; CHECK-BIN-NEXT: (local.get $scratch_3)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: (local.get $4)
+ ;; CHECK-BIN-NEXT: (local.get $scratch_4)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
@@ -625,10 +624,10 @@
;; CHECK-TEXT-NEXT: )
;; CHECK-TEXT-NEXT: )
;; CHECK-BIN: (func $try-table-with-label-and-br (type $4) (result i32)
- ;; CHECK-BIN-NEXT: (block $label$1 (result i32)
- ;; CHECK-BIN-NEXT: (block $label$2 (result i32)
- ;; CHECK-BIN-NEXT: (try_table (result i32) (catch $e-i32 $label$1)
- ;; CHECK-BIN-NEXT: (br $label$2
+ ;; CHECK-BIN-NEXT: (block $block (result i32)
+ ;; CHECK-BIN-NEXT: (block $block1 (result i32)
+ ;; CHECK-BIN-NEXT: (try_table (result i32) (catch $e-i32 $block)
+ ;; CHECK-BIN-NEXT: (br $block1
;; CHECK-BIN-NEXT: (i32.const 0)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
@@ -670,11 +669,11 @@
;; CHECK-TEXT-NEXT: )
;; CHECK-TEXT-NEXT: )
;; CHECK-BIN: (func $nested-try-table (type $3) (result exnref)
- ;; CHECK-BIN-NEXT: (block $label$1 (result exnref)
+ ;; CHECK-BIN-NEXT: (block $block (result exnref)
;; CHECK-BIN-NEXT: (drop
- ;; CHECK-BIN-NEXT: (block $label$2 (result i32)
- ;; CHECK-BIN-NEXT: (try_table (catch_all_ref $label$1)
- ;; CHECK-BIN-NEXT: (try_table (catch $e-i32 $label$2)
+ ;; CHECK-BIN-NEXT: (block $block1 (result i32)
+ ;; CHECK-BIN-NEXT: (try_table (catch_all_ref $block)
+ ;; CHECK-BIN-NEXT: (try_table (catch $e-i32 $block1)
;; CHECK-BIN-NEXT: (if
;; CHECK-BIN-NEXT: (i32.const 0)
;; CHECK-BIN-NEXT: (then
@@ -688,8 +687,11 @@
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (unreachable)
;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (unreachable)
;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (unreachable)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (ref.null noexn)
@@ -779,238 +781,237 @@
;; CHECK-BIN-NODEBUG-NEXT: (try_table
;; CHECK-BIN-NODEBUG-NEXT: (throw $tag$4)
;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (unreachable)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG: (func $3 (type $4) (result i32)
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$1 (result i32)
-;; CHECK-BIN-NODEBUG-NEXT: (try_table (catch $tag$0 $label$1)
+;; CHECK-BIN-NODEBUG-NEXT: (block $block (result i32)
+;; CHECK-BIN-NODEBUG-NEXT: (try_table (catch $tag$0 $block)
;; CHECK-BIN-NODEBUG-NEXT: (throw $tag$0
;; CHECK-BIN-NODEBUG-NEXT: (i32.const 0)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (unreachable)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG: (func $4 (type $0)
;; CHECK-BIN-NODEBUG-NEXT: (throw_ref
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$1 (result exnref)
-;; CHECK-BIN-NODEBUG-NEXT: (try_table (catch_all_ref $label$1)
+;; CHECK-BIN-NODEBUG-NEXT: (block $block (result exnref)
+;; CHECK-BIN-NODEBUG-NEXT: (try_table (catch_all_ref $block)
;; CHECK-BIN-NODEBUG-NEXT: (throw $tag$1
;; CHECK-BIN-NODEBUG-NEXT: (i64.const 0)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (unreachable)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG: (func $5 (type $0)
-;; CHECK-BIN-NODEBUG-NEXT: (local $0 (tuple i32 i64))
-;; CHECK-BIN-NODEBUG-NEXT: (local $1 i32)
-;; CHECK-BIN-NODEBUG-NEXT: (local $2 (tuple i32 i64 exnref))
-;; CHECK-BIN-NODEBUG-NEXT: (local $3 i64)
-;; CHECK-BIN-NODEBUG-NEXT: (local $4 i32)
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$1
-;; CHECK-BIN-NODEBUG-NEXT: (local.set $2
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$2 (type $2) (result i32 i64 exnref)
-;; CHECK-BIN-NODEBUG-NEXT: (local.set $0
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$3 (type $1) (result i32 i64)
-;; CHECK-BIN-NODEBUG-NEXT: (try_table (catch $tag$2 $label$3) (catch_ref $tag$2 $label$2)
-;; CHECK-BIN-NODEBUG-NEXT: (throw $tag$2
-;; CHECK-BIN-NODEBUG-NEXT: (i32.const 0)
-;; CHECK-BIN-NODEBUG-NEXT: (i64.const 0)
-;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: (drop
-;; CHECK-BIN-NODEBUG-NEXT: (block (result i32)
-;; CHECK-BIN-NODEBUG-NEXT: (local.set $1
-;; CHECK-BIN-NODEBUG-NEXT: (tuple.extract 2 0
-;; CHECK-BIN-NODEBUG-NEXT: (local.get $0)
-;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: (drop
-;; CHECK-BIN-NODEBUG-NEXT: (tuple.extract 2 1
-;; CHECK-BIN-NODEBUG-NEXT: (local.get $0)
-;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: (local.get $1)
-;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: (br $label$1)
-;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (local $scratch (tuple i32 i64))
+;; CHECK-BIN-NODEBUG-NEXT: (local $scratch_1 i32)
+;; CHECK-BIN-NODEBUG-NEXT: (local $scratch_2 (tuple i32 i64 exnref))
+;; CHECK-BIN-NODEBUG-NEXT: (local $scratch_3 i64)
+;; CHECK-BIN-NODEBUG-NEXT: (local $scratch_4 i32)
+;; CHECK-BIN-NODEBUG-NEXT: (block $block2
;; CHECK-BIN-NODEBUG-NEXT: (drop
;; CHECK-BIN-NODEBUG-NEXT: (block (result i32)
-;; CHECK-BIN-NODEBUG-NEXT: (local.set $4
+;; CHECK-BIN-NODEBUG-NEXT: (local.set $scratch_4
;; CHECK-BIN-NODEBUG-NEXT: (tuple.extract 3 0
-;; CHECK-BIN-NODEBUG-NEXT: (local.get $2)
+;; CHECK-BIN-NODEBUG-NEXT: (local.tee $scratch_2
+;; CHECK-BIN-NODEBUG-NEXT: (block $block1 (type $2) (result i32 i64 exnref)
+;; CHECK-BIN-NODEBUG-NEXT: (drop
+;; CHECK-BIN-NODEBUG-NEXT: (block (result i32)
+;; CHECK-BIN-NODEBUG-NEXT: (local.set $scratch_1
+;; CHECK-BIN-NODEBUG-NEXT: (tuple.extract 2 0
+;; CHECK-BIN-NODEBUG-NEXT: (local.tee $scratch
+;; CHECK-BIN-NODEBUG-NEXT: (block $block (type $1) (result i32 i64)
+;; CHECK-BIN-NODEBUG-NEXT: (try_table (catch $tag$2 $block) (catch_ref $tag$2 $block1)
+;; CHECK-BIN-NODEBUG-NEXT: (throw $tag$2
+;; CHECK-BIN-NODEBUG-NEXT: (i32.const 0)
+;; CHECK-BIN-NODEBUG-NEXT: (i64.const 0)
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (unreachable)
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (drop
+;; CHECK-BIN-NODEBUG-NEXT: (tuple.extract 2 1
+;; CHECK-BIN-NODEBUG-NEXT: (local.get $scratch)
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (local.get $scratch_1)
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (br $block2)
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (drop
;; CHECK-BIN-NODEBUG-NEXT: (block (result i64)
-;; CHECK-BIN-NODEBUG-NEXT: (local.set $3
+;; CHECK-BIN-NODEBUG-NEXT: (local.set $scratch_3
;; CHECK-BIN-NODEBUG-NEXT: (tuple.extract 3 1
-;; CHECK-BIN-NODEBUG-NEXT: (local.get $2)
+;; CHECK-BIN-NODEBUG-NEXT: (local.get $scratch_2)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (drop
;; CHECK-BIN-NODEBUG-NEXT: (tuple.extract 3 2
-;; CHECK-BIN-NODEBUG-NEXT: (local.get $2)
+;; CHECK-BIN-NODEBUG-NEXT: (local.get $scratch_2)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: (local.get $3)
+;; CHECK-BIN-NODEBUG-NEXT: (local.get $scratch_3)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: (local.get $4)
+;; CHECK-BIN-NODEBUG-NEXT: (local.get $scratch_4)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG: (func $6 (type $0)
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$1
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$2
+;; CHECK-BIN-NODEBUG-NEXT: (block $block4
+;; CHECK-BIN-NODEBUG-NEXT: (block $block
;; CHECK-BIN-NODEBUG-NEXT: (drop
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$3 (result exnref)
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$4
+;; CHECK-BIN-NODEBUG-NEXT: (block $block1 (result exnref)
+;; CHECK-BIN-NODEBUG-NEXT: (block $block2
;; CHECK-BIN-NODEBUG-NEXT: (throw_ref
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$5 (result exnref)
-;; CHECK-BIN-NODEBUG-NEXT: (try_table (catch $tag$4 $label$2) (catch_ref $tag$4 $label$3) (catch_all $label$4) (catch_all_ref $label$5)
+;; CHECK-BIN-NODEBUG-NEXT: (block $block3 (result exnref)
+;; CHECK-BIN-NODEBUG-NEXT: (try_table (catch $tag$4 $block) (catch_ref $tag$4 $block1) (catch_all $block2) (catch_all_ref $block3)
;; CHECK-BIN-NODEBUG-NEXT: (call $0)
;; CHECK-BIN-NODEBUG-NEXT: (call $0)
;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: (br $label$1)
+;; CHECK-BIN-NODEBUG-NEXT: (br $block4)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: (br $label$1)
+;; CHECK-BIN-NODEBUG-NEXT: (br $block4)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: (br $label$1)
+;; CHECK-BIN-NODEBUG-NEXT: (br $block4)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG: (func $7 (type $0)
-;; CHECK-BIN-NODEBUG-NEXT: (local $0 (tuple i32 exnref))
-;; CHECK-BIN-NODEBUG-NEXT: (local $1 i32)
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$1
+;; CHECK-BIN-NODEBUG-NEXT: (local $scratch (tuple i32 exnref))
+;; CHECK-BIN-NODEBUG-NEXT: (local $scratch_1 i32)
+;; CHECK-BIN-NODEBUG-NEXT: (block $block4
;; CHECK-BIN-NODEBUG-NEXT: (drop
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$2 (result i32)
-;; CHECK-BIN-NODEBUG-NEXT: (local.set $0
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$3 (type $5) (result i32 exnref)
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$4
-;; CHECK-BIN-NODEBUG-NEXT: (throw_ref
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$5 (result exnref)
-;; CHECK-BIN-NODEBUG-NEXT: (try_table (catch $tag$0 $label$2) (catch_ref $tag$0 $label$3) (catch_all $label$4) (catch_all_ref $label$5)
-;; CHECK-BIN-NODEBUG-NEXT: (call $0)
-;; CHECK-BIN-NODEBUG-NEXT: (call $0)
-;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: (br $label$1)
-;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: (br $label$1)
-;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (block $block (result i32)
;; CHECK-BIN-NODEBUG-NEXT: (drop
;; CHECK-BIN-NODEBUG-NEXT: (block (result i32)
-;; CHECK-BIN-NODEBUG-NEXT: (local.set $1
+;; CHECK-BIN-NODEBUG-NEXT: (local.set $scratch_1
;; CHECK-BIN-NODEBUG-NEXT: (tuple.extract 2 0
-;; CHECK-BIN-NODEBUG-NEXT: (local.get $0)
+;; CHECK-BIN-NODEBUG-NEXT: (local.tee $scratch
+;; CHECK-BIN-NODEBUG-NEXT: (block $block1 (type $5) (result i32 exnref)
+;; CHECK-BIN-NODEBUG-NEXT: (block $block2
+;; CHECK-BIN-NODEBUG-NEXT: (throw_ref
+;; CHECK-BIN-NODEBUG-NEXT: (block $block3 (result exnref)
+;; CHECK-BIN-NODEBUG-NEXT: (try_table (catch $tag$0 $block) (catch_ref $tag$0 $block1) (catch_all $block2) (catch_all_ref $block3)
+;; CHECK-BIN-NODEBUG-NEXT: (call $0)
+;; CHECK-BIN-NODEBUG-NEXT: (call $0)
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (br $block4)
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (br $block4)
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (drop
;; CHECK-BIN-NODEBUG-NEXT: (tuple.extract 2 1
-;; CHECK-BIN-NODEBUG-NEXT: (local.get $0)
+;; CHECK-BIN-NODEBUG-NEXT: (local.get $scratch)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: (local.get $1)
+;; CHECK-BIN-NODEBUG-NEXT: (local.get $scratch_1)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: (br $label$1)
+;; CHECK-BIN-NODEBUG-NEXT: (br $block4)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG: (func $8 (type $0)
-;; CHECK-BIN-NODEBUG-NEXT: (local $0 (tuple i32 i64 exnref))
-;; CHECK-BIN-NODEBUG-NEXT: (local $1 i64)
-;; CHECK-BIN-NODEBUG-NEXT: (local $2 i32)
-;; CHECK-BIN-NODEBUG-NEXT: (local $3 (tuple i32 i64))
-;; CHECK-BIN-NODEBUG-NEXT: (local $4 i32)
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$1
-;; CHECK-BIN-NODEBUG-NEXT: (local.set $3
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$2 (type $1) (result i32 i64)
-;; CHECK-BIN-NODEBUG-NEXT: (local.set $0
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$3 (type $2) (result i32 i64 exnref)
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$4
-;; CHECK-BIN-NODEBUG-NEXT: (throw_ref
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$5 (result exnref)
-;; CHECK-BIN-NODEBUG-NEXT: (try_table (catch $tag$2 $label$2) (catch_ref $tag$2 $label$3) (catch_all $label$4) (catch_all_ref $label$5)
-;; CHECK-BIN-NODEBUG-NEXT: (call $0)
-;; CHECK-BIN-NODEBUG-NEXT: (call $0)
-;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: (br $label$1)
-;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: (br $label$1)
-;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: (drop
-;; CHECK-BIN-NODEBUG-NEXT: (block (result i32)
-;; CHECK-BIN-NODEBUG-NEXT: (local.set $2
-;; CHECK-BIN-NODEBUG-NEXT: (tuple.extract 3 0
-;; CHECK-BIN-NODEBUG-NEXT: (local.get $0)
-;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: (drop
-;; CHECK-BIN-NODEBUG-NEXT: (block (result i64)
-;; CHECK-BIN-NODEBUG-NEXT: (local.set $1
-;; CHECK-BIN-NODEBUG-NEXT: (tuple.extract 3 1
-;; CHECK-BIN-NODEBUG-NEXT: (local.get $0)
-;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (local $scratch (tuple i32 i64 exnref))
+;; CHECK-BIN-NODEBUG-NEXT: (local $scratch_1 i64)
+;; CHECK-BIN-NODEBUG-NEXT: (local $scratch_2 i32)
+;; CHECK-BIN-NODEBUG-NEXT: (local $scratch_3 (tuple i32 i64))
+;; CHECK-BIN-NODEBUG-NEXT: (local $scratch_4 i32)
+;; CHECK-BIN-NODEBUG-NEXT: (block $block4
+;; CHECK-BIN-NODEBUG-NEXT: (drop
+;; CHECK-BIN-NODEBUG-NEXT: (block (result i32)
+;; CHECK-BIN-NODEBUG-NEXT: (local.set $scratch_4
+;; CHECK-BIN-NODEBUG-NEXT: (tuple.extract 2 0
+;; CHECK-BIN-NODEBUG-NEXT: (local.tee $scratch_3
+;; CHECK-BIN-NODEBUG-NEXT: (block $block (type $1) (result i32 i64)
;; CHECK-BIN-NODEBUG-NEXT: (drop
-;; CHECK-BIN-NODEBUG-NEXT: (tuple.extract 3 2
-;; CHECK-BIN-NODEBUG-NEXT: (local.get $0)
+;; CHECK-BIN-NODEBUG-NEXT: (block (result i32)
+;; CHECK-BIN-NODEBUG-NEXT: (local.set $scratch_2
+;; CHECK-BIN-NODEBUG-NEXT: (tuple.extract 3 0
+;; CHECK-BIN-NODEBUG-NEXT: (local.tee $scratch
+;; CHECK-BIN-NODEBUG-NEXT: (block $block1 (type $2) (result i32 i64 exnref)
+;; CHECK-BIN-NODEBUG-NEXT: (block $block2
+;; CHECK-BIN-NODEBUG-NEXT: (throw_ref
+;; CHECK-BIN-NODEBUG-NEXT: (block $block3 (result exnref)
+;; CHECK-BIN-NODEBUG-NEXT: (try_table (catch $tag$2 $block) (catch_ref $tag$2 $block1) (catch_all $block2) (catch_all_ref $block3)
+;; CHECK-BIN-NODEBUG-NEXT: (call $0)
+;; CHECK-BIN-NODEBUG-NEXT: (call $0)
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (br $block4)
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (br $block4)
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (drop
+;; CHECK-BIN-NODEBUG-NEXT: (block (result i64)
+;; CHECK-BIN-NODEBUG-NEXT: (local.set $scratch_1
+;; CHECK-BIN-NODEBUG-NEXT: (tuple.extract 3 1
+;; CHECK-BIN-NODEBUG-NEXT: (local.get $scratch)
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (drop
+;; CHECK-BIN-NODEBUG-NEXT: (tuple.extract 3 2
+;; CHECK-BIN-NODEBUG-NEXT: (local.get $scratch)
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (local.get $scratch_1)
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (local.get $scratch_2)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: (local.get $1)
+;; CHECK-BIN-NODEBUG-NEXT: (br $block4)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: (local.get $2)
-;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: (br $label$1)
-;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: (drop
-;; CHECK-BIN-NODEBUG-NEXT: (block (result i32)
-;; CHECK-BIN-NODEBUG-NEXT: (local.set $4
-;; CHECK-BIN-NODEBUG-NEXT: (tuple.extract 2 0
-;; CHECK-BIN-NODEBUG-NEXT: (local.get $3)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (drop
;; CHECK-BIN-NODEBUG-NEXT: (tuple.extract 2 1
-;; CHECK-BIN-NODEBUG-NEXT: (local.get $3)
+;; CHECK-BIN-NODEBUG-NEXT: (local.get $scratch_3)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: (local.get $4)
+;; CHECK-BIN-NODEBUG-NEXT: (local.get $scratch_4)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG: (func $9 (type $4) (result i32)
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$1 (result i32)
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$2 (result i32)
-;; CHECK-BIN-NODEBUG-NEXT: (try_table (result i32) (catch $tag$0 $label$1)
-;; CHECK-BIN-NODEBUG-NEXT: (br $label$2
+;; CHECK-BIN-NODEBUG-NEXT: (block $block (result i32)
+;; CHECK-BIN-NODEBUG-NEXT: (block $block1 (result i32)
+;; CHECK-BIN-NODEBUG-NEXT: (try_table (result i32) (catch $tag$0 $block)
+;; CHECK-BIN-NODEBUG-NEXT: (br $block1
;; CHECK-BIN-NODEBUG-NEXT: (i32.const 0)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
@@ -1019,11 +1020,11 @@
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG: (func $10 (type $3) (result exnref)
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$1 (result exnref)
+;; CHECK-BIN-NODEBUG-NEXT: (block $block (result exnref)
;; CHECK-BIN-NODEBUG-NEXT: (drop
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$2 (result i32)
-;; CHECK-BIN-NODEBUG-NEXT: (try_table (catch_all_ref $label$1)
-;; CHECK-BIN-NODEBUG-NEXT: (try_table (catch $tag$0 $label$2)
+;; CHECK-BIN-NODEBUG-NEXT: (block $block1 (result i32)
+;; CHECK-BIN-NODEBUG-NEXT: (try_table (catch_all_ref $block)
+;; CHECK-BIN-NODEBUG-NEXT: (try_table (catch $tag$0 $block1)
;; CHECK-BIN-NODEBUG-NEXT: (if
;; CHECK-BIN-NODEBUG-NEXT: (i32.const 0)
;; CHECK-BIN-NODEBUG-NEXT: (then
@@ -1037,8 +1038,11 @@
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (unreachable)
;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (unreachable)
;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (unreachable)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (ref.null noexn)
diff --git a/test/lit/basic/fn_prolog_epilog.debugInfo.wast b/test/lit/basic/fn_prolog_epilog.debugInfo.wast
index 636c3346e..511ea9ce8 100644
--- a/test/lit/basic/fn_prolog_epilog.debugInfo.wast
+++ b/test/lit/basic/fn_prolog_epilog.debugInfo.wast
@@ -45,9 +45,9 @@
;; CHECK-BIN: (func $0 (type $0)
;; CHECK-BIN-NEXT: (nop)
-;; CHECK-BIN-NEXT: (block $label$1
-;; CHECK-BIN-NEXT: (block $label$2
-;; CHECK-BIN-NEXT: (br $label$2)
+;; CHECK-BIN-NEXT: (block
+;; CHECK-BIN-NEXT: (block $block
+;; CHECK-BIN-NEXT: (br $block)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (return)
@@ -57,9 +57,9 @@
;; CHECK-BIN-NODEBUG: (func $0 (type $0)
;; CHECK-BIN-NODEBUG-NEXT: (nop)
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$1
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$2
-;; CHECK-BIN-NODEBUG-NEXT: (br $label$2)
+;; CHECK-BIN-NODEBUG-NEXT: (block
+;; CHECK-BIN-NODEBUG-NEXT: (block $block
+;; CHECK-BIN-NODEBUG-NEXT: (br $block)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (return)
diff --git a/test/lit/basic/min.wast b/test/lit/basic/min.wast
index 44928cd83..e4de00185 100644
--- a/test/lit/basic/min.wast
+++ b/test/lit/basic/min.wast
@@ -76,7 +76,7 @@
;; CHECK-BIN-NEXT: (local $n f32)
;; CHECK-BIN-NEXT: (local.tee $n
;; CHECK-BIN-NEXT: (f32.neg
- ;; CHECK-BIN-NEXT: (block $label$1 (result f32)
+ ;; CHECK-BIN-NEXT: (block (result f32)
;; CHECK-BIN-NEXT: (i32.store
;; CHECK-BIN-NEXT: (local.get $k)
;; CHECK-BIN-NEXT: (local.get $p)
@@ -127,21 +127,21 @@
;; CHECK-TEXT-NEXT: )
;; CHECK-TEXT-NEXT: )
;; CHECK-BIN: (func $littleswitch (type $2) (param $x i32) (result i32)
- ;; CHECK-BIN-NEXT: (block $label$1 (result i32)
- ;; CHECK-BIN-NEXT: (block $label$2
- ;; CHECK-BIN-NEXT: (block $label$3
- ;; CHECK-BIN-NEXT: (br_table $label$3 $label$2 $label$3
+ ;; CHECK-BIN-NEXT: (block $block2 (result i32)
+ ;; CHECK-BIN-NEXT: (block $block1
+ ;; CHECK-BIN-NEXT: (block $block
+ ;; CHECK-BIN-NEXT: (br_table $block $block1 $block
;; CHECK-BIN-NEXT: (i32.sub
;; CHECK-BIN-NEXT: (local.get $x)
;; CHECK-BIN-NEXT: (i32.const 1)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: (br $label$1
+ ;; CHECK-BIN-NEXT: (br $block2
;; CHECK-BIN-NEXT: (i32.const 1)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: (br $label$1
+ ;; CHECK-BIN-NEXT: (br $block2
;; CHECK-BIN-NEXT: (i32.const 2)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
@@ -196,7 +196,7 @@
;; CHECK-BIN-NODEBUG-NEXT: (local $2 f32)
;; CHECK-BIN-NODEBUG-NEXT: (local.tee $2
;; CHECK-BIN-NODEBUG-NEXT: (f32.neg
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$1 (result f32)
+;; CHECK-BIN-NODEBUG-NEXT: (block (result f32)
;; CHECK-BIN-NODEBUG-NEXT: (i32.store
;; CHECK-BIN-NODEBUG-NEXT: (local.get $0)
;; CHECK-BIN-NODEBUG-NEXT: (local.get $1)
@@ -210,21 +210,21 @@
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG: (func $2 (type $2) (param $0 i32) (result i32)
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$1 (result i32)
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$2
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$3
-;; CHECK-BIN-NODEBUG-NEXT: (br_table $label$3 $label$2 $label$3
+;; CHECK-BIN-NODEBUG-NEXT: (block $block2 (result i32)
+;; CHECK-BIN-NODEBUG-NEXT: (block $block1
+;; CHECK-BIN-NODEBUG-NEXT: (block $block
+;; CHECK-BIN-NODEBUG-NEXT: (br_table $block $block1 $block
;; CHECK-BIN-NODEBUG-NEXT: (i32.sub
;; CHECK-BIN-NODEBUG-NEXT: (local.get $0)
;; CHECK-BIN-NODEBUG-NEXT: (i32.const 1)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: (br $label$1
+;; CHECK-BIN-NODEBUG-NEXT: (br $block2
;; CHECK-BIN-NODEBUG-NEXT: (i32.const 1)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: (br $label$1
+;; CHECK-BIN-NODEBUG-NEXT: (br $block2
;; CHECK-BIN-NODEBUG-NEXT: (i32.const 2)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
diff --git a/test/lit/basic/polymorphic_stack.wast b/test/lit/basic/polymorphic_stack.wast
index fc743bf2a..2ccaa51e7 100644
--- a/test/lit/basic/polymorphic_stack.wast
+++ b/test/lit/basic/polymorphic_stack.wast
@@ -47,9 +47,7 @@
;; CHECK-BIN: (import "env" "table" (table $timport$0 9 9 funcref))
;; CHECK-BIN: (func $break-and-binary (type $0) (result i32)
- ;; CHECK-BIN-NEXT: (block $label$1 (result i32)
- ;; CHECK-BIN-NEXT: (unreachable)
- ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (unreachable)
;; CHECK-BIN-NEXT: )
(func $break-and-binary (result i32)
(block $x (result i32)
@@ -227,15 +225,13 @@
;; CHECK-TEXT-NEXT: )
;; CHECK-TEXT-NEXT: )
;; CHECK-BIN: (func $untaken-break-should-have-value (type $0) (result i32)
- ;; CHECK-BIN-NEXT: (block $label$1 (result i32)
- ;; CHECK-BIN-NEXT: (block $label$2
- ;; CHECK-BIN-NEXT: (drop
- ;; CHECK-BIN-NEXT: (i32.const 0)
- ;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: (unreachable)
+ ;; CHECK-BIN-NEXT: (block
+ ;; CHECK-BIN-NEXT: (drop
+ ;; CHECK-BIN-NEXT: (i32.const 0)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (unreachable)
;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (unreachable)
;; CHECK-BIN-NEXT: )
(func $untaken-break-should-have-value (result i32)
(block $x (result i32)
@@ -275,7 +271,7 @@
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: (block $label$2 (result i32)
+ ;; CHECK-BIN-NEXT: (block (result i32)
;; CHECK-BIN-NEXT: (drop
;; CHECK-BIN-NEXT: (i32.const 0)
;; CHECK-BIN-NEXT: )
@@ -314,10 +310,8 @@
;; CHECK-TEXT-NEXT: )
;; CHECK-TEXT-NEXT: )
;; CHECK-BIN: (func $br_table_unreachable_to_also_unreachable (type $0) (result i32)
- ;; CHECK-BIN-NEXT: (block $label$1 (result i32)
- ;; CHECK-BIN-NEXT: (block $label$2 (result i32)
- ;; CHECK-BIN-NEXT: (unreachable)
- ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (block (result i32)
+ ;; CHECK-BIN-NEXT: (unreachable)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
(func $br_table_unreachable_to_also_unreachable (result i32)
@@ -352,20 +346,19 @@
;; CHECK-TEXT-NEXT: )
;; CHECK-TEXT-NEXT: )
;; CHECK-BIN: (func $untaken-br_if (type $0) (result i32)
- ;; CHECK-BIN-NEXT: (block $label$1 (result i32)
- ;; CHECK-BIN-NEXT: (block $label$2
- ;; CHECK-BIN-NEXT: (if
- ;; CHECK-BIN-NEXT: (i32.const 0)
- ;; CHECK-BIN-NEXT: (then
- ;; CHECK-BIN-NEXT: (unreachable)
- ;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: (else
- ;; CHECK-BIN-NEXT: (unreachable)
- ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (block
+ ;; CHECK-BIN-NEXT: (if
+ ;; CHECK-BIN-NEXT: (i32.const 0)
+ ;; CHECK-BIN-NEXT: (then
+ ;; CHECK-BIN-NEXT: (unreachable)
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (else
+ ;; CHECK-BIN-NEXT: (unreachable)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (unreachable)
;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (unreachable)
;; CHECK-BIN-NEXT: )
(func $untaken-br_if (result i32)
(block $label$8 (result i32)
@@ -399,9 +392,7 @@
;; CHECK-BIN-NODEBUG: (import "env" "table" (table $timport$0 9 9 funcref))
;; CHECK-BIN-NODEBUG: (func $0 (type $0) (result i32)
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$1 (result i32)
-;; CHECK-BIN-NODEBUG-NEXT: (unreachable)
-;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (unreachable)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG: (func $1 (type $1) (param $0 i32) (result i32)
@@ -428,15 +419,13 @@
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG: (func $5 (type $0) (result i32)
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$1 (result i32)
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$2
-;; CHECK-BIN-NODEBUG-NEXT: (drop
-;; CHECK-BIN-NODEBUG-NEXT: (i32.const 0)
-;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: (unreachable)
+;; CHECK-BIN-NODEBUG-NEXT: (block
+;; CHECK-BIN-NODEBUG-NEXT: (drop
+;; CHECK-BIN-NODEBUG-NEXT: (i32.const 0)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (unreachable)
;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (unreachable)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG: (func $6 (type $1) (param $0 i32) (result i32)
@@ -448,7 +437,7 @@
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$2 (result i32)
+;; CHECK-BIN-NODEBUG-NEXT: (block (result i32)
;; CHECK-BIN-NODEBUG-NEXT: (drop
;; CHECK-BIN-NODEBUG-NEXT: (i32.const 0)
;; CHECK-BIN-NODEBUG-NEXT: )
@@ -459,26 +448,23 @@
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG: (func $7 (type $0) (result i32)
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$1 (result i32)
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$2 (result i32)
-;; CHECK-BIN-NODEBUG-NEXT: (unreachable)
-;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (block (result i32)
+;; CHECK-BIN-NODEBUG-NEXT: (unreachable)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG: (func $8 (type $0) (result i32)
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$1 (result i32)
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$2
-;; CHECK-BIN-NODEBUG-NEXT: (if
-;; CHECK-BIN-NODEBUG-NEXT: (i32.const 0)
-;; CHECK-BIN-NODEBUG-NEXT: (then
-;; CHECK-BIN-NODEBUG-NEXT: (unreachable)
-;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: (else
-;; CHECK-BIN-NODEBUG-NEXT: (unreachable)
-;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (block
+;; CHECK-BIN-NODEBUG-NEXT: (if
+;; CHECK-BIN-NODEBUG-NEXT: (i32.const 0)
+;; CHECK-BIN-NODEBUG-NEXT: (then
+;; CHECK-BIN-NODEBUG-NEXT: (unreachable)
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (else
+;; CHECK-BIN-NODEBUG-NEXT: (unreachable)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (unreachable)
;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (unreachable)
;; CHECK-BIN-NODEBUG-NEXT: )
diff --git a/test/lit/basic/reference-types.wast b/test/lit/basic/reference-types.wast
index 22250c9a0..61497e612 100644
--- a/test/lit/basic/reference-types.wast
+++ b/test/lit/basic/reference-types.wast
@@ -944,25 +944,25 @@
;; CHECK-BIN-NEXT: (i32.const 3)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (drop
- ;; CHECK-BIN-NEXT: (block $label$1 (result eqref)
- ;; CHECK-BIN-NEXT: (br_if $label$1
+ ;; CHECK-BIN-NEXT: (block $block (result eqref)
+ ;; CHECK-BIN-NEXT: (br_if $block
;; CHECK-BIN-NEXT: (local.get $local_eqref)
;; CHECK-BIN-NEXT: (i32.const 1)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (drop
- ;; CHECK-BIN-NEXT: (block $label$2 (result eqref)
- ;; CHECK-BIN-NEXT: (br_if $label$2
+ ;; CHECK-BIN-NEXT: (block $block1 (result eqref)
+ ;; CHECK-BIN-NEXT: (br_if $block1
;; CHECK-BIN-NEXT: (global.get $global_eqref)
;; CHECK-BIN-NEXT: (i32.const 1)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (drop
- ;; CHECK-BIN-NEXT: (block $label$3 (result eqref)
+ ;; CHECK-BIN-NEXT: (block $block2 (result eqref)
;; CHECK-BIN-NEXT: (ref.cast nullref
- ;; CHECK-BIN-NEXT: (br_if $label$3
+ ;; CHECK-BIN-NEXT: (br_if $block2
;; CHECK-BIN-NEXT: (ref.null none)
;; CHECK-BIN-NEXT: (i32.const 1)
;; CHECK-BIN-NEXT: )
@@ -970,25 +970,25 @@
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (drop
- ;; CHECK-BIN-NEXT: (block $label$4 (result funcref)
- ;; CHECK-BIN-NEXT: (br_if $label$4
+ ;; CHECK-BIN-NEXT: (block $block3 (result funcref)
+ ;; CHECK-BIN-NEXT: (br_if $block3
;; CHECK-BIN-NEXT: (local.get $local_funcref)
;; CHECK-BIN-NEXT: (i32.const 1)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (drop
- ;; CHECK-BIN-NEXT: (block $label$5 (result funcref)
- ;; CHECK-BIN-NEXT: (br_if $label$5
+ ;; CHECK-BIN-NEXT: (block $block4 (result funcref)
+ ;; CHECK-BIN-NEXT: (br_if $block4
;; CHECK-BIN-NEXT: (global.get $global_funcref)
;; CHECK-BIN-NEXT: (i32.const 1)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (drop
- ;; CHECK-BIN-NEXT: (block $label$6 (result funcref)
+ ;; CHECK-BIN-NEXT: (block $block5 (result funcref)
;; CHECK-BIN-NEXT: (ref.cast nullfuncref
- ;; CHECK-BIN-NEXT: (br_if $label$6
+ ;; CHECK-BIN-NEXT: (br_if $block5
;; CHECK-BIN-NEXT: (ref.null nofunc)
;; CHECK-BIN-NEXT: (i32.const 1)
;; CHECK-BIN-NEXT: )
@@ -996,9 +996,9 @@
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (drop
- ;; CHECK-BIN-NEXT: (block $label$7 (result funcref)
+ ;; CHECK-BIN-NEXT: (block $block6 (result funcref)
;; CHECK-BIN-NEXT: (ref.cast (ref $3)
- ;; CHECK-BIN-NEXT: (br_if $label$7
+ ;; CHECK-BIN-NEXT: (br_if $block6
;; CHECK-BIN-NEXT: (ref.func $foo)
;; CHECK-BIN-NEXT: (i32.const 1)
;; CHECK-BIN-NEXT: )
@@ -1006,25 +1006,25 @@
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (drop
- ;; CHECK-BIN-NEXT: (block $label$8 (result anyref)
- ;; CHECK-BIN-NEXT: (br_if $label$8
+ ;; CHECK-BIN-NEXT: (block $block7 (result anyref)
+ ;; CHECK-BIN-NEXT: (br_if $block7
;; CHECK-BIN-NEXT: (local.get $local_anyref)
;; CHECK-BIN-NEXT: (i32.const 1)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (drop
- ;; CHECK-BIN-NEXT: (block $label$9 (result anyref)
- ;; CHECK-BIN-NEXT: (br_if $label$9
+ ;; CHECK-BIN-NEXT: (block $block8 (result anyref)
+ ;; CHECK-BIN-NEXT: (br_if $block8
;; CHECK-BIN-NEXT: (global.get $global_anyref)
;; CHECK-BIN-NEXT: (i32.const 1)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (drop
- ;; CHECK-BIN-NEXT: (block $label$10 (result anyref)
+ ;; CHECK-BIN-NEXT: (block $block9 (result anyref)
;; CHECK-BIN-NEXT: (ref.cast nullref
- ;; CHECK-BIN-NEXT: (br_if $label$10
+ ;; CHECK-BIN-NEXT: (br_if $block9
;; CHECK-BIN-NEXT: (ref.null none)
;; CHECK-BIN-NEXT: (i32.const 1)
;; CHECK-BIN-NEXT: )
@@ -1032,9 +1032,9 @@
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (drop
- ;; CHECK-BIN-NEXT: (block $label$11 (result anyref)
+ ;; CHECK-BIN-NEXT: (block $block10 (result anyref)
;; CHECK-BIN-NEXT: (ref.cast eqref
- ;; CHECK-BIN-NEXT: (br_if $label$11
+ ;; CHECK-BIN-NEXT: (br_if $block10
;; CHECK-BIN-NEXT: (local.get $local_eqref)
;; CHECK-BIN-NEXT: (i32.const 1)
;; CHECK-BIN-NEXT: )
@@ -1042,9 +1042,9 @@
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (drop
- ;; CHECK-BIN-NEXT: (block $label$12 (result anyref)
+ ;; CHECK-BIN-NEXT: (block $block11 (result anyref)
;; CHECK-BIN-NEXT: (ref.cast nullref
- ;; CHECK-BIN-NEXT: (br_if $label$12
+ ;; CHECK-BIN-NEXT: (br_if $block11
;; CHECK-BIN-NEXT: (ref.null none)
;; CHECK-BIN-NEXT: (i32.const 1)
;; CHECK-BIN-NEXT: )
@@ -1052,67 +1052,67 @@
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (drop
- ;; CHECK-BIN-NEXT: (loop $label$13 (result eqref)
+ ;; CHECK-BIN-NEXT: (loop (result eqref)
;; CHECK-BIN-NEXT: (local.get $local_eqref)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (drop
- ;; CHECK-BIN-NEXT: (loop $label$14 (result eqref)
+ ;; CHECK-BIN-NEXT: (loop (result eqref)
;; CHECK-BIN-NEXT: (global.get $global_eqref)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (drop
- ;; CHECK-BIN-NEXT: (loop $label$15 (result eqref)
+ ;; CHECK-BIN-NEXT: (loop (result eqref)
;; CHECK-BIN-NEXT: (ref.null none)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (drop
- ;; CHECK-BIN-NEXT: (loop $label$16 (result funcref)
+ ;; CHECK-BIN-NEXT: (loop (result funcref)
;; CHECK-BIN-NEXT: (local.get $local_funcref)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (drop
- ;; CHECK-BIN-NEXT: (loop $label$17 (result funcref)
+ ;; CHECK-BIN-NEXT: (loop (result funcref)
;; CHECK-BIN-NEXT: (global.get $global_funcref)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (drop
- ;; CHECK-BIN-NEXT: (loop $label$18 (result funcref)
+ ;; CHECK-BIN-NEXT: (loop (result funcref)
;; CHECK-BIN-NEXT: (ref.null nofunc)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (drop
- ;; CHECK-BIN-NEXT: (loop $label$19 (result funcref)
+ ;; CHECK-BIN-NEXT: (loop (result funcref)
;; CHECK-BIN-NEXT: (ref.func $foo)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (drop
- ;; CHECK-BIN-NEXT: (loop $label$20 (result anyref)
+ ;; CHECK-BIN-NEXT: (loop (result anyref)
;; CHECK-BIN-NEXT: (local.get $local_anyref)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (drop
- ;; CHECK-BIN-NEXT: (loop $label$21 (result anyref)
+ ;; CHECK-BIN-NEXT: (loop (result anyref)
;; CHECK-BIN-NEXT: (global.get $global_anyref)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (drop
- ;; CHECK-BIN-NEXT: (loop $label$22 (result anyref)
+ ;; CHECK-BIN-NEXT: (loop (result anyref)
;; CHECK-BIN-NEXT: (ref.null none)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (drop
- ;; CHECK-BIN-NEXT: (loop $label$23 (result anyref)
+ ;; CHECK-BIN-NEXT: (loop (result anyref)
;; CHECK-BIN-NEXT: (local.get $local_eqref)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (drop
- ;; CHECK-BIN-NEXT: (loop $label$24 (result anyref)
+ ;; CHECK-BIN-NEXT: (loop (result anyref)
;; CHECK-BIN-NEXT: (global.get $global_eqref)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (drop
- ;; CHECK-BIN-NEXT: (loop $label$25 (result anyref)
+ ;; CHECK-BIN-NEXT: (loop (result anyref)
;; CHECK-BIN-NEXT: (ref.null none)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
@@ -1185,7 +1185,7 @@
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (drop
- ;; CHECK-BIN-NEXT: (try $label$40 (result eqref)
+ ;; CHECK-BIN-NEXT: (try (result eqref)
;; CHECK-BIN-NEXT: (do
;; CHECK-BIN-NEXT: (local.get $local_eqref)
;; CHECK-BIN-NEXT: )
@@ -1198,7 +1198,7 @@
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (drop
- ;; CHECK-BIN-NEXT: (try $label$43 (result funcref)
+ ;; CHECK-BIN-NEXT: (try (result funcref)
;; CHECK-BIN-NEXT: (do
;; CHECK-BIN-NEXT: (ref.func $foo)
;; CHECK-BIN-NEXT: )
@@ -1211,7 +1211,7 @@
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (drop
- ;; CHECK-BIN-NEXT: (try $label$46 (result anyref)
+ ;; CHECK-BIN-NEXT: (try (result anyref)
;; CHECK-BIN-NEXT: (do
;; CHECK-BIN-NEXT: (local.get $local_eqref)
;; CHECK-BIN-NEXT: )
@@ -1224,7 +1224,7 @@
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (drop
- ;; CHECK-BIN-NEXT: (try $label$49 (result anyref)
+ ;; CHECK-BIN-NEXT: (try (result anyref)
;; CHECK-BIN-NEXT: (do
;; CHECK-BIN-NEXT: (ref.null none)
;; CHECK-BIN-NEXT: )
@@ -1237,11 +1237,11 @@
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (drop
- ;; CHECK-BIN-NEXT: (block $label$50 (result eqref)
+ ;; CHECK-BIN-NEXT: (block $block13 (result eqref)
;; CHECK-BIN-NEXT: (drop
- ;; CHECK-BIN-NEXT: (block $label$51 (result i32)
- ;; CHECK-BIN-NEXT: (br $label$50
- ;; CHECK-BIN-NEXT: (try_table (result eqref) (catch $e-i32 $label$51)
+ ;; CHECK-BIN-NEXT: (block $block12 (result i32)
+ ;; CHECK-BIN-NEXT: (br $block13
+ ;; CHECK-BIN-NEXT: (try_table (result eqref) (catch $e-i32 $block12)
;; CHECK-BIN-NEXT: (local.get $local_eqref)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
@@ -1251,11 +1251,11 @@
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (drop
- ;; CHECK-BIN-NEXT: (block $label$53 (result funcref)
+ ;; CHECK-BIN-NEXT: (block $block15 (result funcref)
;; CHECK-BIN-NEXT: (drop
- ;; CHECK-BIN-NEXT: (block $label$54 (result i32)
- ;; CHECK-BIN-NEXT: (br $label$53
- ;; CHECK-BIN-NEXT: (try_table (result funcref) (catch $e-i32 $label$54)
+ ;; CHECK-BIN-NEXT: (block $block14 (result i32)
+ ;; CHECK-BIN-NEXT: (br $block15
+ ;; CHECK-BIN-NEXT: (try_table (result funcref) (catch $e-i32 $block14)
;; CHECK-BIN-NEXT: (ref.func $foo)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
@@ -1265,11 +1265,11 @@
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (drop
- ;; CHECK-BIN-NEXT: (block $label$56 (result anyref)
+ ;; CHECK-BIN-NEXT: (block $block17 (result anyref)
;; CHECK-BIN-NEXT: (drop
- ;; CHECK-BIN-NEXT: (block $label$57 (result i32)
- ;; CHECK-BIN-NEXT: (br $label$56
- ;; CHECK-BIN-NEXT: (try_table (result anyref) (catch $e-i32 $label$57)
+ ;; CHECK-BIN-NEXT: (block $block16 (result i32)
+ ;; CHECK-BIN-NEXT: (br $block17
+ ;; CHECK-BIN-NEXT: (try_table (result anyref) (catch $e-i32 $block16)
;; CHECK-BIN-NEXT: (local.get $local_eqref)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
@@ -1279,11 +1279,11 @@
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (drop
- ;; CHECK-BIN-NEXT: (block $label$59 (result anyref)
+ ;; CHECK-BIN-NEXT: (block $block19 (result anyref)
;; CHECK-BIN-NEXT: (drop
- ;; CHECK-BIN-NEXT: (block $label$60 (result i32)
- ;; CHECK-BIN-NEXT: (br $label$59
- ;; CHECK-BIN-NEXT: (try_table (result anyref) (catch $e-i32 $label$60)
+ ;; CHECK-BIN-NEXT: (block $block18 (result i32)
+ ;; CHECK-BIN-NEXT: (br $block19
+ ;; CHECK-BIN-NEXT: (try_table (result anyref) (catch $e-i32 $block18)
;; CHECK-BIN-NEXT: (ref.null none)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
@@ -2281,25 +2281,25 @@
;; CHECK-BIN-NODEBUG-NEXT: (i32.const 3)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (drop
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$1 (result eqref)
-;; CHECK-BIN-NODEBUG-NEXT: (br_if $label$1
+;; CHECK-BIN-NODEBUG-NEXT: (block $block (result eqref)
+;; CHECK-BIN-NODEBUG-NEXT: (br_if $block
;; CHECK-BIN-NODEBUG-NEXT: (local.get $0)
;; CHECK-BIN-NODEBUG-NEXT: (i32.const 1)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (drop
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$2 (result eqref)
-;; CHECK-BIN-NODEBUG-NEXT: (br_if $label$2
+;; CHECK-BIN-NODEBUG-NEXT: (block $block1 (result eqref)
+;; CHECK-BIN-NODEBUG-NEXT: (br_if $block1
;; CHECK-BIN-NODEBUG-NEXT: (global.get $global$0)
;; CHECK-BIN-NODEBUG-NEXT: (i32.const 1)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (drop
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$3 (result eqref)
+;; CHECK-BIN-NODEBUG-NEXT: (block $block2 (result eqref)
;; CHECK-BIN-NODEBUG-NEXT: (ref.cast nullref
-;; CHECK-BIN-NODEBUG-NEXT: (br_if $label$3
+;; CHECK-BIN-NODEBUG-NEXT: (br_if $block2
;; CHECK-BIN-NODEBUG-NEXT: (ref.null none)
;; CHECK-BIN-NODEBUG-NEXT: (i32.const 1)
;; CHECK-BIN-NODEBUG-NEXT: )
@@ -2307,25 +2307,25 @@
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (drop
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$4 (result funcref)
-;; CHECK-BIN-NODEBUG-NEXT: (br_if $label$4
+;; CHECK-BIN-NODEBUG-NEXT: (block $block3 (result funcref)
+;; CHECK-BIN-NODEBUG-NEXT: (br_if $block3
;; CHECK-BIN-NODEBUG-NEXT: (local.get $1)
;; CHECK-BIN-NODEBUG-NEXT: (i32.const 1)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (drop
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$5 (result funcref)
-;; CHECK-BIN-NODEBUG-NEXT: (br_if $label$5
+;; CHECK-BIN-NODEBUG-NEXT: (block $block4 (result funcref)
+;; CHECK-BIN-NODEBUG-NEXT: (br_if $block4
;; CHECK-BIN-NODEBUG-NEXT: (global.get $global$1)
;; CHECK-BIN-NODEBUG-NEXT: (i32.const 1)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (drop
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$6 (result funcref)
+;; CHECK-BIN-NODEBUG-NEXT: (block $block5 (result funcref)
;; CHECK-BIN-NODEBUG-NEXT: (ref.cast nullfuncref
-;; CHECK-BIN-NODEBUG-NEXT: (br_if $label$6
+;; CHECK-BIN-NODEBUG-NEXT: (br_if $block5
;; CHECK-BIN-NODEBUG-NEXT: (ref.null nofunc)
;; CHECK-BIN-NODEBUG-NEXT: (i32.const 1)
;; CHECK-BIN-NODEBUG-NEXT: )
@@ -2333,9 +2333,9 @@
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (drop
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$7 (result funcref)
+;; CHECK-BIN-NODEBUG-NEXT: (block $block6 (result funcref)
;; CHECK-BIN-NODEBUG-NEXT: (ref.cast (ref $3)
-;; CHECK-BIN-NODEBUG-NEXT: (br_if $label$7
+;; CHECK-BIN-NODEBUG-NEXT: (br_if $block6
;; CHECK-BIN-NODEBUG-NEXT: (ref.func $3)
;; CHECK-BIN-NODEBUG-NEXT: (i32.const 1)
;; CHECK-BIN-NODEBUG-NEXT: )
@@ -2343,25 +2343,25 @@
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (drop
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$8 (result anyref)
-;; CHECK-BIN-NODEBUG-NEXT: (br_if $label$8
+;; CHECK-BIN-NODEBUG-NEXT: (block $block7 (result anyref)
+;; CHECK-BIN-NODEBUG-NEXT: (br_if $block7
;; CHECK-BIN-NODEBUG-NEXT: (local.get $2)
;; CHECK-BIN-NODEBUG-NEXT: (i32.const 1)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (drop
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$9 (result anyref)
-;; CHECK-BIN-NODEBUG-NEXT: (br_if $label$9
+;; CHECK-BIN-NODEBUG-NEXT: (block $block8 (result anyref)
+;; CHECK-BIN-NODEBUG-NEXT: (br_if $block8
;; CHECK-BIN-NODEBUG-NEXT: (global.get $global$3)
;; CHECK-BIN-NODEBUG-NEXT: (i32.const 1)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (drop
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$10 (result anyref)
+;; CHECK-BIN-NODEBUG-NEXT: (block $block9 (result anyref)
;; CHECK-BIN-NODEBUG-NEXT: (ref.cast nullref
-;; CHECK-BIN-NODEBUG-NEXT: (br_if $label$10
+;; CHECK-BIN-NODEBUG-NEXT: (br_if $block9
;; CHECK-BIN-NODEBUG-NEXT: (ref.null none)
;; CHECK-BIN-NODEBUG-NEXT: (i32.const 1)
;; CHECK-BIN-NODEBUG-NEXT: )
@@ -2369,9 +2369,9 @@
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (drop
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$11 (result anyref)
+;; CHECK-BIN-NODEBUG-NEXT: (block $block10 (result anyref)
;; CHECK-BIN-NODEBUG-NEXT: (ref.cast eqref
-;; CHECK-BIN-NODEBUG-NEXT: (br_if $label$11
+;; CHECK-BIN-NODEBUG-NEXT: (br_if $block10
;; CHECK-BIN-NODEBUG-NEXT: (local.get $0)
;; CHECK-BIN-NODEBUG-NEXT: (i32.const 1)
;; CHECK-BIN-NODEBUG-NEXT: )
@@ -2379,9 +2379,9 @@
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (drop
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$12 (result anyref)
+;; CHECK-BIN-NODEBUG-NEXT: (block $block11 (result anyref)
;; CHECK-BIN-NODEBUG-NEXT: (ref.cast nullref
-;; CHECK-BIN-NODEBUG-NEXT: (br_if $label$12
+;; CHECK-BIN-NODEBUG-NEXT: (br_if $block11
;; CHECK-BIN-NODEBUG-NEXT: (ref.null none)
;; CHECK-BIN-NODEBUG-NEXT: (i32.const 1)
;; CHECK-BIN-NODEBUG-NEXT: )
@@ -2389,67 +2389,67 @@
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (drop
-;; CHECK-BIN-NODEBUG-NEXT: (loop $label$13 (result eqref)
+;; CHECK-BIN-NODEBUG-NEXT: (loop (result eqref)
;; CHECK-BIN-NODEBUG-NEXT: (local.get $0)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (drop
-;; CHECK-BIN-NODEBUG-NEXT: (loop $label$14 (result eqref)
+;; CHECK-BIN-NODEBUG-NEXT: (loop (result eqref)
;; CHECK-BIN-NODEBUG-NEXT: (global.get $global$0)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (drop
-;; CHECK-BIN-NODEBUG-NEXT: (loop $label$15 (result eqref)
+;; CHECK-BIN-NODEBUG-NEXT: (loop (result eqref)
;; CHECK-BIN-NODEBUG-NEXT: (ref.null none)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (drop
-;; CHECK-BIN-NODEBUG-NEXT: (loop $label$16 (result funcref)
+;; CHECK-BIN-NODEBUG-NEXT: (loop (result funcref)
;; CHECK-BIN-NODEBUG-NEXT: (local.get $1)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (drop
-;; CHECK-BIN-NODEBUG-NEXT: (loop $label$17 (result funcref)
+;; CHECK-BIN-NODEBUG-NEXT: (loop (result funcref)
;; CHECK-BIN-NODEBUG-NEXT: (global.get $global$1)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (drop
-;; CHECK-BIN-NODEBUG-NEXT: (loop $label$18 (result funcref)
+;; CHECK-BIN-NODEBUG-NEXT: (loop (result funcref)
;; CHECK-BIN-NODEBUG-NEXT: (ref.null nofunc)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (drop
-;; CHECK-BIN-NODEBUG-NEXT: (loop $label$19 (result funcref)
+;; CHECK-BIN-NODEBUG-NEXT: (loop (result funcref)
;; CHECK-BIN-NODEBUG-NEXT: (ref.func $3)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (drop
-;; CHECK-BIN-NODEBUG-NEXT: (loop $label$20 (result anyref)
+;; CHECK-BIN-NODEBUG-NEXT: (loop (result anyref)
;; CHECK-BIN-NODEBUG-NEXT: (local.get $2)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (drop
-;; CHECK-BIN-NODEBUG-NEXT: (loop $label$21 (result anyref)
+;; CHECK-BIN-NODEBUG-NEXT: (loop (result anyref)
;; CHECK-BIN-NODEBUG-NEXT: (global.get $global$3)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (drop
-;; CHECK-BIN-NODEBUG-NEXT: (loop $label$22 (result anyref)
+;; CHECK-BIN-NODEBUG-NEXT: (loop (result anyref)
;; CHECK-BIN-NODEBUG-NEXT: (ref.null none)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (drop
-;; CHECK-BIN-NODEBUG-NEXT: (loop $label$23 (result anyref)
+;; CHECK-BIN-NODEBUG-NEXT: (loop (result anyref)
;; CHECK-BIN-NODEBUG-NEXT: (local.get $0)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (drop
-;; CHECK-BIN-NODEBUG-NEXT: (loop $label$24 (result anyref)
+;; CHECK-BIN-NODEBUG-NEXT: (loop (result anyref)
;; CHECK-BIN-NODEBUG-NEXT: (global.get $global$0)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (drop
-;; CHECK-BIN-NODEBUG-NEXT: (loop $label$25 (result anyref)
+;; CHECK-BIN-NODEBUG-NEXT: (loop (result anyref)
;; CHECK-BIN-NODEBUG-NEXT: (ref.null none)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
@@ -2522,7 +2522,7 @@
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (drop
-;; CHECK-BIN-NODEBUG-NEXT: (try $label$40 (result eqref)
+;; CHECK-BIN-NODEBUG-NEXT: (try (result eqref)
;; CHECK-BIN-NODEBUG-NEXT: (do
;; CHECK-BIN-NODEBUG-NEXT: (local.get $0)
;; CHECK-BIN-NODEBUG-NEXT: )
@@ -2535,7 +2535,7 @@
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (drop
-;; CHECK-BIN-NODEBUG-NEXT: (try $label$43 (result funcref)
+;; CHECK-BIN-NODEBUG-NEXT: (try (result funcref)
;; CHECK-BIN-NODEBUG-NEXT: (do
;; CHECK-BIN-NODEBUG-NEXT: (ref.func $3)
;; CHECK-BIN-NODEBUG-NEXT: )
@@ -2548,7 +2548,7 @@
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (drop
-;; CHECK-BIN-NODEBUG-NEXT: (try $label$46 (result anyref)
+;; CHECK-BIN-NODEBUG-NEXT: (try (result anyref)
;; CHECK-BIN-NODEBUG-NEXT: (do
;; CHECK-BIN-NODEBUG-NEXT: (local.get $0)
;; CHECK-BIN-NODEBUG-NEXT: )
@@ -2561,7 +2561,7 @@
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (drop
-;; CHECK-BIN-NODEBUG-NEXT: (try $label$49 (result anyref)
+;; CHECK-BIN-NODEBUG-NEXT: (try (result anyref)
;; CHECK-BIN-NODEBUG-NEXT: (do
;; CHECK-BIN-NODEBUG-NEXT: (ref.null none)
;; CHECK-BIN-NODEBUG-NEXT: )
@@ -2574,11 +2574,11 @@
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (drop
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$50 (result eqref)
+;; CHECK-BIN-NODEBUG-NEXT: (block $block13 (result eqref)
;; CHECK-BIN-NODEBUG-NEXT: (drop
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$51 (result i32)
-;; CHECK-BIN-NODEBUG-NEXT: (br $label$50
-;; CHECK-BIN-NODEBUG-NEXT: (try_table (result eqref) (catch $tag$0 $label$51)
+;; CHECK-BIN-NODEBUG-NEXT: (block $block12 (result i32)
+;; CHECK-BIN-NODEBUG-NEXT: (br $block13
+;; CHECK-BIN-NODEBUG-NEXT: (try_table (result eqref) (catch $tag$0 $block12)
;; CHECK-BIN-NODEBUG-NEXT: (local.get $0)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
@@ -2588,11 +2588,11 @@
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (drop
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$53 (result funcref)
+;; CHECK-BIN-NODEBUG-NEXT: (block $block15 (result funcref)
;; CHECK-BIN-NODEBUG-NEXT: (drop
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$54 (result i32)
-;; CHECK-BIN-NODEBUG-NEXT: (br $label$53
-;; CHECK-BIN-NODEBUG-NEXT: (try_table (result funcref) (catch $tag$0 $label$54)
+;; CHECK-BIN-NODEBUG-NEXT: (block $block14 (result i32)
+;; CHECK-BIN-NODEBUG-NEXT: (br $block15
+;; CHECK-BIN-NODEBUG-NEXT: (try_table (result funcref) (catch $tag$0 $block14)
;; CHECK-BIN-NODEBUG-NEXT: (ref.func $3)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
@@ -2602,11 +2602,11 @@
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (drop
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$56 (result anyref)
+;; CHECK-BIN-NODEBUG-NEXT: (block $block17 (result anyref)
;; CHECK-BIN-NODEBUG-NEXT: (drop
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$57 (result i32)
-;; CHECK-BIN-NODEBUG-NEXT: (br $label$56
-;; CHECK-BIN-NODEBUG-NEXT: (try_table (result anyref) (catch $tag$0 $label$57)
+;; CHECK-BIN-NODEBUG-NEXT: (block $block16 (result i32)
+;; CHECK-BIN-NODEBUG-NEXT: (br $block17
+;; CHECK-BIN-NODEBUG-NEXT: (try_table (result anyref) (catch $tag$0 $block16)
;; CHECK-BIN-NODEBUG-NEXT: (local.get $0)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
@@ -2616,11 +2616,11 @@
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (drop
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$59 (result anyref)
+;; CHECK-BIN-NODEBUG-NEXT: (block $block19 (result anyref)
;; CHECK-BIN-NODEBUG-NEXT: (drop
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$60 (result i32)
-;; CHECK-BIN-NODEBUG-NEXT: (br $label$59
-;; CHECK-BIN-NODEBUG-NEXT: (try_table (result anyref) (catch $tag$0 $label$60)
+;; CHECK-BIN-NODEBUG-NEXT: (block $block18 (result i32)
+;; CHECK-BIN-NODEBUG-NEXT: (br $block19
+;; CHECK-BIN-NODEBUG-NEXT: (try_table (result anyref) (catch $tag$0 $block18)
;; CHECK-BIN-NODEBUG-NEXT: (ref.null none)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
diff --git a/test/lit/basic/reg_switch.wast b/test/lit/basic/reg_switch.wast
index db7494511..a1d00e8aa 100644
--- a/test/lit/basic/reg_switch.wast
+++ b/test/lit/basic/reg_switch.wast
@@ -35,8 +35,8 @@
;; CHECK-BIN-NEXT: (if
;; CHECK-BIN-NEXT: (i32.const 0)
;; CHECK-BIN-NEXT: (then
- ;; CHECK-BIN-NEXT: (block $label$2
- ;; CHECK-BIN-NEXT: (br_table $label$2
+ ;; CHECK-BIN-NEXT: (block $block
+ ;; CHECK-BIN-NEXT: (br_table $block
;; CHECK-BIN-NEXT: (i32.const 0)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
@@ -47,8 +47,8 @@
;; CHECK-BIN-NODEBUG-NEXT: (if
;; CHECK-BIN-NODEBUG-NEXT: (i32.const 0)
;; CHECK-BIN-NODEBUG-NEXT: (then
- ;; CHECK-BIN-NODEBUG-NEXT: (block $label$2
- ;; CHECK-BIN-NODEBUG-NEXT: (br_table $label$2
+ ;; CHECK-BIN-NODEBUG-NEXT: (block $block
+ ;; CHECK-BIN-NODEBUG-NEXT: (br_table $block
;; CHECK-BIN-NODEBUG-NEXT: (i32.const 0)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
diff --git a/test/lit/basic/typed_continuations_resume.wast b/test/lit/basic/typed_continuations_resume.wast
index 5cd2277d3..07afb9388 100644
--- a/test/lit/basic/typed_continuations_resume.wast
+++ b/test/lit/basic/typed_continuations_resume.wast
@@ -61,31 +61,28 @@
;; CHECK-TEXT-NEXT: )
;; CHECK-TEXT-NEXT: )
;; CHECK-BIN: (func $go (type $3) (param $x (ref $ct)) (result i32)
- ;; CHECK-BIN-NEXT: (local $1 (tuple i32 (ref $ct)))
- ;; CHECK-BIN-NEXT: (local $2 i32)
- ;; CHECK-BIN-NEXT: (local.set $1
- ;; CHECK-BIN-NEXT: (block $label$1 (type $2) (result i32 (ref $ct))
- ;; CHECK-BIN-NEXT: (return
- ;; CHECK-BIN-NEXT: (resume $ct (on $t $label$1)
- ;; CHECK-BIN-NEXT: (i32.const 123)
- ;; CHECK-BIN-NEXT: (local.get $x)
+ ;; CHECK-BIN-NEXT: (local $scratch (tuple i32 (ref $ct)))
+ ;; CHECK-BIN-NEXT: (local $scratch_2 i32)
+ ;; CHECK-BIN-NEXT: (local.set $scratch_2
+ ;; CHECK-BIN-NEXT: (tuple.extract 2 0
+ ;; CHECK-BIN-NEXT: (local.tee $scratch
+ ;; CHECK-BIN-NEXT: (block $block (type $2) (result i32 (ref $ct))
+ ;; CHECK-BIN-NEXT: (return
+ ;; CHECK-BIN-NEXT: (resume $ct (on $t $block)
+ ;; CHECK-BIN-NEXT: (i32.const 123)
+ ;; CHECK-BIN-NEXT: (local.get $x)
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: (block (result i32)
- ;; CHECK-BIN-NEXT: (local.set $2
- ;; CHECK-BIN-NEXT: (tuple.extract 2 0
- ;; CHECK-BIN-NEXT: (local.get $1)
- ;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: (drop
- ;; CHECK-BIN-NEXT: (tuple.extract 2 1
- ;; CHECK-BIN-NEXT: (local.get $1)
- ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (drop
+ ;; CHECK-BIN-NEXT: (tuple.extract 2 1
+ ;; CHECK-BIN-NEXT: (local.get $scratch)
;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: (local.get $2)
;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (local.get $scratch_2)
;; CHECK-BIN-NEXT: )
(func $go (param $x (ref $ct)) (result i32)
(tuple.extract 2 0
@@ -135,29 +132,26 @@
;; CHECK-BIN-NODEBUG: (tag $tag$0 (param i32) (result i32))
;; CHECK-BIN-NODEBUG: (func $0 (type $3) (param $0 (ref $1)) (result i32)
-;; CHECK-BIN-NODEBUG-NEXT: (local $1 (tuple i32 (ref $1)))
-;; CHECK-BIN-NODEBUG-NEXT: (local $2 i32)
-;; CHECK-BIN-NODEBUG-NEXT: (local.set $1
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$1 (type $2) (result i32 (ref $1))
-;; CHECK-BIN-NODEBUG-NEXT: (return
-;; CHECK-BIN-NODEBUG-NEXT: (resume $1 (on $tag$0 $label$1)
-;; CHECK-BIN-NODEBUG-NEXT: (i32.const 123)
-;; CHECK-BIN-NODEBUG-NEXT: (local.get $0)
+;; CHECK-BIN-NODEBUG-NEXT: (local $scratch (tuple i32 (ref $1)))
+;; CHECK-BIN-NODEBUG-NEXT: (local $scratch_2 i32)
+;; CHECK-BIN-NODEBUG-NEXT: (local.set $scratch_2
+;; CHECK-BIN-NODEBUG-NEXT: (tuple.extract 2 0
+;; CHECK-BIN-NODEBUG-NEXT: (local.tee $scratch
+;; CHECK-BIN-NODEBUG-NEXT: (block $block (type $2) (result i32 (ref $1))
+;; CHECK-BIN-NODEBUG-NEXT: (return
+;; CHECK-BIN-NODEBUG-NEXT: (resume $1 (on $tag$0 $block)
+;; CHECK-BIN-NODEBUG-NEXT: (i32.const 123)
+;; CHECK-BIN-NODEBUG-NEXT: (local.get $0)
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: (block (result i32)
-;; CHECK-BIN-NODEBUG-NEXT: (local.set $2
-;; CHECK-BIN-NODEBUG-NEXT: (tuple.extract 2 0
-;; CHECK-BIN-NODEBUG-NEXT: (local.get $1)
-;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: (drop
-;; CHECK-BIN-NODEBUG-NEXT: (tuple.extract 2 1
-;; CHECK-BIN-NODEBUG-NEXT: (local.get $1)
-;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (drop
+;; CHECK-BIN-NODEBUG-NEXT: (tuple.extract 2 1
+;; CHECK-BIN-NODEBUG-NEXT: (local.get $scratch)
;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: (local.get $2)
;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (local.get $scratch_2)
;; CHECK-BIN-NODEBUG-NEXT: )
diff --git a/test/lit/basic/types-function-references.wast b/test/lit/basic/types-function-references.wast
index 9500fa4c9..8997e1a3a 100644
--- a/test/lit/basic/types-function-references.wast
+++ b/test/lit/basic/types-function-references.wast
@@ -192,37 +192,36 @@
;; CHECK-TEXT-NEXT: )
;; CHECK-TEXT-NEXT: )
;; CHECK-BIN: (func $type-only-in-tuple-block (type $void)
- ;; CHECK-BIN-NEXT: (local $0 (tuple i32 (ref null $mixed_results) f64))
- ;; CHECK-BIN-NEXT: (local $1 (ref null $mixed_results))
- ;; CHECK-BIN-NEXT: (local $2 i32)
- ;; CHECK-BIN-NEXT: (local.set $0
- ;; CHECK-BIN-NEXT: (block $label$1 (type $3) (result i32 (ref null $mixed_results) f64)
- ;; CHECK-BIN-NEXT: (unreachable)
- ;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (local $scratch (tuple i32 (ref null $mixed_results) f64))
+ ;; CHECK-BIN-NEXT: (local $scratch_1 (ref null $mixed_results))
+ ;; CHECK-BIN-NEXT: (local $scratch_2 i32)
;; CHECK-BIN-NEXT: (drop
;; CHECK-BIN-NEXT: (block (result i32)
- ;; CHECK-BIN-NEXT: (local.set $2
+ ;; CHECK-BIN-NEXT: (local.set $scratch_2
;; CHECK-BIN-NEXT: (tuple.extract 3 0
- ;; CHECK-BIN-NEXT: (local.get $0)
+ ;; CHECK-BIN-NEXT: (local.tee $scratch
+ ;; CHECK-BIN-NEXT: (block (type $3) (result i32 (ref null $mixed_results) f64)
+ ;; CHECK-BIN-NEXT: (unreachable)
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (drop
;; CHECK-BIN-NEXT: (block (result (ref null $mixed_results))
- ;; CHECK-BIN-NEXT: (local.set $1
+ ;; CHECK-BIN-NEXT: (local.set $scratch_1
;; CHECK-BIN-NEXT: (tuple.extract 3 1
- ;; CHECK-BIN-NEXT: (local.get $0)
+ ;; CHECK-BIN-NEXT: (local.get $scratch)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (drop
;; CHECK-BIN-NEXT: (tuple.extract 3 2
- ;; CHECK-BIN-NEXT: (local.get $0)
+ ;; CHECK-BIN-NEXT: (local.get $scratch)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: (local.get $1)
+ ;; CHECK-BIN-NEXT: (local.get $scratch_1)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: (local.get $2)
+ ;; CHECK-BIN-NEXT: (local.get $scratch_2)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
@@ -423,37 +422,36 @@
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG: (func $8 (type $2)
-;; CHECK-BIN-NODEBUG-NEXT: (local $0 (tuple i32 (ref null $0) f64))
-;; CHECK-BIN-NODEBUG-NEXT: (local $1 (ref null $0))
-;; CHECK-BIN-NODEBUG-NEXT: (local $2 i32)
-;; CHECK-BIN-NODEBUG-NEXT: (local.set $0
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$1 (type $3) (result i32 (ref null $0) f64)
-;; CHECK-BIN-NODEBUG-NEXT: (unreachable)
-;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (local $scratch (tuple i32 (ref null $0) f64))
+;; CHECK-BIN-NODEBUG-NEXT: (local $scratch_1 (ref null $0))
+;; CHECK-BIN-NODEBUG-NEXT: (local $scratch_2 i32)
;; CHECK-BIN-NODEBUG-NEXT: (drop
;; CHECK-BIN-NODEBUG-NEXT: (block (result i32)
-;; CHECK-BIN-NODEBUG-NEXT: (local.set $2
+;; CHECK-BIN-NODEBUG-NEXT: (local.set $scratch_2
;; CHECK-BIN-NODEBUG-NEXT: (tuple.extract 3 0
-;; CHECK-BIN-NODEBUG-NEXT: (local.get $0)
+;; CHECK-BIN-NODEBUG-NEXT: (local.tee $scratch
+;; CHECK-BIN-NODEBUG-NEXT: (block (type $3) (result i32 (ref null $0) f64)
+;; CHECK-BIN-NODEBUG-NEXT: (unreachable)
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (drop
;; CHECK-BIN-NODEBUG-NEXT: (block (result (ref null $0))
-;; CHECK-BIN-NODEBUG-NEXT: (local.set $1
+;; CHECK-BIN-NODEBUG-NEXT: (local.set $scratch_1
;; CHECK-BIN-NODEBUG-NEXT: (tuple.extract 3 1
-;; CHECK-BIN-NODEBUG-NEXT: (local.get $0)
+;; CHECK-BIN-NODEBUG-NEXT: (local.get $scratch)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (drop
;; CHECK-BIN-NODEBUG-NEXT: (tuple.extract 3 2
-;; CHECK-BIN-NODEBUG-NEXT: (local.get $0)
+;; CHECK-BIN-NODEBUG-NEXT: (local.get $scratch)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: (local.get $1)
+;; CHECK-BIN-NODEBUG-NEXT: (local.get $scratch_1)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: (local.get $2)
+;; CHECK-BIN-NODEBUG-NEXT: (local.get $scratch_2)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
diff --git a/test/lit/basic/unit.wat b/test/lit/basic/unit.wat
index 5846febd5..43901e3bc 100644
--- a/test/lit/basic/unit.wat
+++ b/test/lit/basic/unit.wat
@@ -215,7 +215,7 @@
;; CHECK-TEXT-NEXT: )
;; CHECK-BIN: (func $importedDoubles (type $4) (result f64)
;; CHECK-BIN-NEXT: (local $temp f64)
- ;; CHECK-BIN-NEXT: (block $label$1 (result f64)
+ ;; CHECK-BIN-NEXT: (block $block (result f64)
;; CHECK-BIN-NEXT: (local.set $temp
;; CHECK-BIN-NEXT: (f64.add
;; CHECK-BIN-NEXT: (f64.add
@@ -248,7 +248,7 @@
;; CHECK-BIN-NEXT: (i32.const 0)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (then
- ;; CHECK-BIN-NEXT: (br $label$1
+ ;; CHECK-BIN-NEXT: (br $block
;; CHECK-BIN-NEXT: (f64.const -3.4)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
@@ -261,7 +261,7 @@
;; CHECK-BIN-NEXT: (f64.const 0)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (then
- ;; CHECK-BIN-NEXT: (br $label$1
+ ;; CHECK-BIN-NEXT: (br $block
;; CHECK-BIN-NEXT: (f64.const 5.6)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
@@ -381,14 +381,14 @@
;; CHECK-BIN-NEXT: (local $t f64)
;; CHECK-BIN-NEXT: (local $Int f64)
;; CHECK-BIN-NEXT: (local $Double i32)
- ;; CHECK-BIN-NEXT: (block $label$1 (result f64)
+ ;; CHECK-BIN-NEXT: (block $block (result f64)
;; CHECK-BIN-NEXT: (if
;; CHECK-BIN-NEXT: (f64.gt
;; CHECK-BIN-NEXT: (local.get $x)
;; CHECK-BIN-NEXT: (f64.const 0)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (then
- ;; CHECK-BIN-NEXT: (br $label$1
+ ;; CHECK-BIN-NEXT: (br $block
;; CHECK-BIN-NEXT: (f64.const 1.2)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
@@ -399,7 +399,7 @@
;; CHECK-BIN-NEXT: (f64.const 0)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (then
- ;; CHECK-BIN-NEXT: (br $label$1
+ ;; CHECK-BIN-NEXT: (br $block
;; CHECK-BIN-NEXT: (f64.const -3.4)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
@@ -410,7 +410,7 @@
;; CHECK-BIN-NEXT: (i32.const 0)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (then
- ;; CHECK-BIN-NEXT: (br $label$1
+ ;; CHECK-BIN-NEXT: (br $block
;; CHECK-BIN-NEXT: (f64.const 5.6)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
@@ -421,7 +421,7 @@
;; CHECK-BIN-NEXT: (local.get $y)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (then
- ;; CHECK-BIN-NEXT: (br $label$1
+ ;; CHECK-BIN-NEXT: (br $block
;; CHECK-BIN-NEXT: (local.get $x)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
@@ -628,13 +628,13 @@
;; CHECK-BIN-NEXT: (local $J f64)
;; CHECK-BIN-NEXT: (local.set $J
;; CHECK-BIN-NEXT: (f64.sub
- ;; CHECK-BIN-NEXT: (block $label$1 (result f64)
+ ;; CHECK-BIN-NEXT: (block (result f64)
;; CHECK-BIN-NEXT: (drop
;; CHECK-BIN-NEXT: (f64.const 0.1)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (f64.const 5.1)
;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: (block $label$2 (result f64)
+ ;; CHECK-BIN-NEXT: (block (result f64)
;; CHECK-BIN-NEXT: (drop
;; CHECK-BIN-NEXT: (f64.const 3.2)
;; CHECK-BIN-NEXT: )
@@ -749,77 +749,80 @@
;; CHECK-TEXT-NEXT: )
;; CHECK-TEXT-NEXT: )
;; CHECK-BIN: (func $switcher (type $6) (param $x i32) (result i32)
- ;; CHECK-BIN-NEXT: (block $label$1 (result i32)
- ;; CHECK-BIN-NEXT: (block $label$2
- ;; CHECK-BIN-NEXT: (block $label$3
- ;; CHECK-BIN-NEXT: (block $label$4
- ;; CHECK-BIN-NEXT: (block $label$5
- ;; CHECK-BIN-NEXT: (br_table $label$5 $label$4 $label$3
+ ;; CHECK-BIN-NEXT: (block $block3 (result i32)
+ ;; CHECK-BIN-NEXT: (block
+ ;; CHECK-BIN-NEXT: (block $block2
+ ;; CHECK-BIN-NEXT: (block $block1
+ ;; CHECK-BIN-NEXT: (block $block
+ ;; CHECK-BIN-NEXT: (br_table $block $block1 $block2
;; CHECK-BIN-NEXT: (i32.sub
;; CHECK-BIN-NEXT: (local.get $x)
;; CHECK-BIN-NEXT: (i32.const 1)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: (br $label$1
+ ;; CHECK-BIN-NEXT: (br $block3
;; CHECK-BIN-NEXT: (i32.const 1)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: (br $label$1
+ ;; CHECK-BIN-NEXT: (br $block3
;; CHECK-BIN-NEXT: (i32.const 2)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (nop)
;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: (block $label$6
- ;; CHECK-BIN-NEXT: (block $label$7
- ;; CHECK-BIN-NEXT: (block $label$8
- ;; CHECK-BIN-NEXT: (block $label$9
- ;; CHECK-BIN-NEXT: (br_table $label$8 $label$7 $label$7 $label$7 $label$7 $label$7 $label$7 $label$9 $label$7
+ ;; CHECK-BIN-NEXT: (block
+ ;; CHECK-BIN-NEXT: (block $block5
+ ;; CHECK-BIN-NEXT: (block $block4
+ ;; CHECK-BIN-NEXT: (block $block6
+ ;; CHECK-BIN-NEXT: (br_table $block4 $block5 $block5 $block5 $block5 $block5 $block5 $block6 $block5
;; CHECK-BIN-NEXT: (i32.sub
;; CHECK-BIN-NEXT: (local.get $x)
;; CHECK-BIN-NEXT: (i32.const 5)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: (br $label$1
+ ;; CHECK-BIN-NEXT: (br $block3
;; CHECK-BIN-NEXT: (i32.const 121)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: (br $label$1
+ ;; CHECK-BIN-NEXT: (br $block3
;; CHECK-BIN-NEXT: (i32.const 51)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (nop)
;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: (block $label$10
- ;; CHECK-BIN-NEXT: (block $label$11
- ;; CHECK-BIN-NEXT: (block $label$12
- ;; CHECK-BIN-NEXT: (block $label$13
- ;; CHECK-BIN-NEXT: (block $label$14
- ;; CHECK-BIN-NEXT: (block $label$15
- ;; CHECK-BIN-NEXT: (br_table $label$12 $label$11 $label$11 $label$13 $label$11 $label$11 $label$11 $label$11 $label$14 $label$11 $label$15 $label$11
+ ;; CHECK-BIN-NEXT: (block $block12
+ ;; CHECK-BIN-NEXT: (block $block8
+ ;; CHECK-BIN-NEXT: (block $block7
+ ;; CHECK-BIN-NEXT: (block $block9
+ ;; CHECK-BIN-NEXT: (block $block10
+ ;; CHECK-BIN-NEXT: (block $block11
+ ;; CHECK-BIN-NEXT: (br_table $block7 $block8 $block8 $block9 $block8 $block8 $block8 $block8 $block10 $block8 $block11 $block8
;; CHECK-BIN-NEXT: (i32.sub
;; CHECK-BIN-NEXT: (local.get $x)
;; CHECK-BIN-NEXT: (i32.const 2)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: (br $label$10)
+ ;; CHECK-BIN-NEXT: (br $block12)
;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: (br $label$10)
+ ;; CHECK-BIN-NEXT: (br $block12)
;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: (block $label$16
- ;; CHECK-BIN-NEXT: (loop $label$17
- ;; CHECK-BIN-NEXT: (br $label$16)
+ ;; CHECK-BIN-NEXT: (block $block13
+ ;; CHECK-BIN-NEXT: (loop
+ ;; CHECK-BIN-NEXT: (br $block13)
;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (unreachable)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: (block $label$18
- ;; CHECK-BIN-NEXT: (loop $label$19
- ;; CHECK-BIN-NEXT: (br $label$10)
+ ;; CHECK-BIN-NEXT: (block
+ ;; CHECK-BIN-NEXT: (loop
+ ;; CHECK-BIN-NEXT: (br $block12)
;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (unreachable)
;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (unreachable)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (nop)
;; CHECK-BIN-NEXT: )
@@ -918,8 +921,8 @@
;; CHECK-TEXT-NEXT: )
;; CHECK-TEXT-NEXT: )
;; CHECK-BIN: (func $blocker (type $FUNCSIG$v)
- ;; CHECK-BIN-NEXT: (block $label$1
- ;; CHECK-BIN-NEXT: (br $label$1)
+ ;; CHECK-BIN-NEXT: (block $block
+ ;; CHECK-BIN-NEXT: (br $block)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
(func $blocker (type $FUNCSIG$v)
@@ -1115,7 +1118,7 @@
;; CHECK-BIN-NEXT: (local $y f64)
;; CHECK-BIN-NEXT: (local $z f32)
;; CHECK-BIN-NEXT: (local.set $x
- ;; CHECK-BIN-NEXT: (block $label$1 (result i32)
+ ;; CHECK-BIN-NEXT: (block (result i32)
;; CHECK-BIN-NEXT: (local.set $asm2wasm_i32_temp
;; CHECK-BIN-NEXT: (i32.const 0)
;; CHECK-BIN-NEXT: )
@@ -1337,11 +1340,11 @@
;; CHECK-TEXT-NEXT: (i32.const 0)
;; CHECK-TEXT-NEXT: )
;; CHECK-BIN: (func $block_and_after (type $5) (result i32)
- ;; CHECK-BIN-NEXT: (block $label$1
+ ;; CHECK-BIN-NEXT: (block $block
;; CHECK-BIN-NEXT: (drop
;; CHECK-BIN-NEXT: (i32.const 1)
;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: (br $label$1)
+ ;; CHECK-BIN-NEXT: (br $block)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (i32.const 0)
;; CHECK-BIN-NEXT: )
@@ -1363,7 +1366,7 @@
;; CHECK-TEXT-NEXT: )
;; CHECK-TEXT-NEXT: )
;; CHECK-BIN: (func $loop-roundtrip (type $7) (param $0 f64) (result f64)
- ;; CHECK-BIN-NEXT: (loop $label$1 (result f64)
+ ;; CHECK-BIN-NEXT: (loop (result f64)
;; CHECK-BIN-NEXT: (drop
;; CHECK-BIN-NEXT: (local.get $0)
;; CHECK-BIN-NEXT: )
@@ -1514,11 +1517,11 @@
;; CHECK-TEXT-NEXT: (i32.const 1)
;; CHECK-TEXT-NEXT: )
;; CHECK-BIN: (func $unreachable-block-with-br (type $5) (result i32)
- ;; CHECK-BIN-NEXT: (block $label$1
+ ;; CHECK-BIN-NEXT: (block $block
;; CHECK-BIN-NEXT: (drop
;; CHECK-BIN-NEXT: (i32.const 1)
;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: (br $label$1)
+ ;; CHECK-BIN-NEXT: (br $block)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (i32.const 1)
;; CHECK-BIN-NEXT: )
@@ -1560,6 +1563,7 @@
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (unreachable)
;; CHECK-BIN-NEXT: )
(func $unreachable-if (result i32)
(f64.abs
@@ -1603,6 +1607,7 @@
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (unreachable)
;; CHECK-BIN-NEXT: )
(func $unreachable-if-toplevel (result i32)
(if ;; note no type - valid in binaryen IR, in wasm must be i32
@@ -1626,12 +1631,13 @@
;; CHECK-TEXT-NEXT: )
;; CHECK-TEXT-NEXT: )
;; CHECK-BIN: (func $unreachable-loop (type $5) (result i32)
- ;; CHECK-BIN-NEXT: (loop $label$1
+ ;; CHECK-BIN-NEXT: (loop
;; CHECK-BIN-NEXT: (nop)
;; CHECK-BIN-NEXT: (return
;; CHECK-BIN-NEXT: (i32.const 1)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (unreachable)
;; CHECK-BIN-NEXT: )
(func $unreachable-loop (result i32)
(f64.abs
@@ -1651,11 +1657,12 @@
;; CHECK-TEXT-NEXT: )
;; CHECK-TEXT-NEXT: )
;; CHECK-BIN: (func $unreachable-loop0 (type $5) (result i32)
- ;; CHECK-BIN-NEXT: (loop $label$1
+ ;; CHECK-BIN-NEXT: (loop
;; CHECK-BIN-NEXT: (return
;; CHECK-BIN-NEXT: (i32.const 1)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (unreachable)
;; CHECK-BIN-NEXT: )
(func $unreachable-loop0 (result i32)
(f64.abs
@@ -1673,12 +1680,13 @@
;; CHECK-TEXT-NEXT: )
;; CHECK-TEXT-NEXT: )
;; CHECK-BIN: (func $unreachable-loop-toplevel (type $5) (result i32)
- ;; CHECK-BIN-NEXT: (loop $label$1
+ ;; CHECK-BIN-NEXT: (loop
;; CHECK-BIN-NEXT: (nop)
;; CHECK-BIN-NEXT: (return
;; CHECK-BIN-NEXT: (i32.const 1)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (unreachable)
;; CHECK-BIN-NEXT: )
(func $unreachable-loop-toplevel (result i32)
(loop ;; note no type - valid in binaryen IR, in wasm must be i32
@@ -1694,11 +1702,12 @@
;; CHECK-TEXT-NEXT: )
;; CHECK-TEXT-NEXT: )
;; CHECK-BIN: (func $unreachable-loop0-toplevel (type $5) (result i32)
- ;; CHECK-BIN-NEXT: (loop $label$1
+ ;; CHECK-BIN-NEXT: (loop
;; CHECK-BIN-NEXT: (return
;; CHECK-BIN-NEXT: (i32.const 1)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (unreachable)
;; CHECK-BIN-NEXT: )
(func $unreachable-loop0-toplevel (result i32)
(loop ;; note no type - valid in binaryen IR, in wasm must be i32
@@ -1870,7 +1879,7 @@
;; CHECK-BIN-NODEBUG: (func $1 (type $3) (result f64)
;; CHECK-BIN-NODEBUG-NEXT: (local $0 f64)
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$1 (result f64)
+;; CHECK-BIN-NODEBUG-NEXT: (block $block (result f64)
;; CHECK-BIN-NODEBUG-NEXT: (local.set $0
;; CHECK-BIN-NODEBUG-NEXT: (f64.add
;; CHECK-BIN-NODEBUG-NEXT: (f64.add
@@ -1903,7 +1912,7 @@
;; CHECK-BIN-NODEBUG-NEXT: (i32.const 0)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (then
-;; CHECK-BIN-NODEBUG-NEXT: (br $label$1
+;; CHECK-BIN-NODEBUG-NEXT: (br $block
;; CHECK-BIN-NODEBUG-NEXT: (f64.const -3.4)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
@@ -1916,7 +1925,7 @@
;; CHECK-BIN-NODEBUG-NEXT: (f64.const 0)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (then
-;; CHECK-BIN-NODEBUG-NEXT: (br $label$1
+;; CHECK-BIN-NODEBUG-NEXT: (br $block
;; CHECK-BIN-NODEBUG-NEXT: (f64.const 5.6)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
@@ -1929,14 +1938,14 @@
;; CHECK-BIN-NODEBUG-NEXT: (local $2 f64)
;; CHECK-BIN-NODEBUG-NEXT: (local $3 f64)
;; CHECK-BIN-NODEBUG-NEXT: (local $4 i32)
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$1 (result f64)
+;; CHECK-BIN-NODEBUG-NEXT: (block $block (result f64)
;; CHECK-BIN-NODEBUG-NEXT: (if
;; CHECK-BIN-NODEBUG-NEXT: (f64.gt
;; CHECK-BIN-NODEBUG-NEXT: (local.get $0)
;; CHECK-BIN-NODEBUG-NEXT: (f64.const 0)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (then
-;; CHECK-BIN-NODEBUG-NEXT: (br $label$1
+;; CHECK-BIN-NODEBUG-NEXT: (br $block
;; CHECK-BIN-NODEBUG-NEXT: (f64.const 1.2)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
@@ -1947,7 +1956,7 @@
;; CHECK-BIN-NODEBUG-NEXT: (f64.const 0)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (then
-;; CHECK-BIN-NODEBUG-NEXT: (br $label$1
+;; CHECK-BIN-NODEBUG-NEXT: (br $block
;; CHECK-BIN-NODEBUG-NEXT: (f64.const -3.4)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
@@ -1958,7 +1967,7 @@
;; CHECK-BIN-NODEBUG-NEXT: (i32.const 0)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (then
-;; CHECK-BIN-NODEBUG-NEXT: (br $label$1
+;; CHECK-BIN-NODEBUG-NEXT: (br $block
;; CHECK-BIN-NODEBUG-NEXT: (f64.const 5.6)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
@@ -1969,7 +1978,7 @@
;; CHECK-BIN-NODEBUG-NEXT: (local.get $1)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (then
-;; CHECK-BIN-NODEBUG-NEXT: (br $label$1
+;; CHECK-BIN-NODEBUG-NEXT: (br $block
;; CHECK-BIN-NODEBUG-NEXT: (local.get $0)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
@@ -2025,13 +2034,13 @@
;; CHECK-BIN-NODEBUG-NEXT: (local $0 f64)
;; CHECK-BIN-NODEBUG-NEXT: (local.set $0
;; CHECK-BIN-NODEBUG-NEXT: (f64.sub
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$1 (result f64)
+;; CHECK-BIN-NODEBUG-NEXT: (block (result f64)
;; CHECK-BIN-NODEBUG-NEXT: (drop
;; CHECK-BIN-NODEBUG-NEXT: (f64.const 0.1)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (f64.const 5.1)
;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$2 (result f64)
+;; CHECK-BIN-NODEBUG-NEXT: (block (result f64)
;; CHECK-BIN-NODEBUG-NEXT: (drop
;; CHECK-BIN-NODEBUG-NEXT: (f64.const 3.2)
;; CHECK-BIN-NODEBUG-NEXT: )
@@ -2042,77 +2051,80 @@
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG: (func $7 (type $6) (param $0 i32) (result i32)
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$1 (result i32)
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$2
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$3
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$4
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$5
-;; CHECK-BIN-NODEBUG-NEXT: (br_table $label$5 $label$4 $label$3
+;; CHECK-BIN-NODEBUG-NEXT: (block $block3 (result i32)
+;; CHECK-BIN-NODEBUG-NEXT: (block
+;; CHECK-BIN-NODEBUG-NEXT: (block $block2
+;; CHECK-BIN-NODEBUG-NEXT: (block $block1
+;; CHECK-BIN-NODEBUG-NEXT: (block $block
+;; CHECK-BIN-NODEBUG-NEXT: (br_table $block $block1 $block2
;; CHECK-BIN-NODEBUG-NEXT: (i32.sub
;; CHECK-BIN-NODEBUG-NEXT: (local.get $0)
;; CHECK-BIN-NODEBUG-NEXT: (i32.const 1)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: (br $label$1
+;; CHECK-BIN-NODEBUG-NEXT: (br $block3
;; CHECK-BIN-NODEBUG-NEXT: (i32.const 1)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: (br $label$1
+;; CHECK-BIN-NODEBUG-NEXT: (br $block3
;; CHECK-BIN-NODEBUG-NEXT: (i32.const 2)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (nop)
;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$6
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$7
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$8
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$9
-;; CHECK-BIN-NODEBUG-NEXT: (br_table $label$8 $label$7 $label$7 $label$7 $label$7 $label$7 $label$7 $label$9 $label$7
+;; CHECK-BIN-NODEBUG-NEXT: (block
+;; CHECK-BIN-NODEBUG-NEXT: (block $block5
+;; CHECK-BIN-NODEBUG-NEXT: (block $block4
+;; CHECK-BIN-NODEBUG-NEXT: (block $block6
+;; CHECK-BIN-NODEBUG-NEXT: (br_table $block4 $block5 $block5 $block5 $block5 $block5 $block5 $block6 $block5
;; CHECK-BIN-NODEBUG-NEXT: (i32.sub
;; CHECK-BIN-NODEBUG-NEXT: (local.get $0)
;; CHECK-BIN-NODEBUG-NEXT: (i32.const 5)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: (br $label$1
+;; CHECK-BIN-NODEBUG-NEXT: (br $block3
;; CHECK-BIN-NODEBUG-NEXT: (i32.const 121)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: (br $label$1
+;; CHECK-BIN-NODEBUG-NEXT: (br $block3
;; CHECK-BIN-NODEBUG-NEXT: (i32.const 51)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (nop)
;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$10
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$11
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$12
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$13
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$14
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$15
-;; CHECK-BIN-NODEBUG-NEXT: (br_table $label$12 $label$11 $label$11 $label$13 $label$11 $label$11 $label$11 $label$11 $label$14 $label$11 $label$15 $label$11
+;; CHECK-BIN-NODEBUG-NEXT: (block $block12
+;; CHECK-BIN-NODEBUG-NEXT: (block $block8
+;; CHECK-BIN-NODEBUG-NEXT: (block $block7
+;; CHECK-BIN-NODEBUG-NEXT: (block $block9
+;; CHECK-BIN-NODEBUG-NEXT: (block $block10
+;; CHECK-BIN-NODEBUG-NEXT: (block $block11
+;; CHECK-BIN-NODEBUG-NEXT: (br_table $block7 $block8 $block8 $block9 $block8 $block8 $block8 $block8 $block10 $block8 $block11 $block8
;; CHECK-BIN-NODEBUG-NEXT: (i32.sub
;; CHECK-BIN-NODEBUG-NEXT: (local.get $0)
;; CHECK-BIN-NODEBUG-NEXT: (i32.const 2)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: (br $label$10)
+;; CHECK-BIN-NODEBUG-NEXT: (br $block12)
;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: (br $label$10)
+;; CHECK-BIN-NODEBUG-NEXT: (br $block12)
;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$16
-;; CHECK-BIN-NODEBUG-NEXT: (loop $label$17
-;; CHECK-BIN-NODEBUG-NEXT: (br $label$16)
+;; CHECK-BIN-NODEBUG-NEXT: (block $block13
+;; CHECK-BIN-NODEBUG-NEXT: (loop
+;; CHECK-BIN-NODEBUG-NEXT: (br $block13)
;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (unreachable)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$18
-;; CHECK-BIN-NODEBUG-NEXT: (loop $label$19
-;; CHECK-BIN-NODEBUG-NEXT: (br $label$10)
+;; CHECK-BIN-NODEBUG-NEXT: (block
+;; CHECK-BIN-NODEBUG-NEXT: (loop
+;; CHECK-BIN-NODEBUG-NEXT: (br $block12)
;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (unreachable)
;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (unreachable)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (nop)
;; CHECK-BIN-NODEBUG-NEXT: )
@@ -2121,8 +2133,8 @@
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG: (func $8 (type $1)
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$1
-;; CHECK-BIN-NODEBUG-NEXT: (br $label$1)
+;; CHECK-BIN-NODEBUG-NEXT: (block $block
+;; CHECK-BIN-NODEBUG-NEXT: (br $block)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
@@ -2182,7 +2194,7 @@
;; CHECK-BIN-NODEBUG-NEXT: (local $2 f64)
;; CHECK-BIN-NODEBUG-NEXT: (local $3 f32)
;; CHECK-BIN-NODEBUG-NEXT: (local.set $0
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$1 (result i32)
+;; CHECK-BIN-NODEBUG-NEXT: (block (result i32)
;; CHECK-BIN-NODEBUG-NEXT: (local.set $1
;; CHECK-BIN-NODEBUG-NEXT: (i32.const 0)
;; CHECK-BIN-NODEBUG-NEXT: )
@@ -2265,17 +2277,17 @@
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG: (func $19 (type $0) (result i32)
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$1
+;; CHECK-BIN-NODEBUG-NEXT: (block $block
;; CHECK-BIN-NODEBUG-NEXT: (drop
;; CHECK-BIN-NODEBUG-NEXT: (i32.const 1)
;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: (br $label$1)
+;; CHECK-BIN-NODEBUG-NEXT: (br $block)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (i32.const 0)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG: (func $20 (type $7) (param $0 f64) (result f64)
-;; CHECK-BIN-NODEBUG-NEXT: (loop $label$1 (result f64)
+;; CHECK-BIN-NODEBUG-NEXT: (loop (result f64)
;; CHECK-BIN-NODEBUG-NEXT: (drop
;; CHECK-BIN-NODEBUG-NEXT: (local.get $0)
;; CHECK-BIN-NODEBUG-NEXT: )
@@ -2331,11 +2343,11 @@
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG: (func $28 (type $0) (result i32)
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$1
+;; CHECK-BIN-NODEBUG-NEXT: (block $block
;; CHECK-BIN-NODEBUG-NEXT: (drop
;; CHECK-BIN-NODEBUG-NEXT: (i32.const 1)
;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: (br $label$1)
+;; CHECK-BIN-NODEBUG-NEXT: (br $block)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (i32.const 1)
;; CHECK-BIN-NODEBUG-NEXT: )
@@ -2354,6 +2366,7 @@
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (unreachable)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG: (func $30 (type $0) (result i32)
@@ -2370,40 +2383,45 @@
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (unreachable)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG: (func $31 (type $0) (result i32)
-;; CHECK-BIN-NODEBUG-NEXT: (loop $label$1
+;; CHECK-BIN-NODEBUG-NEXT: (loop
;; CHECK-BIN-NODEBUG-NEXT: (nop)
;; CHECK-BIN-NODEBUG-NEXT: (return
;; CHECK-BIN-NODEBUG-NEXT: (i32.const 1)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (unreachable)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG: (func $32 (type $0) (result i32)
-;; CHECK-BIN-NODEBUG-NEXT: (loop $label$1
+;; CHECK-BIN-NODEBUG-NEXT: (loop
;; CHECK-BIN-NODEBUG-NEXT: (return
;; CHECK-BIN-NODEBUG-NEXT: (i32.const 1)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (unreachable)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG: (func $33 (type $0) (result i32)
-;; CHECK-BIN-NODEBUG-NEXT: (loop $label$1
+;; CHECK-BIN-NODEBUG-NEXT: (loop
;; CHECK-BIN-NODEBUG-NEXT: (nop)
;; CHECK-BIN-NODEBUG-NEXT: (return
;; CHECK-BIN-NODEBUG-NEXT: (i32.const 1)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (unreachable)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG: (func $34 (type $0) (result i32)
-;; CHECK-BIN-NODEBUG-NEXT: (loop $label$1
+;; CHECK-BIN-NODEBUG-NEXT: (loop
;; CHECK-BIN-NODEBUG-NEXT: (return
;; CHECK-BIN-NODEBUG-NEXT: (i32.const 1)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (unreachable)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG: (func $35 (type $1)
diff --git a/test/lit/basic/unreachable-code.wast b/test/lit/basic/unreachable-code.wast
index 0dfb00c40..baf156496 100644
--- a/test/lit/basic/unreachable-code.wast
+++ b/test/lit/basic/unreachable-code.wast
@@ -59,6 +59,7 @@
;; CHECK-BIN-NEXT: (unreachable)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (unreachable)
;; CHECK-BIN-NEXT: )
(func $b
(if (i32.const 1)
@@ -118,6 +119,7 @@
;; CHECK-BIN-NEXT: (unreachable)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (unreachable)
;; CHECK-BIN-NEXT: )
(func $b-block
(block
@@ -186,6 +188,7 @@
;; CHECK-BIN-NEXT: (unreachable)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (unreachable)
;; CHECK-BIN-NEXT: )
(func $b-prepost
(nop)
@@ -260,6 +263,7 @@
;; CHECK-BIN-NEXT: (unreachable)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (unreachable)
;; CHECK-BIN-NEXT: )
(func $b-block-prepost
(nop)
@@ -289,9 +293,9 @@
;; CHECK-TEXT-NEXT: )
;; CHECK-BIN: (func $recurse (type $0)
;; CHECK-BIN-NEXT: (nop)
- ;; CHECK-BIN-NEXT: (block $label$1
+ ;; CHECK-BIN-NEXT: (block $block
;; CHECK-BIN-NEXT: (nop)
- ;; CHECK-BIN-NEXT: (br $label$1)
+ ;; CHECK-BIN-NEXT: (br $block)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (nop)
;; CHECK-BIN-NEXT: )
@@ -319,12 +323,13 @@
;; CHECK-TEXT-NEXT: )
;; CHECK-TEXT-NEXT: )
;; CHECK-BIN: (func $recurse-b (type $0)
- ;; CHECK-BIN-NEXT: (block $label$1
+ ;; CHECK-BIN-NEXT: (block $block
;; CHECK-BIN-NEXT: (nop)
- ;; CHECK-BIN-NEXT: (block $label$2
+ ;; CHECK-BIN-NEXT: (block
;; CHECK-BIN-NEXT: (nop)
- ;; CHECK-BIN-NEXT: (br $label$1)
+ ;; CHECK-BIN-NEXT: (br $block)
;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (unreachable)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
(func $recurse-b
@@ -360,6 +365,7 @@
;; CHECK-BIN-NODEBUG-NEXT: (unreachable)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (unreachable)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG: (func $2 (type $0)
@@ -381,6 +387,7 @@
;; CHECK-BIN-NODEBUG-NEXT: (unreachable)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (unreachable)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG: (func $4 (type $0)
@@ -405,6 +412,7 @@
;; CHECK-BIN-NODEBUG-NEXT: (unreachable)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (unreachable)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG: (func $6 (type $0)
@@ -429,23 +437,25 @@
;; CHECK-BIN-NODEBUG-NEXT: (unreachable)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (unreachable)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG: (func $8 (type $0)
;; CHECK-BIN-NODEBUG-NEXT: (nop)
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$1
+;; CHECK-BIN-NODEBUG-NEXT: (block $block
;; CHECK-BIN-NODEBUG-NEXT: (nop)
-;; CHECK-BIN-NODEBUG-NEXT: (br $label$1)
+;; CHECK-BIN-NODEBUG-NEXT: (br $block)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (nop)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG: (func $9 (type $0)
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$1
+;; CHECK-BIN-NODEBUG-NEXT: (block $block
;; CHECK-BIN-NODEBUG-NEXT: (nop)
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$2
+;; CHECK-BIN-NODEBUG-NEXT: (block
;; CHECK-BIN-NODEBUG-NEXT: (nop)
-;; CHECK-BIN-NODEBUG-NEXT: (br $label$1)
+;; CHECK-BIN-NODEBUG-NEXT: (br $block)
;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (unreachable)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
diff --git a/test/lit/basic/untaken-br_if.wast b/test/lit/basic/untaken-br_if.wast
index bf2ad1ce3..4d9826549 100644
--- a/test/lit/basic/untaken-br_if.wast
+++ b/test/lit/basic/untaken-br_if.wast
@@ -37,12 +37,10 @@
;; CHECK-BIN-NEXT: (unreachable)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: (else
- ;; CHECK-BIN-NEXT: (block $label$3 (result f32)
- ;; CHECK-BIN-NEXT: (drop
- ;; CHECK-BIN-NEXT: (f32.const 1)
- ;; CHECK-BIN-NEXT: )
- ;; CHECK-BIN-NEXT: (unreachable)
+ ;; CHECK-BIN-NEXT: (drop
+ ;; CHECK-BIN-NEXT: (f32.const 1)
;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (unreachable)
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
;; CHECK-BIN-NEXT: )
@@ -72,12 +70,10 @@
;; CHECK-BIN-NODEBUG-NEXT: (unreachable)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: (else
-;; CHECK-BIN-NODEBUG-NEXT: (block $label$3 (result f32)
-;; CHECK-BIN-NODEBUG-NEXT: (drop
-;; CHECK-BIN-NODEBUG-NEXT: (f32.const 1)
-;; CHECK-BIN-NODEBUG-NEXT: )
-;; CHECK-BIN-NODEBUG-NEXT: (unreachable)
+;; CHECK-BIN-NODEBUG-NEXT: (drop
+;; CHECK-BIN-NODEBUG-NEXT: (f32.const 1)
;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (unreachable)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
diff --git a/test/lit/binary/bad-delegate.test b/test/lit/binary/bad-delegate.test
deleted file mode 100644
index 8e6a011a5..000000000
--- a/test/lit/binary/bad-delegate.test
+++ /dev/null
@@ -1,17 +0,0 @@
-;; Test that we error properly on a file with a bad delegate (a delegate of an
-;; index that does not refer to a valid try-catch).
-
-;; Disassembled binary from wabt:
-;;
-;; (module
-;; (type (;0;) (func))
-;; (func (;0;) (type 0)
-;; block ;; label = @1
-;; try ;; label = @2
-;; nop
-;; delegate 0
-;; end))
-
-;; RUN: not wasm-opt -all %s.wasm 2>&1 | filecheck %s
-
-;; CHECK: exceptionTargetNames not empty - invalid delegate
diff --git a/test/lit/binary/declarative-element-use-expr.test b/test/lit/binary/declarative-element-use-expr.test
index aecdf9ebd..fa0eb965f 100644
--- a/test/lit/binary/declarative-element-use-expr.test
+++ b/test/lit/binary/declarative-element-use-expr.test
@@ -13,16 +13,14 @@
;; preserve declarative segments. This is fine, as we test that the
;; binary parser can parse it correctly.
-;; RUN: wasm-opt -all %s.wasm -all --print | filecheck %s
+;; RUN: wasm-opt -all %s.wasm -S -o - | filecheck %s
;; CHECK: (module
;; CHECK-NEXT: (type $0 (func))
;; CHECK-NEXT: (elem declare func $0)
;; CHECK-NEXT: (func $0 (type $0)
-;; CHECK-NEXT: (block $label$1
-;; CHECK-NEXT: (drop
-;; CHECK-NEXT: (ref.func $0)
-;; CHECK-NEXT: )
+;; CHECK-NEXT: (drop
+;; CHECK-NEXT: (ref.func $0)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
diff --git a/test/lit/binary/delegate-block.test b/test/lit/binary/delegate-block.test
new file mode 100644
index 000000000..7da386cb0
--- /dev/null
+++ b/test/lit/binary/delegate-block.test
@@ -0,0 +1,27 @@
+;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited.
+
+;; Test that we can parse a binary with a delegate that targets a block instead
+;; of a try-catch.
+
+;; Disassembled binary from wabt:
+;;
+;; (module
+;; (type (;0;) (func))
+;; (func (;0;) (type 0)
+;; block ;; label = @1
+;; try ;; label = @2
+;; nop
+;; delegate 0
+;; end))
+
+;; RUN: wasm-opt -all %s.wasm -S -o - | filecheck %s
+;; CHECK: (type $0 (func))
+
+;; CHECK: (func $0 (type $0)
+;; CHECK-NEXT: (try
+;; CHECK-NEXT: (do
+;; CHECK-NEXT: (nop)
+;; CHECK-NEXT: )
+;; CHECK-NEXT: (delegate 0)
+;; CHECK-NEXT: )
+;; CHECK-NEXT: )
diff --git a/test/lit/binary/bad-delegate.test.wasm b/test/lit/binary/delegate-block.test.wasm
index db9645e35..db9645e35 100644
--- a/test/lit/binary/bad-delegate.test.wasm
+++ b/test/lit/binary/delegate-block.test.wasm
Binary files differ
diff --git a/test/lit/binary/dwarf-multivalue.test b/test/lit/binary/dwarf-multivalue.test
index c803dea14..250a861bf 100644
--- a/test/lit/binary/dwarf-multivalue.test
+++ b/test/lit/binary/dwarf-multivalue.test
@@ -39,8 +39,8 @@
;; (local $10 f32)
;; If we parse this wasm file into Binaryen IR, two locals are added in the
-;; process. Here $11 is added for tuple parsing and $12 is added for stacky IR
-;; resolving during binary reading process.
+;; process. Here $scratch is added for tuple parsing and $scratch_12 is added
+;; for stacky IR resolving during binary reading process.
;; RUN: wasm-dis %s.wasm -o - | filecheck %s --check-prefix=ORIG
;; ORIG: (func $test
;; ORIG-NEXT: (local $0 i32)
@@ -54,8 +54,8 @@
;; ORIG-NEXT: (local $8 f32)
;; ORIG-NEXT: (local $9 i32)
;; ORIG-NEXT: (local $10 f32)
-;; ORIG-NEXT: (local $11 (tuple i32 f32))
-;; ORIG-NEXT: (local $12 i32)
+;; ORIG-NEXT: (local $scratch (tuple i32 f32))
+;; ORIG-NEXT: (local $scratch_12 i32)
;; If we write this IR into binary, even if this cannot be displayed in the wast
;; format, the local order of $test will look like this, because we don't
@@ -92,11 +92,11 @@
;; ROUNDTRIP-NEXT: (local $8 f32)
;; ROUNDTRIP-NEXT: (local $9 i32)
;; ROUNDTRIP-NEXT: (local $10 f32)
-;; ROUNDTRIP-NEXT: (local $11 i32)
+;; ROUNDTRIP-NEXT: (local $scratch i32)
;; ROUNDTRIP-NEXT: (local $12 f32)
-;; ROUNDTRIP-NEXT: (local $13 i32)
-;; ROUNDTRIP-NEXT: (local $14 (tuple i32 f32))
-;; ROUNDTRIP-NEXT: (local $15 i32)
+;; ROUNDTRIP-NEXT: (local $scratch_12 i32)
+;; ROUNDTRIP-NEXT: (local $scratch_14 (tuple i32 f32))
+;; ROUNDTRIP-NEXT: (local $scratch_15 i32)
;; We can see that we don't reorder the locals during the process and the
;; original list of locals, local $0~$10, is untouched, to NOT invalidate DWARF
diff --git a/test/lit/binary/stacky-eh-legacy.test b/test/lit/binary/stacky-eh-legacy.test
index c22a5165d..c77435f0b 100644
--- a/test/lit/binary/stacky-eh-legacy.test
+++ b/test/lit/binary/stacky-eh-legacy.test
@@ -1,3 +1,4 @@
+;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited.
;; Verify stacky EH binary can be parsed correctly.
;;
;; stacky-eh-old.test.wasm contains below:
@@ -34,15 +35,21 @@
;; The fixup will hoist the 'pop' and create another local to store it right
;; after 'catch'.
-RUN: wasm-opt -all %s.wasm --print | filecheck %s
+;; RUN: wasm-opt -all %s.wasm -S -o - | filecheck %s
-;; CHECK: (func $0
+;; CHECK: (type $0 (func (param i32)))
+
+;; CHECK: (type $1 (func))
+
+;; CHECK: (tag $tag$0 (param i32))
+
+;; CHECK: (func $0 (type $1)
;; CHECK-NEXT: (local $0 i32)
;; CHECK-NEXT: (local $1 i32)
;; CHECK-NEXT: (local $2 i32)
-;; CHECK-NEXT: (local $3 i32)
+;; CHECK-NEXT: (local $scratch i32)
;; CHECK-NEXT: (local $4 i32)
-;; CHECK-NEXT: (try $label$3
+;; CHECK-NEXT: (try
;; CHECK-NEXT: (do
;; CHECK-NEXT: (nop)
;; CHECK-NEXT: )
@@ -52,13 +59,13 @@ RUN: wasm-opt -all %s.wasm --print | filecheck %s
;; CHECK-NEXT: )
;; CHECK-NEXT: (local.set $2
;; CHECK-NEXT: (block (result i32)
-;; CHECK-NEXT: (local.set $3
+;; CHECK-NEXT: (local.set $scratch
;; CHECK-NEXT: (local.get $4)
;; CHECK-NEXT: )
;; CHECK-NEXT: (local.set $1
;; CHECK-NEXT: (i32.const 3)
;; CHECK-NEXT: )
-;; CHECK-NEXT: (local.get $3)
+;; CHECK-NEXT: (local.get $scratch)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
diff --git a/test/lit/binary/stacky-nn-tuple.test b/test/lit/binary/stacky-nn-tuple.test
index e8a0475b5..1f6b5bb59 100644
--- a/test/lit/binary/stacky-nn-tuple.test
+++ b/test/lit/binary/stacky-nn-tuple.test
@@ -1,112 +1,120 @@
-# Verify stacky non-nullable tuples binary can be parsed correctly. The wasm
-# contains code that uses pops to get a tuple and store it in a local, then
-# reads those values. The file contains this:
-#
-# (module
-# (type $A (struct (field (mut i32))))
-# (type $B (struct (field (mut i32)) (field (mut i32))))
-# (tag $tag$0 (param (ref $A) (ref $B)))
-# (func $foo
-# (local $temp ((ref null $A) (ref null $B)))
-# (try $label$3
-# (do
-# (nop)
-# )
-# (catch $tag$0
-# (local.set $temp
-# (pop (ref $A) (ref $B))
-# )
-# (drop
-# (ref.as_non_null
-# (tuple.extract 0
-# (local.get $temp)
-# )
-# )
-# )
-# (drop
-# (ref.as_non_null
-# (tuple.extract 1
-# (local.get $temp)
-# )
-# )
-# )
-# (unreachable)
-# )
-# )
-# )
-# )
+;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited.
+;; Verify stacky non-nullable tuples binary can be parsed correctly. The wasm
+;; contains code that uses pops to get a tuple and store it in a local, then
+;; reads those values. The file contains this:
+;;
+;; (module
+;; (type $A (struct (field (mut i32))))
+;; (type $B (struct (field (mut i32)) (field (mut i32))))
+;; (tag $tag$0 (param (ref $A) (ref $B)))
+;; (func $foo
+;; (local $temp ((ref null $A) (ref null $B)))
+;; (try $label$3
+;; (do
+;; (nop)
+;; )
+;; (catch $tag$0
+;; (local.set $temp
+;; (pop (ref $A) (ref $B))
+;; )
+;; (drop
+;; (ref.as_non_null
+;; (tuple.extract 0
+;; (local.get $temp)
+;; )
+;; )
+;; )
+;; (drop
+;; (ref.as_non_null
+;; (tuple.extract 1
+;; (local.get $temp)
+;; )
+;; )
+;; )
+;; (unreachable)
+;; )
+;; )
+;; )
+;; )
-RUN: wasm-opt -all %s.wasm -all --print
+;; RUN: wasm-opt -all %s.wasm -all -S -o - | filecheck %s
-# CHECK: (module
-# CHECK-NEXT: (type ${mut:i32} (struct (field (mut i32))))
-# CHECK-NEXT: (type ${mut:i32_mut:i32} (struct (field (mut i32)) (field (mut i32))))
-# CHECK-NEXT: (type $ref|{mut:i32}|_ref|{mut:i32_mut:i32}|_=>_none (func (param (ref ${mut:i32}) (ref ${mut:i32_mut:i32}))))
-# CHECK-NEXT: (type $none_=>_none (func))
-# CHECK-NEXT: (tag $tag$0 (param (ref ${mut:i32}) (ref ${mut:i32_mut:i32})))
-# CHECK-NEXT: (func $0
-# CHECK-NEXT: (local $0 (ref null ${mut:i32}))
-# CHECK-NEXT: (local $1 (ref null ${mut:i32_mut:i32}))
-# CHECK-NEXT: (local $2 (ref null ${mut:i32_mut:i32}))
-# CHECK-NEXT: (local $3 ((ref ${mut:i32}) (ref ${mut:i32_mut:i32})))
-# CHECK-NEXT: (local $4 (ref ${mut:i32}))
-# CHECK-NEXT: (local $5 (ref null ${mut:i32}))
-# CHECK-NEXT: (local $6 (ref null ${mut:i32}))
-# CHECK-NEXT: (try $label$3
-# CHECK-NEXT: (do
-# CHECK-NEXT: (nop)
-# CHECK-NEXT: )
-# CHECK-NEXT: (catch $tag$0
-# CHECK-NEXT: (local.set $3
-# CHECK-NEXT: (pop (ref ${mut:i32}) (ref ${mut:i32_mut:i32}))
-# CHECK-NEXT: )
-# CHECK-NEXT: (local.set $0
-# CHECK-NEXT: (block (result (ref ${mut:i32}))
-# CHECK-NEXT: (local.set $4
-# CHECK-NEXT: (tuple.extract 0
-# CHECK-NEXT: (local.get $3)
-# CHECK-NEXT: )
-# CHECK-NEXT: )
-# CHECK-NEXT: (local.set $1
-# CHECK-NEXT: (tuple.extract 1
-# CHECK-NEXT: (local.get $3)
-# CHECK-NEXT: )
-# CHECK-NEXT: )
-# CHECK-NEXT: (local.get $4)
-# CHECK-NEXT: )
-# CHECK-NEXT: )
-# CHECK-NEXT: (drop
-# CHECK-NEXT: (ref.as_non_null
-# CHECK-NEXT: (block (result (ref null ${mut:i32}))
-# CHECK-NEXT: (local.set $5
-# CHECK-NEXT: (local.get $0)
-# CHECK-NEXT: )
-# CHECK-NEXT: (drop
-# CHECK-NEXT: (local.get $1)
-# CHECK-NEXT: )
-# CHECK-NEXT: (local.get $5)
-# CHECK-NEXT: )
-# CHECK-NEXT: )
-# CHECK-NEXT: )
-# CHECK-NEXT: (drop
-# CHECK-NEXT: (block (result (ref null ${mut:i32}))
-# CHECK-NEXT: (local.set $6
-# CHECK-NEXT: (local.get $0)
-# CHECK-NEXT: )
-# CHECK-NEXT: (local.set $2
-# CHECK-NEXT: (local.get $1)
-# CHECK-NEXT: )
-# CHECK-NEXT: (local.get $6)
-# CHECK-NEXT: )
-# CHECK-NEXT: )
-# CHECK-NEXT: (drop
-# CHECK-NEXT: (ref.as_non_null
-# CHECK-NEXT: (local.get $2)
-# CHECK-NEXT: )
-# CHECK-NEXT: )
-# CHECK-NEXT: (unreachable)
-# CHECK-NEXT: )
-# CHECK-NEXT: )
-# CHECK-NEXT: )
-# CHECK-NEXT: )
-# CHECK-NEXT:
+;; CHECK: (type $0 (struct (field (mut i32))))
+
+;; CHECK: (type $1 (struct (field (mut i32)) (field (mut i32))))
+
+;; CHECK: (type $2 (func (param (ref null $0) (ref null $1))))
+
+;; CHECK: (type $3 (func))
+
+;; CHECK: (tag $tag$0 (param (ref null $0) (ref null $1)))
+
+;; CHECK: (func $0 (type $3)
+;; CHECK-NEXT: (local $0 (ref null $0))
+;; CHECK-NEXT: (local $1 (ref null $1))
+;; CHECK-NEXT: (local $2 (ref null $1))
+;; CHECK-NEXT: (local $scratch (tuple (ref null $0) (ref null $1)))
+;; CHECK-NEXT: (local $scratch_4 (ref null $0))
+;; CHECK-NEXT: (local $scratch_5 (ref null $0))
+;; CHECK-NEXT: (local $scratch_6 (ref null $0))
+;; CHECK-NEXT: (local $7 (tuple (ref null $0) (ref null $1)))
+;; CHECK-NEXT: (try
+;; CHECK-NEXT: (do
+;; CHECK-NEXT: (nop)
+;; CHECK-NEXT: )
+;; CHECK-NEXT: (catch $tag$0
+;; CHECK-NEXT: (local.set $7
+;; CHECK-NEXT: (pop (tuple (ref null $0) (ref null $1)))
+;; CHECK-NEXT: )
+;; CHECK-NEXT: (block
+;; CHECK-NEXT: (local.set $0
+;; CHECK-NEXT: (block (result (ref null $0))
+;; CHECK-NEXT: (local.set $scratch_4
+;; CHECK-NEXT: (tuple.extract 2 0
+;; CHECK-NEXT: (local.tee $scratch
+;; CHECK-NEXT: (local.get $7)
+;; CHECK-NEXT: )
+;; CHECK-NEXT: )
+;; CHECK-NEXT: )
+;; CHECK-NEXT: (local.set $1
+;; CHECK-NEXT: (tuple.extract 2 1
+;; CHECK-NEXT: (local.get $scratch)
+;; CHECK-NEXT: )
+;; CHECK-NEXT: )
+;; CHECK-NEXT: (local.get $scratch_4)
+;; CHECK-NEXT: )
+;; CHECK-NEXT: )
+;; CHECK-NEXT: (drop
+;; CHECK-NEXT: (ref.as_non_null
+;; CHECK-NEXT: (block (result (ref null $0))
+;; CHECK-NEXT: (local.set $scratch_5
+;; CHECK-NEXT: (local.get $0)
+;; CHECK-NEXT: )
+;; CHECK-NEXT: (drop
+;; CHECK-NEXT: (local.get $1)
+;; CHECK-NEXT: )
+;; CHECK-NEXT: (local.get $scratch_5)
+;; CHECK-NEXT: )
+;; CHECK-NEXT: )
+;; CHECK-NEXT: )
+;; CHECK-NEXT: (drop
+;; CHECK-NEXT: (block (result (ref null $0))
+;; CHECK-NEXT: (local.set $scratch_6
+;; CHECK-NEXT: (local.get $0)
+;; CHECK-NEXT: )
+;; CHECK-NEXT: (local.set $2
+;; CHECK-NEXT: (local.get $1)
+;; CHECK-NEXT: )
+;; CHECK-NEXT: (local.get $scratch_6)
+;; CHECK-NEXT: )
+;; CHECK-NEXT: )
+;; CHECK-NEXT: (drop
+;; CHECK-NEXT: (ref.as_non_null
+;; CHECK-NEXT: (local.get $2)
+;; CHECK-NEXT: )
+;; CHECK-NEXT: )
+;; CHECK-NEXT: (unreachable)
+;; CHECK-NEXT: )
+;; CHECK-NEXT: )
+;; CHECK-NEXT: )
+;; CHECK-NEXT: )
diff --git a/test/lit/blocktype.wast b/test/lit/blocktype.wast
index 0150f0a37..805d5d07e 100644
--- a/test/lit/blocktype.wast
+++ b/test/lit/blocktype.wast
@@ -25,30 +25,8 @@
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; RTRIP: (func $f1 (type $f1) (result (ref $f1) (ref $f2))
- ;; RTRIP-NEXT: (local $0 (tuple (ref $f1) (ref $f2)))
- ;; RTRIP-NEXT: (local $1 (tuple (ref $f1) (ref $f2)))
- ;; RTRIP-NEXT: (local.set $1
- ;; RTRIP-NEXT: (loop $label$1 (type $f1) (result (ref $f1) (ref $f2))
- ;; RTRIP-NEXT: (local.set $0
- ;; RTRIP-NEXT: (call $f1)
- ;; RTRIP-NEXT: )
- ;; RTRIP-NEXT: (tuple.make 2
- ;; RTRIP-NEXT: (tuple.extract 2 0
- ;; RTRIP-NEXT: (local.get $0)
- ;; RTRIP-NEXT: )
- ;; RTRIP-NEXT: (tuple.extract 2 1
- ;; RTRIP-NEXT: (local.get $0)
- ;; RTRIP-NEXT: )
- ;; RTRIP-NEXT: )
- ;; RTRIP-NEXT: )
- ;; RTRIP-NEXT: )
- ;; RTRIP-NEXT: (tuple.make 2
- ;; RTRIP-NEXT: (tuple.extract 2 0
- ;; RTRIP-NEXT: (local.get $1)
- ;; RTRIP-NEXT: )
- ;; RTRIP-NEXT: (tuple.extract 2 1
- ;; RTRIP-NEXT: (local.get $1)
- ;; RTRIP-NEXT: )
+ ;; RTRIP-NEXT: (loop (type $f1) (result (ref $f1) (ref $f2))
+ ;; RTRIP-NEXT: (call $f1)
;; RTRIP-NEXT: )
;; RTRIP-NEXT: )
(func $f1 (type $f1) (result (ref $f1) (ref $f2))
@@ -64,30 +42,8 @@
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; RTRIP: (func $f2 (type $f2) (result (ref $f2) (ref $f1))
- ;; RTRIP-NEXT: (local $0 (tuple (ref $f2) (ref $f1)))
- ;; RTRIP-NEXT: (local $1 (tuple (ref $f2) (ref $f1)))
- ;; RTRIP-NEXT: (local.set $1
- ;; RTRIP-NEXT: (loop $label$1 (type $f2) (result (ref $f2) (ref $f1))
- ;; RTRIP-NEXT: (local.set $0
- ;; RTRIP-NEXT: (call $f2)
- ;; RTRIP-NEXT: )
- ;; RTRIP-NEXT: (tuple.make 2
- ;; RTRIP-NEXT: (tuple.extract 2 0
- ;; RTRIP-NEXT: (local.get $0)
- ;; RTRIP-NEXT: )
- ;; RTRIP-NEXT: (tuple.extract 2 1
- ;; RTRIP-NEXT: (local.get $0)
- ;; RTRIP-NEXT: )
- ;; RTRIP-NEXT: )
- ;; RTRIP-NEXT: )
- ;; RTRIP-NEXT: )
- ;; RTRIP-NEXT: (tuple.make 2
- ;; RTRIP-NEXT: (tuple.extract 2 0
- ;; RTRIP-NEXT: (local.get $1)
- ;; RTRIP-NEXT: )
- ;; RTRIP-NEXT: (tuple.extract 2 1
- ;; RTRIP-NEXT: (local.get $1)
- ;; RTRIP-NEXT: )
+ ;; RTRIP-NEXT: (loop (type $f2) (result (ref $f2) (ref $f1))
+ ;; RTRIP-NEXT: (call $f2)
;; RTRIP-NEXT: )
;; RTRIP-NEXT: )
(func $f2 (type $f2) (result (ref $f2) (ref $f1))
diff --git a/test/lit/cast-and-recast-tuple.wast b/test/lit/cast-and-recast-tuple.wast
index 3febcbff7..6ceefe7d6 100644
--- a/test/lit/cast-and-recast-tuple.wast
+++ b/test/lit/cast-and-recast-tuple.wast
@@ -16,46 +16,34 @@
(type $B (sub $A (struct)))
)
- ;; CHECK: (func $test-local-tuple-1 (type $5) (param $B (ref $B)) (param $x i32) (result anyref i32)
- ;; CHECK-NEXT: (local $2 (tuple (ref $B) i32))
- ;; CHECK-NEXT: (local $3 (ref $B))
- ;; CHECK-NEXT: (local $4 (tuple (ref $A) i32))
- ;; CHECK-NEXT: (local.set $4
- ;; CHECK-NEXT: (block $label$1 (type $3) (result (ref $A) i32)
- ;; CHECK-NEXT: (local.set $2
- ;; CHECK-NEXT: (br_if $label$1
- ;; CHECK-NEXT: (tuple.make 2
- ;; CHECK-NEXT: (local.get $B)
- ;; CHECK-NEXT: (i32.const 3)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (local.get $x)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (block (result (ref $B))
- ;; CHECK-NEXT: (local.set $3
- ;; CHECK-NEXT: (tuple.extract 2 0
- ;; CHECK-NEXT: (local.get $2)
+ ;; CHECK: (func $test-local-tuple-1 (type $3) (param $B (ref $B)) (param $x i32) (result anyref i32)
+ ;; CHECK-NEXT: (local $scratch (tuple (ref $B) i32))
+ ;; CHECK-NEXT: (local $scratch_3 (ref $B))
+ ;; CHECK-NEXT: (block $block (type $2) (result (ref $A) i32)
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (block (result (ref $B))
+ ;; CHECK-NEXT: (local.set $scratch_3
+ ;; CHECK-NEXT: (tuple.extract 2 0
+ ;; CHECK-NEXT: (local.tee $scratch
+ ;; CHECK-NEXT: (br_if $block
+ ;; CHECK-NEXT: (tuple.make 2
+ ;; CHECK-NEXT: (local.get $B)
+ ;; CHECK-NEXT: (i32.const 3)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (local.get $x)
+ ;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (tuple.extract 2 1
- ;; CHECK-NEXT: (local.get $2)
- ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (tuple.extract 2 1
+ ;; CHECK-NEXT: (local.get $scratch)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (local.get $3)
;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (local.get $scratch_3)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (unreachable)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (tuple.make 2
- ;; CHECK-NEXT: (tuple.extract 2 0
- ;; CHECK-NEXT: (local.get $4)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (tuple.extract 2 1
- ;; CHECK-NEXT: (local.get $4)
;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (unreachable)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $test-local-tuple-1 (param $B (ref $B)) (param $x i32) (result anyref i32)
@@ -77,48 +65,36 @@
)
)
- ;; CHECK: (func $test-local-tuple-2 (type $9) (param $B (ref $B)) (param $x i32) (result i32 i32)
+ ;; CHECK: (func $test-local-tuple-2 (type $7) (param $B (ref $B)) (param $x i32) (result i32 i32)
;; CHECK-NEXT: (local $temp i32)
;; CHECK-NEXT: (local $3 i32)
- ;; CHECK-NEXT: (local $4 (tuple i32 i32))
- ;; CHECK-NEXT: (local $5 i32)
- ;; CHECK-NEXT: (local $6 (tuple i32 i32))
- ;; CHECK-NEXT: (local.set $6
- ;; CHECK-NEXT: (block $label$1 (type $4) (result i32 i32)
- ;; CHECK-NEXT: (local.set $4
- ;; CHECK-NEXT: (br_if $label$1
- ;; CHECK-NEXT: (tuple.make 2
- ;; CHECK-NEXT: (i32.const -1)
- ;; CHECK-NEXT: (i32.const 3)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (local.get $x)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (local.set $temp
- ;; CHECK-NEXT: (block (result i32)
- ;; CHECK-NEXT: (local.set $5
- ;; CHECK-NEXT: (tuple.extract 2 0
- ;; CHECK-NEXT: (local.get $4)
+ ;; CHECK-NEXT: (local $scratch (tuple i32 i32))
+ ;; CHECK-NEXT: (local $scratch_5 i32)
+ ;; CHECK-NEXT: (block $block (type $4) (result i32 i32)
+ ;; CHECK-NEXT: (local.set $temp
+ ;; CHECK-NEXT: (block (result i32)
+ ;; CHECK-NEXT: (local.set $scratch_5
+ ;; CHECK-NEXT: (tuple.extract 2 0
+ ;; CHECK-NEXT: (local.tee $scratch
+ ;; CHECK-NEXT: (br_if $block
+ ;; CHECK-NEXT: (tuple.make 2
+ ;; CHECK-NEXT: (i32.const -1)
+ ;; CHECK-NEXT: (i32.const 3)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (local.get $x)
+ ;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (local.set $3
- ;; CHECK-NEXT: (tuple.extract 2 1
- ;; CHECK-NEXT: (local.get $4)
- ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (local.set $3
+ ;; CHECK-NEXT: (tuple.extract 2 1
+ ;; CHECK-NEXT: (local.get $scratch)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (local.get $5)
;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (local.get $scratch_5)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (unreachable)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (tuple.make 2
- ;; CHECK-NEXT: (tuple.extract 2 0
- ;; CHECK-NEXT: (local.get $6)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (tuple.extract 2 1
- ;; CHECK-NEXT: (local.get $6)
;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (unreachable)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $test-local-tuple-2 (param $B (ref $B)) (param $x i32) (result i32 i32)
@@ -139,48 +115,36 @@
)
)
- ;; CHECK: (func $test-local-tuple-3 (type $5) (param $B (ref $B)) (param $x i32) (result anyref i32)
+ ;; CHECK: (func $test-local-tuple-3 (type $3) (param $B (ref $B)) (param $x i32) (result anyref i32)
;; CHECK-NEXT: (local $temp (ref $B))
;; CHECK-NEXT: (local $3 i32)
- ;; CHECK-NEXT: (local $4 (tuple (ref $B) i32))
- ;; CHECK-NEXT: (local $5 (ref $B))
- ;; CHECK-NEXT: (local $6 (tuple (ref $B) i32))
- ;; CHECK-NEXT: (local.set $6
- ;; CHECK-NEXT: (block $label$1 (type $6) (result (ref $B) i32)
- ;; CHECK-NEXT: (local.set $4
- ;; CHECK-NEXT: (br_if $label$1
- ;; CHECK-NEXT: (tuple.make 2
- ;; CHECK-NEXT: (local.get $B)
- ;; CHECK-NEXT: (i32.const 3)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (local.get $x)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (local.set $temp
- ;; CHECK-NEXT: (block (result (ref $B))
- ;; CHECK-NEXT: (local.set $5
- ;; CHECK-NEXT: (tuple.extract 2 0
- ;; CHECK-NEXT: (local.get $4)
+ ;; CHECK-NEXT: (local $scratch (tuple (ref $B) i32))
+ ;; CHECK-NEXT: (local $scratch_5 (ref $B))
+ ;; CHECK-NEXT: (block $block (type $5) (result (ref $B) i32)
+ ;; CHECK-NEXT: (local.set $temp
+ ;; CHECK-NEXT: (block (result (ref $B))
+ ;; CHECK-NEXT: (local.set $scratch_5
+ ;; CHECK-NEXT: (tuple.extract 2 0
+ ;; CHECK-NEXT: (local.tee $scratch
+ ;; CHECK-NEXT: (br_if $block
+ ;; CHECK-NEXT: (tuple.make 2
+ ;; CHECK-NEXT: (local.get $B)
+ ;; CHECK-NEXT: (i32.const 3)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (local.get $x)
+ ;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (local.set $3
- ;; CHECK-NEXT: (tuple.extract 2 1
- ;; CHECK-NEXT: (local.get $4)
- ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (local.set $3
+ ;; CHECK-NEXT: (tuple.extract 2 1
+ ;; CHECK-NEXT: (local.get $scratch)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (local.get $5)
;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (local.get $scratch_5)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (unreachable)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (tuple.make 2
- ;; CHECK-NEXT: (tuple.extract 2 0
- ;; CHECK-NEXT: (local.get $6)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (tuple.extract 2 1
- ;; CHECK-NEXT: (local.get $6)
;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (unreachable)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $test-local-tuple-3 (param $B (ref $B)) (param $x i32) (result anyref i32)
@@ -201,64 +165,52 @@
)
)
- ;; CHECK: (func $test-local-tuple-4-bad (type $5) (param $B (ref $B)) (param $x i32) (result anyref i32)
+ ;; CHECK: (func $test-local-tuple-4-bad (type $3) (param $B (ref $B)) (param $x i32) (result anyref i32)
;; CHECK-NEXT: (local $temp (ref $B))
;; CHECK-NEXT: (local $3 (ref $A))
;; CHECK-NEXT: (local $4 i32)
;; CHECK-NEXT: (local $5 i32)
- ;; CHECK-NEXT: (local $6 (tuple (ref $B) i32))
- ;; CHECK-NEXT: (local $7 (ref $B))
- ;; CHECK-NEXT: (local $8 (ref $B))
- ;; CHECK-NEXT: (local $9 (tuple (ref $A) i32))
- ;; CHECK-NEXT: (local.set $9
- ;; CHECK-NEXT: (block $label$1 (type $3) (result (ref $A) i32)
- ;; CHECK-NEXT: (local.set $6
- ;; CHECK-NEXT: (br_if $label$1
- ;; CHECK-NEXT: (tuple.make 2
- ;; CHECK-NEXT: (local.get $B)
- ;; CHECK-NEXT: (i32.const 3)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (local.get $x)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (local.set $3
- ;; CHECK-NEXT: (block (result (ref $B))
- ;; CHECK-NEXT: (local.set $7
- ;; CHECK-NEXT: (tuple.extract 2 0
- ;; CHECK-NEXT: (local.get $6)
+ ;; CHECK-NEXT: (local $scratch (tuple (ref $B) i32))
+ ;; CHECK-NEXT: (local $scratch_7 (ref $B))
+ ;; CHECK-NEXT: (local $scratch_8 (ref $B))
+ ;; CHECK-NEXT: (block $block (type $2) (result (ref $A) i32)
+ ;; CHECK-NEXT: (local.set $3
+ ;; CHECK-NEXT: (block (result (ref $B))
+ ;; CHECK-NEXT: (local.set $scratch_7
+ ;; CHECK-NEXT: (tuple.extract 2 0
+ ;; CHECK-NEXT: (local.tee $scratch
+ ;; CHECK-NEXT: (br_if $block
+ ;; CHECK-NEXT: (tuple.make 2
+ ;; CHECK-NEXT: (local.get $B)
+ ;; CHECK-NEXT: (i32.const 3)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (local.get $x)
+ ;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (local.set $5
- ;; CHECK-NEXT: (tuple.extract 2 1
- ;; CHECK-NEXT: (local.get $6)
- ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (local.set $5
+ ;; CHECK-NEXT: (tuple.extract 2 1
+ ;; CHECK-NEXT: (local.get $scratch)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (local.get $7)
;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (local.get $scratch_7)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (local.set $temp
- ;; CHECK-NEXT: (block (result (ref $B))
- ;; CHECK-NEXT: (local.set $8
- ;; CHECK-NEXT: (ref.cast (ref $B)
- ;; CHECK-NEXT: (local.get $3)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (local.set $4
- ;; CHECK-NEXT: (local.get $5)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (local.set $temp
+ ;; CHECK-NEXT: (block (result (ref $B))
+ ;; CHECK-NEXT: (local.set $scratch_8
+ ;; CHECK-NEXT: (ref.cast (ref $B)
+ ;; CHECK-NEXT: (local.get $3)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (local.get $8)
;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (local.set $4
+ ;; CHECK-NEXT: (local.get $5)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (local.get $scratch_8)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (unreachable)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (tuple.make 2
- ;; CHECK-NEXT: (tuple.extract 2 0
- ;; CHECK-NEXT: (local.get $9)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (tuple.extract 2 1
- ;; CHECK-NEXT: (local.get $9)
;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (unreachable)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $test-local-tuple-4-bad (param $B (ref $B)) (param $x i32) (result anyref i32)
@@ -284,7 +236,7 @@
)
)
- ;; CHECK: (func $test-local-tuple-4-bad-dupes (type $10) (param $B (ref $B)) (param $x i32) (result i32 anyref i32)
+ ;; CHECK: (func $test-local-tuple-4-bad-dupes (type $8) (param $B (ref $B)) (param $x i32) (result i32 anyref i32)
;; CHECK-NEXT: (local $temp (ref $B))
;; CHECK-NEXT: (local $3 (ref $B))
;; CHECK-NEXT: (local $4 (ref $A))
@@ -293,97 +245,82 @@
;; CHECK-NEXT: (local $7 i32)
;; CHECK-NEXT: (local $8 i32)
;; CHECK-NEXT: (local $9 i32)
- ;; CHECK-NEXT: (local $10 (tuple i32 (ref $B) i32))
- ;; CHECK-NEXT: (local $11 (ref $B))
- ;; CHECK-NEXT: (local $12 i32)
- ;; CHECK-NEXT: (local $13 (ref $B))
- ;; CHECK-NEXT: (local $14 i32)
- ;; CHECK-NEXT: (local $15 (ref $B))
- ;; CHECK-NEXT: (local $16 (tuple i32 (ref $A) i32))
- ;; CHECK-NEXT: (local.set $16
- ;; CHECK-NEXT: (block $label$1 (type $7) (result i32 (ref $A) i32)
- ;; CHECK-NEXT: (local.set $10
- ;; CHECK-NEXT: (br_if $label$1
- ;; CHECK-NEXT: (tuple.make 3
- ;; CHECK-NEXT: (i32.const -3)
- ;; CHECK-NEXT: (local.get $B)
- ;; CHECK-NEXT: (i32.const 3)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (local.get $x)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (local.set $9
- ;; CHECK-NEXT: (block (result i32)
- ;; CHECK-NEXT: (local.set $12
- ;; CHECK-NEXT: (tuple.extract 3 0
- ;; CHECK-NEXT: (local.get $10)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (local.set $4
- ;; CHECK-NEXT: (block (result (ref $B))
- ;; CHECK-NEXT: (local.set $11
- ;; CHECK-NEXT: (tuple.extract 3 1
- ;; CHECK-NEXT: (local.get $10)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (local.set $8
- ;; CHECK-NEXT: (tuple.extract 3 2
- ;; CHECK-NEXT: (local.get $10)
+ ;; CHECK-NEXT: (local $scratch_10 (tuple i32 (ref $B) i32))
+ ;; CHECK-NEXT: (local $scratch_11 (ref $B))
+ ;; CHECK-NEXT: (local $scratch_12 i32)
+ ;; CHECK-NEXT: (local $scratch_13 (ref $B))
+ ;; CHECK-NEXT: (local $scratch_14 i32)
+ ;; CHECK-NEXT: (local $scratch_15 (ref $B))
+ ;; CHECK-NEXT: (block $block (type $6) (result i32 (ref $A) i32)
+ ;; CHECK-NEXT: (local.set $9
+ ;; CHECK-NEXT: (block (result i32)
+ ;; CHECK-NEXT: (local.set $scratch_12
+ ;; CHECK-NEXT: (tuple.extract 3 0
+ ;; CHECK-NEXT: (local.tee $scratch_10
+ ;; CHECK-NEXT: (br_if $block
+ ;; CHECK-NEXT: (tuple.make 3
+ ;; CHECK-NEXT: (i32.const -3)
+ ;; CHECK-NEXT: (local.get $B)
+ ;; CHECK-NEXT: (i32.const 3)
;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (local.get $x)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (local.get $11)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (local.get $12)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (local.tee $scratch
- ;; CHECK-NEXT: (block (result i32)
- ;; CHECK-NEXT: (local.set $14
- ;; CHECK-NEXT: (local.get $9)
+ ;; CHECK-NEXT: (local.set $4
+ ;; CHECK-NEXT: (block (result (ref $B))
+ ;; CHECK-NEXT: (local.set $scratch_11
+ ;; CHECK-NEXT: (tuple.extract 3 1
+ ;; CHECK-NEXT: (local.get $scratch_10)
+ ;; CHECK-NEXT: )
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (local.set $3
- ;; CHECK-NEXT: (block (result (ref $B))
- ;; CHECK-NEXT: (local.set $13
- ;; CHECK-NEXT: (ref.cast (ref $B)
- ;; CHECK-NEXT: (local.get $4)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (local.set $7
- ;; CHECK-NEXT: (local.get $8)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (local.get $13)
+ ;; CHECK-NEXT: (local.set $8
+ ;; CHECK-NEXT: (tuple.extract 3 2
+ ;; CHECK-NEXT: (local.get $scratch_10)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (local.get $14)
+ ;; CHECK-NEXT: (local.get $scratch_11)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (local.get $scratch_12)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (local.set $temp
- ;; CHECK-NEXT: (block (result (ref $B))
- ;; CHECK-NEXT: (local.set $15
- ;; CHECK-NEXT: (local.get $3)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (local.tee $scratch
+ ;; CHECK-NEXT: (block (result i32)
+ ;; CHECK-NEXT: (local.set $scratch_14
+ ;; CHECK-NEXT: (local.get $9)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (local.set $5
- ;; CHECK-NEXT: (local.get $7)
+ ;; CHECK-NEXT: (local.set $3
+ ;; CHECK-NEXT: (block (result (ref $B))
+ ;; CHECK-NEXT: (local.set $scratch_13
+ ;; CHECK-NEXT: (ref.cast (ref $B)
+ ;; CHECK-NEXT: (local.get $4)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (local.set $7
+ ;; CHECK-NEXT: (local.get $8)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (local.get $scratch_13)
+ ;; CHECK-NEXT: )
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (local.get $15)
+ ;; CHECK-NEXT: (local.get $scratch_14)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (unreachable)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (tuple.make 3
- ;; CHECK-NEXT: (tuple.extract 3 0
- ;; CHECK-NEXT: (local.get $16)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (tuple.extract 3 1
- ;; CHECK-NEXT: (local.get $16)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (tuple.extract 3 2
- ;; CHECK-NEXT: (local.get $16)
+ ;; CHECK-NEXT: (local.set $temp
+ ;; CHECK-NEXT: (block (result (ref $B))
+ ;; CHECK-NEXT: (local.set $scratch_15
+ ;; CHECK-NEXT: (local.get $3)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (local.set $5
+ ;; CHECK-NEXT: (local.get $7)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (local.get $scratch_15)
+ ;; CHECK-NEXT: )
;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (unreachable)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $test-local-tuple-4-bad-dupes (param $B (ref $B)) (param $x i32) (result i32 anyref i32)
diff --git a/test/lit/cast-and-recast.wast b/test/lit/cast-and-recast.wast
index a2fe43711..ce2af9d98 100644
--- a/test/lit/cast-and-recast.wast
+++ b/test/lit/cast-and-recast.wast
@@ -19,9 +19,9 @@
)
;; CHECK: (func $test (type $3) (param $B (ref $B)) (param $x i32) (result anyref)
- ;; CHECK-NEXT: (block $label$1 (result (ref $A))
+ ;; CHECK-NEXT: (block $block (result (ref $A))
;; CHECK-NEXT: (ref.cast (ref $B)
- ;; CHECK-NEXT: (br_if $label$1
+ ;; CHECK-NEXT: (br_if $block
;; CHECK-NEXT: (local.get $B)
;; CHECK-NEXT: (local.get $x)
;; CHECK-NEXT: )
@@ -41,9 +41,9 @@
)
;; CHECK: (func $test-cast (type $3) (param $B (ref $B)) (param $x i32) (result anyref)
- ;; CHECK-NEXT: (block $label$1 (result (ref $A))
+ ;; CHECK-NEXT: (block $block (result (ref $A))
;; CHECK-NEXT: (ref.cast (ref $B)
- ;; CHECK-NEXT: (br_if $label$1
+ ;; CHECK-NEXT: (br_if $block
;; CHECK-NEXT: (local.get $B)
;; CHECK-NEXT: (local.get $x)
;; CHECK-NEXT: )
@@ -64,9 +64,9 @@
)
;; CHECK: (func $test-cast-more (type $3) (param $B (ref $B)) (param $x i32) (result anyref)
- ;; CHECK-NEXT: (block $label$1 (result (ref $A))
+ ;; CHECK-NEXT: (block $block (result (ref $A))
;; CHECK-NEXT: (ref.cast (ref $C)
- ;; CHECK-NEXT: (br_if $label$1
+ ;; CHECK-NEXT: (br_if $block
;; CHECK-NEXT: (local.get $B)
;; CHECK-NEXT: (local.get $x)
;; CHECK-NEXT: )
@@ -87,9 +87,9 @@
)
;; CHECK: (func $test-cast-less (type $3) (param $B (ref $B)) (param $x i32) (result anyref)
- ;; CHECK-NEXT: (block $label$1 (result (ref $A))
+ ;; CHECK-NEXT: (block $block (result (ref $A))
;; CHECK-NEXT: (ref.cast (ref $B)
- ;; CHECK-NEXT: (br_if $label$1
+ ;; CHECK-NEXT: (br_if $block
;; CHECK-NEXT: (local.get $B)
;; CHECK-NEXT: (local.get $x)
;; CHECK-NEXT: )
@@ -112,10 +112,10 @@
;; CHECK: (func $test-local (type $3) (param $B (ref $B)) (param $x i32) (result anyref)
;; CHECK-NEXT: (local $temp (ref $B))
- ;; CHECK-NEXT: (block $label$1 (result (ref $A))
+ ;; CHECK-NEXT: (block $block (result (ref $A))
;; CHECK-NEXT: (local.set $temp
;; CHECK-NEXT: (ref.cast (ref $B)
- ;; CHECK-NEXT: (br_if $label$1
+ ;; CHECK-NEXT: (br_if $block
;; CHECK-NEXT: (local.get $B)
;; CHECK-NEXT: (local.get $x)
;; CHECK-NEXT: )
@@ -140,9 +140,9 @@
)
;; CHECK: (func $test-drop (type $3) (param $B (ref $B)) (param $x i32) (result anyref)
- ;; CHECK-NEXT: (block $label$1 (result (ref $A))
+ ;; CHECK-NEXT: (block $block (result (ref $A))
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (br_if $label$1
+ ;; CHECK-NEXT: (br_if $block
;; CHECK-NEXT: (local.get $B)
;; CHECK-NEXT: (local.get $x)
;; CHECK-NEXT: )
@@ -164,8 +164,8 @@
)
;; CHECK: (func $test-same (type $4) (param $A (ref $A)) (param $x i32) (result anyref)
- ;; CHECK-NEXT: (block $label$1 (result (ref $A))
- ;; CHECK-NEXT: (br_if $label$1
+ ;; CHECK-NEXT: (block $block (result (ref $A))
+ ;; CHECK-NEXT: (br_if $block
;; CHECK-NEXT: (local.get $A)
;; CHECK-NEXT: (local.get $x)
;; CHECK-NEXT: )
diff --git a/test/lit/cast-to-basic.wast b/test/lit/cast-to-basic.wast
index 4c2e7c047..7c45cf8a3 100644
--- a/test/lit/cast-to-basic.wast
+++ b/test/lit/cast-to-basic.wast
@@ -33,9 +33,9 @@
;; CHECK: (func $br (type $0) (param $anyref anyref)
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (block $label$1 (result structref)
+ ;; CHECK-NEXT: (block $block (result structref)
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (br_on_cast $label$1 anyref (ref struct)
+ ;; CHECK-NEXT: (br_on_cast $block anyref (ref struct)
;; CHECK-NEXT: (local.get $anyref)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
@@ -58,9 +58,9 @@
;; CHECK: (func $br-null (type $0) (param $anyref anyref)
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (block $label$1 (result structref)
+ ;; CHECK-NEXT: (block $block (result structref)
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (br_on_cast $label$1 anyref structref
+ ;; CHECK-NEXT: (br_on_cast $block anyref structref
;; CHECK-NEXT: (local.get $anyref)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
@@ -83,9 +83,9 @@
;; CHECK: (func $br-fail-null (type $0) (param $anyref anyref)
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (block $label$1 (result anyref)
+ ;; CHECK-NEXT: (block $block (result anyref)
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (br_on_cast_fail $label$1 anyref structref
+ ;; CHECK-NEXT: (br_on_cast_fail $block anyref structref
;; CHECK-NEXT: (local.get $anyref)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
diff --git a/test/lit/debug/source-map-stop.wast b/test/lit/debug/source-map-stop.wast
index 95545e65a..04a77d9ea 100644
--- a/test/lit/debug/source-map-stop.wast
+++ b/test/lit/debug/source-map-stop.wast
@@ -142,6 +142,8 @@
;; CHECK-NEXT: (return)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
+ ;; CHECK-NEXT: ;;@
+ ;; CHECK-NEXT: (unreachable)
;; CHECK-NEXT: )
(func $foo (param $x i32) (param $y i32)
;;@ src.cpp:90:1
diff --git a/test/lit/downgrade-reftypes.wast b/test/lit/downgrade-reftypes.wast
index 76d8d9975..71d009dee 100644
--- a/test/lit/downgrade-reftypes.wast
+++ b/test/lit/downgrade-reftypes.wast
@@ -13,29 +13,29 @@
;; CHECK: (func $foo (type $f)
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (block $label$1 (result funcref)
- ;; CHECK-NEXT: (br $label$1
+ ;; CHECK-NEXT: (block $block (result funcref)
+ ;; CHECK-NEXT: (br $block
;; CHECK-NEXT: (ref.func $foo)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (block $label$2 (result funcref)
- ;; CHECK-NEXT: (br $label$2
+ ;; CHECK-NEXT: (block $block1 (result funcref)
+ ;; CHECK-NEXT: (br $block1
;; CHECK-NEXT: (ref.null nofunc)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (block $label$3 (result externref)
- ;; CHECK-NEXT: (br $label$3
+ ;; CHECK-NEXT: (block $block2 (result externref)
+ ;; CHECK-NEXT: (br $block2
;; CHECK-NEXT: (ref.null noextern)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (block $label$4 (result stringref)
- ;; CHECK-NEXT: (br $label$4
+ ;; CHECK-NEXT: (block $block3 (result stringref)
+ ;; CHECK-NEXT: (br $block3
;; CHECK-NEXT: (string.const "hello world")
;; CHECK-NEXT: )
;; CHECK-NEXT: )
diff --git a/test/lit/multivalue-stack-ir.wast b/test/lit/multivalue-stack-ir.wast
index b4a394a05..97c353eb4 100644
--- a/test/lit/multivalue-stack-ir.wast
+++ b/test/lit/multivalue-stack-ir.wast
@@ -9,16 +9,16 @@
;; CHECK-NEXT: (local $pair f32)
;; CHECK-NEXT: (local $f32 f32)
;; CHECK-NEXT: (local $2 i32)
- ;; CHECK-NEXT: (local $3 f32)
+ ;; CHECK-NEXT: (local $scratch f32)
;; CHECK-NEXT: (local.set $pair
;; CHECK-NEXT: (block (result f32)
- ;; CHECK-NEXT: (local.set $3
+ ;; CHECK-NEXT: (local.set $scratch
;; CHECK-NEXT: (f32.const 0)
;; CHECK-NEXT: )
;; CHECK-NEXT: (local.set $2
;; CHECK-NEXT: (i32.const 0)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (local.get $3)
+ ;; CHECK-NEXT: (local.get $scratch)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (local.set $f32
diff --git a/test/lit/multivalue.wast b/test/lit/multivalue.wast
index 0cfafb2a9..d9cc14e05 100644
--- a/test/lit/multivalue.wast
+++ b/test/lit/multivalue.wast
@@ -28,35 +28,32 @@
)
;; CHECK: (func $get-first (type $6) (result i32)
- ;; CHECK-NEXT: (local $0 (tuple i32 i64 f32))
- ;; CHECK-NEXT: (local $1 i64)
- ;; CHECK-NEXT: (local $2 i32)
- ;; CHECK-NEXT: (local.set $0
- ;; CHECK-NEXT: (call $triple)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (block (result i32)
- ;; CHECK-NEXT: (local.set $2
- ;; CHECK-NEXT: (tuple.extract 3 0
- ;; CHECK-NEXT: (local.get $0)
+ ;; CHECK-NEXT: (local $scratch (tuple i32 i64 f32))
+ ;; CHECK-NEXT: (local $scratch_1 i64)
+ ;; CHECK-NEXT: (local $scratch_2 i32)
+ ;; CHECK-NEXT: (local.set $scratch_2
+ ;; CHECK-NEXT: (tuple.extract 3 0
+ ;; CHECK-NEXT: (local.tee $scratch
+ ;; CHECK-NEXT: (call $triple)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (block (result i64)
- ;; CHECK-NEXT: (local.set $1
- ;; CHECK-NEXT: (tuple.extract 3 1
- ;; CHECK-NEXT: (local.get $0)
- ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (block (result i64)
+ ;; CHECK-NEXT: (local.set $scratch_1
+ ;; CHECK-NEXT: (tuple.extract 3 1
+ ;; CHECK-NEXT: (local.get $scratch)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (tuple.extract 3 2
- ;; CHECK-NEXT: (local.get $0)
- ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (tuple.extract 3 2
+ ;; CHECK-NEXT: (local.get $scratch)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (local.get $1)
;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (local.get $scratch_1)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (local.get $2)
;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (local.get $scratch_2)
;; CHECK-NEXT: )
(func $get-first (result i32)
(tuple.extract 3 0
@@ -64,37 +61,36 @@
)
)
- ;; CHECK: (func $get-second (type $3) (result i64)
+ ;; CHECK: (func $get-second (type $2) (result i64)
;; CHECK-NEXT: (local $0 i64)
- ;; CHECK-NEXT: (local $1 (tuple i32 i64 f32))
- ;; CHECK-NEXT: (local $2 i64)
- ;; CHECK-NEXT: (local $3 i32)
- ;; CHECK-NEXT: (local.set $1
- ;; CHECK-NEXT: (call $triple)
- ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (local $scratch (tuple i32 i64 f32))
+ ;; CHECK-NEXT: (local $scratch_2 i64)
+ ;; CHECK-NEXT: (local $scratch_3 i32)
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (block (result i32)
- ;; CHECK-NEXT: (local.set $3
+ ;; CHECK-NEXT: (local.set $scratch_3
;; CHECK-NEXT: (tuple.extract 3 0
- ;; CHECK-NEXT: (local.get $1)
+ ;; CHECK-NEXT: (local.tee $scratch
+ ;; CHECK-NEXT: (call $triple)
+ ;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (local.set $0
;; CHECK-NEXT: (block (result i64)
- ;; CHECK-NEXT: (local.set $2
+ ;; CHECK-NEXT: (local.set $scratch_2
;; CHECK-NEXT: (tuple.extract 3 1
- ;; CHECK-NEXT: (local.get $1)
+ ;; CHECK-NEXT: (local.get $scratch)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (tuple.extract 3 2
- ;; CHECK-NEXT: (local.get $1)
+ ;; CHECK-NEXT: (local.get $scratch)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (local.get $2)
+ ;; CHECK-NEXT: (local.get $scratch_2)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (local.get $3)
+ ;; CHECK-NEXT: (local.get $scratch_3)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (local.get $0)
@@ -107,35 +103,34 @@
;; CHECK: (func $get-third (type $7) (result f32)
;; CHECK-NEXT: (local $0 f32)
- ;; CHECK-NEXT: (local $1 (tuple i32 i64 f32))
- ;; CHECK-NEXT: (local $2 i64)
- ;; CHECK-NEXT: (local $3 i32)
- ;; CHECK-NEXT: (local.set $1
- ;; CHECK-NEXT: (call $triple)
- ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (local $scratch (tuple i32 i64 f32))
+ ;; CHECK-NEXT: (local $scratch_2 i64)
+ ;; CHECK-NEXT: (local $scratch_3 i32)
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (block (result i32)
- ;; CHECK-NEXT: (local.set $3
+ ;; CHECK-NEXT: (local.set $scratch_3
;; CHECK-NEXT: (tuple.extract 3 0
- ;; CHECK-NEXT: (local.get $1)
+ ;; CHECK-NEXT: (local.tee $scratch
+ ;; CHECK-NEXT: (call $triple)
+ ;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (block (result i64)
- ;; CHECK-NEXT: (local.set $2
+ ;; CHECK-NEXT: (local.set $scratch_2
;; CHECK-NEXT: (tuple.extract 3 1
- ;; CHECK-NEXT: (local.get $1)
+ ;; CHECK-NEXT: (local.get $scratch)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (local.set $0
;; CHECK-NEXT: (tuple.extract 3 2
- ;; CHECK-NEXT: (local.get $1)
+ ;; CHECK-NEXT: (local.get $scratch)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (local.get $2)
+ ;; CHECK-NEXT: (local.get $scratch_2)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (local.get $3)
+ ;; CHECK-NEXT: (local.get $scratch_3)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (local.get $0)
@@ -146,39 +141,38 @@
)
)
- ;; CHECK: (func $reverse (type $4) (result f32 i64 i32)
+ ;; CHECK: (func $reverse (type $3) (result f32 i64 i32)
;; CHECK-NEXT: (local $x i32)
;; CHECK-NEXT: (local $1 i64)
;; CHECK-NEXT: (local $2 f32)
- ;; CHECK-NEXT: (local $3 (tuple i32 i64 f32))
- ;; CHECK-NEXT: (local $4 i64)
- ;; CHECK-NEXT: (local $5 i32)
- ;; CHECK-NEXT: (local.set $3
- ;; CHECK-NEXT: (call $triple)
- ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (local $scratch (tuple i32 i64 f32))
+ ;; CHECK-NEXT: (local $scratch_4 i64)
+ ;; CHECK-NEXT: (local $scratch_5 i32)
;; CHECK-NEXT: (local.set $x
;; CHECK-NEXT: (block (result i32)
- ;; CHECK-NEXT: (local.set $5
+ ;; CHECK-NEXT: (local.set $scratch_5
;; CHECK-NEXT: (tuple.extract 3 0
- ;; CHECK-NEXT: (local.get $3)
+ ;; CHECK-NEXT: (local.tee $scratch
+ ;; CHECK-NEXT: (call $triple)
+ ;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (local.set $1
;; CHECK-NEXT: (block (result i64)
- ;; CHECK-NEXT: (local.set $4
+ ;; CHECK-NEXT: (local.set $scratch_4
;; CHECK-NEXT: (tuple.extract 3 1
- ;; CHECK-NEXT: (local.get $3)
+ ;; CHECK-NEXT: (local.get $scratch)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (local.set $2
;; CHECK-NEXT: (tuple.extract 3 2
- ;; CHECK-NEXT: (local.get $3)
+ ;; CHECK-NEXT: (local.get $scratch)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (local.get $4)
+ ;; CHECK-NEXT: (local.get $scratch_4)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (local.get $5)
+ ;; CHECK-NEXT: (local.get $scratch_5)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (tuple.make 3
@@ -205,7 +199,7 @@
)
)
- ;; CHECK: (func $unreachable (type $3) (result i64)
+ ;; CHECK: (func $unreachable (type $2) (result i64)
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (i32.const 42)
;; CHECK-NEXT: )
@@ -226,16 +220,16 @@
;; Test multivalue globals
;; CHECK: (func $global (type $0) (result i32 i64)
- ;; CHECK-NEXT: (local $0 i32)
+ ;; CHECK-NEXT: (local $scratch i32)
;; CHECK-NEXT: (global.set $g1
;; CHECK-NEXT: (block (result i32)
- ;; CHECK-NEXT: (local.set $0
+ ;; CHECK-NEXT: (local.set $scratch
;; CHECK-NEXT: (i32.const 42)
;; CHECK-NEXT: )
;; CHECK-NEXT: (global.set $g2
;; CHECK-NEXT: (i64.const 7)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (local.get $0)
+ ;; CHECK-NEXT: (local.get $scratch)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
@@ -263,24 +257,23 @@
;; Test lowering of multivalue drops
;; CHECK: (func $drop-call (type $1)
- ;; CHECK-NEXT: (local $0 (tuple i32 i64))
- ;; CHECK-NEXT: (local $1 i32)
- ;; CHECK-NEXT: (local.set $0
- ;; CHECK-NEXT: (call $pair)
- ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (local $scratch (tuple i32 i64))
+ ;; CHECK-NEXT: (local $scratch_1 i32)
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (block (result i32)
- ;; CHECK-NEXT: (local.set $1
+ ;; CHECK-NEXT: (local.set $scratch_1
;; CHECK-NEXT: (tuple.extract 2 0
- ;; CHECK-NEXT: (local.get $0)
+ ;; CHECK-NEXT: (local.tee $scratch
+ ;; CHECK-NEXT: (call $pair)
+ ;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (tuple.extract 2 1
- ;; CHECK-NEXT: (local.get $0)
+ ;; CHECK-NEXT: (local.get $scratch)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (local.get $1)
+ ;; CHECK-NEXT: (local.get $scratch_1)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
@@ -291,16 +284,16 @@
)
;; CHECK: (func $drop-tuple-make (type $1)
- ;; CHECK-NEXT: (local $0 i32)
+ ;; CHECK-NEXT: (local $scratch i32)
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (block (result i32)
- ;; CHECK-NEXT: (local.set $0
+ ;; CHECK-NEXT: (local.set $scratch
;; CHECK-NEXT: (i32.const 42)
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (i64.const 42)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (local.get $0)
+ ;; CHECK-NEXT: (local.get $scratch)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
@@ -314,29 +307,28 @@
)
;; CHECK: (func $drop-block (type $1)
- ;; CHECK-NEXT: (local $0 (tuple i32 i64))
- ;; CHECK-NEXT: (local $1 i32)
- ;; CHECK-NEXT: (local.set $0
- ;; CHECK-NEXT: (block $label$1 (type $0) (result i32 i64)
- ;; CHECK-NEXT: (tuple.make 2
- ;; CHECK-NEXT: (i32.const 42)
- ;; CHECK-NEXT: (i64.const 42)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (local $scratch (tuple i32 i64))
+ ;; CHECK-NEXT: (local $scratch_1 i32)
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (block (result i32)
- ;; CHECK-NEXT: (local.set $1
+ ;; CHECK-NEXT: (local.set $scratch_1
;; CHECK-NEXT: (tuple.extract 2 0
- ;; CHECK-NEXT: (local.get $0)
+ ;; CHECK-NEXT: (local.tee $scratch
+ ;; CHECK-NEXT: (block (type $0) (result i32 i64)
+ ;; CHECK-NEXT: (tuple.make 2
+ ;; CHECK-NEXT: (i32.const 42)
+ ;; CHECK-NEXT: (i64.const 42)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (tuple.extract 2 1
- ;; CHECK-NEXT: (local.get $0)
+ ;; CHECK-NEXT: (local.get $scratch)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (local.get $1)
+ ;; CHECK-NEXT: (local.get $scratch_1)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
@@ -389,25 +381,14 @@
)
;; CHECK: (func $mv-block-break (type $0) (result i32 i64)
- ;; CHECK-NEXT: (local $0 (tuple i32 i64))
- ;; CHECK-NEXT: (local.set $0
- ;; CHECK-NEXT: (block $label$1 (type $0) (result i32 i64)
- ;; CHECK-NEXT: (br $label$1
- ;; CHECK-NEXT: (tuple.make 2
- ;; CHECK-NEXT: (i32.const 42)
- ;; CHECK-NEXT: (i64.const 42)
- ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (block $block (type $0) (result i32 i64)
+ ;; CHECK-NEXT: (br $block
+ ;; CHECK-NEXT: (tuple.make 2
+ ;; CHECK-NEXT: (i32.const 42)
+ ;; CHECK-NEXT: (i64.const 42)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (tuple.make 2
- ;; CHECK-NEXT: (tuple.extract 2 0
- ;; CHECK-NEXT: (local.get $0)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (tuple.extract 2 1
- ;; CHECK-NEXT: (local.get $0)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $mv-block-break (result i32 i64)
(block $l (result i32 i64)
@@ -421,35 +402,13 @@
)
;; CHECK: (func $mv-block-br-if (type $0) (result i32 i64)
- ;; CHECK-NEXT: (local $0 (tuple i32 i64))
- ;; CHECK-NEXT: (local $1 (tuple i32 i64))
- ;; CHECK-NEXT: (local.set $1
- ;; CHECK-NEXT: (block $label$1 (type $0) (result i32 i64)
- ;; CHECK-NEXT: (local.set $0
- ;; CHECK-NEXT: (br_if $label$1
- ;; CHECK-NEXT: (tuple.make 2
- ;; CHECK-NEXT: (i32.const 42)
- ;; CHECK-NEXT: (i64.const 42)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (i32.const 1)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (block $block (type $0) (result i32 i64)
+ ;; CHECK-NEXT: (br_if $block
;; CHECK-NEXT: (tuple.make 2
- ;; CHECK-NEXT: (tuple.extract 2 0
- ;; CHECK-NEXT: (local.get $0)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (tuple.extract 2 1
- ;; CHECK-NEXT: (local.get $0)
- ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (i32.const 42)
+ ;; CHECK-NEXT: (i64.const 42)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (tuple.make 2
- ;; CHECK-NEXT: (tuple.extract 2 0
- ;; CHECK-NEXT: (local.get $1)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (tuple.extract 2 1
- ;; CHECK-NEXT: (local.get $1)
+ ;; CHECK-NEXT: (i32.const 1)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
@@ -465,36 +424,22 @@
)
)
- ;; CHECK: (func $mv-if (type $2) (result i32 i64 externref)
- ;; CHECK-NEXT: (local $0 (tuple i32 i64 externref))
- ;; CHECK-NEXT: (local.set $0
- ;; CHECK-NEXT: (if (type $2) (result i32 i64 externref)
- ;; CHECK-NEXT: (i32.const 1)
- ;; CHECK-NEXT: (then
- ;; CHECK-NEXT: (tuple.make 3
- ;; CHECK-NEXT: (i32.const 42)
- ;; CHECK-NEXT: (i64.const 42)
- ;; CHECK-NEXT: (ref.null noextern)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (else
- ;; CHECK-NEXT: (tuple.make 3
- ;; CHECK-NEXT: (i32.const 42)
- ;; CHECK-NEXT: (i64.const 42)
- ;; CHECK-NEXT: (ref.null noextern)
- ;; CHECK-NEXT: )
+ ;; CHECK: (func $mv-if (type $4) (result i32 i64 externref)
+ ;; CHECK-NEXT: (if (type $4) (result i32 i64 externref)
+ ;; CHECK-NEXT: (i32.const 1)
+ ;; CHECK-NEXT: (then
+ ;; CHECK-NEXT: (tuple.make 3
+ ;; CHECK-NEXT: (i32.const 42)
+ ;; CHECK-NEXT: (i64.const 42)
+ ;; CHECK-NEXT: (ref.null noextern)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (tuple.make 3
- ;; CHECK-NEXT: (tuple.extract 3 0
- ;; CHECK-NEXT: (local.get $0)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (tuple.extract 3 1
- ;; CHECK-NEXT: (local.get $0)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (tuple.extract 3 2
- ;; CHECK-NEXT: (local.get $0)
+ ;; CHECK-NEXT: (else
+ ;; CHECK-NEXT: (tuple.make 3
+ ;; CHECK-NEXT: (i32.const 42)
+ ;; CHECK-NEXT: (i64.const 42)
+ ;; CHECK-NEXT: (ref.null noextern)
+ ;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
@@ -519,21 +464,10 @@
)
;; CHECK: (func $mv-loop (type $0) (result i32 i64)
- ;; CHECK-NEXT: (local $0 (tuple i32 i64))
- ;; CHECK-NEXT: (local.set $0
- ;; CHECK-NEXT: (loop $label$1 (type $0) (result i32 i64)
- ;; CHECK-NEXT: (tuple.make 2
- ;; CHECK-NEXT: (i32.const 42)
- ;; CHECK-NEXT: (i64.const 42)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (tuple.make 2
- ;; CHECK-NEXT: (tuple.extract 2 0
- ;; CHECK-NEXT: (local.get $0)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (tuple.extract 2 1
- ;; CHECK-NEXT: (local.get $0)
+ ;; CHECK-NEXT: (loop (type $0) (result i32 i64)
+ ;; CHECK-NEXT: (tuple.make 2
+ ;; CHECK-NEXT: (i32.const 42)
+ ;; CHECK-NEXT: (i64.const 42)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
@@ -547,39 +481,17 @@
)
;; CHECK: (func $mv-switch (type $0) (result i32 i64)
- ;; CHECK-NEXT: (local $0 (tuple i32 i64))
- ;; CHECK-NEXT: (local $1 (tuple i32 i64))
- ;; CHECK-NEXT: (local.set $1
- ;; CHECK-NEXT: (block $label$1 (type $0) (result i32 i64)
- ;; CHECK-NEXT: (local.set $0
- ;; CHECK-NEXT: (block $label$2 (type $0) (result i32 i64)
- ;; CHECK-NEXT: (br_table $label$1 $label$2
- ;; CHECK-NEXT: (tuple.make 2
- ;; CHECK-NEXT: (i32.const 42)
- ;; CHECK-NEXT: (i64.const 42)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (i32.const 0)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (tuple.make 2
- ;; CHECK-NEXT: (tuple.extract 2 0
- ;; CHECK-NEXT: (local.get $0)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (tuple.extract 2 1
- ;; CHECK-NEXT: (local.get $0)
+ ;; CHECK-NEXT: (block $block (type $0) (result i32 i64)
+ ;; CHECK-NEXT: (block $block1 (type $0) (result i32 i64)
+ ;; CHECK-NEXT: (br_table $block $block1
+ ;; CHECK-NEXT: (tuple.make 2
+ ;; CHECK-NEXT: (i32.const 42)
+ ;; CHECK-NEXT: (i64.const 42)
;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (i32.const 0)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (tuple.make 2
- ;; CHECK-NEXT: (tuple.extract 2 0
- ;; CHECK-NEXT: (local.get $1)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (tuple.extract 2 1
- ;; CHECK-NEXT: (local.get $1)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $mv-switch (result i32 i64)
(block $a (result i32 i64)
diff --git a/test/lit/parse-double-unreachable.wast b/test/lit/parse-double-unreachable.wast
index b232a40fb..9b0e8f573 100644
--- a/test/lit/parse-double-unreachable.wast
+++ b/test/lit/parse-double-unreachable.wast
@@ -15,7 +15,24 @@
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (ref.null nofunc)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (unreachable)
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (unreachable)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (local.get $x)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (ref.null nofunc)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (block ;; (replaces unreachable ArrayGet we can't emit)
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (unreachable)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (unreachable)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (unreachable)
+ ;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $double-unreachable (param $x (ref $array)) (result i32)
diff --git a/test/lit/passes/roundtrip-gc.wast b/test/lit/passes/roundtrip-gc.wast
index 57300def5..d2c32542c 100644
--- a/test/lit/passes/roundtrip-gc.wast
+++ b/test/lit/passes/roundtrip-gc.wast
@@ -6,14 +6,14 @@
;; CHECK: (export "export" (func $test))
(export "export" (func $test))
;; CHECK: (func $test (type $1)
- ;; CHECK-NEXT: (local $0 (ref $\7bi32\7d))
+ ;; CHECK-NEXT: (local $scratch (ref $\7bi32\7d))
;; CHECK-NEXT: (call $help
;; CHECK-NEXT: (block (result (ref $\7bi32\7d))
- ;; CHECK-NEXT: (local.set $0
+ ;; CHECK-NEXT: (local.set $scratch
;; CHECK-NEXT: (struct.new_default $\7bi32\7d)
;; CHECK-NEXT: )
;; CHECK-NEXT: (call $other)
- ;; CHECK-NEXT: (local.get $0)
+ ;; CHECK-NEXT: (local.get $scratch)
;; CHECK-NEXT: )
;; CHECK-NEXT: (i32.const 1)
;; CHECK-NEXT: )
diff --git a/test/lit/passes/roundtrip.wast b/test/lit/passes/roundtrip.wast
index 59e303eaf..21aa1f671 100644
--- a/test/lit/passes/roundtrip.wast
+++ b/test/lit/passes/roundtrip.wast
@@ -5,29 +5,28 @@
;; CHECK: (type $none (func))
(type $none (func))
;; CHECK: (func $foo (type $none)
- ;; CHECK-NEXT: (local $0 (tuple funcref (ref $none)))
- ;; CHECK-NEXT: (local $1 funcref)
- ;; CHECK-NEXT: (local.set $0
- ;; CHECK-NEXT: (block $label$1 (type $1) (result funcref (ref $none))
- ;; CHECK-NEXT: (tuple.make 2
- ;; CHECK-NEXT: (ref.null nofunc)
- ;; CHECK-NEXT: (ref.func $foo)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (local $scratch (tuple funcref (ref $none)))
+ ;; CHECK-NEXT: (local $scratch_1 funcref)
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (block (result funcref)
- ;; CHECK-NEXT: (local.set $1
+ ;; CHECK-NEXT: (local.set $scratch_1
;; CHECK-NEXT: (tuple.extract 2 0
- ;; CHECK-NEXT: (local.get $0)
+ ;; CHECK-NEXT: (local.tee $scratch
+ ;; CHECK-NEXT: (block (type $1) (result funcref (ref $none))
+ ;; CHECK-NEXT: (tuple.make 2
+ ;; CHECK-NEXT: (ref.null nofunc)
+ ;; CHECK-NEXT: (ref.func $foo)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (tuple.extract 2 1
- ;; CHECK-NEXT: (local.get $0)
+ ;; CHECK-NEXT: (local.get $scratch)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (local.get $1)
+ ;; CHECK-NEXT: (local.get $scratch_1)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
diff --git a/test/lit/passes/signature-refining_gto.wat b/test/lit/passes/signature-refining_gto.wat
index ec2b517b1..c69eeb244 100644
--- a/test/lit/passes/signature-refining_gto.wat
+++ b/test/lit/passes/signature-refining_gto.wat
@@ -17,7 +17,9 @@
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (local.get $0)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (unreachable)
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (unreachable)
+ ;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $struct.get (param $0 (ref $A))
;; This function is always called with a null, so the parameter type will be
diff --git a/test/lit/passes/stack-ir-roundtrip-eh-legacy.wast b/test/lit/passes/stack-ir-roundtrip-eh-legacy.wast
index 439681a8f..dbaa2c601 100644
--- a/test/lit/passes/stack-ir-roundtrip-eh-legacy.wast
+++ b/test/lit/passes/stack-ir-roundtrip-eh-legacy.wast
@@ -5,16 +5,16 @@
;; CHECK: (tag $tag (param i32))
(tag $tag (param i32))
;; CHECK: (func $delegate-child (type $1)
- ;; CHECK-NEXT: (try $label$9
+ ;; CHECK-NEXT: (try
;; CHECK-NEXT: (do
- ;; CHECK-NEXT: (try $label$7
+ ;; CHECK-NEXT: (try
;; CHECK-NEXT: (do
;; CHECK-NEXT: )
;; CHECK-NEXT: (catch $tag
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (pop i32)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (try $label$6
+ ;; CHECK-NEXT: (try
;; CHECK-NEXT: (do
;; CHECK-NEXT: )
;; CHECK-NEXT: (delegate 2)
diff --git a/test/lit/reftypes-without-gc.wast b/test/lit/reftypes-without-gc.wast
index e71aa5269..d251d0e0b 100644
--- a/test/lit/reftypes-without-gc.wast
+++ b/test/lit/reftypes-without-gc.wast
@@ -10,8 +10,8 @@
(module
;; CHECK: (func $test (param $x i32) (result funcref)
- ;; CHECK-NEXT: (block $label$1 (result funcref)
- ;; CHECK-NEXT: (br_if $label$1
+ ;; CHECK-NEXT: (block $block (result funcref)
+ ;; CHECK-NEXT: (br_if $block
;; CHECK-NEXT: (ref.func $test)
;; CHECK-NEXT: (local.get $x)
;; CHECK-NEXT: )
diff --git a/test/lit/source-map.wast b/test/lit/source-map.wast
index b4fc55374..fe534043b 100644
--- a/test/lit/source-map.wast
+++ b/test/lit/source-map.wast
@@ -48,10 +48,7 @@
;;@ src.cpp:40:1
(local.get $y)
)
- ;; For the legacy parser
- ;;@ src.cpp:50:1
(then
- ;; For the new parser
;;@ src.cpp:50:1
(return)
)
@@ -68,10 +65,10 @@
;; CHECK: (func $nested-blocks
;; CHECK-NEXT: ;;@ src.cpp:2:1
- ;; CHECK-NEXT: (block $label$1
+ ;; CHECK-NEXT: (block
;; CHECK-NEXT: ;;@ src.cpp:2:2
- ;; CHECK-NEXT: (block $label$2
- ;; CHECK-NEXT: (br $label$2)
+ ;; CHECK-NEXT: (block $block
+ ;; CHECK-NEXT: (br $block)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: ;;@ src.cpp:3:1
diff --git a/test/lit/string.as_wtf16.wast b/test/lit/string.as_wtf16.wast
index 60bdcf5ec..74bbc97ea 100644
--- a/test/lit/string.as_wtf16.wast
+++ b/test/lit/string.as_wtf16.wast
@@ -26,33 +26,33 @@
;; CHECK-NEXT: )
;; RTRIP: (func $codeunit (type $1) (result i32)
;; RTRIP-NEXT: (local $0 i32)
- ;; RTRIP-NEXT: (local $1 (ref string))
+ ;; RTRIP-NEXT: (local $scratch (ref string))
;; RTRIP-NEXT: (stringview_wtf16.get_codeunit
;; RTRIP-NEXT: (block (result (ref string))
- ;; RTRIP-NEXT: (local.set $1
+ ;; RTRIP-NEXT: (local.set $scratch
;; RTRIP-NEXT: (string.const "abc")
;; RTRIP-NEXT: )
;; RTRIP-NEXT: (local.set $0
;; RTRIP-NEXT: (i32.const 0)
;; RTRIP-NEXT: )
- ;; RTRIP-NEXT: (local.get $1)
+ ;; RTRIP-NEXT: (local.get $scratch)
;; RTRIP-NEXT: )
;; RTRIP-NEXT: (local.get $0)
;; RTRIP-NEXT: )
;; RTRIP-NEXT: )
;; RRTRP: (func $codeunit (type $1) (result i32)
;; RRTRP-NEXT: (local $0 i32)
- ;; RRTRP-NEXT: (local $1 (ref string))
- ;; RRTRP-NEXT: (local $2 (ref string))
+ ;; RRTRP-NEXT: (local $scratch (ref string))
+ ;; RRTRP-NEXT: (local $scratch_2 (ref string))
;; RRTRP-NEXT: (stringview_wtf16.get_codeunit
;; RRTRP-NEXT: (block (result (ref string))
- ;; RRTRP-NEXT: (local.set $2
+ ;; RRTRP-NEXT: (local.set $scratch_2
;; RRTRP-NEXT: (string.const "abc")
;; RRTRP-NEXT: )
;; RRTRP-NEXT: (local.set $0
;; RRTRP-NEXT: (i32.const 0)
;; RRTRP-NEXT: )
- ;; RRTRP-NEXT: (local.get $2)
+ ;; RRTRP-NEXT: (local.get $scratch_2)
;; RRTRP-NEXT: )
;; RRTRP-NEXT: (local.get $0)
;; RRTRP-NEXT: )
@@ -108,25 +108,25 @@
;; RTRIP: (func $slice (type $0) (result stringref)
;; RTRIP-NEXT: (local $0 i32)
;; RTRIP-NEXT: (local $1 i32)
- ;; RTRIP-NEXT: (local $2 i32)
- ;; RTRIP-NEXT: (local $3 (ref string))
+ ;; RTRIP-NEXT: (local $scratch i32)
+ ;; RTRIP-NEXT: (local $scratch_3 (ref string))
;; RTRIP-NEXT: (stringview_wtf16.slice
;; RTRIP-NEXT: (block (result (ref string))
- ;; RTRIP-NEXT: (local.set $3
+ ;; RTRIP-NEXT: (local.set $scratch_3
;; RTRIP-NEXT: (string.const "abc")
;; RTRIP-NEXT: )
;; RTRIP-NEXT: (local.set $0
;; RTRIP-NEXT: (block (result i32)
- ;; RTRIP-NEXT: (local.set $2
+ ;; RTRIP-NEXT: (local.set $scratch
;; RTRIP-NEXT: (i32.const 1)
;; RTRIP-NEXT: )
;; RTRIP-NEXT: (local.set $1
;; RTRIP-NEXT: (i32.const 2)
;; RTRIP-NEXT: )
- ;; RTRIP-NEXT: (local.get $2)
+ ;; RTRIP-NEXT: (local.get $scratch)
;; RTRIP-NEXT: )
;; RTRIP-NEXT: )
- ;; RTRIP-NEXT: (local.get $3)
+ ;; RTRIP-NEXT: (local.get $scratch_3)
;; RTRIP-NEXT: )
;; RTRIP-NEXT: (local.get $0)
;; RTRIP-NEXT: (local.get $1)
@@ -135,27 +135,27 @@
;; RRTRP: (func $slice (type $0) (result stringref)
;; RRTRP-NEXT: (local $0 i32)
;; RRTRP-NEXT: (local $1 i32)
- ;; RRTRP-NEXT: (local $2 i32)
- ;; RRTRP-NEXT: (local $3 (ref string))
- ;; RRTRP-NEXT: (local $4 i32)
- ;; RRTRP-NEXT: (local $5 (ref string))
+ ;; RRTRP-NEXT: (local $scratch i32)
+ ;; RRTRP-NEXT: (local $scratch_3 (ref string))
+ ;; RRTRP-NEXT: (local $scratch_4 i32)
+ ;; RRTRP-NEXT: (local $scratch_5 (ref string))
;; RRTRP-NEXT: (stringview_wtf16.slice
;; RRTRP-NEXT: (block (result (ref string))
- ;; RRTRP-NEXT: (local.set $5
+ ;; RRTRP-NEXT: (local.set $scratch_5
;; RRTRP-NEXT: (string.const "abc")
;; RRTRP-NEXT: )
;; RRTRP-NEXT: (local.set $0
;; RRTRP-NEXT: (block (result i32)
- ;; RRTRP-NEXT: (local.set $4
+ ;; RRTRP-NEXT: (local.set $scratch_4
;; RRTRP-NEXT: (i32.const 1)
;; RRTRP-NEXT: )
;; RRTRP-NEXT: (local.set $1
;; RRTRP-NEXT: (i32.const 2)
;; RRTRP-NEXT: )
- ;; RRTRP-NEXT: (local.get $4)
+ ;; RRTRP-NEXT: (local.get $scratch_4)
;; RRTRP-NEXT: )
;; RRTRP-NEXT: )
- ;; RRTRP-NEXT: (local.get $5)
+ ;; RRTRP-NEXT: (local.get $scratch_5)
;; RRTRP-NEXT: )
;; RRTRP-NEXT: (local.get $0)
;; RRTRP-NEXT: (local.get $1)
@@ -185,25 +185,25 @@
;; RTRIP-NEXT: (local $start i32)
;; RTRIP-NEXT: (local $1 i32)
;; RTRIP-NEXT: (local $2 i32)
- ;; RTRIP-NEXT: (local $3 i32)
- ;; RTRIP-NEXT: (local $4 (ref string))
+ ;; RTRIP-NEXT: (local $scratch i32)
+ ;; RTRIP-NEXT: (local $scratch_4 (ref string))
;; RTRIP-NEXT: (stringview_wtf16.slice
;; RTRIP-NEXT: (block (result (ref string))
- ;; RTRIP-NEXT: (local.set $4
+ ;; RTRIP-NEXT: (local.set $scratch_4
;; RTRIP-NEXT: (string.const "abc")
;; RTRIP-NEXT: )
;; RTRIP-NEXT: (local.set $1
;; RTRIP-NEXT: (block (result i32)
- ;; RTRIP-NEXT: (local.set $3
+ ;; RTRIP-NEXT: (local.set $scratch
;; RTRIP-NEXT: (local.get $start)
;; RTRIP-NEXT: )
;; RTRIP-NEXT: (local.set $2
;; RTRIP-NEXT: (i32.const 2)
;; RTRIP-NEXT: )
- ;; RTRIP-NEXT: (local.get $3)
+ ;; RTRIP-NEXT: (local.get $scratch)
;; RTRIP-NEXT: )
;; RTRIP-NEXT: )
- ;; RTRIP-NEXT: (local.get $4)
+ ;; RTRIP-NEXT: (local.get $scratch_4)
;; RTRIP-NEXT: )
;; RTRIP-NEXT: (local.get $1)
;; RTRIP-NEXT: (local.get $2)
@@ -213,27 +213,27 @@
;; RRTRP-NEXT: (local $start i32)
;; RRTRP-NEXT: (local $1 i32)
;; RRTRP-NEXT: (local $2 i32)
- ;; RRTRP-NEXT: (local $3 i32)
- ;; RRTRP-NEXT: (local $4 (ref string))
- ;; RRTRP-NEXT: (local $5 i32)
- ;; RRTRP-NEXT: (local $6 (ref string))
+ ;; RRTRP-NEXT: (local $scratch i32)
+ ;; RRTRP-NEXT: (local $scratch_4 (ref string))
+ ;; RRTRP-NEXT: (local $scratch_5 i32)
+ ;; RRTRP-NEXT: (local $scratch_6 (ref string))
;; RRTRP-NEXT: (stringview_wtf16.slice
;; RRTRP-NEXT: (block (result (ref string))
- ;; RRTRP-NEXT: (local.set $6
+ ;; RRTRP-NEXT: (local.set $scratch_6
;; RRTRP-NEXT: (string.const "abc")
;; RRTRP-NEXT: )
;; RRTRP-NEXT: (local.set $1
;; RRTRP-NEXT: (block (result i32)
- ;; RRTRP-NEXT: (local.set $5
+ ;; RRTRP-NEXT: (local.set $scratch_5
;; RRTRP-NEXT: (local.get $start)
;; RRTRP-NEXT: )
;; RRTRP-NEXT: (local.set $2
;; RRTRP-NEXT: (i32.const 2)
;; RRTRP-NEXT: )
- ;; RRTRP-NEXT: (local.get $5)
+ ;; RRTRP-NEXT: (local.get $scratch_5)
;; RRTRP-NEXT: )
;; RRTRP-NEXT: )
- ;; RRTRP-NEXT: (local.get $6)
+ ;; RRTRP-NEXT: (local.get $scratch_6)
;; RRTRP-NEXT: )
;; RRTRP-NEXT: (local.get $1)
;; RRTRP-NEXT: (local.get $2)
@@ -261,25 +261,25 @@
;; RTRIP-NEXT: (local $end i32)
;; RTRIP-NEXT: (local $1 i32)
;; RTRIP-NEXT: (local $2 i32)
- ;; RTRIP-NEXT: (local $3 i32)
- ;; RTRIP-NEXT: (local $4 (ref string))
+ ;; RTRIP-NEXT: (local $scratch i32)
+ ;; RTRIP-NEXT: (local $scratch_4 (ref string))
;; RTRIP-NEXT: (stringview_wtf16.slice
;; RTRIP-NEXT: (block (result (ref string))
- ;; RTRIP-NEXT: (local.set $4
+ ;; RTRIP-NEXT: (local.set $scratch_4
;; RTRIP-NEXT: (string.const "abc")
;; RTRIP-NEXT: )
;; RTRIP-NEXT: (local.set $1
;; RTRIP-NEXT: (block (result i32)
- ;; RTRIP-NEXT: (local.set $3
+ ;; RTRIP-NEXT: (local.set $scratch
;; RTRIP-NEXT: (i32.const 1)
;; RTRIP-NEXT: )
;; RTRIP-NEXT: (local.set $2
;; RTRIP-NEXT: (local.get $end)
;; RTRIP-NEXT: )
- ;; RTRIP-NEXT: (local.get $3)
+ ;; RTRIP-NEXT: (local.get $scratch)
;; RTRIP-NEXT: )
;; RTRIP-NEXT: )
- ;; RTRIP-NEXT: (local.get $4)
+ ;; RTRIP-NEXT: (local.get $scratch_4)
;; RTRIP-NEXT: )
;; RTRIP-NEXT: (local.get $1)
;; RTRIP-NEXT: (local.get $2)
@@ -289,27 +289,27 @@
;; RRTRP-NEXT: (local $end i32)
;; RRTRP-NEXT: (local $1 i32)
;; RRTRP-NEXT: (local $2 i32)
- ;; RRTRP-NEXT: (local $3 i32)
- ;; RRTRP-NEXT: (local $4 (ref string))
- ;; RRTRP-NEXT: (local $5 i32)
- ;; RRTRP-NEXT: (local $6 (ref string))
+ ;; RRTRP-NEXT: (local $scratch i32)
+ ;; RRTRP-NEXT: (local $scratch_4 (ref string))
+ ;; RRTRP-NEXT: (local $scratch_5 i32)
+ ;; RRTRP-NEXT: (local $scratch_6 (ref string))
;; RRTRP-NEXT: (stringview_wtf16.slice
;; RRTRP-NEXT: (block (result (ref string))
- ;; RRTRP-NEXT: (local.set $6
+ ;; RRTRP-NEXT: (local.set $scratch_6
;; RRTRP-NEXT: (string.const "abc")
;; RRTRP-NEXT: )
;; RRTRP-NEXT: (local.set $1
;; RRTRP-NEXT: (block (result i32)
- ;; RRTRP-NEXT: (local.set $5
+ ;; RRTRP-NEXT: (local.set $scratch_5
;; RRTRP-NEXT: (i32.const 1)
;; RRTRP-NEXT: )
;; RRTRP-NEXT: (local.set $2
;; RRTRP-NEXT: (local.get $end)
;; RRTRP-NEXT: )
- ;; RRTRP-NEXT: (local.get $5)
+ ;; RRTRP-NEXT: (local.get $scratch_5)
;; RRTRP-NEXT: )
;; RRTRP-NEXT: )
- ;; RRTRP-NEXT: (local.get $6)
+ ;; RRTRP-NEXT: (local.get $scratch_6)
;; RRTRP-NEXT: )
;; RRTRP-NEXT: (local.get $1)
;; RRTRP-NEXT: (local.get $2)
diff --git a/test/lld/em_asm_pthread.wasm.out b/test/lld/em_asm_pthread.wasm.out
index f275876a9..8284cc6dc 100644
--- a/test/lld/em_asm_pthread.wasm.out
+++ b/test/lld/em_asm_pthread.wasm.out
@@ -269,8 +269,8 @@
)
(func $5
(local $0 i32)
- (block $label$1
- (br_if $label$1
+ (block $block
+ (br_if $block
(i32.eqz
(local.tee $0
(global.get $global$1)
@@ -348,9 +348,9 @@
(i32.const 2147483647)
)
)
- (block $label$1
- (block $label$2
- (br_if $label$2
+ (block $block1
+ (block $block
+ (br_if $block
(i32.ne
(i32.and
(local.get $1)
@@ -359,7 +359,7 @@
(i32.const 1)
)
)
- (br_if $label$2
+ (br_if $block
(i32.ne
(local.get $5)
(local.get $3)
@@ -368,7 +368,7 @@
(local.set $6
(i32.const 6)
)
- (br_if $label$1
+ (br_if $block1
(i32.gt_u
(local.tee $5
(i32.load offset=20
@@ -392,14 +392,14 @@
(local.set $6
(i32.const 56)
)
- (br_if $label$1
+ (br_if $block1
(i32.eq
(local.get $5)
(i32.const 2147483647)
)
)
- (block $label$3
- (br_if $label$3
+ (block $block2
+ (br_if $block2
(i32.eqz
(i32.and
(i32.load8_u
@@ -409,8 +409,8 @@
)
)
)
- (block $label$4
- (br_if $label$4
+ (block $block3
+ (br_if $block3
(i32.load
(i32.add
(local.get $2)
@@ -449,15 +449,15 @@
)
)
)
- (block $label$5
- (block $label$6
- (block $label$7
- (br_if $label$7
+ (block $block6
+ (block $block5
+ (block $block4
+ (br_if $block4
(i32.eqz
(local.get $5)
)
)
- (br_if $label$6
+ (br_if $block5
(i32.eqz
(i32.and
(local.get $1)
@@ -465,7 +465,7 @@
)
)
)
- (br_if $label$6
+ (br_if $block5
(i32.eqz
(i32.and
(local.get $4)
@@ -474,7 +474,7 @@
)
)
)
- (br_if $label$5
+ (br_if $block6
(i32.eq
(call $12
(i32.add
@@ -523,8 +523,8 @@
(i32.const 16)
)
)
- (block $label$8
- (br_if $label$8
+ (block $block7
+ (br_if $block7
(i32.eq
(local.get $3)
(local.get $6)
@@ -552,7 +552,7 @@
)
(i32.const 0)
)
- (br_if $label$1
+ (br_if $block1
(i32.eqz
(local.get $5)
)
@@ -584,8 +584,8 @@
)
)
(func $13 (param $0 i32) (result i32)
- (block $label$1
- (br_if $label$1
+ (block $block
+ (br_if $block
(i32.and
(i32.load8_u
(local.get $0)
@@ -626,14 +626,14 @@
)
)
(func $17
- (block $label$1
- (br_if $label$1
+ (block $block
+ (br_if $block
(i32.ne
(call $18)
(i32.const 1)
)
)
- (br_if $label$1
+ (br_if $block
(i32.eqz
(i32.load offset=1796
(i32.const 0)
@@ -683,10 +683,10 @@
(local.get $0)
)
)
- (block $label$1
- (block $label$2
- (block $label$3
- (br_if $label$3
+ (block $block2
+ (block $block1
+ (block $block
+ (br_if $block
(local.tee $4
(i32.and
(local.get $1)
@@ -694,7 +694,7 @@
)
)
)
- (br $label$2)
+ (br $block1)
)
(local.set $5
(call $7)
@@ -702,7 +702,7 @@
(local.set $6
(i32.const 63)
)
- (br_if $label$1
+ (br_if $block2
(i32.ne
(i32.and
(i32.load offset=4
@@ -715,8 +715,8 @@
)
)
)
- (block $label$4
- (br_if $label$4
+ (block $block3
+ (br_if $block3
(i32.ne
(i32.and
(local.get $1)
@@ -725,7 +725,7 @@
(i32.const 1)
)
)
- (br_if $label$4
+ (br_if $block3
(i32.eqz
(local.tee $6
(i32.load offset=20
@@ -745,8 +745,8 @@
(i32.const 0)
)
)
- (block $label$5
- (br_if $label$5
+ (block $block4
+ (br_if $block4
(local.get $2)
)
(i32.store
@@ -773,7 +773,7 @@
)
)
)
- (br_if $label$2
+ (br_if $block1
(i32.eq
(local.get $6)
(i32.add
@@ -810,13 +810,13 @@
)
)
)
- (block $label$6
- (br_if $label$6
+ (block $block5
+ (br_if $block5
(i32.eqz
(local.get $4)
)
)
- (br_if $label$6
+ (br_if $block5
(local.get $2)
)
(i32.store
@@ -831,11 +831,11 @@
(local.set $6
(i32.const 0)
)
- (block $label$7
- (br_if $label$7
+ (block $block6
+ (br_if $block6
(local.get $3)
)
- (br_if $label$1
+ (br_if $block2
(i32.gt_s
(local.get $0)
(i32.const -1)
@@ -925,14 +925,14 @@
(local $1 i32)
(local $2 i32)
(local $3 i32)
- (block $label$1
- (block $label$2
- (br_if $label$2
+ (block $block1
+ (block $block
+ (br_if $block
(i32.eqz
(call $10)
)
)
- (br_if $label$1
+ (br_if $block1
(i32.load8_u offset=1832
(i32.const 0)
)
@@ -947,8 +947,8 @@
(i32.const 1804)
)
)
- (block $label$3
- (br_if $label$3
+ (block $block2
+ (br_if $block2
(local.tee $0
(call $32
(call $14)
@@ -960,7 +960,7 @@
(i32.const 1804)
)
)
- (br_if $label$1
+ (br_if $block1
(i32.eqz
(call $10)
)
@@ -971,8 +971,8 @@
)
(return)
)
- (block $label$4
- (br_if $label$4
+ (block $block3
+ (br_if $block3
(i32.eq
(local.tee $2
(call $23
@@ -994,7 +994,7 @@
)
)
)
- (loop $label$5
+ (loop $label
(drop
(call $20
(i32.const 1804)
@@ -1032,7 +1032,7 @@
)
)
)
- (br_if $label$5
+ (br_if $label
(i32.ne
(local.get $2)
(call $23
@@ -1053,7 +1053,7 @@
(i32.const 2147483647)
)
)
- (br_if $label$1
+ (br_if $block1
(i32.eqz
(call $10)
)
@@ -1066,14 +1066,14 @@
)
(func $32 (param $0 i32) (result i32)
(local $1 i32)
- (block $label$1
- (br_if $label$1
+ (block $block
+ (br_if $block
(i32.eqz
(local.get $0)
)
)
- (block $label$2
- (br_if $label$2
+ (block $block1
+ (br_if $block1
(i32.eqz
(local.tee $1
(i32.load offset=1840
@@ -1082,9 +1082,9 @@
)
)
)
- (loop $label$3
- (block $label$4
- (br_if $label$4
+ (loop $label
+ (block $block2
+ (br_if $block2
(i32.ne
(i32.load
(local.get $1)
@@ -1096,7 +1096,7 @@
(local.get $1)
)
)
- (br_if $label$3
+ (br_if $label
(local.tee $1
(i32.load offset=16
(local.get $1)
@@ -1119,10 +1119,10 @@
)
(func $33 (param $0 i32)
(local $1 i32)
- (block $label$1
- (block $label$2
- (block $label$3
- (br_if $label$3
+ (block $block9
+ (block $block42
+ (block $block
+ (br_if $block
(i32.eq
(i32.and
(local.tee $1
@@ -1135,67 +1135,67 @@
(i32.const 402653184)
)
)
- (block $label$4
- (block $label$5
- (block $label$6
- (block $label$7
- (block $label$8
- (block $label$9
- (block $label$10
- (block $label$11
- (block $label$12
- (block $label$13
- (block $label$14
- (block $label$15
- (block $label$16
- (block $label$17
- (block $label$18
- (block $label$19
- (block $label$20
- (block $label$21
- (block $label$22
- (block $label$23
- (block $label$24
- (block $label$25
- (block $label$26
- (block $label$27
- (block $label$28
- (block $label$29
- (br_if $label$29
+ (block $block8
+ (block $block5
+ (block $block13
+ (block $block41
+ (block $block40
+ (block $block39
+ (block $block37
+ (block $block36
+ (block $block33
+ (block $block32
+ (block $block31
+ (block $block29
+ (block $block28
+ (block $block24
+ (block $block23
+ (block $block22
+ (block $block21
+ (block $block19
+ (block $block17
+ (block $block16
+ (block $block14
+ (block $block12
+ (block $block11
+ (block $block6
+ (block $block4
+ (block $block1
+ (br_if $block1
(i32.gt_s
(local.get $1)
(i32.const 234881023)
)
)
- (block $label$30
- (br_if $label$30
+ (block $block2
+ (br_if $block2
(i32.gt_s
(local.get $1)
(i32.const 100663335)
)
)
- (block $label$31
- (br_if $label$31
+ (block $block3
+ (br_if $block3
(i32.gt_s
(local.get $1)
(i32.const 67108863)
)
)
- (block $label$32
- (br_table $label$28 $label$5 $label$27 $label$32
+ (block $block7
+ (br_table $block4 $block5 $block6 $block7
(i32.add
(local.get $1)
(i32.const -33554432)
)
)
)
- (br_if $label$4
+ (br_if $block8
(i32.eq
(local.get $1)
(i32.const -2126512128)
)
)
- (br_if $label$5
+ (br_if $block5
(local.get $1)
)
(call_indirect (type $2)
@@ -1203,29 +1203,29 @@
(local.get $0)
)
)
- (br $label$1)
+ (br $block9)
)
- (block $label$33
- (br_if $label$33
+ (block $block10
+ (br_if $block10
(i32.gt_s
(local.get $1)
(i32.const 100663295)
)
)
- (br_table $label$26 $label$5 $label$25 $label$6
+ (br_table $block11 $block5 $block12 $block13
(i32.add
(local.get $1)
(i32.const -67108872)
)
)
)
- (br_if $label$24
+ (br_if $block14
(i32.eq
(local.get $1)
(i32.const 100663296)
)
)
- (br_if $label$5
+ (br_if $block5
(i32.ne
(local.get $1)
(i32.const 100663328)
@@ -1251,30 +1251,30 @@
(local.get $0)
)
)
- (br $label$1)
+ (br $block9)
)
- (block $label$34
- (br_if $label$34
+ (block $block15
+ (br_if $block15
(i32.gt_s
(local.get $1)
(i32.const 134217895)
)
)
- (block $label$35
- (br_table $label$23 $label$5 $label$22 $label$35
+ (block $block18
+ (br_table $block16 $block5 $block17 $block18
(i32.add
(local.get $1)
(i32.const -100663336)
)
)
)
- (br_if $label$21
+ (br_if $block19
(i32.eq
(local.get $1)
(i32.const 134217728)
)
)
- (br_if $label$5
+ (br_if $block5
(i32.ne
(local.get $1)
(i32.const 134217760)
@@ -1306,29 +1306,29 @@
(local.get $0)
)
)
- (br $label$1)
+ (br $block9)
)
- (block $label$36
- (br_if $label$36
+ (block $block20
+ (br_if $block20
(i32.gt_s
(local.get $1)
(i32.const 167772839)
)
)
- (br_table $label$20 $label$5 $label$19 $label$18
+ (br_table $block21 $block5 $block22 $block23
(i32.add
(local.get $1)
(i32.const -134217896)
)
)
)
- (br_if $label$17
+ (br_if $block24
(i32.eq
(local.get $1)
(i32.const 167772840)
)
)
- (br_if $label$5
+ (br_if $block5
(i32.ne
(local.get $1)
(i32.const 201326592)
@@ -1372,36 +1372,36 @@
(local.get $0)
)
)
- (br $label$1)
+ (br $block9)
)
- (block $label$37
- (br_if $label$37
+ (block $block25
+ (br_if $block25
(i32.gt_s
(local.get $1)
(i32.const 637534207)
)
)
- (block $label$38
- (br_if $label$38
+ (block $block26
+ (br_if $block26
(i32.gt_s
(local.get $1)
(i32.const 369098751)
)
)
- (block $label$39
- (br_if $label$39
+ (block $block27
+ (br_if $block27
(i32.gt_s
(local.get $1)
(i32.const 301989887)
)
)
- (br_if $label$16
+ (br_if $block28
(i32.eq
(local.get $1)
(i32.const 234881024)
)
)
- (br_if $label$5
+ (br_if $block5
(i32.ne
(local.get $1)
(i32.const 268435456)
@@ -1457,15 +1457,15 @@
(local.get $0)
)
)
- (br $label$1)
+ (br $block9)
)
- (br_if $label$15
+ (br_if $block29
(i32.eq
(local.get $1)
(i32.const 301989888)
)
)
- (br_if $label$5
+ (br_if $block5
(i32.ne
(local.get $1)
(i32.const 335544320)
@@ -1533,22 +1533,22 @@
(local.get $0)
)
)
- (br $label$1)
+ (br $block9)
)
- (block $label$40
- (br_if $label$40
+ (block $block30
+ (br_if $block30
(i32.gt_s
(local.get $1)
(i32.const 570425343)
)
)
- (br_if $label$14
+ (br_if $block31
(i32.eq
(local.get $1)
(i32.const 369098752)
)
)
- (br_if $label$5
+ (br_if $block5
(i32.ne
(local.get $1)
(i32.const 536870912)
@@ -1562,21 +1562,21 @@
)
)
)
- (br $label$1)
+ (br $block9)
)
- (br_if $label$13
+ (br_if $block32
(i32.eq
(local.get $1)
(i32.const 570425344)
)
)
- (br_if $label$12
+ (br_if $block33
(i32.eq
(local.get $1)
(i32.const 603979776)
)
)
- (br_if $label$5
+ (br_if $block5
(i32.ne
(local.get $1)
(i32.const 622854144)
@@ -1596,29 +1596,29 @@
)
)
)
- (br $label$1)
+ (br $block9)
)
- (block $label$41
- (br_if $label$41
+ (block $block34
+ (br_if $block34
(i32.gt_s
(local.get $1)
(i32.const 704643071)
)
)
- (block $label$42
- (br_if $label$42
+ (block $block35
+ (br_if $block35
(i32.gt_s
(local.get $1)
(i32.const 671088639)
)
)
- (br_if $label$11
+ (br_if $block36
(i32.eq
(local.get $1)
(i32.const 637534208)
)
)
- (br_if $label$5
+ (br_if $block5
(i32.ne
(local.get $1)
(i32.const 657457152)
@@ -1644,15 +1644,15 @@
)
)
)
- (br $label$1)
+ (br $block9)
)
- (br_if $label$10
+ (br_if $block37
(i32.eq
(local.get $1)
(i32.const 671088640)
)
)
- (br_if $label$5
+ (br_if $block5
(i32.ne
(local.get $1)
(i32.const 687865856)
@@ -1684,22 +1684,22 @@
)
)
)
- (br $label$1)
+ (br $block9)
)
- (block $label$43
- (br_if $label$43
+ (block $block38
+ (br_if $block38
(i32.gt_s
(local.get $1)
(i32.const 771751935)
)
)
- (br_if $label$9
+ (br_if $block39
(i32.eq
(local.get $1)
(i32.const 704643072)
)
)
- (br_if $label$5
+ (br_if $block5
(i32.ne
(local.get $1)
(i32.const 738197504)
@@ -1746,21 +1746,21 @@
)
)
)
- (br $label$1)
+ (br $block9)
)
- (br_if $label$8
+ (br_if $block40
(i32.eq
(local.get $1)
(i32.const 771751936)
)
)
- (br_if $label$7
+ (br_if $block41
(i32.eq
(local.get $1)
(i32.const 805306368)
)
)
- (br_if $label$5
+ (br_if $block5
(i32.ne
(local.get $1)
(i32.const 838860800)
@@ -1825,7 +1825,7 @@
)
)
)
- (br $label$1)
+ (br $block9)
)
(call_indirect (type $1)
(i32.load offset=16
@@ -1835,7 +1835,7 @@
(local.get $0)
)
)
- (br $label$1)
+ (br $block9)
)
(call_indirect (type $22)
(f32.load offset=16
@@ -1845,7 +1845,7 @@
(local.get $0)
)
)
- (br $label$1)
+ (br $block9)
)
(call_indirect (type $23)
(i32.load offset=16
@@ -1861,7 +1861,7 @@
(local.get $0)
)
)
- (br $label$1)
+ (br $block9)
)
(call_indirect (type $24)
(f32.load offset=16
@@ -1877,7 +1877,7 @@
(local.get $0)
)
)
- (br $label$1)
+ (br $block9)
)
(call_indirect (type $11)
(i32.load offset=16
@@ -1899,7 +1899,7 @@
(local.get $0)
)
)
- (br $label$1)
+ (br $block9)
)
(call_indirect (type $25)
(i32.load offset=16
@@ -1921,7 +1921,7 @@
(local.get $0)
)
)
- (br $label$1)
+ (br $block9)
)
(call_indirect (type $26)
(f32.load offset=16
@@ -1943,7 +1943,7 @@
(local.get $0)
)
)
- (br $label$1)
+ (br $block9)
)
(call_indirect (type $10)
(i32.load offset=16
@@ -1971,7 +1971,7 @@
(local.get $0)
)
)
- (br $label$1)
+ (br $block9)
)
(call_indirect (type $27)
(i32.load offset=16
@@ -1999,7 +1999,7 @@
(local.get $0)
)
)
- (br $label$1)
+ (br $block9)
)
(call_indirect (type $28)
(f32.load offset=16
@@ -2027,9 +2027,9 @@
(local.get $0)
)
)
- (br $label$1)
+ (br $block9)
)
- (br_if $label$5
+ (br_if $block5
(i32.ne
(local.get $1)
(i32.const 167772160)
@@ -2067,7 +2067,7 @@
(local.get $0)
)
)
- (br $label$1)
+ (br $block9)
)
(call_indirect (type $30)
(i32.load offset=16
@@ -2101,7 +2101,7 @@
(local.get $0)
)
)
- (br $label$1)
+ (br $block9)
)
(call_indirect (type $31)
(i32.load offset=16
@@ -2147,7 +2147,7 @@
(local.get $0)
)
)
- (br $label$1)
+ (br $block9)
)
(call_indirect (type $32)
(i32.load offset=16
@@ -2205,7 +2205,7 @@
(local.get $0)
)
)
- (br $label$1)
+ (br $block9)
)
(call_indirect (type $33)
(i32.load offset=16
@@ -2275,7 +2275,7 @@
(local.get $0)
)
)
- (br $label$1)
+ (br $block9)
)
(i32.store offset=176
(local.get $0)
@@ -2288,7 +2288,7 @@
)
)
)
- (br $label$1)
+ (br $block9)
)
(i32.store offset=176
(local.get $0)
@@ -2307,7 +2307,7 @@
)
)
)
- (br $label$1)
+ (br $block9)
)
(i32.store offset=176
(local.get $0)
@@ -2332,7 +2332,7 @@
)
)
)
- (br $label$1)
+ (br $block9)
)
(i32.store offset=176
(local.get $0)
@@ -2363,7 +2363,7 @@
)
)
)
- (br $label$1)
+ (br $block9)
)
(i32.store offset=176
(local.get $0)
@@ -2400,7 +2400,7 @@
)
)
)
- (br $label$1)
+ (br $block9)
)
(i32.store offset=176
(local.get $0)
@@ -2449,7 +2449,7 @@
)
)
)
- (br $label$1)
+ (br $block9)
)
(i32.store offset=176
(local.get $0)
@@ -2504,9 +2504,9 @@
)
)
)
- (br $label$1)
+ (br $block9)
)
- (br_if $label$2
+ (br_if $block42
(i32.eq
(local.get $1)
(i32.const 67108864)
@@ -2536,7 +2536,7 @@
)
)
)
- (br $label$1)
+ (br $block9)
)
(call $fimport$8
(i32.const 1254)
@@ -2561,8 +2561,8 @@
)
)
)
- (block $label$44
- (br_if $label$44
+ (block $block43
+ (br_if $block43
(i32.eqz
(i32.load offset=188
(local.get $0)
@@ -2589,8 +2589,8 @@
)
)
(func $34 (param $0 i32)
- (block $label$1
- (br_if $label$1
+ (block $block
+ (br_if $block
(i32.eqz
(local.get $0)
)
@@ -2608,8 +2608,8 @@
(func $35 (param $0 i32) (param $1 f64) (result i32)
(local $2 i32)
(local $3 f64)
- (block $label$1
- (br_if $label$1
+ (block $block
+ (br_if $block
(local.tee $0
(call $23
(local.tee $2
@@ -2630,8 +2630,8 @@
(local.set $0
(i32.const 0)
)
- (block $label$2
- (br_if $label$2
+ (block $block1
+ (br_if $block1
(i32.xor
(f64.lt
(local.get $3)
@@ -2645,7 +2645,7 @@
(i32.const 1)
)
)
- (loop $label$3
+ (loop $label
(drop
(call $fimport$6
(local.get $2)
@@ -2664,10 +2664,10 @@
(local.set $3
(call $fimport$4)
)
- (br_if $label$2
+ (br_if $block1
(local.get $0)
)
- (br_if $label$3
+ (br_if $label
(f64.lt
(local.get $3)
(local.get $1)
@@ -2703,18 +2703,18 @@
(local $5 i32)
(local $6 i32)
(local $7 i32)
- (block $label$1
- (block $label$2
- (block $label$3
- (br_if $label$3
+ (block $block10
+ (block $block8
+ (block $block
+ (br_if $block
(i32.eqz
(local.get $1)
)
)
- (block $label$4
- (block $label$5
- (block $label$6
- (br_table $label$6 $label$5 $label$4
+ (block $block3
+ (block $block2
+ (block $block1
+ (br_table $block1 $block2 $block3
(local.get $0)
)
)
@@ -2730,15 +2730,15 @@
(call $37)
)
)
- (block $label$7
- (block $label$8
- (br_if $label$8
+ (block $block5
+ (block $block4
+ (br_if $block4
(i32.eq
(local.get $0)
(i32.const 2)
)
)
- (br_if $label$7
+ (br_if $block5
(i32.ne
(local.get $0)
(call $14)
@@ -2757,8 +2757,8 @@
(i32.const 1804)
)
)
- (block $label$9
- (br_if $label$9
+ (block $block6
+ (br_if $block6
(i32.load offset=4
(local.tee $2
(call $39
@@ -2774,8 +2774,8 @@
)
)
)
- (block $label$10
- (br_if $label$10
+ (block $block7
+ (br_if $block7
(i32.ne
(local.tee $4
(call $23
@@ -2807,13 +2807,13 @@
)
)
)
- (loop $label$11
+ (loop $label
(drop
(call $20
(i32.const 1804)
)
)
- (br_if $label$2
+ (br_if $block8
(i32.ne
(local.get $0)
(call $37)
@@ -2831,7 +2831,7 @@
(i32.const 1804)
)
)
- (br_if $label$11
+ (br_if $label
(i32.eq
(local.tee $4
(call $23
@@ -2867,14 +2867,14 @@
)
(local.get $1)
)
- (block $label$12
- (br_if $label$12
+ (block $block9
+ (br_if $block9
(i32.ne
(local.get $4)
(local.get $6)
)
)
- (br_if $label$12
+ (br_if $block9
(call $fimport$10
(local.get $0)
(call $37)
@@ -2888,7 +2888,7 @@
(i32.const 1804)
)
)
- (br $label$1)
+ (br $block10)
)
(drop
(call $24
@@ -2901,7 +2901,7 @@
(i32.const 1804)
)
)
- (br $label$1)
+ (br $block10)
)
(call $fimport$8
(i32.const 1090)
@@ -2920,8 +2920,8 @@
(func $39 (param $0 i32) (result i32)
(local $1 i32)
(local $2 i32)
- (block $label$1
- (br_if $label$1
+ (block $block
+ (br_if $block
(local.tee $1
(call $32
(local.get $0)
@@ -2944,9 +2944,9 @@
(local.get $1)
(local.get $0)
)
- (block $label$2
- (block $label$3
- (br_if $label$3
+ (block $block2
+ (block $block1
+ (br_if $block1
(local.tee $0
(i32.load offset=1840
(i32.const 0)
@@ -2956,10 +2956,10 @@
(local.set $0
(i32.const 1840)
)
- (br $label$2)
+ (br $block2)
)
- (loop $label$4
- (br_if $label$4
+ (loop $label
+ (br_if $label
(local.tee $0
(i32.load offset=16
(local.tee $2
@@ -3117,13 +3117,13 @@
(local.get $0)
)
(func $44
- (block $label$1
- (br_if $label$1
+ (block $block
+ (br_if $block
(i32.eqz
(call $9)
)
)
- (br_if $label$1
+ (br_if $block
(i32.eqz
(i32.load offset=1432
(i32.const 0)
@@ -3146,9 +3146,9 @@
)
)
)
- (block $label$1
- (block $label$2
- (br_if $label$2
+ (block $block1
+ (block $block
+ (br_if $block
(i32.eqz
(local.get $3)
)
@@ -3164,7 +3164,7 @@
(local.set $5
(local.get $4)
)
- (br $label$1)
+ (br $block1)
)
(local.set $5
(call $46)
@@ -3185,8 +3185,8 @@
(local.get $3)
)
)
- (block $label$3
- (br_if $label$3
+ (block $block2
+ (br_if $block2
(i32.ge_s
(local.get $1)
(i32.const 20)
@@ -3199,14 +3199,14 @@
(local.set $0
(i32.const 0)
)
- (block $label$4
- (br_if $label$4
+ (block $block3
+ (br_if $block3
(i32.le_s
(local.get $1)
(i32.const 0)
)
)
- (loop $label$5
+ (loop $label
(i64.store
(i32.add
(i32.add
@@ -3236,7 +3236,7 @@
(local.set $0
(local.get $6)
)
- (br_if $label$5
+ (br_if $label
(i32.ne
(local.get $6)
(local.get $1)
@@ -3244,9 +3244,9 @@
)
)
)
- (block $label$6
- (block $label$7
- (br_if $label$7
+ (block $block5
+ (block $block4
+ (br_if $block4
(i32.eqz
(local.get $3)
)
@@ -3259,7 +3259,7 @@
(local.get $4)
)
)
- (br $label$6)
+ (br $block5)
)
(call $40
(local.get $5)
@@ -3288,8 +3288,8 @@
)
(func $46 (result i32)
(local $0 i32)
- (block $label$1
- (br_if $label$1
+ (block $block
+ (br_if $block
(local.tee $0
(call $60
(i32.const 192)
@@ -3325,8 +3325,8 @@
)
)
)
- (block $label$1
- (br_if $label$1
+ (block $block
+ (br_if $block
(i32.eqz
(local.tee $7
(call $46)
@@ -3349,8 +3349,8 @@
(local.get $6)
(local.get $5)
)
- (block $label$2
- (br_if $label$2
+ (block $block1
+ (br_if $block1
(i32.eqz
(local.tee $4
(i32.and
@@ -3372,13 +3372,13 @@
(local.set $3
(i32.const 0)
)
- (loop $label$3
- (block $label$4
- (block $label$5
- (block $label$6
- (block $label$7
- (block $label$8
- (br_table $label$8 $label$7 $label$6 $label$5 $label$8
+ (loop $label
+ (block $block6
+ (block $block5
+ (block $block4
+ (block $block3
+ (block $block2
+ (br_table $block2 $block3 $block4 $block5 $block2
(i32.and
(local.get $2)
(i32.const 3)
@@ -3411,7 +3411,7 @@
(local.get $5)
)
)
- (br $label$4)
+ (br $block6)
)
(i32.store offset=12
(local.get $6)
@@ -3445,7 +3445,7 @@
(local.get $5)
)
)
- (br $label$4)
+ (br $block6)
)
(i32.store offset=12
(local.get $6)
@@ -3481,7 +3481,7 @@
)
)
)
- (br $label$4)
+ (br $block6)
)
(i32.store offset=12
(local.get $6)
@@ -3522,7 +3522,7 @@
(i32.const 2)
)
)
- (br_if $label$3
+ (br_if $label
(i32.ne
(local.tee $3
(i32.add
@@ -3539,9 +3539,9 @@
(local.get $7)
(i32.const 1)
)
- (block $label$9
- (block $label$10
- (br_if $label$10
+ (block $block8
+ (block $block7
+ (br_if $block7
(i32.eqz
(local.get $0)
)
@@ -3575,7 +3575,7 @@
(local.get $6)
)
)
- (br $label$9)
+ (br $block8)
)
(local.set $2
(call $38
@@ -3607,8 +3607,8 @@
(local.set $2
(i32.const 28)
)
- (block $label$1
- (br_if $label$1
+ (block $block
+ (br_if $block
(i32.gt_u
(local.get $0)
(i32.const 2)
@@ -3617,8 +3617,8 @@
(local.set $2
(call $7)
)
- (block $label$2
- (br_if $label$2
+ (block $block1
+ (br_if $block1
(i32.eqz
(local.get $1)
)
@@ -3653,22 +3653,22 @@
)
)
)
- (block $label$1
- (block $label$2
- (block $label$3
- (block $label$4
- (br_if $label$4
+ (block $block2
+ (block $block4
+ (block $block1
+ (block $block
+ (br_if $block
(local.get $3)
)
(local.set $6
(f64.const inf)
)
- (br $label$3)
+ (br $block1)
)
(local.set $7
(i32.const 28)
)
- (br_if $label$1
+ (br_if $block2
(i32.gt_u
(i32.load offset=4
(local.get $3)
@@ -3676,7 +3676,7 @@
(i32.const 999999999)
)
)
- (br_if $label$1
+ (br_if $block2
(call $fimport$3
(local.get $2)
(i32.add
@@ -3711,8 +3711,8 @@
)
)
)
- (block $label$5
- (br_if $label$5
+ (block $block3
+ (br_if $block3
(i32.gt_s
(local.get $3)
(i32.const -1)
@@ -3737,7 +3737,7 @@
)
)
)
- (br_if $label$2
+ (br_if $block4
(i32.lt_s
(local.get $7)
(i32.const 0)
@@ -3760,15 +3760,15 @@
)
)
)
- (block $label$6
- (block $label$7
- (block $label$8
- (br_if $label$8
+ (block $block9
+ (block $block6
+ (block $block5
+ (br_if $block5
(local.tee $3
(call $10)
)
)
- (br_if $label$8
+ (br_if $block5
(i32.ne
(i32.load offset=56
(call $14)
@@ -3776,7 +3776,7 @@
(i32.const 1)
)
)
- (br_if $label$7
+ (br_if $block6
(i32.ne
(i32.load offset=60
(call $14)
@@ -3791,9 +3791,9 @@
(call $fimport$4)
)
)
- (loop $label$9
- (block $label$10
- (br_if $label$10
+ (loop $label
+ (block $block7
+ (br_if $block7
(i32.eqz
(call $30
(call $14)
@@ -3803,17 +3803,17 @@
(local.set $7
(i32.const 11)
)
- (br $label$1)
+ (br $block2)
)
- (block $label$11
- (br_if $label$11
+ (block $block8
+ (br_if $block8
(i32.eqz
(local.get $3)
)
)
(call $44)
)
- (br_if $label$2
+ (br_if $block4
(f64.le
(local.tee $6
(f64.sub
@@ -3824,7 +3824,7 @@
(f64.const 0)
)
)
- (br_if $label$9
+ (br_if $label
(i32.eq
(local.tee $7
(i32.sub
@@ -3855,7 +3855,7 @@
(i32.const 73)
)
)
- (br $label$6)
+ (br $block9)
)
)
(local.set $7
@@ -3869,19 +3869,19 @@
)
)
)
- (br_if $label$1
+ (br_if $block2
(i32.eq
(local.get $7)
(i32.const 11)
)
)
- (br_if $label$1
+ (br_if $block2
(i32.eq
(local.get $7)
(i32.const 27)
)
)
- (br_if $label$1
+ (br_if $block2
(i32.eq
(local.get $7)
(i32.const 73)
@@ -3890,7 +3890,7 @@
(local.set $7
(i32.const 0)
)
- (br $label$1)
+ (br $block2)
)
(local.set $7
(i32.const 73)
@@ -3962,9 +3962,9 @@
(local $4 i32)
(local $5 i32)
(local $6 i32)
- (block $label$1
- (block $label$2
- (br_if $label$2
+ (block $block1
+ (block $block
+ (br_if $block
(i32.and
(local.tee $2
(i32.load
@@ -3977,7 +3977,7 @@
(local.set $3
(i32.const 0)
)
- (br_if $label$1
+ (br_if $block1
(i32.eqz
(call $52
(i32.add
@@ -3995,7 +3995,7 @@
)
)
)
- (br_if $label$1
+ (br_if $block1
(i32.ne
(local.tee $3
(call $13
@@ -4029,14 +4029,14 @@
(local.set $3
(i32.const 100)
)
- (block $label$3
- (loop $label$4
- (br_if $label$3
+ (block $block2
+ (loop $label
+ (br_if $block2
(i32.eqz
(local.get $3)
)
)
- (br_if $label$3
+ (br_if $block2
(i32.eqz
(i32.load
(local.get $2)
@@ -4049,7 +4049,7 @@
(i32.const -1)
)
)
- (br_if $label$4
+ (br_if $label
(i32.eqz
(i32.load
(local.get $5)
@@ -4058,7 +4058,7 @@
)
)
)
- (br_if $label$1
+ (br_if $block1
(i32.ne
(local.tee $3
(call $13
@@ -4068,9 +4068,9 @@
(i32.const 10)
)
)
- (loop $label$5
- (block $label$6
- (br_if $label$6
+ (loop $label1
+ (block $block3
+ (br_if $block3
(i32.eqz
(local.tee $3
(i32.load
@@ -4084,8 +4084,8 @@
(local.get $0)
)
)
- (block $label$7
- (br_if $label$7
+ (block $block4
+ (br_if $block4
(i32.eqz
(i32.and
(local.get $3)
@@ -4093,15 +4093,15 @@
)
)
)
- (br_if $label$6
+ (br_if $block3
(i32.and
(local.get $6)
(i32.const 4)
)
)
)
- (block $label$8
- (br_if $label$8
+ (block $block5
+ (br_if $block5
(i32.ne
(i32.and
(local.get $6)
@@ -4110,7 +4110,7 @@
(i32.const 2)
)
)
- (br_if $label$8
+ (br_if $block5
(i32.ne
(i32.and
(local.get $3)
@@ -4152,19 +4152,19 @@
(call $54
(local.get $5)
)
- (br_if $label$6
+ (br_if $block3
(i32.eqz
(local.get $3)
)
)
- (br_if $label$1
+ (br_if $block1
(i32.ne
(local.get $3)
(i32.const 27)
)
)
)
- (br_if $label$5
+ (br_if $label1
(i32.eq
(local.tee $3
(call $13
@@ -4202,8 +4202,8 @@
)
)
(func $55 (param $0 i32) (result i32)
- (block $label$1
- (br_if $label$1
+ (block $block
+ (br_if $block
(i32.and
(i32.load8_u
(local.get $0)
@@ -4211,7 +4211,7 @@
(i32.const 15)
)
)
- (br_if $label$1
+ (br_if $block
(call $56
(i32.add
(local.get $0)
@@ -4316,8 +4316,8 @@
(local.get $5)
)
)
- (block $label$1
- (br_if $label$1
+ (block $block
+ (br_if $block
(i32.eqz
(local.get $1)
)
@@ -4346,17 +4346,17 @@
(local $9 i32)
(local $10 i32)
(local $11 i32)
- (block $label$1
- (br_if $label$1
+ (block $block
+ (br_if $block
(i32.load offset=1844
(i32.const 0)
)
)
(call $61)
)
- (block $label$2
- (block $label$3
- (br_if $label$3
+ (block $block2
+ (block $block1
+ (br_if $block1
(i32.eqz
(i32.and
(i32.load8_u offset=2312
@@ -4369,32 +4369,32 @@
(local.set $1
(i32.const 0)
)
- (br_if $label$2
+ (br_if $block2
(call $55
(i32.const 2316)
)
)
)
- (block $label$4
- (block $label$5
- (block $label$6
- (block $label$7
- (block $label$8
- (block $label$9
- (block $label$10
- (block $label$11
- (block $label$12
- (block $label$13
- (block $label$14
- (block $label$15
- (br_if $label$15
+ (block $block7
+ (block $block19
+ (block $block31
+ (block $block40
+ (block $block50
+ (block $block44
+ (block $block51
+ (block $block33
+ (block $block21
+ (block $block17
+ (block $block8
+ (block $block3
+ (br_if $block3
(i32.gt_u
(local.get $0)
(i32.const 244)
)
)
- (block $label$16
- (br_if $label$16
+ (block $block4
+ (br_if $block4
(i32.eqz
(i32.and
(local.tee $0
@@ -4460,9 +4460,9 @@
(i32.const 8)
)
)
- (block $label$17
- (block $label$18
- (br_if $label$18
+ (block $block6
+ (block $block5
+ (br_if $block5
(i32.ne
(local.tee $3
(i32.load offset=8
@@ -4487,7 +4487,7 @@
)
)
)
- (br $label$17)
+ (br $block6)
)
(i32.store offset=12
(local.get $3)
@@ -4524,9 +4524,9 @@
(i32.const 1)
)
)
- (br $label$4)
+ (br $block7)
)
- (br_if $label$14
+ (br_if $block8
(i32.le_u
(local.get $3)
(local.tee $6
@@ -4536,15 +4536,15 @@
)
)
)
- (block $label$19
- (br_if $label$19
+ (block $block9
+ (br_if $block9
(i32.eqz
(local.get $0)
)
)
- (block $label$20
- (block $label$21
- (br_if $label$21
+ (block $block11
+ (block $block10
+ (br_if $block10
(i32.ne
(local.tee $1
(i32.load offset=8
@@ -4693,7 +4693,7 @@
)
)
)
- (br $label$20)
+ (br $block11)
)
(i32.store offset=12
(local.get $1)
@@ -4746,8 +4746,8 @@
)
(local.get $4)
)
- (block $label$22
- (br_if $label$22
+ (block $block12
+ (br_if $block12
(i32.eqz
(local.get $6)
)
@@ -4771,9 +4771,9 @@
(i32.const 0)
)
)
- (block $label$23
- (block $label$24
- (br_if $label$24
+ (block $block14
+ (block $block13
+ (br_if $block13
(i32.and
(local.get $2)
(local.tee $7
@@ -4794,7 +4794,7 @@
(local.set $7
(local.get $3)
)
- (br $label$23)
+ (br $block14)
)
(local.set $7
(i32.load offset=8
@@ -4827,9 +4827,9 @@
(i32.const 0)
(local.get $4)
)
- (br $label$4)
+ (br $block7)
)
- (br_if $label$14
+ (br_if $block8
(i32.eqz
(local.tee $8
(i32.load offset=1872
@@ -4951,17 +4951,17 @@
(local.set $4
(local.get $5)
)
- (block $label$25
- (loop $label$26
- (block $label$27
- (br_if $label$27
+ (block $block16
+ (loop $label
+ (block $block15
+ (br_if $block15
(local.tee $0
(i32.load offset=16
(local.get $4)
)
)
)
- (br_if $label$25
+ (br_if $block16
(i32.eqz
(local.tee $0
(i32.load
@@ -5006,10 +5006,10 @@
(local.set $4
(local.get $0)
)
- (br $label$26)
+ (br $label)
)
)
- (br_if $label$13
+ (br_if $block17
(i32.le_u
(local.tee $9
(i32.add
@@ -5025,8 +5025,8 @@
(local.get $5)
)
)
- (block $label$28
- (br_if $label$28
+ (block $block18
+ (br_if $block18
(i32.eq
(local.tee $7
(i32.load offset=12
@@ -5056,10 +5056,10 @@
(local.get $7)
(local.get $0)
)
- (br $label$5)
+ (br $block19)
)
- (block $label$29
- (br_if $label$29
+ (block $block20
+ (br_if $block20
(local.tee $0
(i32.load
(local.tee $4
@@ -5071,7 +5071,7 @@
)
)
)
- (br_if $label$12
+ (br_if $block21
(i32.eqz
(local.tee $0
(i32.load offset=16
@@ -5087,11 +5087,11 @@
)
)
)
- (loop $label$30
+ (loop $label1
(local.set $11
(local.get $4)
)
- (br_if $label$30
+ (br_if $label1
(local.tee $0
(i32.load
(local.tee $4
@@ -5111,7 +5111,7 @@
(i32.const 16)
)
)
- (br_if $label$30
+ (br_if $label1
(local.tee $0
(i32.load offset=16
(local.get $7)
@@ -5123,12 +5123,12 @@
(local.get $11)
(i32.const 0)
)
- (br $label$5)
+ (br $block19)
)
(local.set $3
(i32.const -1)
)
- (br_if $label$14
+ (br_if $block8
(i32.gt_u
(local.get $0)
(i32.const -65)
@@ -5145,7 +5145,7 @@
(i32.const -8)
)
)
- (br_if $label$14
+ (br_if $block8
(i32.eqz
(local.tee $6
(i32.load offset=1872
@@ -5157,8 +5157,8 @@
(local.set $11
(i32.const 31)
)
- (block $label$31
- (br_if $label$31
+ (block $block22
+ (br_if $block22
(i32.gt_u
(local.get $3)
(i32.const 16777215)
@@ -5257,11 +5257,11 @@
(local.get $3)
)
)
- (block $label$32
- (block $label$33
- (block $label$34
- (block $label$35
- (br_if $label$35
+ (block $block28
+ (block $block26
+ (block $block24
+ (block $block23
+ (br_if $block23
(local.tee $4
(i32.load
(i32.add
@@ -5280,7 +5280,7 @@
(local.set $7
(i32.const 0)
)
- (br $label$34)
+ (br $block24)
)
(local.set $0
(i32.const 0)
@@ -5307,9 +5307,9 @@
(local.set $7
(i32.const 0)
)
- (loop $label$36
- (block $label$37
- (br_if $label$37
+ (loop $label2
+ (block $block25
+ (br_if $block25
(i32.ge_u
(local.tee $2
(i32.sub
@@ -5331,7 +5331,7 @@
(local.set $7
(local.get $4)
)
- (br_if $label$37
+ (br_if $block25
(local.get $2)
)
(local.set $1
@@ -5343,7 +5343,7 @@
(local.set $0
(local.get $4)
)
- (br $label$33)
+ (br $block26)
)
(local.set $0
(select
@@ -5388,19 +5388,19 @@
(i32.const 1)
)
)
- (br_if $label$36
+ (br_if $label2
(local.get $4)
)
)
)
- (block $label$38
- (br_if $label$38
+ (block $block27
+ (br_if $block27
(i32.or
(local.get $0)
(local.get $7)
)
)
- (br_if $label$14
+ (br_if $block8
(i32.eqz
(local.tee $0
(i32.and
@@ -5522,13 +5522,13 @@
)
)
)
- (br_if $label$32
+ (br_if $block28
(i32.eqz
(local.get $0)
)
)
)
- (loop $label$39
+ (loop $label3
(local.set $5
(i32.lt_u
(local.tee $2
@@ -5545,8 +5545,8 @@
(local.get $1)
)
)
- (block $label$40
- (br_if $label$40
+ (block $block29
+ (br_if $block29
(local.tee $4
(i32.load offset=16
(local.get $0)
@@ -5579,17 +5579,17 @@
(local.set $0
(local.get $4)
)
- (br_if $label$39
+ (br_if $label3
(local.get $4)
)
)
)
- (br_if $label$14
+ (br_if $block8
(i32.eqz
(local.get $7)
)
)
- (br_if $label$14
+ (br_if $block8
(i32.ge_u
(local.get $1)
(i32.sub
@@ -5600,7 +5600,7 @@
)
)
)
- (br_if $label$13
+ (br_if $block17
(i32.le_u
(local.tee $11
(i32.add
@@ -5616,8 +5616,8 @@
(local.get $7)
)
)
- (block $label$41
- (br_if $label$41
+ (block $block30
+ (br_if $block30
(i32.eq
(local.tee $5
(i32.load offset=12
@@ -5647,10 +5647,10 @@
(local.get $5)
(local.get $0)
)
- (br $label$6)
+ (br $block31)
)
- (block $label$42
- (br_if $label$42
+ (block $block32
+ (br_if $block32
(local.tee $0
(i32.load
(local.tee $4
@@ -5662,7 +5662,7 @@
)
)
)
- (br_if $label$11
+ (br_if $block33
(i32.eqz
(local.tee $0
(i32.load offset=16
@@ -5678,11 +5678,11 @@
)
)
)
- (loop $label$43
+ (loop $label4
(local.set $2
(local.get $4)
)
- (br_if $label$43
+ (br_if $label4
(local.tee $0
(i32.load
(local.tee $4
@@ -5702,7 +5702,7 @@
(i32.const 16)
)
)
- (br_if $label$43
+ (br_if $label4
(local.tee $0
(i32.load offset=16
(local.get $5)
@@ -5714,10 +5714,10 @@
(local.get $2)
(i32.const 0)
)
- (br $label$6)
+ (br $block31)
)
- (block $label$44
- (br_if $label$44
+ (block $block34
+ (br_if $block34
(i32.lt_u
(local.tee $0
(i32.load offset=1876
@@ -5732,9 +5732,9 @@
(i32.const 0)
)
)
- (block $label$45
- (block $label$46
- (br_if $label$46
+ (block $block36
+ (block $block35
+ (br_if $block35
(i32.lt_u
(local.tee $4
(i32.sub
@@ -5779,7 +5779,7 @@
(i32.const 3)
)
)
- (br $label$45)
+ (br $block36)
)
(i32.store offset=1888
(i32.const 0)
@@ -5817,10 +5817,10 @@
(i32.const 8)
)
)
- (br $label$4)
+ (br $block7)
)
- (block $label$47
- (br_if $label$47
+ (block $block37
+ (br_if $block37
(i32.le_u
(local.tee $0
(i32.load offset=1880
@@ -5872,20 +5872,20 @@
(i32.const 8)
)
)
- (br $label$4)
+ (br $block7)
)
(local.set $1
(i32.const 0)
)
- (block $label$48
- (br_if $label$48
+ (block $block38
+ (br_if $block38
(i32.load offset=1844
(i32.const 0)
)
)
(call $61)
)
- (br_if $label$4
+ (br_if $block7
(i32.le_u
(local.tee $7
(i32.and
@@ -5914,8 +5914,8 @@
(local.set $1
(i32.const 0)
)
- (block $label$49
- (br_if $label$49
+ (block $block39
+ (br_if $block39
(i32.eqz
(local.tee $0
(i32.load offset=2308
@@ -5924,7 +5924,7 @@
)
)
)
- (br_if $label$4
+ (br_if $block7
(i32.le_u
(local.tee $5
(i32.add
@@ -5939,7 +5939,7 @@
(local.get $4)
)
)
- (br_if $label$4
+ (br_if $block7
(i32.gt_u
(local.get $5)
(local.get $0)
@@ -5952,7 +5952,7 @@
(local.set $5
(i32.const -1)
)
- (br_if $label$7
+ (br_if $block40
(i32.and
(i32.load8_u offset=2312
(i32.const 0)
@@ -5963,10 +5963,10 @@
(local.set $6
(i32.const 0)
)
- (block $label$50
- (block $label$51
- (block $label$52
- (br_if $label$52
+ (block $block49
+ (block $block43
+ (block $block41
+ (br_if $block41
(i32.eqz
(local.tee $1
(i32.load offset=1892
@@ -5978,9 +5978,9 @@
(local.set $0
(i32.const 2344)
)
- (loop $label$53
- (block $label$54
- (br_if $label$54
+ (loop $label5
+ (block $block42
+ (br_if $block42
(i32.gt_u
(local.tee $4
(i32.load
@@ -5990,7 +5990,7 @@
(local.get $1)
)
)
- (br_if $label$51
+ (br_if $block43
(i32.gt_u
(i32.add
(local.get $4)
@@ -6002,7 +6002,7 @@
)
)
)
- (br_if $label$53
+ (br_if $label5
(local.tee $0
(i32.load offset=8
(local.get $0)
@@ -6016,7 +6016,7 @@
(i32.const 2368)
)
)
- (br_if $label$9
+ (br_if $block44
(i32.eq
(local.tee $5
(call $66
@@ -6029,8 +6029,8 @@
(local.set $2
(local.get $7)
)
- (block $label$55
- (br_if $label$55
+ (block $block45
+ (br_if $block45
(i32.eqz
(i32.and
(local.tee $1
@@ -6066,8 +6066,8 @@
)
)
)
- (block $label$56
- (br_if $label$56
+ (block $block46
+ (br_if $block46
(i32.gt_u
(local.get $2)
(local.get $3)
@@ -6076,10 +6076,10 @@
(local.set $6
(i32.const 0)
)
- (br $label$9)
+ (br $block44)
)
- (block $label$57
- (br_if $label$57
+ (block $block47
+ (br_if $block47
(i32.le_u
(local.get $2)
(i32.const 2147483646)
@@ -6088,13 +6088,13 @@
(local.set $6
(i32.const 0)
)
- (br $label$9)
+ (br $block44)
)
(local.set $6
(i32.const 0)
)
- (block $label$58
- (br_if $label$58
+ (block $block48
+ (br_if $block48
(i32.eqz
(local.tee $0
(i32.load offset=2308
@@ -6103,7 +6103,7 @@
)
)
)
- (br_if $label$9
+ (br_if $block44
(i32.le_u
(local.tee $4
(i32.add
@@ -6118,14 +6118,14 @@
(local.get $1)
)
)
- (br_if $label$9
+ (br_if $block44
(i32.gt_u
(local.get $4)
(local.get $0)
)
)
)
- (br_if $label$50
+ (br_if $block49
(i32.ne
(local.tee $0
(call $66
@@ -6135,7 +6135,7 @@
(local.get $5)
)
)
- (br $label$8)
+ (br $block50)
)
(drop
(call $55
@@ -6145,7 +6145,7 @@
(local.set $6
(i32.const 0)
)
- (br_if $label$9
+ (br_if $block44
(i32.gt_u
(local.tee $2
(i32.and
@@ -6171,7 +6171,7 @@
(i32.const 2147483646)
)
)
- (br_if $label$10
+ (br_if $block51
(i32.eq
(local.tee $5
(call $66
@@ -6195,8 +6195,8 @@
(local.set $6
(i32.const 0)
)
- (block $label$59
- (br_if $label$59
+ (block $block52
+ (br_if $block52
(i32.le_u
(i32.add
(local.get $3)
@@ -6205,14 +6205,14 @@
(local.get $2)
)
)
- (br_if $label$59
+ (br_if $block52
(i32.eq
(local.get $0)
(i32.const -1)
)
)
- (block $label$60
- (br_if $label$60
+ (block $block53
+ (br_if $block53
(i32.le_u
(local.tee $1
(i32.and
@@ -6239,10 +6239,10 @@
(local.set $5
(local.get $0)
)
- (br $label$8)
+ (br $block50)
)
- (block $label$61
- (br_if $label$61
+ (block $block54
+ (br_if $block54
(i32.eq
(call $66
(local.get $1)
@@ -6259,7 +6259,7 @@
(local.set $5
(local.get $0)
)
- (br $label$8)
+ (br $block50)
)
(drop
(call $66
@@ -6272,35 +6272,36 @@
(local.set $6
(i32.const 0)
)
- (br $label$9)
+ (br $block44)
)
(local.set $5
(local.get $0)
)
- (br_if $label$8
+ (br_if $block50
(i32.ne
(local.get $0)
(i32.const -1)
)
)
- (br $label$9)
+ (br $block44)
)
(unreachable)
+ (unreachable)
)
(local.set $7
(i32.const 0)
)
- (br $label$5)
+ (br $block19)
)
(local.set $5
(i32.const 0)
)
- (br $label$6)
+ (br $block31)
)
(local.set $6
(local.get $2)
)
- (br_if $label$8
+ (br_if $block50
(i32.ne
(local.get $5)
(i32.const -1)
@@ -6329,16 +6330,16 @@
)
)
)
- (block $label$62
- (block $label$63
- (block $label$64
- (br_if $label$64
+ (block $block56
+ (block $block57
+ (block $block55
+ (br_if $block55
(i32.gt_u
(local.get $7)
(i32.const 2147483646)
)
)
- (br_if $label$64
+ (br_if $block55
(i32.ne
(local.get $5)
(i32.const -1)
@@ -6364,25 +6365,25 @@
(i32.const 2368)
)
)
- (br_if $label$62
+ (br_if $block56
(i32.ge_u
(local.get $5)
(local.get $0)
)
)
- (br_if $label$62
+ (br_if $block56
(i32.eq
(local.get $5)
(i32.const -1)
)
)
- (br_if $label$62
+ (br_if $block56
(i32.eq
(local.get $0)
(i32.const -1)
)
)
- (br_if $label$63
+ (br_if $block57
(i32.gt_u
(local.tee $2
(i32.sub
@@ -6396,9 +6397,9 @@
)
)
)
- (br $label$62)
+ (br $block56)
)
- (br_if $label$62
+ (br_if $block56
(i32.eq
(local.get $5)
(i32.const -1)
@@ -6416,8 +6417,8 @@
)
)
)
- (block $label$65
- (br_if $label$65
+ (block $block58
+ (br_if $block58
(i32.le_u
(local.get $0)
(i32.load offset=2304
@@ -6430,11 +6431,11 @@
(local.get $0)
)
)
- (block $label$66
- (block $label$67
- (block $label$68
- (block $label$69
- (br_if $label$69
+ (block $block64
+ (block $block61
+ (block $block60
+ (block $block59
+ (br_if $block59
(i32.eqz
(local.tee $1
(i32.load offset=1892
@@ -6446,8 +6447,8 @@
(local.set $0
(i32.const 2344)
)
- (loop $label$70
- (br_if $label$68
+ (loop $label6
+ (br_if $block60
(i32.eq
(local.get $5)
(i32.add
@@ -6464,19 +6465,19 @@
)
)
)
- (br_if $label$70
+ (br_if $label6
(local.tee $0
(i32.load offset=8
(local.get $0)
)
)
)
- (br $label$67)
+ (br $block61)
)
)
- (block $label$71
- (block $label$72
- (br_if $label$72
+ (block $block63
+ (block $block62
+ (br_if $block62
(i32.eqz
(local.tee $0
(i32.load offset=1884
@@ -6485,7 +6486,7 @@
)
)
)
- (br_if $label$71
+ (br_if $block63
(i32.ge_u
(local.get $5)
(local.get $0)
@@ -6522,7 +6523,7 @@
(i32.const 0)
(i32.const 0)
)
- (loop $label$73
+ (loop $label7
(i32.store
(i32.add
(local.tee $1
@@ -6547,7 +6548,7 @@
)
(local.get $4)
)
- (br_if $label$73
+ (br_if $label7
(i32.ne
(local.tee $0
(i32.add
@@ -6620,21 +6621,21 @@
(i32.const 0)
)
)
- (br $label$66)
+ (br $block64)
)
- (br_if $label$67
+ (br_if $block61
(i32.le_u
(local.get $5)
(local.get $1)
)
)
- (br_if $label$67
+ (br_if $block61
(i32.gt_u
(local.get $4)
(local.get $1)
)
)
- (br_if $label$67
+ (br_if $block61
(i32.and
(i32.load offset=12
(local.get $0)
@@ -6712,10 +6713,10 @@
(i32.const 0)
)
)
- (br $label$66)
+ (br $block64)
)
- (block $label$74
- (br_if $label$74
+ (block $block65
+ (br_if $block65
(i32.ge_u
(local.get $5)
(local.tee $7
@@ -6742,15 +6743,15 @@
(local.set $0
(i32.const 2344)
)
- (block $label$75
- (block $label$76
- (block $label$77
- (block $label$78
- (block $label$79
- (block $label$80
- (block $label$81
- (loop $label$82
- (br_if $label$81
+ (block $block97
+ (block $block72
+ (block $block90
+ (block $block70
+ (block $block68
+ (block $block67
+ (block $block66
+ (loop $label8
+ (br_if $block66
(i32.eq
(i32.load
(local.get $0)
@@ -6758,17 +6759,17 @@
(local.get $4)
)
)
- (br_if $label$82
+ (br_if $label8
(local.tee $0
(i32.load offset=8
(local.get $0)
)
)
)
- (br $label$80)
+ (br $block67)
)
)
- (br_if $label$79
+ (br_if $block68
(i32.eqz
(i32.and
(i32.load8_u offset=12
@@ -6782,9 +6783,9 @@
(local.set $0
(i32.const 2344)
)
- (loop $label$83
- (block $label$84
- (br_if $label$84
+ (loop $label9
+ (block $block69
+ (br_if $block69
(i32.gt_u
(local.tee $4
(i32.load
@@ -6794,7 +6795,7 @@
(local.get $1)
)
)
- (br_if $label$78
+ (br_if $block70
(i32.gt_u
(local.tee $4
(i32.add
@@ -6813,7 +6814,7 @@
(local.get $0)
)
)
- (br $label$83)
+ (br $label9)
)
)
(i32.store
@@ -6893,8 +6894,8 @@
(local.get $3)
)
)
- (block $label$85
- (br_if $label$85
+ (block $block71
+ (br_if $block71
(i32.ne
(local.get $1)
(local.get $2)
@@ -6922,10 +6923,10 @@
(i32.const 1)
)
)
- (br $label$76)
+ (br $block72)
)
- (block $label$86
- (br_if $label$86
+ (block $block73
+ (br_if $block73
(i32.ne
(i32.load offset=1888
(i32.const 0)
@@ -6962,10 +6963,10 @@
)
(local.get $0)
)
- (br $label$76)
+ (br $block72)
)
- (block $label$87
- (br_if $label$87
+ (block $block74
+ (br_if $block74
(i32.ne
(i32.and
(local.tee $0
@@ -6984,9 +6985,9 @@
(i32.const -8)
)
)
- (block $label$88
- (block $label$89
- (br_if $label$89
+ (block $block77
+ (block $block75
+ (br_if $block75
(i32.gt_u
(local.get $0)
(i32.const 255)
@@ -7015,8 +7016,8 @@
)
)
)
- (block $label$90
- (br_if $label$90
+ (block $block76
+ (br_if $block76
(i32.ne
(local.tee $0
(i32.load offset=12
@@ -7038,7 +7039,7 @@
)
)
)
- (br $label$88)
+ (br $block77)
)
(drop
(i32.eq
@@ -7054,16 +7055,16 @@
(local.get $0)
(local.get $1)
)
- (br $label$88)
+ (br $block77)
)
(local.set $8
(i32.load offset=24
(local.get $2)
)
)
- (block $label$91
- (block $label$92
- (br_if $label$92
+ (block $block79
+ (block $block78
+ (br_if $block78
(i32.eq
(local.tee $5
(i32.load offset=12
@@ -7091,10 +7092,10 @@
(local.get $5)
(local.get $0)
)
- (br $label$91)
+ (br $block79)
)
- (block $label$93
- (br_if $label$93
+ (block $block80
+ (br_if $block80
(local.tee $1
(i32.load
(local.tee $0
@@ -7106,7 +7107,7 @@
)
)
)
- (br_if $label$93
+ (br_if $block80
(local.tee $1
(i32.load
(local.tee $0
@@ -7121,13 +7122,13 @@
(local.set $5
(i32.const 0)
)
- (br $label$91)
+ (br $block79)
)
- (loop $label$94
+ (loop $label10
(local.set $7
(local.get $0)
)
- (br_if $label$94
+ (br_if $label10
(local.tee $1
(i32.load
(local.tee $0
@@ -7147,7 +7148,7 @@
(i32.const 16)
)
)
- (br_if $label$94
+ (br_if $label10
(local.tee $1
(i32.load offset=16
(local.get $5)
@@ -7160,14 +7161,14 @@
(i32.const 0)
)
)
- (br_if $label$88
+ (br_if $block77
(i32.eqz
(local.get $8)
)
)
- (block $label$95
- (block $label$96
- (br_if $label$96
+ (block $block82
+ (block $block81
+ (br_if $block81
(i32.ne
(i32.load
(local.tee $0
@@ -7191,7 +7192,7 @@
(local.get $0)
(local.get $5)
)
- (br_if $label$95
+ (br_if $block82
(local.get $5)
)
(i32.store offset=1872
@@ -7206,7 +7207,7 @@
)
)
)
- (br $label$88)
+ (br $block77)
)
(i32.store
(i32.add
@@ -7224,7 +7225,7 @@
)
(local.get $5)
)
- (br_if $label$88
+ (br_if $block77
(i32.eqz
(local.get $5)
)
@@ -7234,8 +7235,8 @@
(local.get $5)
(local.get $8)
)
- (block $label$97
- (br_if $label$97
+ (block $block83
+ (br_if $block83
(i32.eqz
(local.tee $0
(i32.load offset=16
@@ -7253,7 +7254,7 @@
(local.get $5)
)
)
- (br_if $label$88
+ (br_if $block77
(i32.eqz
(local.tee $0
(i32.load offset=20
@@ -7310,8 +7311,8 @@
)
(local.get $4)
)
- (block $label$98
- (br_if $label$98
+ (block $block84
+ (br_if $block84
(i32.gt_u
(local.get $4)
(i32.const 255)
@@ -7331,9 +7332,9 @@
(i32.const 1908)
)
)
- (block $label$99
- (block $label$100
- (br_if $label$100
+ (block $block86
+ (block $block85
+ (br_if $block85
(i32.and
(local.tee $4
(i32.load offset=1868
@@ -7358,7 +7359,7 @@
(local.set $1
(local.get $0)
)
- (br $label$99)
+ (br $block86)
)
(local.set $1
(i32.load offset=8
@@ -7382,13 +7383,13 @@
(local.get $3)
(local.get $1)
)
- (br $label$76)
+ (br $block72)
)
(local.set $0
(i32.const 31)
)
- (block $label$101
- (br_if $label$101
+ (block $block87
+ (br_if $block87
(i32.gt_u
(local.get $4)
(i32.const 16777215)
@@ -7498,9 +7499,9 @@
(i32.const 2172)
)
)
- (block $label$102
- (block $label$103
- (br_if $label$103
+ (block $block89
+ (block $block88
+ (br_if $block88
(i32.and
(local.tee $5
(i32.load offset=1872
@@ -7530,7 +7531,7 @@
(local.get $3)
(local.get $1)
)
- (br $label$102)
+ (br $block89)
)
(local.set $0
(i32.shl
@@ -7556,8 +7557,8 @@
(local.get $1)
)
)
- (loop $label$104
- (br_if $label$77
+ (loop $label11
+ (br_if $block90
(i32.eq
(i32.and
(i32.load offset=4
@@ -7582,7 +7583,7 @@
(i32.const 1)
)
)
- (br_if $label$104
+ (br_if $label11
(local.tee $5
(i32.load
(local.tee $7
@@ -7618,7 +7619,7 @@
(local.get $3)
(local.get $3)
)
- (br $label$76)
+ (br $block72)
)
(i32.store offset=1880
(i32.const 0)
@@ -7761,7 +7762,7 @@
(i32.const 24)
)
)
- (loop $label$105
+ (loop $label12
(i32.store offset=4
(local.get $0)
(i32.const 7)
@@ -7778,14 +7779,14 @@
(i32.const 4)
)
)
- (br_if $label$105
+ (br_if $label12
(i32.gt_u
(local.get $4)
(local.get $5)
)
)
)
- (br_if $label$66
+ (br_if $block64
(i32.eq
(local.get $7)
(local.get $1)
@@ -7816,8 +7817,8 @@
(local.get $7)
(local.get $2)
)
- (block $label$106
- (br_if $label$106
+ (block $block91
+ (br_if $block91
(i32.gt_u
(local.get $2)
(i32.const 255)
@@ -7837,9 +7838,9 @@
(i32.const 1908)
)
)
- (block $label$107
- (block $label$108
- (br_if $label$108
+ (block $block93
+ (block $block92
+ (br_if $block92
(i32.and
(local.tee $5
(i32.load offset=1868
@@ -7864,7 +7865,7 @@
(local.set $4
(local.get $0)
)
- (br $label$107)
+ (br $block93)
)
(local.set $4
(i32.load offset=8
@@ -7888,13 +7889,13 @@
(local.get $1)
(local.get $4)
)
- (br $label$66)
+ (br $block64)
)
(local.set $0
(i32.const 31)
)
- (block $label$109
- (br_if $label$109
+ (block $block94
+ (br_if $block94
(i32.gt_u
(local.get $2)
(i32.const 16777215)
@@ -8007,9 +8008,9 @@
(i32.const 2172)
)
)
- (block $label$110
- (block $label$111
- (br_if $label$111
+ (block $block96
+ (block $block95
+ (br_if $block95
(i32.and
(local.tee $5
(i32.load offset=1872
@@ -8042,7 +8043,7 @@
)
(local.get $4)
)
- (br $label$110)
+ (br $block96)
)
(local.set $0
(i32.shl
@@ -8068,8 +8069,8 @@
(local.get $4)
)
)
- (loop $label$112
- (br_if $label$75
+ (loop $label13
+ (br_if $block97
(i32.eq
(i32.and
(i32.load offset=4
@@ -8094,7 +8095,7 @@
(i32.const 1)
)
)
- (br_if $label$112
+ (br_if $label13
(local.tee $5
(i32.load
(local.tee $7
@@ -8133,7 +8134,7 @@
(local.get $1)
(local.get $1)
)
- (br $label$66)
+ (br $block64)
)
(i32.store offset=12
(local.tee $0
@@ -8166,7 +8167,7 @@
(i32.const 8)
)
)
- (br $label$4)
+ (br $block7)
)
(i32.store offset=12
(local.tee $0
@@ -8196,7 +8197,7 @@
(local.get $0)
)
)
- (br_if $label$62
+ (br_if $block56
(i32.le_u
(local.tee $0
(i32.load offset=1880
@@ -8248,7 +8249,7 @@
(i32.const 8)
)
)
- (br $label$4)
+ (br $block7)
)
(i32.store
(call $25)
@@ -8257,17 +8258,17 @@
(local.set $1
(i32.const 0)
)
- (br $label$4)
+ (br $block7)
)
- (block $label$113
- (br_if $label$113
+ (block $block98
+ (br_if $block98
(i32.eqz
(local.get $8)
)
)
- (block $label$114
- (block $label$115
- (br_if $label$115
+ (block $block100
+ (block $block99
+ (br_if $block99
(i32.ne
(local.get $7)
(i32.load
@@ -8291,7 +8292,7 @@
(local.get $0)
(local.get $5)
)
- (br_if $label$114
+ (br_if $block100
(local.get $5)
)
(i32.store offset=1872
@@ -8306,7 +8307,7 @@
)
)
)
- (br $label$113)
+ (br $block98)
)
(i32.store
(i32.add
@@ -8324,7 +8325,7 @@
)
(local.get $5)
)
- (br_if $label$113
+ (br_if $block98
(i32.eqz
(local.get $5)
)
@@ -8334,8 +8335,8 @@
(local.get $5)
(local.get $8)
)
- (block $label$116
- (br_if $label$116
+ (block $block101
+ (br_if $block101
(i32.eqz
(local.tee $0
(i32.load offset=16
@@ -8353,7 +8354,7 @@
(local.get $5)
)
)
- (br_if $label$113
+ (br_if $block98
(i32.eqz
(local.tee $0
(i32.load
@@ -8377,9 +8378,9 @@
(local.get $5)
)
)
- (block $label$117
- (block $label$118
- (br_if $label$118
+ (block $block103
+ (block $block102
+ (br_if $block102
(i32.gt_u
(local.get $1)
(i32.const 15)
@@ -8411,7 +8412,7 @@
(i32.const 1)
)
)
- (br $label$117)
+ (br $block103)
)
(i32.store offset=4
(local.get $7)
@@ -8434,8 +8435,8 @@
)
(local.get $1)
)
- (block $label$119
- (br_if $label$119
+ (block $block104
+ (br_if $block104
(i32.gt_u
(local.get $1)
(i32.const 255)
@@ -8455,9 +8456,9 @@
(i32.const 1908)
)
)
- (block $label$120
- (block $label$121
- (br_if $label$121
+ (block $block106
+ (block $block105
+ (br_if $block105
(i32.and
(local.tee $4
(i32.load offset=1868
@@ -8482,7 +8483,7 @@
(local.set $1
(local.get $0)
)
- (br $label$120)
+ (br $block106)
)
(local.set $1
(i32.load offset=8
@@ -8506,13 +8507,13 @@
(local.get $11)
(local.get $1)
)
- (br $label$117)
+ (br $block103)
)
(local.set $0
(i32.const 31)
)
- (block $label$122
- (br_if $label$122
+ (block $block107
+ (br_if $block107
(i32.gt_u
(local.get $1)
(i32.const 16777215)
@@ -8622,10 +8623,10 @@
(i32.const 2172)
)
)
- (block $label$123
- (block $label$124
- (block $label$125
- (br_if $label$125
+ (block $block110
+ (block $block109
+ (block $block108
+ (br_if $block108
(i32.and
(local.get $6)
(local.tee $3
@@ -8651,7 +8652,7 @@
(local.get $11)
(local.get $4)
)
- (br $label$124)
+ (br $block109)
)
(local.set $0
(i32.shl
@@ -8677,8 +8678,8 @@
(local.get $4)
)
)
- (loop $label$126
- (br_if $label$123
+ (loop $label14
+ (br_if $block110
(i32.eq
(i32.and
(i32.load offset=4
@@ -8703,7 +8704,7 @@
(i32.const 1)
)
)
- (br_if $label$126
+ (br_if $label14
(local.tee $3
(i32.load
(local.tee $5
@@ -8739,7 +8740,7 @@
(local.get $11)
(local.get $11)
)
- (br $label$117)
+ (br $block103)
)
(i32.store offset=12
(local.tee $0
@@ -8772,17 +8773,17 @@
(i32.const 8)
)
)
- (br $label$4)
+ (br $block7)
)
- (block $label$127
- (br_if $label$127
+ (block $block111
+ (br_if $block111
(i32.eqz
(local.get $10)
)
)
- (block $label$128
- (block $label$129
- (br_if $label$129
+ (block $block113
+ (block $block112
+ (br_if $block112
(i32.ne
(local.get $5)
(i32.load
@@ -8806,7 +8807,7 @@
(local.get $0)
(local.get $7)
)
- (br_if $label$128
+ (br_if $block113
(local.get $7)
)
(i32.store offset=1872
@@ -8819,7 +8820,7 @@
)
)
)
- (br $label$127)
+ (br $block111)
)
(i32.store
(i32.add
@@ -8837,7 +8838,7 @@
)
(local.get $7)
)
- (br_if $label$127
+ (br_if $block111
(i32.eqz
(local.get $7)
)
@@ -8847,8 +8848,8 @@
(local.get $7)
(local.get $10)
)
- (block $label$130
- (br_if $label$130
+ (block $block114
+ (br_if $block114
(i32.eqz
(local.tee $0
(i32.load offset=16
@@ -8866,7 +8867,7 @@
(local.get $7)
)
)
- (br_if $label$127
+ (br_if $block111
(i32.eqz
(local.tee $0
(i32.load
@@ -8890,9 +8891,9 @@
(local.get $7)
)
)
- (block $label$131
- (block $label$132
- (br_if $label$132
+ (block $block116
+ (block $block115
+ (br_if $block115
(i32.gt_u
(local.get $1)
(i32.const 15)
@@ -8924,7 +8925,7 @@
(i32.const 1)
)
)
- (br $label$131)
+ (br $block116)
)
(i32.store offset=4
(local.get $5)
@@ -8947,8 +8948,8 @@
)
(local.get $1)
)
- (block $label$133
- (br_if $label$133
+ (block $block117
+ (br_if $block117
(i32.eqz
(local.get $6)
)
@@ -8972,9 +8973,9 @@
(i32.const 0)
)
)
- (block $label$134
- (block $label$135
- (br_if $label$135
+ (block $block119
+ (block $block118
+ (br_if $block118
(i32.and
(local.tee $3
(i32.shl
@@ -8995,7 +8996,7 @@
(local.set $3
(local.get $4)
)
- (br $label$134)
+ (br $block119)
)
(local.set $3
(i32.load offset=8
@@ -9036,7 +9037,7 @@
)
)
)
- (br_if $label$2
+ (br_if $block2
(i32.eqz
(i32.and
(i32.load8_u offset=2312
@@ -9069,8 +9070,8 @@
(i32.const 2368)
)
)
- (block $label$1
- (br_if $label$1
+ (block $block
+ (br_if $block
(i32.load offset=1844
(i32.const 0)
)
@@ -9091,8 +9092,8 @@
(i32.const 0)
(i32.const 2)
)
- (block $label$2
- (br_if $label$2
+ (block $block1
+ (br_if $block1
(call $57
(i32.add
(local.get $0)
@@ -9100,7 +9101,7 @@
)
)
)
- (br_if $label$2
+ (br_if $block1
(call $58
(i32.const 2316)
(i32.add
@@ -9152,14 +9153,14 @@
(local $5 i32)
(local $6 i32)
(local $7 i32)
- (block $label$1
- (br_if $label$1
+ (block $block
+ (br_if $block
(i32.eqz
(local.get $0)
)
)
- (block $label$2
- (br_if $label$2
+ (block $block1
+ (br_if $block1
(i32.eqz
(i32.and
(i32.load8_u offset=2312
@@ -9169,7 +9170,7 @@
)
)
)
- (br_if $label$1
+ (br_if $block
(call $55
(i32.const 2316)
)
@@ -9198,15 +9199,15 @@
)
)
)
- (block $label$3
- (block $label$4
- (br_if $label$4
+ (block $block3
+ (block $block2
+ (br_if $block2
(i32.and
(local.get $2)
(i32.const 1)
)
)
- (br_if $label$3
+ (br_if $block3
(i32.eqz
(i32.and
(local.get $2)
@@ -9214,7 +9215,7 @@
)
)
)
- (br_if $label$3
+ (br_if $block3
(i32.lt_u
(local.tee $1
(i32.sub
@@ -9239,8 +9240,8 @@
(local.get $0)
)
)
- (block $label$5
- (br_if $label$5
+ (block $block4
+ (br_if $block4
(i32.eq
(i32.load offset=1888
(i32.const 0)
@@ -9248,8 +9249,8 @@
(local.get $1)
)
)
- (block $label$6
- (br_if $label$6
+ (block $block5
+ (br_if $block5
(i32.gt_u
(local.get $2)
(i32.const 255)
@@ -9278,8 +9279,8 @@
)
)
)
- (block $label$7
- (br_if $label$7
+ (block $block6
+ (br_if $block6
(i32.ne
(local.tee $2
(i32.load offset=12
@@ -9301,7 +9302,7 @@
)
)
)
- (br $label$4)
+ (br $block2)
)
(drop
(i32.eq
@@ -9317,16 +9318,16 @@
(local.get $2)
(local.get $4)
)
- (br $label$4)
+ (br $block2)
)
(local.set $7
(i32.load offset=24
(local.get $1)
)
)
- (block $label$8
- (block $label$9
- (br_if $label$9
+ (block $block8
+ (block $block7
+ (br_if $block7
(i32.eq
(local.tee $6
(i32.load offset=12
@@ -9354,10 +9355,10 @@
(local.get $6)
(local.get $2)
)
- (br $label$8)
+ (br $block8)
)
- (block $label$10
- (br_if $label$10
+ (block $block9
+ (br_if $block9
(local.tee $4
(i32.load
(local.tee $2
@@ -9369,7 +9370,7 @@
)
)
)
- (br_if $label$10
+ (br_if $block9
(local.tee $4
(i32.load
(local.tee $2
@@ -9384,13 +9385,13 @@
(local.set $6
(i32.const 0)
)
- (br $label$8)
+ (br $block8)
)
- (loop $label$11
+ (loop $label
(local.set $5
(local.get $2)
)
- (br_if $label$11
+ (br_if $label
(local.tee $4
(i32.load
(local.tee $2
@@ -9410,7 +9411,7 @@
(i32.const 16)
)
)
- (br_if $label$11
+ (br_if $label
(local.tee $4
(i32.load offset=16
(local.get $6)
@@ -9423,14 +9424,14 @@
(i32.const 0)
)
)
- (br_if $label$4
+ (br_if $block2
(i32.eqz
(local.get $7)
)
)
- (block $label$12
- (block $label$13
- (br_if $label$13
+ (block $block11
+ (block $block10
+ (br_if $block10
(i32.ne
(i32.load
(local.tee $2
@@ -9454,7 +9455,7 @@
(local.get $2)
(local.get $6)
)
- (br_if $label$12
+ (br_if $block11
(local.get $6)
)
(i32.store offset=1872
@@ -9469,7 +9470,7 @@
)
)
)
- (br $label$4)
+ (br $block2)
)
(i32.store
(i32.add
@@ -9487,7 +9488,7 @@
)
(local.get $6)
)
- (br_if $label$4
+ (br_if $block2
(i32.eqz
(local.get $6)
)
@@ -9497,8 +9498,8 @@
(local.get $6)
(local.get $7)
)
- (block $label$14
- (br_if $label$14
+ (block $block12
+ (br_if $block12
(i32.eqz
(local.tee $2
(i32.load offset=16
@@ -9516,7 +9517,7 @@
(local.get $6)
)
)
- (br_if $label$4
+ (br_if $block2
(i32.eqz
(local.tee $2
(i32.load offset=20
@@ -9536,9 +9537,9 @@
(local.get $2)
(local.get $6)
)
- (br $label$4)
+ (br $block2)
)
- (br_if $label$4
+ (br_if $block2
(i32.ne
(i32.and
(local.tee $2
@@ -9576,15 +9577,15 @@
)
(local.get $0)
)
- (br $label$3)
+ (br $block3)
)
- (br_if $label$3
+ (br_if $block3
(i32.le_u
(local.get $3)
(local.get $1)
)
)
- (br_if $label$3
+ (br_if $block3
(i32.eqz
(i32.and
(local.tee $2
@@ -9596,16 +9597,16 @@
)
)
)
- (block $label$15
- (block $label$16
- (br_if $label$16
+ (block $block25
+ (block $block13
+ (br_if $block13
(i32.and
(local.get $2)
(i32.const 2)
)
)
- (block $label$17
- (br_if $label$17
+ (block $block14
+ (br_if $block14
(i32.ne
(i32.load offset=1892
(i32.const 0)
@@ -9635,7 +9636,7 @@
(i32.const 1)
)
)
- (br_if $label$3
+ (br_if $block3
(i32.ne
(local.get $1)
(i32.load offset=1888
@@ -9651,10 +9652,10 @@
(i32.const 0)
(i32.const 0)
)
- (br $label$3)
+ (br $block3)
)
- (block $label$18
- (br_if $label$18
+ (block $block15
+ (br_if $block15
(i32.ne
(i32.load offset=1888
(i32.const 0)
@@ -9691,7 +9692,7 @@
)
(local.get $0)
)
- (br $label$3)
+ (br $block3)
)
(local.set $0
(i32.add
@@ -9702,9 +9703,9 @@
(local.get $0)
)
)
- (block $label$19
- (block $label$20
- (br_if $label$20
+ (block $block18
+ (block $block16
+ (br_if $block16
(i32.gt_u
(local.get $2)
(i32.const 255)
@@ -9733,8 +9734,8 @@
)
)
)
- (block $label$21
- (br_if $label$21
+ (block $block17
+ (br_if $block17
(i32.ne
(local.tee $2
(i32.load offset=12
@@ -9756,7 +9757,7 @@
)
)
)
- (br $label$19)
+ (br $block18)
)
(drop
(i32.eq
@@ -9772,16 +9773,16 @@
(local.get $2)
(local.get $4)
)
- (br $label$19)
+ (br $block18)
)
(local.set $7
(i32.load offset=24
(local.get $3)
)
)
- (block $label$22
- (block $label$23
- (br_if $label$23
+ (block $block20
+ (block $block19
+ (br_if $block19
(i32.eq
(local.tee $6
(i32.load offset=12
@@ -9811,10 +9812,10 @@
(local.get $6)
(local.get $2)
)
- (br $label$22)
+ (br $block20)
)
- (block $label$24
- (br_if $label$24
+ (block $block21
+ (br_if $block21
(local.tee $2
(i32.load
(local.tee $4
@@ -9826,7 +9827,7 @@
)
)
)
- (br_if $label$24
+ (br_if $block21
(local.tee $2
(i32.load
(local.tee $4
@@ -9841,13 +9842,13 @@
(local.set $6
(i32.const 0)
)
- (br $label$22)
+ (br $block20)
)
- (loop $label$25
+ (loop $label1
(local.set $5
(local.get $4)
)
- (br_if $label$25
+ (br_if $label1
(local.tee $2
(i32.load
(local.tee $4
@@ -9867,7 +9868,7 @@
(i32.const 16)
)
)
- (br_if $label$25
+ (br_if $label1
(local.tee $2
(i32.load offset=16
(local.get $6)
@@ -9880,14 +9881,14 @@
(i32.const 0)
)
)
- (br_if $label$19
+ (br_if $block18
(i32.eqz
(local.get $7)
)
)
- (block $label$26
- (block $label$27
- (br_if $label$27
+ (block $block23
+ (block $block22
+ (br_if $block22
(i32.ne
(i32.load
(local.tee $2
@@ -9911,7 +9912,7 @@
(local.get $2)
(local.get $6)
)
- (br_if $label$26
+ (br_if $block23
(local.get $6)
)
(i32.store offset=1872
@@ -9926,7 +9927,7 @@
)
)
)
- (br $label$19)
+ (br $block18)
)
(i32.store
(i32.add
@@ -9944,7 +9945,7 @@
)
(local.get $6)
)
- (br_if $label$19
+ (br_if $block18
(i32.eqz
(local.get $6)
)
@@ -9954,8 +9955,8 @@
(local.get $6)
(local.get $7)
)
- (block $label$28
- (br_if $label$28
+ (block $block24
+ (br_if $block24
(i32.eqz
(local.tee $2
(i32.load offset=16
@@ -9973,7 +9974,7 @@
(local.get $6)
)
)
- (br_if $label$19
+ (br_if $block18
(i32.eqz
(local.tee $2
(i32.load offset=20
@@ -10008,7 +10009,7 @@
)
(local.get $0)
)
- (br_if $label$15
+ (br_if $block25
(i32.ne
(local.get $1)
(i32.load offset=1888
@@ -10020,7 +10021,7 @@
(i32.const 0)
(local.get $0)
)
- (br $label$3)
+ (br $block3)
)
(i32.store offset=4
(local.get $3)
@@ -10044,8 +10045,8 @@
(local.get $0)
)
)
- (block $label$29
- (br_if $label$29
+ (block $block26
+ (br_if $block26
(i32.gt_u
(local.get $0)
(i32.const 255)
@@ -10065,9 +10066,9 @@
(i32.const 1908)
)
)
- (block $label$30
- (block $label$31
- (br_if $label$31
+ (block $block28
+ (block $block27
+ (br_if $block27
(i32.and
(local.tee $4
(i32.load offset=1868
@@ -10092,7 +10093,7 @@
(local.set $2
(local.get $0)
)
- (br $label$30)
+ (br $block28)
)
(local.set $2
(i32.load offset=8
@@ -10116,13 +10117,13 @@
(local.get $1)
(local.get $2)
)
- (br $label$3)
+ (br $block3)
)
(local.set $2
(i32.const 31)
)
- (block $label$32
- (br_if $label$32
+ (block $block29
+ (br_if $block29
(i32.gt_u
(local.get $0)
(i32.const 16777215)
@@ -10235,11 +10236,11 @@
(i32.const 2172)
)
)
- (block $label$33
- (block $label$34
- (block $label$35
- (block $label$36
- (br_if $label$36
+ (block $block33
+ (block $block32
+ (block $block31
+ (block $block30
+ (br_if $block30
(i32.and
(local.tee $6
(i32.load offset=1872
@@ -10272,7 +10273,7 @@
)
(local.get $4)
)
- (br $label$35)
+ (br $block31)
)
(local.set $2
(i32.shl
@@ -10298,8 +10299,8 @@
(local.get $4)
)
)
- (loop $label$37
- (br_if $label$34
+ (loop $label2
+ (br_if $block32
(i32.eq
(i32.and
(i32.load offset=4
@@ -10324,7 +10325,7 @@
(i32.const 1)
)
)
- (br_if $label$37
+ (br_if $label2
(local.tee $6
(i32.load
(local.tee $3
@@ -10363,7 +10364,7 @@
(local.get $1)
(local.get $1)
)
- (br $label$33)
+ (br $block33)
)
(i32.store offset=12
(local.tee $0
@@ -10409,7 +10410,7 @@
)
)
)
- (br_if $label$1
+ (br_if $block
(i32.eqz
(i32.and
(i32.load8_u offset=2312
@@ -10427,8 +10428,8 @@
)
)
(func $63 (param $0 i32) (param $1 i32) (result i32)
- (block $label$1
- (br_if $label$1
+ (block $block
+ (br_if $block
(i32.gt_u
(local.get $0)
(i32.const 8)
@@ -10454,9 +10455,9 @@
(local.set $2
(i32.const 16)
)
- (block $label$1
- (block $label$2
- (br_if $label$2
+ (block $block1
+ (block $block
+ (br_if $block
(i32.and
(local.tee $3
(select
@@ -10477,9 +10478,9 @@
(local.set $0
(local.get $3)
)
- (br $label$1)
+ (br $block1)
)
- (loop $label$3
+ (loop $label
(local.set $2
(i32.shl
(local.tee $0
@@ -10488,7 +10489,7 @@
(i32.const 1)
)
)
- (br_if $label$3
+ (br_if $label
(i32.lt_u
(local.get $0)
(local.get $3)
@@ -10496,8 +10497,8 @@
)
)
)
- (block $label$4
- (br_if $label$4
+ (block $block2
+ (br_if $block2
(i32.gt_u
(i32.sub
(i32.const -64)
@@ -10514,8 +10515,8 @@
(i32.const 0)
)
)
- (block $label$5
- (br_if $label$5
+ (block $block3
+ (br_if $block3
(local.tee $3
(call $60
(i32.add
@@ -10550,9 +10551,9 @@
(local.set $2
(i32.const 0)
)
- (block $label$6
- (block $label$7
- (br_if $label$7
+ (block $block5
+ (block $block4
+ (br_if $block4
(i32.eqz
(i32.and
(i32.load8_u offset=2312
@@ -10562,7 +10563,7 @@
)
)
)
- (br_if $label$6
+ (br_if $block5
(call $55
(i32.const 2316)
)
@@ -10574,8 +10575,8 @@
(i32.const -8)
)
)
- (block $label$8
- (br_if $label$8
+ (block $block6
+ (br_if $block6
(i32.eqz
(i32.and
(i32.add
@@ -10641,9 +10642,9 @@
)
)
)
- (block $label$9
- (block $label$10
- (br_if $label$10
+ (block $block8
+ (block $block7
+ (br_if $block7
(i32.and
(local.get $5)
(i32.const 3)
@@ -10665,7 +10666,7 @@
(local.get $3)
)
)
- (br $label$9)
+ (br $block8)
)
(i32.store offset=4
(local.get $0)
@@ -10734,8 +10735,8 @@
(local.get $0)
)
)
- (block $label$11
- (br_if $label$11
+ (block $block9
+ (br_if $block9
(i32.eqz
(i32.and
(local.tee $0
@@ -10747,7 +10748,7 @@
)
)
)
- (br_if $label$11
+ (br_if $block9
(i32.le_u
(local.tee $3
(i32.and
@@ -10816,7 +10817,7 @@
(i32.const 8)
)
)
- (br_if $label$6
+ (br_if $block5
(i32.eqz
(i32.and
(i32.load8_u offset=2312
@@ -10847,9 +10848,9 @@
(local.get $1)
)
)
- (block $label$1
- (block $label$2
- (br_if $label$2
+ (block $block1
+ (block $block
+ (br_if $block
(i32.and
(local.tee $3
(i32.load offset=4
@@ -10859,7 +10860,7 @@
(i32.const 1)
)
)
- (br_if $label$1
+ (br_if $block1
(i32.eqz
(i32.and
(local.get $3)
@@ -10877,9 +10878,9 @@
(local.get $1)
)
)
- (block $label$3
- (block $label$4
- (br_if $label$4
+ (block $block4
+ (block $block2
+ (br_if $block2
(i32.eq
(i32.load offset=1888
(i32.const 0)
@@ -10892,8 +10893,8 @@
)
)
)
- (block $label$5
- (br_if $label$5
+ (block $block3
+ (br_if $block3
(i32.gt_u
(local.get $3)
(i32.const 255)
@@ -10922,7 +10923,7 @@
)
)
)
- (br_if $label$3
+ (br_if $block4
(i32.ne
(local.tee $3
(i32.load offset=12
@@ -10944,16 +10945,16 @@
)
)
)
- (br $label$2)
+ (br $block)
)
(local.set $7
(i32.load offset=24
(local.get $0)
)
)
- (block $label$6
- (block $label$7
- (br_if $label$7
+ (block $block6
+ (block $block5
+ (br_if $block5
(i32.eq
(local.tee $6
(i32.load offset=12
@@ -10983,10 +10984,10 @@
(local.get $6)
(local.get $3)
)
- (br $label$6)
+ (br $block6)
)
- (block $label$8
- (br_if $label$8
+ (block $block7
+ (br_if $block7
(local.tee $4
(i32.load
(local.tee $3
@@ -10998,7 +10999,7 @@
)
)
)
- (br_if $label$8
+ (br_if $block7
(local.tee $4
(i32.load
(local.tee $3
@@ -11013,13 +11014,13 @@
(local.set $6
(i32.const 0)
)
- (br $label$6)
+ (br $block6)
)
- (loop $label$9
+ (loop $label
(local.set $5
(local.get $3)
)
- (br_if $label$9
+ (br_if $label
(local.tee $4
(i32.load
(local.tee $3
@@ -11039,7 +11040,7 @@
(i32.const 16)
)
)
- (br_if $label$9
+ (br_if $label
(local.tee $4
(i32.load offset=16
(local.get $6)
@@ -11052,14 +11053,14 @@
(i32.const 0)
)
)
- (br_if $label$2
+ (br_if $block
(i32.eqz
(local.get $7)
)
)
- (block $label$10
- (block $label$11
- (br_if $label$11
+ (block $block9
+ (block $block8
+ (br_if $block8
(i32.ne
(i32.load
(local.tee $3
@@ -11083,7 +11084,7 @@
(local.get $3)
(local.get $6)
)
- (br_if $label$10
+ (br_if $block9
(local.get $6)
)
(i32.store offset=1872
@@ -11098,7 +11099,7 @@
)
)
)
- (br $label$2)
+ (br $block)
)
(i32.store
(i32.add
@@ -11116,7 +11117,7 @@
)
(local.get $6)
)
- (br_if $label$2
+ (br_if $block
(i32.eqz
(local.get $6)
)
@@ -11126,8 +11127,8 @@
(local.get $6)
(local.get $7)
)
- (block $label$12
- (br_if $label$12
+ (block $block10
+ (br_if $block10
(i32.eqz
(local.tee $3
(i32.load offset=16
@@ -11145,7 +11146,7 @@
(local.get $6)
)
)
- (br_if $label$2
+ (br_if $block
(i32.eqz
(local.tee $3
(i32.load offset=20
@@ -11165,9 +11166,9 @@
(local.get $3)
(local.get $6)
)
- (br $label$2)
+ (br $block)
)
- (br_if $label$2
+ (br_if $block
(i32.ne
(i32.and
(local.tee $3
@@ -11219,9 +11220,9 @@
(local.get $4)
)
)
- (block $label$13
- (block $label$14
- (br_if $label$14
+ (block $block23
+ (block $block11
+ (br_if $block11
(i32.and
(local.tee $3
(i32.load offset=4
@@ -11231,8 +11232,8 @@
(i32.const 2)
)
)
- (block $label$15
- (br_if $label$15
+ (block $block12
+ (br_if $block12
(i32.ne
(i32.load offset=1892
(i32.const 0)
@@ -11262,7 +11263,7 @@
(i32.const 1)
)
)
- (br_if $label$1
+ (br_if $block1
(i32.ne
(local.get $0)
(i32.load offset=1888
@@ -11280,8 +11281,8 @@
)
(return)
)
- (block $label$16
- (br_if $label$16
+ (block $block13
+ (br_if $block13
(i32.ne
(i32.load offset=1888
(i32.const 0)
@@ -11329,9 +11330,9 @@
(local.get $1)
)
)
- (block $label$17
- (block $label$18
- (br_if $label$18
+ (block $block16
+ (block $block14
+ (br_if $block14
(i32.gt_u
(local.get $3)
(i32.const 255)
@@ -11360,8 +11361,8 @@
)
)
)
- (block $label$19
- (br_if $label$19
+ (block $block15
+ (br_if $block15
(i32.ne
(local.tee $3
(i32.load offset=12
@@ -11383,7 +11384,7 @@
)
)
)
- (br $label$17)
+ (br $block16)
)
(drop
(i32.eq
@@ -11399,16 +11400,16 @@
(local.get $3)
(local.get $4)
)
- (br $label$17)
+ (br $block16)
)
(local.set $7
(i32.load offset=24
(local.get $2)
)
)
- (block $label$20
- (block $label$21
- (br_if $label$21
+ (block $block18
+ (block $block17
+ (br_if $block17
(i32.eq
(local.tee $6
(i32.load offset=12
@@ -11438,10 +11439,10 @@
(local.get $6)
(local.get $3)
)
- (br $label$20)
+ (br $block18)
)
- (block $label$22
- (br_if $label$22
+ (block $block19
+ (br_if $block19
(local.tee $3
(i32.load
(local.tee $4
@@ -11453,7 +11454,7 @@
)
)
)
- (br_if $label$22
+ (br_if $block19
(local.tee $3
(i32.load
(local.tee $4
@@ -11468,13 +11469,13 @@
(local.set $6
(i32.const 0)
)
- (br $label$20)
+ (br $block18)
)
- (loop $label$23
+ (loop $label1
(local.set $5
(local.get $4)
)
- (br_if $label$23
+ (br_if $label1
(local.tee $3
(i32.load
(local.tee $4
@@ -11494,7 +11495,7 @@
(i32.const 16)
)
)
- (br_if $label$23
+ (br_if $label1
(local.tee $3
(i32.load offset=16
(local.get $6)
@@ -11507,14 +11508,14 @@
(i32.const 0)
)
)
- (br_if $label$17
+ (br_if $block16
(i32.eqz
(local.get $7)
)
)
- (block $label$24
- (block $label$25
- (br_if $label$25
+ (block $block21
+ (block $block20
+ (br_if $block20
(i32.ne
(i32.load
(local.tee $3
@@ -11538,7 +11539,7 @@
(local.get $3)
(local.get $6)
)
- (br_if $label$24
+ (br_if $block21
(local.get $6)
)
(i32.store offset=1872
@@ -11553,7 +11554,7 @@
)
)
)
- (br $label$17)
+ (br $block16)
)
(i32.store
(i32.add
@@ -11571,7 +11572,7 @@
)
(local.get $6)
)
- (br_if $label$17
+ (br_if $block16
(i32.eqz
(local.get $6)
)
@@ -11581,8 +11582,8 @@
(local.get $6)
(local.get $7)
)
- (block $label$26
- (br_if $label$26
+ (block $block22
+ (br_if $block22
(i32.eqz
(local.tee $3
(i32.load offset=16
@@ -11600,7 +11601,7 @@
(local.get $6)
)
)
- (br_if $label$17
+ (br_if $block16
(i32.eqz
(local.tee $3
(i32.load offset=20
@@ -11635,7 +11636,7 @@
)
(local.get $1)
)
- (br_if $label$13
+ (br_if $block23
(i32.ne
(local.get $0)
(i32.load offset=1888
@@ -11671,8 +11672,8 @@
(local.get $1)
)
)
- (block $label$27
- (br_if $label$27
+ (block $block24
+ (br_if $block24
(i32.gt_u
(local.get $1)
(i32.const 255)
@@ -11692,9 +11693,9 @@
(i32.const 1908)
)
)
- (block $label$28
- (block $label$29
- (br_if $label$29
+ (block $block26
+ (block $block25
+ (br_if $block25
(i32.and
(local.tee $4
(i32.load offset=1868
@@ -11719,7 +11720,7 @@
(local.set $3
(local.get $1)
)
- (br $label$28)
+ (br $block26)
)
(local.set $3
(i32.load offset=8
@@ -11748,8 +11749,8 @@
(local.set $3
(i32.const 31)
)
- (block $label$30
- (br_if $label$30
+ (block $block27
+ (br_if $block27
(i32.gt_u
(local.get $1)
(i32.const 16777215)
@@ -11862,10 +11863,10 @@
(i32.const 2172)
)
)
- (block $label$31
- (block $label$32
- (block $label$33
- (br_if $label$33
+ (block $block30
+ (block $block29
+ (block $block28
+ (br_if $block28
(i32.and
(local.tee $6
(i32.load offset=1872
@@ -11898,7 +11899,7 @@
)
(local.get $4)
)
- (br $label$32)
+ (br $block29)
)
(local.set $3
(i32.shl
@@ -11924,8 +11925,8 @@
(local.get $4)
)
)
- (loop $label$34
- (br_if $label$31
+ (loop $label2
+ (br_if $block30
(i32.eq
(i32.and
(i32.load offset=4
@@ -11950,7 +11951,7 @@
(i32.const 1)
)
)
- (br_if $label$34
+ (br_if $label2
(local.tee $6
(i32.load
(local.tee $2
@@ -12038,8 +12039,8 @@
(i32.const 1)
)
)
- (block $label$1
- (loop $label$2
+ (block $block1
+ (loop $label
(local.set $0
(i32.add
(local.tee $3
@@ -12050,19 +12051,19 @@
(local.get $1)
)
)
- (block $label$3
- (br_if $label$3
+ (block $block
+ (br_if $block
(local.get $2)
)
- (br_if $label$1
+ (br_if $block1
(i32.le_u
(local.get $0)
(local.get $3)
)
)
)
- (block $label$4
- (br_if $label$4
+ (block $block2
+ (br_if $block2
(i32.le_u
(local.get $0)
(i32.shl
@@ -12071,7 +12072,7 @@
)
)
)
- (br_if $label$1
+ (br_if $block1
(i32.eqz
(call $fimport$15
(local.get $0)
@@ -12079,7 +12080,7 @@
)
)
)
- (br_if $label$2
+ (br_if $label
(i32.ne
(i32.atomic.rmw.cmpxchg offset=1436
(i32.const 0)
@@ -12116,8 +12117,8 @@
)
)
(func $71 (param $0 i32) (result i32)
- (block $label$1
- (br_if $label$1
+ (block $block
+ (br_if $block
(local.get $0)
)
(return
@@ -12191,11 +12192,11 @@
(i32.const 16)
)
)
- (block $label$1
- (block $label$2
- (block $label$3
- (block $label$4
- (br_if $label$4
+ (block $block3
+ (block $block2
+ (block $block1
+ (block $block
+ (br_if $block
(call $71
(call $fimport$16
(i32.load offset=60
@@ -12213,8 +12214,8 @@
)
)
)
- (loop $label$5
- (br_if $label$3
+ (loop $label
+ (br_if $block1
(i32.eq
(local.get $6)
(local.tee $4
@@ -12224,7 +12225,7 @@
)
)
)
- (br_if $label$2
+ (br_if $block2
(i32.le_s
(local.get $4)
(i32.const -1)
@@ -12289,7 +12290,7 @@
(local.get $4)
)
)
- (br_if $label$5
+ (br_if $label
(i32.eqz
(call $71
(call $fimport$16
@@ -12322,7 +12323,7 @@
)
)
)
- (br_if $label$2
+ (br_if $block2
(i32.ne
(local.get $6)
(i32.const -1)
@@ -12353,7 +12354,7 @@
(local.set $4
(local.get $2)
)
- (br $label$1)
+ (br $block3)
)
(local.set $4
(i32.const 0)
@@ -12375,7 +12376,7 @@
(i32.const 32)
)
)
- (br_if $label$1
+ (br_if $block3
(i32.eq
(local.get $7)
(i32.const 2)
@@ -12436,15 +12437,15 @@
(func $80 (param $0 i32) (result i32)
(local $1 i32)
(local $2 i32)
- (block $label$1
- (block $label$2
- (br_if $label$2
+ (block $block2
+ (block $block
+ (br_if $block
(i32.eqz
(local.get $0)
)
)
- (block $label$3
- (br_if $label$3
+ (block $block1
+ (br_if $block1
(i32.gt_s
(i32.load offset=76
(local.get $0)
@@ -12468,7 +12469,7 @@
(local.get $0)
)
)
- (br_if $label$1
+ (br_if $block2
(i32.eqz
(local.get $1)
)
@@ -12483,8 +12484,8 @@
(local.set $2
(i32.const 0)
)
- (block $label$4
- (br_if $label$4
+ (block $block3
+ (br_if $block3
(i32.eqz
(i32.load offset=1584
(i32.const 0)
@@ -12499,8 +12500,8 @@
)
)
)
- (block $label$5
- (br_if $label$5
+ (block $block4
+ (br_if $block4
(i32.eqz
(local.tee $0
(i32.load
@@ -12509,12 +12510,12 @@
)
)
)
- (loop $label$6
+ (loop $label
(local.set $1
(i32.const 0)
)
- (block $label$7
- (br_if $label$7
+ (block $block5
+ (br_if $block5
(i32.lt_s
(i32.load offset=76
(local.get $0)
@@ -12528,8 +12529,8 @@
)
)
)
- (block $label$8
- (br_if $label$8
+ (block $block6
+ (br_if $block6
(i32.le_u
(i32.load offset=20
(local.get $0)
@@ -12548,8 +12549,8 @@
)
)
)
- (block $label$9
- (br_if $label$9
+ (block $block7
+ (br_if $block7
(i32.eqz
(local.get $1)
)
@@ -12558,7 +12559,7 @@
(local.get $0)
)
)
- (br_if $label$6
+ (br_if $label
(local.tee $0
(i32.load offset=56
(local.get $0)
@@ -12574,8 +12575,8 @@
(func $81 (param $0 i32) (result i32)
(local $1 i32)
(local $2 i32)
- (block $label$1
- (br_if $label$1
+ (block $block
+ (br_if $block
(i32.le_u
(i32.load offset=20
(local.get $0)
@@ -12595,7 +12596,7 @@
)
)
)
- (br_if $label$1
+ (br_if $block
(i32.load offset=20
(local.get $0)
)
@@ -12604,8 +12605,8 @@
(i32.const -1)
)
)
- (block $label$2
- (br_if $label$2
+ (block $block1
+ (br_if $block1
(i32.ge_u
(local.tee $1
(i32.load offset=4
@@ -12670,8 +12671,8 @@
(local $4 i32)
(local $5 i32)
(local $6 i32)
- (block $label$1
- (br_if $label$1
+ (block $block
+ (br_if $block
(i32.eqz
(i32.load offset=44
(local.tee $0
@@ -12683,16 +12684,16 @@
(local.set $1
(i32.const 0)
)
- (loop $label$2
+ (loop $label1
(local.set $2
(i32.const 0)
)
(local.set $3
(i32.const 0)
)
- (loop $label$3
- (block $label$4
- (br_if $label$4
+ (loop $label
+ (block $block1
+ (br_if $block1
(i32.eqz
(local.tee $6
(i32.load
@@ -12713,7 +12714,7 @@
)
)
)
- (br_if $label$4
+ (br_if $block1
(i32.eqz
(i32.load
(local.tee $4
@@ -12739,7 +12740,7 @@
(i32.const 1)
)
)
- (br_if $label$3
+ (br_if $label
(i32.ne
(local.tee $2
(i32.add
@@ -12751,7 +12752,7 @@
)
)
)
- (br_if $label$1
+ (br_if $block
(i32.gt_u
(local.get $1)
(i32.const 2)
@@ -12763,7 +12764,7 @@
(i32.const 1)
)
)
- (br_if $label$2
+ (br_if $label1
(local.get $3)
)
)
diff --git a/test/passes/O.bin.txt b/test/passes/O.bin.txt
index 3302ebcc7..fc4724490 100644
--- a/test/passes/O.bin.txt
+++ b/test/passes/O.bin.txt
@@ -55,7 +55,7 @@
(local.set $1
(i64.const 1)
)
- (loop $label$3
+ (loop $label
(if
(i32.eqz
(i64.eqz
@@ -75,7 +75,7 @@
(i64.const 1)
)
)
- (br $label$3)
+ (br $label)
)
)
)
@@ -92,14 +92,14 @@
(i64.const 2)
)
(then
- (loop $label$3
+ (loop $label
(local.set $1
(i64.mul
(local.get $0)
(local.get $1)
)
)
- (br_if $label$3
+ (br_if $label
(i64.gt_s
(local.tee $0
(i64.sub
diff --git a/test/passes/converge_O3_metrics.bin.txt b/test/passes/converge_O3_metrics.bin.txt
index 712172cc7..2d9ef8f57 100644
--- a/test/passes/converge_O3_metrics.bin.txt
+++ b/test/passes/converge_O3_metrics.bin.txt
@@ -59,8 +59,8 @@ total
(local.set $0
(i32.const 10888)
)
- (loop $label$3
- (br_if $label$3
+ (loop $label
+ (br_if $label
(i32.load8_s
(local.tee $0
(i32.add
@@ -94,8 +94,8 @@ total
)
)
(then
- (block $label$2
- (br_if $label$2
+ (block $block
+ (br_if $block
(call_indirect (type $0)
(local.get $1)
(i32.const 10888)
@@ -113,8 +113,8 @@ total
)
)
)
- (block $label$1
- (br_if $label$1
+ (block $block0
+ (br_if $block0
(if (result i32)
(i32.load
(i32.add
@@ -291,8 +291,8 @@ total
(local.set $0
(i32.const 10888)
)
- (loop $label$3
- (br_if $label$3
+ (loop $label
+ (br_if $label
(i32.load8_s
(local.tee $0
(i32.add
@@ -326,8 +326,8 @@ total
)
)
(then
- (block $label$2
- (br_if $label$2
+ (block $block
+ (br_if $block
(call_indirect (type $0)
(local.get $1)
(i32.const 10888)
@@ -345,8 +345,8 @@ total
)
)
)
- (block $label$1
- (br_if $label$1
+ (block $block0
+ (br_if $block0
(if (result i32)
(i32.load
(i32.add
@@ -518,8 +518,8 @@ total
(local.set $0
(i32.const 10888)
)
- (loop $label$3
- (br_if $label$3
+ (loop $label
+ (br_if $label
(i32.load8_s
(local.tee $0
(i32.add
@@ -553,8 +553,8 @@ total
)
)
(then
- (block $label$2
- (br_if $label$2
+ (block $block
+ (br_if $block
(call_indirect (type $0)
(local.get $1)
(i32.const 10888)
@@ -572,8 +572,8 @@ total
)
)
)
- (block $label$1
- (br_if $label$1
+ (block $block0
+ (br_if $block0
(if (result i32)
(i32.load
(i32.add
diff --git a/test/passes/dce_vacuum_remove-unused-names.bin.txt b/test/passes/dce_vacuum_remove-unused-names.bin.txt
index 8a01d2ee5..72bdb2a9c 100644
--- a/test/passes/dce_vacuum_remove-unused-names.bin.txt
+++ b/test/passes/dce_vacuum_remove-unused-names.bin.txt
@@ -4,8 +4,8 @@
(export "f32.compute_radix" (func $0))
(export "f64.compute_radix" (func $1))
(func $0 (param $0 f32) (param $1 f32) (result f32)
- (loop $label$2
- (br_if $label$2
+ (loop $label
+ (br_if $label
(f32.eq
(f32.add
(f32.sub
@@ -45,8 +45,8 @@
)
)
(func $1 (param $0 f64) (param $1 f64) (result f64)
- (loop $label$2
- (br_if $label$2
+ (loop $label
+ (br_if $label
(f64.eq
(f64.add
(f64.sub
@@ -67,8 +67,8 @@
)
)
)
- (loop $label$3
- (br_if $label$3
+ (loop $label1
+ (br_if $label1
(f64.ne
(f64.sub
(f64.sub
diff --git a/test/passes/dwarf-local-order.bin.txt b/test/passes/dwarf-local-order.bin.txt
index 509db04b1..8fc6cfbbe 100644
--- a/test/passes/dwarf-local-order.bin.txt
+++ b/test/passes/dwarf-local-order.bin.txt
@@ -122,9 +122,9 @@
(local.get $15)
)
)
- (block $label$1
- (block $label$2
- (br_if $label$2
+ (block $block1
+ (block $block
+ (br_if $block
(local.get $16)
)
(local.set $17
@@ -135,7 +135,7 @@
(local.set $18
(local.get $17)
)
- (br $label$1)
+ (br $block1)
)
(local.set $19
(i32.const -2147483648)
@@ -340,11 +340,11 @@
)
)
;; code offset: 0xa9
- (block $label$1
+ (block $block1
;; code offset: 0xab
- (block $label$2
+ (block $block
;; code offset: 0xaf
- (br_if $label$2
+ (br_if $block
;; code offset: 0xad
(local.get $16)
)
@@ -362,7 +362,7 @@
(local.get $17)
)
;; code offset: 0xba
- (br $label$1)
+ (br $block1)
)
;; code offset: 0xc3
(local.set $19
@@ -516,9 +516,9 @@
(local.get $7)
)
)
- (block $label$1
- (block $label$2
- (br_if $label$2
+ (block $block1
+ (block $block
+ (br_if $block
(local.get $8)
)
(local.set $9
@@ -529,7 +529,7 @@
(local.set $10
(local.get $9)
)
- (br $label$1)
+ (br $block1)
)
(local.set $11
(i32.const -2147483648)
@@ -671,9 +671,9 @@
(local.get $7)
)
)
- (block $label$1
- (block $label$2
- (br_if $label$2
+ (block $block1
+ (block $block
+ (br_if $block
(local.get $8)
)
(local.set $9
@@ -684,7 +684,7 @@
(local.set $10
(local.get $9)
)
- (br $label$1)
+ (br $block1)
)
(local.set $11
(i32.const -2147483648)
diff --git a/test/passes/dwarf_with_exceptions.bin.txt b/test/passes/dwarf_with_exceptions.bin.txt
index 8a70d511a..a4e3b5e61 100644
--- a/test/passes/dwarf_with_exceptions.bin.txt
+++ b/test/passes/dwarf_with_exceptions.bin.txt
@@ -20,8 +20,8 @@
;; code offset: 0x8
(global.get $__stack_pointer)
)
- ;; code offset: 0x10
- (try $label$9
+ ;; code offset: 0x18
+ (try
(do
;; code offset: 0x12
(call $foo\28\29)
@@ -45,8 +45,8 @@
(local.get $1)
)
)
- ;; code offset: 0x31
- (try $label$8
+ ;; code offset: 0x41
+ (try $label
(do
;; code offset: 0x33
(call $foo\28\29)
@@ -58,8 +58,8 @@
)
;; code offset: 0x41
(catch_all
- ;; code offset: 0x42
- (try $label$7
+ ;; code offset: 0x63
+ (try
(do
;; code offset: 0x44
(call $__cxa_end_catch)
@@ -92,7 +92,7 @@
)
)
;; code offset: 0x6c
- (rethrow $label$8)
+ (rethrow $label)
)
)
;; code offset: 0x6f
@@ -274,7 +274,7 @@ DWARF debug info
Contains section .debug_info (63 bytes)
Contains section .debug_abbrev (41 bytes)
-Contains section .debug_line (162 bytes)
+Contains section .debug_line (136 bytes)
Contains section .debug_str (178 bytes)
.debug_abbrev contents:
@@ -326,7 +326,7 @@ Abbrev table for offset: 0x00000000
.debug_line contents:
debug_line[0x00000000]
Line table prologue:
- total_length: 0x0000009e
+ total_length: 0x00000084
version: 4
prologue_length: 0x00000031
min_inst_length: 1
@@ -366,51 +366,36 @@ file_names[ 1]:
0x000000000000000e 4 5 1 0 0 is_stmt prologue_end
-0x00000052: 00 DW_LNE_set_address (0x0000000000000012)
-0x00000059: 03 DW_LNS_advance_line (5)
-0x0000005b: 05 DW_LNS_set_column (3)
-0x0000005d: 01 DW_LNS_copy
- 0x0000000000000012 5 3 1 0 0 is_stmt
-
-
-0x0000005e: 00 DW_LNE_set_address (0x000000000000001f)
-0x00000065: 03 DW_LNS_advance_line (6)
-0x00000067: 05 DW_LNS_set_column (5)
-0x00000069: 01 DW_LNS_copy
+0x00000052: 00 DW_LNE_set_address (0x000000000000001f)
+0x00000059: 03 DW_LNS_advance_line (6)
+0x0000005b: 01 DW_LNS_copy
0x000000000000001f 6 5 1 0 0 is_stmt
-0x0000006a: 00 DW_LNE_set_address (0x000000000000003e)
-0x00000071: 03 DW_LNS_advance_line (7)
-0x00000073: 05 DW_LNS_set_column (3)
-0x00000075: 06 DW_LNS_negate_stmt
-0x00000076: 01 DW_LNS_copy
+0x0000005c: 00 DW_LNE_set_address (0x000000000000003e)
+0x00000063: 03 DW_LNS_advance_line (7)
+0x00000065: 05 DW_LNS_set_column (3)
+0x00000067: 06 DW_LNS_negate_stmt
+0x00000068: 01 DW_LNS_copy
0x000000000000003e 7 3 1 0 0
-0x00000077: 00 DW_LNE_set_address (0x0000000000000041)
-0x0000007e: 01 DW_LNS_copy
+0x00000069: 00 DW_LNE_set_address (0x0000000000000041)
+0x00000070: 01 DW_LNS_copy
0x0000000000000041 7 3 1 0 0
-0x0000007f: 00 DW_LNE_set_address (0x0000000000000044)
-0x00000086: 03 DW_LNS_advance_line (8)
-0x00000088: 05 DW_LNS_set_column (1)
-0x0000008a: 06 DW_LNS_negate_stmt
-0x0000008b: 01 DW_LNS_copy
+0x00000071: 00 DW_LNE_set_address (0x0000000000000044)
+0x00000078: 03 DW_LNS_advance_line (8)
+0x0000007a: 05 DW_LNS_set_column (1)
+0x0000007c: 06 DW_LNS_negate_stmt
+0x0000007d: 01 DW_LNS_copy
0x0000000000000044 8 1 1 0 0 is_stmt
-0x0000008c: 00 DW_LNE_set_address (0x0000000000000045)
-0x00000093: 01 DW_LNS_copy
- 0x0000000000000045 8 1 1 0 0 is_stmt
-
-
-0x00000094: 00 DW_LNE_set_address (0x00000000ffffff64)
-0x0000009b: 03 DW_LNS_advance_line (7)
-0x0000009d: 05 DW_LNS_set_column (3)
-0x0000009f: 00 DW_LNE_end_sequence
- 0x00000000ffffff64 7 3 1 0 0 is_stmt end_sequence
+0x0000007e: 00 DW_LNE_set_address (0x0000000000000045)
+0x00000085: 00 DW_LNE_end_sequence
+ 0x0000000000000045 8 1 1 0 0 is_stmt end_sequence
.debug_str contents:
@@ -441,8 +426,8 @@ file_names[ 1]:
;; code offset: 0xa
(global.get $__stack_pointer)
)
- ;; code offset: 0xe
- (try $label$9
+ ;; code offset: 0x12
+ (try
(do
;; code offset: 0x10
(call $foo\28\29)
@@ -466,8 +451,8 @@ file_names[ 1]:
(local.get $1)
)
)
- ;; code offset: 0x1f
- (try $label$8
+ ;; code offset: 0x27
+ (try $label
(do
;; code offset: 0x21
(call $foo\28\29)
@@ -479,8 +464,8 @@ file_names[ 1]:
)
;; code offset: 0x27
(catch_all
- ;; code offset: 0x28
- (try $label$7
+ ;; code offset: 0x39
+ (try
(do
;; code offset: 0x2a
(call $__cxa_end_catch)
@@ -513,7 +498,7 @@ file_names[ 1]:
)
)
;; code offset: 0x3e
- (rethrow $label$8)
+ (rethrow $label)
)
)
;; code offset: 0x41
@@ -537,7 +522,7 @@ file_names[ 1]:
)
;; custom section ".debug_info", size 63
;; custom section ".debug_abbrev", size 41
- ;; custom section ".debug_line", size 162
+ ;; custom section ".debug_line", size 136
;; custom section ".debug_str", size 178
;; custom section "producers", size 134
;; features section: mutable-globals, sign-ext, exception-handling
diff --git a/test/passes/fannkuch0_dwarf.bin.txt b/test/passes/fannkuch0_dwarf.bin.txt
index bee23dc18..9e9bb8537 100644
--- a/test/passes/fannkuch0_dwarf.bin.txt
+++ b/test/passes/fannkuch0_dwarf.bin.txt
@@ -5658,9 +5658,9 @@ file_names[ 3]:
(local.get $4)
)
;; code offset: 0x29d
- (block $label$1
+ (block $block
;; code offset: 0x29f
- (loop $label$2
+ (loop $label
;; code offset: 0x2a6
(local.set $20
;; code offset: 0x2a3
@@ -5713,7 +5713,7 @@ file_names[ 3]:
)
)
;; code offset: 0x2cc
- (br_if $label$1
+ (br_if $block
;; code offset: 0x2cb
(i32.eqz
;; code offset: 0x2c9
@@ -5807,8 +5807,10 @@ file_names[ 3]:
(local.get $35)
)
;; code offset: 0x315
- (br $label$2)
+ (br $label)
)
+ ;; code offset: 0x318
+ (unreachable)
)
;; code offset: 0x31f
(local.set $36
@@ -5984,11 +5986,11 @@ file_names[ 3]:
(local.get $54)
)
;; code offset: 0x3a8
- (loop $label$3 (result i32)
+ (loop $label7 (result i32)
;; code offset: 0x3aa
- (block $label$4
+ (block $block1
;; code offset: 0x3ac
- (loop $label$5
+ (loop $label1
;; code offset: 0x3b0
(local.set $55
;; code offset: 0x3ae
@@ -6038,7 +6040,7 @@ file_names[ 3]:
)
)
;; code offset: 0x3d6
- (br_if $label$4
+ (br_if $block1
;; code offset: 0x3d5
(i32.eqz
;; code offset: 0x3d3
@@ -6147,8 +6149,10 @@ file_names[ 3]:
(local.get $72)
)
;; code offset: 0x42a
- (br $label$5)
+ (br $label1)
)
+ ;; code offset: 0x42d
+ (unreachable)
)
;; code offset: 0x434
(local.set $73
@@ -6167,9 +6171,9 @@ file_names[ 3]:
)
)
;; code offset: 0x43d
- (block $label$6
+ (block $block2
;; code offset: 0x442
- (br_if $label$6
+ (br_if $block2
;; code offset: 0x441
(i32.eqz
;; code offset: 0x43f
@@ -6299,7 +6303,7 @@ file_names[ 3]:
)
)
;; code offset: 0x4a5
- (br_if $label$6
+ (br_if $block2
;; code offset: 0x4a4
(i32.eqz
;; code offset: 0x4a2
@@ -6319,9 +6323,9 @@ file_names[ 3]:
(local.get $91)
)
;; code offset: 0x4b2
- (block $label$7
+ (block $block3
;; code offset: 0x4b4
- (loop $label$8
+ (loop $label2
;; code offset: 0x4bb
(local.set $92
;; code offset: 0x4b8
@@ -6374,7 +6378,7 @@ file_names[ 3]:
)
)
;; code offset: 0x4e1
- (br_if $label$7
+ (br_if $block3
;; code offset: 0x4e0
(i32.eqz
;; code offset: 0x4de
@@ -6509,8 +6513,10 @@ file_names[ 3]:
(local.get $112)
)
;; code offset: 0x54a
- (br $label$8)
+ (br $label2)
)
+ ;; code offset: 0x54d
+ (unreachable)
)
;; code offset: 0x551
(local.set $113
@@ -6548,7 +6554,7 @@ file_names[ 3]:
(local.get $115)
)
;; code offset: 0x56f
- (loop $label$9
+ (loop $label4
;; code offset: 0x573
(local.set $116
;; code offset: 0x571
@@ -6592,9 +6598,9 @@ file_names[ 3]:
(local.get $119)
)
;; code offset: 0x595
- (block $label$10
+ (block $block4
;; code offset: 0x597
- (loop $label$11
+ (loop $label3
;; code offset: 0x59e
(local.set $120
;; code offset: 0x59b
@@ -6647,7 +6653,7 @@ file_names[ 3]:
)
)
;; code offset: 0x5c4
- (br_if $label$10
+ (br_if $block4
;; code offset: 0x5c3
(i32.eqz
;; code offset: 0x5c1
@@ -6924,8 +6930,10 @@ file_names[ 3]:
(local.get $155)
)
;; code offset: 0x6da
- (br $label$11)
+ (br $label3)
)
+ ;; code offset: 0x6dd
+ (unreachable)
)
;; code offset: 0x6e4
(local.set $156
@@ -7093,7 +7101,7 @@ file_names[ 3]:
)
)
;; code offset: 0x78d
- (br_if $label$9
+ (br_if $label4
;; code offset: 0x78a
(local.get $172)
)
@@ -7150,9 +7158,9 @@ file_names[ 3]:
)
)
;; code offset: 0x7c5
- (block $label$12
+ (block $block5
;; code offset: 0x7cb
- (br_if $label$12
+ (br_if $block5
;; code offset: 0x7ca
(i32.eqz
;; code offset: 0x7c7
@@ -7177,7 +7185,7 @@ file_names[ 3]:
)
)
;; code offset: 0x7df
- (loop $label$13
+ (loop $label6
;; code offset: 0x7e6
(local.set $181
;; code offset: 0x7e3
@@ -7245,9 +7253,9 @@ file_names[ 3]:
)
)
;; code offset: 0x825
- (block $label$14
+ (block $block6
;; code offset: 0x82b
- (br_if $label$14
+ (br_if $block6
;; code offset: 0x82a
(i32.eqz
;; code offset: 0x827
@@ -7363,9 +7371,9 @@ file_names[ 3]:
(local.get $196)
)
;; code offset: 0x89b
- (block $label$15
+ (block $block7
;; code offset: 0x89d
- (loop $label$16
+ (loop $label5
;; code offset: 0x8a4
(local.set $199
;; code offset: 0x8a1
@@ -7418,7 +7426,7 @@ file_names[ 3]:
)
)
;; code offset: 0x8d8
- (br_if $label$15
+ (br_if $block7
;; code offset: 0x8d7
(i32.eqz
;; code offset: 0x8d4
@@ -7568,8 +7576,10 @@ file_names[ 3]:
(local.get $221)
)
;; code offset: 0x96c
- (br $label$16)
+ (br $label5)
)
+ ;; code offset: 0x96f
+ (unreachable)
)
;; code offset: 0x973
(local.set $222
@@ -7739,11 +7749,11 @@ file_names[ 3]:
)
)
;; code offset: 0xa1f
- (block $label$17
+ (block $block9
;; code offset: 0xa21
- (block $label$18
+ (block $block8
;; code offset: 0xa27
- (br_if $label$18
+ (br_if $block8
;; code offset: 0xa26
(i32.eqz
;; code offset: 0xa23
@@ -7751,7 +7761,7 @@ file_names[ 3]:
)
)
;; code offset: 0xa29
- (br $label$17)
+ (br $block9)
)
;; code offset: 0xa31
(local.set $242
@@ -7784,11 +7794,11 @@ file_names[ 3]:
(local.get $244)
)
;; code offset: 0xa4b
- (br $label$13)
+ (br $label6)
)
)
;; code offset: 0xa4f
- (br $label$3)
+ (br $label7)
)
)
(func $main (param $0 i32) (param $1 i32) (result i32)
@@ -7927,11 +7937,11 @@ file_names[ 3]:
)
)
;; code offset: 0xaed
- (block $label$1
+ (block $block1
;; code offset: 0xaef
- (block $label$2
+ (block $block
;; code offset: 0xaf4
- (br_if $label$2
+ (br_if $block
;; code offset: 0xaf3
(i32.eqz
;; code offset: 0xaf1
@@ -7968,7 +7978,7 @@ file_names[ 3]:
(local.get $15)
)
;; code offset: 0xb0e
- (br $label$1)
+ (br $block1)
)
;; code offset: 0xb13
(local.set $17
@@ -8042,11 +8052,11 @@ file_names[ 3]:
)
)
;; code offset: 0xb4a
- (block $label$3
+ (block $block3
;; code offset: 0xb4c
- (block $label$4
+ (block $block2
;; code offset: 0xb51
- (br_if $label$4
+ (br_if $block2
;; code offset: 0xb50
(i32.eqz
;; code offset: 0xb4e
@@ -8086,7 +8096,7 @@ file_names[ 3]:
(local.get $28)
)
;; code offset: 0xb6e
- (br $label$3)
+ (br $block3)
)
;; code offset: 0xb76
(local.set $29
@@ -8432,9 +8442,9 @@ file_names[ 3]:
(local.get $4)
)
;; code offset: 0xd66
- (block $label$1
+ (block $block
;; code offset: 0xd68
- (loop $label$2
+ (loop $label
;; code offset: 0xd6f
(local.set $6
;; code offset: 0xd6c
@@ -8502,7 +8512,7 @@ file_names[ 3]:
)
)
;; code offset: 0xda0
- (br_if $label$1
+ (br_if $block
;; code offset: 0xd9f
(i32.eqz
;; code offset: 0xd9d
@@ -8644,8 +8654,10 @@ file_names[ 3]:
(local.get $26)
)
;; code offset: 0xe19
- (br $label$2)
+ (br $label)
)
+ ;; code offset: 0xe1c
+ (unreachable)
)
;; code offset: 0xe20
(local.set $27
@@ -8736,9 +8748,9 @@ file_names[ 3]:
(local.get $27)
)
;; code offset: 0xe67
- (block $label$3
+ (block $block1
;; code offset: 0xe69
- (loop $label$4
+ (loop $label1
;; code offset: 0xe70
(local.set $36
;; code offset: 0xe6d
@@ -8791,7 +8803,7 @@ file_names[ 3]:
)
)
;; code offset: 0xe96
- (br_if $label$3
+ (br_if $block1
;; code offset: 0xe95
(i32.eqz
;; code offset: 0xe93
@@ -8885,8 +8897,10 @@ file_names[ 3]:
(local.get $51)
)
;; code offset: 0xedf
- (br $label$4)
+ (br $label1)
)
+ ;; code offset: 0xee2
+ (unreachable)
)
;; code offset: 0xee9
(local.set $52
@@ -8904,9 +8918,9 @@ file_names[ 3]:
(local.get $52)
)
;; code offset: 0xef2
- (block $label$5
+ (block $block5
;; code offset: 0xef4
- (loop $label$6
+ (loop $label6
;; code offset: 0xefb
(local.set $53
;; code offset: 0xef8
@@ -8916,11 +8930,11 @@ file_names[ 3]:
)
)
;; code offset: 0xefd
- (block $label$7
+ (block $block4
;; code offset: 0xeff
- (block $label$8
+ (block $block2
;; code offset: 0xf04
- (br_if $label$8
+ (br_if $block2
;; code offset: 0xf03
(i32.eqz
;; code offset: 0xf01
@@ -8940,9 +8954,9 @@ file_names[ 3]:
(local.get $54)
)
;; code offset: 0xf11
- (block $label$9
+ (block $block3
;; code offset: 0xf13
- (loop $label$10
+ (loop $label2
;; code offset: 0xf1a
(local.set $55
;; code offset: 0xf17
@@ -8995,7 +9009,7 @@ file_names[ 3]:
)
)
;; code offset: 0xf40
- (br_if $label$9
+ (br_if $block3
;; code offset: 0xf3f
(i32.eqz
;; code offset: 0xf3d
@@ -9119,8 +9133,10 @@ file_names[ 3]:
(local.get $73)
)
;; code offset: 0xfa0
- (br $label$10)
+ (br $label2)
)
+ ;; code offset: 0xfa3
+ (unreachable)
)
;; code offset: 0xfa8
(local.set $74
@@ -9173,15 +9189,15 @@ file_names[ 3]:
(local.get $78)
)
;; code offset: 0xfce
- (br $label$7)
+ (br $block4)
)
;; code offset: 0xfd1
- (br $label$5)
+ (br $block5)
)
;; code offset: 0xfd4
- (block $label$11
+ (block $block6
;; code offset: 0xfd6
- (loop $label$12
+ (loop $label3
;; code offset: 0xfda
(local.set $79
;; code offset: 0xfd8
@@ -9231,7 +9247,7 @@ file_names[ 3]:
)
)
;; code offset: 0x1000
- (br_if $label$11
+ (br_if $block6
;; code offset: 0xfff
(i32.eqz
;; code offset: 0xffd
@@ -9340,11 +9356,13 @@ file_names[ 3]:
(local.get $96)
)
;; code offset: 0x1054
- (br $label$12)
+ (br $label3)
)
+ ;; code offset: 0x1057
+ (unreachable)
)
;; code offset: 0x1059
- (loop $label$13
+ (loop $label5
;; code offset: 0x1060
(local.set $97
;; code offset: 0x105d
@@ -9397,9 +9415,9 @@ file_names[ 3]:
)
)
;; code offset: 0x1083
- (block $label$14
+ (block $block7
;; code offset: 0x1088
- (br_if $label$14
+ (br_if $block7
;; code offset: 0x1087
(i32.eqz
;; code offset: 0x1085
@@ -9407,7 +9425,7 @@ file_names[ 3]:
)
)
;; code offset: 0x108a
- (br $label$5)
+ (br $block5)
)
;; code offset: 0x108f
(local.set $104
@@ -9445,9 +9463,9 @@ file_names[ 3]:
(local.get $104)
)
;; code offset: 0x10ad
- (block $label$15
+ (block $block8
;; code offset: 0x10af
- (loop $label$16
+ (loop $label4
;; code offset: 0x10b6
(local.set $107
;; code offset: 0x10b3
@@ -9500,7 +9518,7 @@ file_names[ 3]:
)
)
;; code offset: 0x10dc
- (br_if $label$15
+ (br_if $block8
;; code offset: 0x10db
(i32.eqz
;; code offset: 0x10d9
@@ -9650,8 +9668,10 @@ file_names[ 3]:
(local.get $129)
)
;; code offset: 0x1154
- (br $label$16)
+ (br $label4)
)
+ ;; code offset: 0x1157
+ (unreachable)
)
;; code offset: 0x115b
(local.set $130
@@ -9821,11 +9841,11 @@ file_names[ 3]:
)
)
;; code offset: 0x1207
- (block $label$17
+ (block $block10
;; code offset: 0x1209
- (block $label$18
+ (block $block9
;; code offset: 0x120f
- (br_if $label$18
+ (br_if $block9
;; code offset: 0x120e
(i32.eqz
;; code offset: 0x120b
@@ -9833,7 +9853,7 @@ file_names[ 3]:
)
)
;; code offset: 0x1211
- (br $label$17)
+ (br $block10)
)
;; code offset: 0x1219
(local.set $150
@@ -9866,12 +9886,14 @@ file_names[ 3]:
(local.get $152)
)
;; code offset: 0x1233
- (br $label$13)
+ (br $label5)
)
)
;; code offset: 0x1237
- (br $label$6)
+ (br $label6)
)
+ ;; code offset: 0x123a
+ (unreachable)
)
;; code offset: 0x123e
(local.set $153
@@ -9912,9 +9934,9 @@ file_names[ 3]:
(local.get $153)
)
;; code offset: 0x1263
- (block $label$19
+ (block $block11
;; code offset: 0x1265
- (loop $label$20
+ (loop $label7
;; code offset: 0x1269
(local.set $156
;; code offset: 0x1267
@@ -9964,7 +9986,7 @@ file_names[ 3]:
)
)
;; code offset: 0x129d
- (br_if $label$19
+ (br_if $block11
;; code offset: 0x129c
(i32.eqz
;; code offset: 0x1299
@@ -10046,9 +10068,9 @@ file_names[ 3]:
)
)
;; code offset: 0x12ec
- (block $label$21
+ (block $block12
;; code offset: 0x12f2
- (br_if $label$21
+ (br_if $block12
;; code offset: 0x12f1
(i32.eqz
;; code offset: 0x12ee
@@ -10123,8 +10145,10 @@ file_names[ 3]:
(local.get $176)
)
;; code offset: 0x133b
- (br $label$20)
+ (br $label7)
)
+ ;; code offset: 0x133e
+ (unreachable)
)
;; code offset: 0x1345
(local.set $177
diff --git a/test/passes/fannkuch3_dwarf.bin.txt b/test/passes/fannkuch3_dwarf.bin.txt
index 74b6446a5..b2e61acfa 100644
--- a/test/passes/fannkuch3_dwarf.bin.txt
+++ b/test/passes/fannkuch3_dwarf.bin.txt
@@ -4873,13 +4873,13 @@ file_names[ 4]:
)
)
;; code offset: 0x47
- (block $label$1
+ (block $block5
;; code offset: 0x49
- (block $label$2
+ (block $block1
;; code offset: 0x4b
- (block $label$3
+ (block $block
;; code offset: 0x52
- (br_if $label$3
+ (br_if $block
;; code offset: 0x51
(i32.le_s
;; code offset: 0x4d
@@ -4889,7 +4889,7 @@ file_names[ 4]:
)
)
;; code offset: 0x54
- (loop $label$4
+ (loop $label
;; code offset: 0x60
(i32.store
;; code offset: 0x5d
@@ -4908,7 +4908,7 @@ file_names[ 4]:
(local.get $1)
)
;; code offset: 0x6d
- (br_if $label$4
+ (br_if $label
;; code offset: 0x6c
(i32.ne
;; code offset: 0x68
@@ -4983,7 +4983,7 @@ file_names[ 4]:
(i32.const 0)
)
;; code offset: 0x9f
- (br_if $label$2
+ (br_if $block1
;; code offset: 0x9e
(i32.le_s
;; code offset: 0x9a
@@ -4993,11 +4993,11 @@ file_names[ 4]:
)
)
;; code offset: 0xa1
- (loop $label$5
+ (loop $label5
;; code offset: 0xa3
- (block $label$6
+ (block $block2
;; code offset: 0xaa
- (br_if $label$6
+ (br_if $block2
;; code offset: 0xa9
(i32.le_s
;; code offset: 0xa5
@@ -5007,7 +5007,7 @@ file_names[ 4]:
)
)
;; code offset: 0xac
- (loop $label$7
+ (loop $label1
;; code offset: 0xbd
(i32.store
;; code offset: 0xba
@@ -5049,16 +5049,16 @@ file_names[ 4]:
(local.get $1)
)
;; code offset: 0xcd
- (br_if $label$7
+ (br_if $label1
;; code offset: 0xcb
(local.get $0)
)
)
)
;; code offset: 0xd1
- (block $label$8
+ (block $block3
;; code offset: 0xdb
- (br_if $label$8
+ (br_if $block3
;; code offset: 0xda
(i32.eqz
;; code offset: 0xd8
@@ -5072,7 +5072,7 @@ file_names[ 4]:
)
)
;; code offset: 0xe5
- (br_if $label$8
+ (br_if $block3
;; code offset: 0xe4
(i32.eq
;; code offset: 0xdf
@@ -5108,16 +5108,16 @@ file_names[ 4]:
(i32.const 0)
)
;; code offset: 0xfa
- (loop $label$9
+ (loop $label3
;; code offset: 0xfe
(local.set $13
;; code offset: 0xfc
(local.get $0)
)
;; code offset: 0x100
- (block $label$10
+ (block $block4
;; code offset: 0x107
- (br_if $label$10
+ (br_if $block4
;; code offset: 0x106
(i32.lt_s
;; code offset: 0x102
@@ -5142,7 +5142,7 @@ file_names[ 4]:
(i32.const 1)
)
;; code offset: 0x114
- (loop $label$11
+ (loop $label2
;; code offset: 0x123
(local.set $15
;; code offset: 0x120
@@ -5195,7 +5195,7 @@ file_names[ 4]:
(local.get $15)
)
;; code offset: 0x14d
- (br_if $label$11
+ (br_if $label2
;; code offset: 0x14c
(i32.lt_s
;; code offset: 0x143
@@ -5266,7 +5266,7 @@ file_names[ 4]:
(local.get $1)
)
;; code offset: 0x174
- (br_if $label$9
+ (br_if $label3
;; code offset: 0x172
(local.get $1)
)
@@ -5290,7 +5290,7 @@ file_names[ 4]:
)
)
;; code offset: 0x189
- (br_if $label$1
+ (br_if $block5
;; code offset: 0x188
(i32.ge_s
;; code offset: 0x184
@@ -5300,16 +5300,16 @@ file_names[ 4]:
)
)
;; code offset: 0x18b
- (loop $label$12
+ (loop $label6
;; code offset: 0x18f
(local.set $1
;; code offset: 0x18d
(i32.const 0)
)
;; code offset: 0x191
- (block $label$13
+ (block $block6
;; code offset: 0x198
- (br_if $label$13
+ (br_if $block6
;; code offset: 0x197
(i32.le_s
;; code offset: 0x193
@@ -5319,7 +5319,7 @@ file_names[ 4]:
)
)
;; code offset: 0x19a
- (loop $label$14
+ (loop $label4
;; code offset: 0x1b4
(i32.store
;; code offset: 0x1a3
@@ -5359,7 +5359,7 @@ file_names[ 4]:
)
)
;; code offset: 0x1bc
- (br_if $label$14
+ (br_if $label4
;; code offset: 0x1bb
(i32.ne
;; code offset: 0x1b7
@@ -5424,7 +5424,7 @@ file_names[ 4]:
)
)
;; code offset: 0x1ed
- (br_if $label$5
+ (br_if $label5
;; code offset: 0x1ec
(i32.gt_s
;; code offset: 0x1e8
@@ -5434,7 +5434,7 @@ file_names[ 4]:
)
)
;; code offset: 0x1f9
- (br_if $label$1
+ (br_if $block5
;; code offset: 0x1f8
(i32.eq
;; code offset: 0x1f4
@@ -5460,9 +5460,13 @@ file_names[ 4]:
)
)
;; code offset: 0x202
- (br $label$12)
+ (br $label6)
)
+ ;; code offset: 0x205
+ (unreachable)
)
+ ;; code offset: 0x207
+ (unreachable)
)
;; code offset: 0x21d
(i32.store
@@ -5522,11 +5526,11 @@ file_names[ 4]:
(i32.const 0)
)
;; code offset: 0x234
- (loop $label$15
+ (loop $label11
;; code offset: 0x236
- (block $label$16
+ (block $block7
;; code offset: 0x23d
- (br_if $label$16
+ (br_if $block7
;; code offset: 0x23c
(i32.lt_s
;; code offset: 0x238
@@ -5536,7 +5540,7 @@ file_names[ 4]:
)
)
;; code offset: 0x23f
- (loop $label$17
+ (loop $label7
;; code offset: 0x250
(i32.store
;; code offset: 0x24d
@@ -5578,16 +5582,16 @@ file_names[ 4]:
(local.get $1)
)
;; code offset: 0x260
- (br_if $label$17
+ (br_if $label7
;; code offset: 0x25e
(local.get $0)
)
)
)
;; code offset: 0x264
- (block $label$18
+ (block $block8
;; code offset: 0x26e
- (br_if $label$18
+ (br_if $block8
;; code offset: 0x26d
(i32.eqz
;; code offset: 0x26b
@@ -5601,7 +5605,7 @@ file_names[ 4]:
)
)
;; code offset: 0x278
- (br_if $label$18
+ (br_if $block8
;; code offset: 0x277
(i32.eq
;; code offset: 0x272
@@ -5627,16 +5631,16 @@ file_names[ 4]:
(i32.const 0)
)
;; code offset: 0x285
- (loop $label$19
+ (loop $label9
;; code offset: 0x289
(local.set $10
;; code offset: 0x287
(local.get $0)
)
;; code offset: 0x28b
- (block $label$20
+ (block $block9
;; code offset: 0x292
- (br_if $label$20
+ (br_if $block9
;; code offset: 0x291
(i32.lt_s
;; code offset: 0x28d
@@ -5661,7 +5665,7 @@ file_names[ 4]:
(i32.const 1)
)
;; code offset: 0x29f
- (loop $label$21
+ (loop $label8
;; code offset: 0x2ae
(local.set $14
;; code offset: 0x2ab
@@ -5714,7 +5718,7 @@ file_names[ 4]:
(local.get $14)
)
;; code offset: 0x2d8
- (br_if $label$21
+ (br_if $label8
;; code offset: 0x2d7
(i32.lt_s
;; code offset: 0x2ce
@@ -5785,7 +5789,7 @@ file_names[ 4]:
(local.get $1)
)
;; code offset: 0x2ff
- (br_if $label$19
+ (br_if $label9
;; code offset: 0x2fd
(local.get $1)
)
@@ -5809,7 +5813,7 @@ file_names[ 4]:
)
)
;; code offset: 0x314
- (br_if $label$1
+ (br_if $block5
;; code offset: 0x313
(i32.ge_s
;; code offset: 0x30f
@@ -5819,16 +5823,16 @@ file_names[ 4]:
)
)
;; code offset: 0x316
- (loop $label$22
+ (loop $label12
;; code offset: 0x31a
(local.set $1
;; code offset: 0x318
(i32.const 0)
)
;; code offset: 0x31c
- (block $label$23
+ (block $block10
;; code offset: 0x323
- (br_if $label$23
+ (br_if $block10
;; code offset: 0x322
(i32.lt_s
;; code offset: 0x31e
@@ -5838,7 +5842,7 @@ file_names[ 4]:
)
)
;; code offset: 0x325
- (loop $label$24
+ (loop $label10
;; code offset: 0x33f
(i32.store
;; code offset: 0x32e
@@ -5878,7 +5882,7 @@ file_names[ 4]:
)
)
;; code offset: 0x347
- (br_if $label$24
+ (br_if $label10
;; code offset: 0x346
(i32.ne
;; code offset: 0x342
@@ -5943,7 +5947,7 @@ file_names[ 4]:
)
)
;; code offset: 0x378
- (br_if $label$15
+ (br_if $label11
;; code offset: 0x377
(i32.gt_s
;; code offset: 0x373
@@ -5953,7 +5957,7 @@ file_names[ 4]:
)
)
;; code offset: 0x384
- (br_if $label$1
+ (br_if $block5
;; code offset: 0x383
(i32.eq
;; code offset: 0x37f
@@ -5979,9 +5983,13 @@ file_names[ 4]:
)
)
;; code offset: 0x38d
- (br $label$22)
+ (br $label12)
)
+ ;; code offset: 0x390
+ (unreachable)
)
+ ;; code offset: 0x392
+ (unreachable)
)
;; code offset: 0x396
(call $free
@@ -6023,13 +6031,13 @@ file_names[ 4]:
)
)
;; code offset: 0x3bd
- (block $label$1
+ (block $block2
;; code offset: 0x3bf
- (block $label$2
+ (block $block1
;; code offset: 0x3c1
- (block $label$3
+ (block $block
;; code offset: 0x3c8
- (br_if $label$3
+ (br_if $block
;; code offset: 0x3c7
(i32.lt_s
;; code offset: 0x3c3
@@ -6044,7 +6052,7 @@ file_names[ 4]:
(i32.const 0)
)
;; code offset: 0x3da
- (br_if $label$2
+ (br_if $block1
;; code offset: 0x3d9
(i32.gt_s
;; code offset: 0x3d5
@@ -6077,12 +6085,12 @@ file_names[ 4]:
(i32.const 1)
)
;; code offset: 0x3e7
- (br $label$1)
+ (br $block2)
)
;; code offset: 0x3ea
- (block $label$4
+ (block $block3
;; code offset: 0x3f1
- (br_if $label$4
+ (br_if $block3
;; code offset: 0x3f0
(i32.eq
;; code offset: 0x3ec
@@ -6112,7 +6120,7 @@ file_names[ 4]:
(i32.const 0)
)
;; code offset: 0x402
- (loop $label$5
+ (loop $label
;; code offset: 0x40c
(i32.store offset=8
;; code offset: 0x408
@@ -6146,7 +6154,7 @@ file_names[ 4]:
(local.get $3)
)
;; code offset: 0x42b
- (br_if $label$5
+ (br_if $label
;; code offset: 0x42a
(i32.ne
;; code offset: 0x426
@@ -6195,15 +6203,15 @@ file_names[ 4]:
)
)
;; code offset: 0x444
- (block $label$6
+ (block $block8
;; code offset: 0x446
- (block $label$7
+ (block $block6
;; code offset: 0x448
- (block $label$8
+ (block $block5
;; code offset: 0x44a
- (block $label$9
+ (block $block4
;; code offset: 0x451
- (br_if $label$9
+ (br_if $block4
;; code offset: 0x450
(i32.le_s
;; code offset: 0x44c
@@ -6213,7 +6221,7 @@ file_names[ 4]:
)
)
;; code offset: 0x453
- (loop $label$10
+ (loop $label1
;; code offset: 0x45f
(i32.store
;; code offset: 0x45c
@@ -6232,7 +6240,7 @@ file_names[ 4]:
(local.get $0)
)
;; code offset: 0x46c
- (br_if $label$10
+ (br_if $label1
;; code offset: 0x46b
(i32.ne
;; code offset: 0x467
@@ -6261,7 +6269,7 @@ file_names[ 4]:
(local.get $4)
)
;; code offset: 0x477
- (br $label$8)
+ (br $block5)
)
;; code offset: 0x47c
(local.set $7
@@ -6274,17 +6282,17 @@ file_names[ 4]:
(local.get $4)
)
;; code offset: 0x482
- (br $label$7)
+ (br $block6)
)
;; code offset: 0x485
- (loop $label$11
+ (loop $label6
;; code offset: 0x489
(local.set $0
;; code offset: 0x487
(i32.const 0)
)
;; code offset: 0x48b
- (loop $label$12
+ (loop $label2
;; code offset: 0x49d
(i32.store offset=16
;; code offset: 0x48d
@@ -6326,7 +6334,7 @@ file_names[ 4]:
)
)
;; code offset: 0x4b5
- (br_if $label$12
+ (br_if $label2
;; code offset: 0x4b4
(i32.ne
;; code offset: 0x4b0
@@ -6353,9 +6361,9 @@ file_names[ 4]:
)
)
;; code offset: 0x4bd
- (block $label$13
+ (block $block7
;; code offset: 0x4c4
- (br_if $label$13
+ (br_if $block7
;; code offset: 0x4c3
(i32.le_s
;; code offset: 0x4bf
@@ -6365,7 +6373,7 @@ file_names[ 4]:
)
)
;; code offset: 0x4c6
- (loop $label$14
+ (loop $label3
;; code offset: 0x4d7
(i32.store
;; code offset: 0x4d4
@@ -6407,14 +6415,14 @@ file_names[ 4]:
(local.get $0)
)
;; code offset: 0x4e7
- (br_if $label$14
+ (br_if $label3
;; code offset: 0x4e5
(local.get $8)
)
)
)
;; code offset: 0x4f0
- (br_if $label$6
+ (br_if $block8
;; code offset: 0x4ef
(i32.eq
;; code offset: 0x4eb
@@ -6434,7 +6442,7 @@ file_names[ 4]:
)
)
;; code offset: 0x4f9
- (loop $label$15
+ (loop $label5
;; code offset: 0x4fd
(local.set $0
;; code offset: 0x4fb
@@ -6449,9 +6457,9 @@ file_names[ 4]:
)
)
;; code offset: 0x506
- (block $label$16
+ (block $block9
;; code offset: 0x50d
- (br_if $label$16
+ (br_if $block9
;; code offset: 0x50c
(i32.le_s
;; code offset: 0x508
@@ -6461,7 +6469,7 @@ file_names[ 4]:
)
)
;; code offset: 0x50f
- (loop $label$17
+ (loop $label4
;; code offset: 0x529
(i32.store
;; code offset: 0x518
@@ -6501,7 +6509,7 @@ file_names[ 4]:
)
)
;; code offset: 0x531
- (br_if $label$17
+ (br_if $label4
;; code offset: 0x530
(i32.ne
;; code offset: 0x52c
@@ -6566,9 +6574,9 @@ file_names[ 4]:
)
)
;; code offset: 0x55d
- (block $label$18
+ (block $block10
;; code offset: 0x564
- (br_if $label$18
+ (br_if $block10
;; code offset: 0x563
(i32.gt_s
;; code offset: 0x55f
@@ -6578,7 +6586,7 @@ file_names[ 4]:
)
)
;; code offset: 0x570
- (br_if $label$15
+ (br_if $label5
;; code offset: 0x56f
(i32.ne
;; code offset: 0x56b
@@ -6596,11 +6604,11 @@ file_names[ 4]:
)
)
;; code offset: 0x572
- (br $label$6)
+ (br $block8)
)
)
;; code offset: 0x579
- (br_if $label$6
+ (br_if $block8
;; code offset: 0x578
(i32.eqz
;; code offset: 0x576
@@ -6608,11 +6616,13 @@ file_names[ 4]:
)
)
;; code offset: 0x57b
- (br $label$11)
+ (br $label6)
)
+ ;; code offset: 0x57e
+ (unreachable)
)
;; code offset: 0x580
- (loop $label$19
+ (loop $label10
;; code offset: 0x586
(drop
;; code offset: 0x584
@@ -6622,9 +6632,9 @@ file_names[ 4]:
)
)
;; code offset: 0x587
- (block $label$20
+ (block $block11
;; code offset: 0x58e
- (br_if $label$20
+ (br_if $block11
;; code offset: 0x58d
(i32.le_s
;; code offset: 0x589
@@ -6634,7 +6644,7 @@ file_names[ 4]:
)
)
;; code offset: 0x590
- (loop $label$21
+ (loop $label7
;; code offset: 0x5a1
(i32.store
;; code offset: 0x59e
@@ -6676,14 +6686,14 @@ file_names[ 4]:
(local.get $0)
)
;; code offset: 0x5b1
- (br_if $label$21
+ (br_if $label7
;; code offset: 0x5af
(local.get $8)
)
)
)
;; code offset: 0x5ba
- (br_if $label$6
+ (br_if $block8
;; code offset: 0x5b9
(i32.eq
;; code offset: 0x5b5
@@ -6703,7 +6713,7 @@ file_names[ 4]:
)
)
;; code offset: 0x5c3
- (loop $label$22
+ (loop $label9
;; code offset: 0x5ca
(local.set $8
;; code offset: 0x5c7
@@ -6718,9 +6728,9 @@ file_names[ 4]:
(i32.const 0)
)
;; code offset: 0x5d0
- (block $label$23
+ (block $block12
;; code offset: 0x5d7
- (br_if $label$23
+ (br_if $block12
;; code offset: 0x5d6
(i32.lt_s
;; code offset: 0x5d2
@@ -6730,7 +6740,7 @@ file_names[ 4]:
)
)
;; code offset: 0x5d9
- (loop $label$24
+ (loop $label8
;; code offset: 0x5f3
(i32.store
;; code offset: 0x5e2
@@ -6770,7 +6780,7 @@ file_names[ 4]:
)
)
;; code offset: 0x5fb
- (br_if $label$24
+ (br_if $label8
;; code offset: 0x5fa
(i32.ne
;; code offset: 0x5f6
@@ -6835,9 +6845,9 @@ file_names[ 4]:
)
)
;; code offset: 0x627
- (block $label$25
+ (block $block13
;; code offset: 0x62e
- (br_if $label$25
+ (br_if $block13
;; code offset: 0x62d
(i32.gt_s
;; code offset: 0x629
@@ -6847,7 +6857,7 @@ file_names[ 4]:
)
)
;; code offset: 0x63a
- (br_if $label$22
+ (br_if $label9
;; code offset: 0x639
(i32.ne
;; code offset: 0x635
@@ -6865,11 +6875,11 @@ file_names[ 4]:
)
)
;; code offset: 0x63c
- (br $label$6)
+ (br $block8)
)
)
;; code offset: 0x642
- (br_if $label$19
+ (br_if $label10
;; code offset: 0x640
(local.get $7)
)
@@ -6896,9 +6906,9 @@ file_names[ 4]:
(i32.const 0)
)
;; code offset: 0x656
- (block $label$26
+ (block $block14
;; code offset: 0x65b
- (br_if $label$26
+ (br_if $block14
;; code offset: 0x65a
(i32.eqz
;; code offset: 0x658
@@ -6911,7 +6921,7 @@ file_names[ 4]:
(i32.const 0)
)
;; code offset: 0x661
- (loop $label$27
+ (loop $label11
;; code offset: 0x667
(local.set $1
;; code offset: 0x665
@@ -6956,7 +6966,7 @@ file_names[ 4]:
(local.get $6)
)
;; code offset: 0x686
- (br_if $label$27
+ (br_if $label11
;; code offset: 0x684
(local.get $6)
)
diff --git a/test/passes/fannkuch3_manyopts_dwarf.bin.txt b/test/passes/fannkuch3_manyopts_dwarf.bin.txt
index 3ffb81efe..6feceabff 100644
--- a/test/passes/fannkuch3_manyopts_dwarf.bin.txt
+++ b/test/passes/fannkuch3_manyopts_dwarf.bin.txt
@@ -4710,8 +4710,8 @@ file_names[ 4]:
(local $14 i32)
(local $15 i32)
(local $16 i32)
- (local $17 i32)
- (local $18 i32)
+ (local $scratch i32)
+ (local $scratch_18 i32)
;; code offset: 0x35
(local.set $3
;; code offset: 0x33
@@ -4751,9 +4751,9 @@ file_names[ 4]:
)
)
;; code offset: 0x43
- (block $label$1
+ (block $block2
;; code offset: 0x45
- (block $label$2
+ (block $block
;; code offset: 0x4c
(if
;; code offset: 0x4b
@@ -4765,7 +4765,7 @@ file_names[ 4]:
)
(then
;; code offset: 0x4e
- (loop $label$4
+ (loop $label
;; code offset: 0x5a
(i32.store
;; code offset: 0x57
@@ -4784,7 +4784,7 @@ file_names[ 4]:
(local.get $1)
)
;; code offset: 0x67
- (br_if $label$4
+ (br_if $label
;; code offset: 0x66
(i32.ne
;; code offset: 0x62
@@ -4854,7 +4854,7 @@ file_names[ 4]:
(local.get $1)
)
;; code offset: 0x95
- (br_if $label$2
+ (br_if $block
;; code offset: 0x94
(i32.le_s
;; code offset: 0x90
@@ -4864,7 +4864,7 @@ file_names[ 4]:
)
)
;; code offset: 0x97
- (loop $label$5
+ (loop $label5
;; code offset: 0x9e
(if
;; code offset: 0x9d
@@ -4876,7 +4876,7 @@ file_names[ 4]:
)
(then
;; code offset: 0xa0
- (loop $label$7
+ (loop $label1
;; code offset: 0xb1
(i32.store
;; code offset: 0xae
@@ -4902,10 +4902,9 @@ file_names[ 4]:
;; code offset: 0xaf
(local.get $2)
)
- ;; code offset: 0xbd
- (br_if $label$7
+ (br_if $label1
(block (result i32)
- (local.set $17
+ (local.set $scratch
;; code offset: 0xb8
(i32.gt_s
;; code offset: 0xb4
@@ -4919,16 +4918,17 @@ file_names[ 4]:
;; code offset: 0xb9
(local.get $1)
)
- (local.get $17)
+ ;; code offset: 0xbd
+ (local.get $scratch)
)
)
)
)
)
;; code offset: 0xc1
- (block $label$8
+ (block $block1
;; code offset: 0xcb
- (br_if $label$8
+ (br_if $block1
;; code offset: 0xca
(i32.eqz
;; code offset: 0xc8
@@ -4942,7 +4942,7 @@ file_names[ 4]:
)
)
;; code offset: 0xd5
- (br_if $label$8
+ (br_if $block1
;; code offset: 0xd4
(i32.eq
;; code offset: 0xcf
@@ -4978,7 +4978,7 @@ file_names[ 4]:
(i32.const 0)
)
;; code offset: 0xea
- (loop $label$9
+ (loop $label3
;; code offset: 0xee
(local.set $16
;; code offset: 0xec
@@ -5010,7 +5010,7 @@ file_names[ 4]:
(i32.const 1)
)
;; code offset: 0x102
- (loop $label$11
+ (loop $label2
;; code offset: 0x111
(local.set $15
;; code offset: 0x10e
@@ -5063,7 +5063,7 @@ file_names[ 4]:
(local.get $15)
)
;; code offset: 0x13b
- (br_if $label$11
+ (br_if $label2
;; code offset: 0x13a
(i32.lt_s
;; code offset: 0x131
@@ -5135,7 +5135,7 @@ file_names[ 4]:
(local.get $1)
)
;; code offset: 0x162
- (br_if $label$9
+ (br_if $label3
;; code offset: 0x160
(local.get $1)
)
@@ -5159,7 +5159,7 @@ file_names[ 4]:
)
)
;; code offset: 0x177
- (br_if $label$1
+ (br_if $block2
;; code offset: 0x176
(i32.ge_s
;; code offset: 0x172
@@ -5169,7 +5169,7 @@ file_names[ 4]:
)
)
;; code offset: 0x179
- (loop $label$12
+ (loop $label6
;; code offset: 0x17d
(local.set $1
;; code offset: 0x17b
@@ -5186,7 +5186,7 @@ file_names[ 4]:
)
(then
;; code offset: 0x186
- (loop $label$14
+ (loop $label4
;; code offset: 0x1a0
(i32.store
;; code offset: 0x18f
@@ -5226,7 +5226,7 @@ file_names[ 4]:
)
)
;; code offset: 0x1a8
- (br_if $label$14
+ (br_if $label4
;; code offset: 0x1a7
(i32.ne
;; code offset: 0x1a3
@@ -5292,7 +5292,7 @@ file_names[ 4]:
)
)
;; code offset: 0x1d9
- (br_if $label$5
+ (br_if $label5
;; code offset: 0x1d8
(i32.gt_s
;; code offset: 0x1d4
@@ -5302,7 +5302,7 @@ file_names[ 4]:
)
)
;; code offset: 0x1e5
- (br_if $label$1
+ (br_if $block2
;; code offset: 0x1e4
(i32.eq
;; code offset: 0x1e0
@@ -5328,9 +5328,13 @@ file_names[ 4]:
)
)
;; code offset: 0x1ee
- (br $label$12)
+ (br $label6)
)
+ ;; code offset: 0x1f1
+ (unreachable)
)
+ ;; code offset: 0x1f3
+ (unreachable)
)
)
;; code offset: 0x209
@@ -5386,7 +5390,7 @@ file_names[ 4]:
)
)
;; code offset: 0x21c
- (loop $label$15
+ (loop $label11
;; code offset: 0x223
(if
;; code offset: 0x222
@@ -5398,7 +5402,7 @@ file_names[ 4]:
)
(then
;; code offset: 0x225
- (loop $label$17
+ (loop $label7
;; code offset: 0x236
(i32.store
;; code offset: 0x233
@@ -5424,10 +5428,9 @@ file_names[ 4]:
;; code offset: 0x234
(local.get $2)
)
- ;; code offset: 0x242
- (br_if $label$17
+ (br_if $label7
(block (result i32)
- (local.set $18
+ (local.set $scratch_18
;; code offset: 0x23d
(i32.gt_s
;; code offset: 0x239
@@ -5441,16 +5444,17 @@ file_names[ 4]:
;; code offset: 0x23e
(local.get $1)
)
- (local.get $18)
+ ;; code offset: 0x242
+ (local.get $scratch_18)
)
)
)
)
)
;; code offset: 0x246
- (block $label$18
+ (block $block3
;; code offset: 0x250
- (br_if $label$18
+ (br_if $block3
;; code offset: 0x24f
(i32.eqz
;; code offset: 0x24d
@@ -5464,7 +5468,7 @@ file_names[ 4]:
)
)
;; code offset: 0x25a
- (br_if $label$18
+ (br_if $block3
;; code offset: 0x259
(i32.eq
;; code offset: 0x254
@@ -5490,7 +5494,7 @@ file_names[ 4]:
(i32.const 0)
)
;; code offset: 0x267
- (loop $label$19
+ (loop $label9
;; code offset: 0x26b
(local.set $10
;; code offset: 0x269
@@ -5522,7 +5526,7 @@ file_names[ 4]:
(i32.const 1)
)
;; code offset: 0x27f
- (loop $label$21
+ (loop $label8
;; code offset: 0x28e
(local.set $14
;; code offset: 0x28b
@@ -5575,7 +5579,7 @@ file_names[ 4]:
(local.get $14)
)
;; code offset: 0x2b8
- (br_if $label$21
+ (br_if $label8
;; code offset: 0x2b7
(i32.lt_s
;; code offset: 0x2ae
@@ -5647,7 +5651,7 @@ file_names[ 4]:
(local.get $1)
)
;; code offset: 0x2df
- (br_if $label$19
+ (br_if $label9
;; code offset: 0x2dd
(local.get $1)
)
@@ -5671,7 +5675,7 @@ file_names[ 4]:
)
)
;; code offset: 0x2f4
- (br_if $label$1
+ (br_if $block2
;; code offset: 0x2f3
(i32.ge_s
;; code offset: 0x2ef
@@ -5681,7 +5685,7 @@ file_names[ 4]:
)
)
;; code offset: 0x2f6
- (loop $label$22
+ (loop $label12
;; code offset: 0x2fa
(local.set $1
;; code offset: 0x2f8
@@ -5698,7 +5702,7 @@ file_names[ 4]:
)
(then
;; code offset: 0x303
- (loop $label$24
+ (loop $label10
;; code offset: 0x31d
(i32.store
;; code offset: 0x30c
@@ -5738,7 +5742,7 @@ file_names[ 4]:
)
)
;; code offset: 0x325
- (br_if $label$24
+ (br_if $label10
;; code offset: 0x324
(i32.ne
;; code offset: 0x320
@@ -5804,7 +5808,7 @@ file_names[ 4]:
)
)
;; code offset: 0x356
- (br_if $label$15
+ (br_if $label11
;; code offset: 0x355
(i32.gt_s
;; code offset: 0x351
@@ -5814,7 +5818,7 @@ file_names[ 4]:
)
)
;; code offset: 0x362
- (br_if $label$1
+ (br_if $block2
;; code offset: 0x361
(i32.eq
;; code offset: 0x35d
@@ -5840,9 +5844,13 @@ file_names[ 4]:
)
)
;; code offset: 0x36b
- (br $label$22)
+ (br $label12)
)
+ ;; code offset: 0x36e
+ (unreachable)
)
+ ;; code offset: 0x370
+ (unreachable)
)
;; code offset: 0x374
(call $free
@@ -5870,8 +5878,8 @@ file_names[ 4]:
(local $6 i32)
(local $7 i32)
(local $8 i32)
- (local $9 i32)
- (local $10 i32)
+ (local $scratch i32)
+ (local $scratch_10 i32)
;; code offset: 0x399
(global.set $global$0
;; code offset: 0x397
@@ -5886,9 +5894,9 @@ file_names[ 4]:
)
)
;; code offset: 0x39b
- (block $label$1
+ (block $block1
;; code offset: 0x39d
- (block $label$2
+ (block $block
;; code offset: 0x3a4
(if
;; code offset: 0x3a3
@@ -5900,7 +5908,7 @@ file_names[ 4]:
)
(then
;; code offset: 0x3b2
- (br_if $label$2
+ (br_if $block
;; code offset: 0x3b1
(i32.gt_s
;; code offset: 0x3ad
@@ -5934,7 +5942,7 @@ file_names[ 4]:
(i32.const 1)
)
;; code offset: 0x3bf
- (br $label$1)
+ (br $block1)
)
;; code offset: 0x3c7
(if
@@ -5967,7 +5975,7 @@ file_names[ 4]:
(i32.const 0)
)
;; code offset: 0x3d8
- (loop $label$5
+ (loop $label
;; code offset: 0x3e2
(i32.store offset=8
;; code offset: 0x3de
@@ -6001,7 +6009,7 @@ file_names[ 4]:
(local.get $4)
)
;; code offset: 0x401
- (br_if $label$5
+ (br_if $label
;; code offset: 0x400
(i32.ne
;; code offset: 0x3fc
@@ -6051,11 +6059,11 @@ file_names[ 4]:
)
)
;; code offset: 0x41a
- (block $label$6
+ (block $block4
;; code offset: 0x41c
- (block $label$7
+ (block $block3
;; code offset: 0x41e
- (block $label$8
+ (block $block2
;; code offset: 0x425
(if
;; code offset: 0x424
@@ -6067,7 +6075,7 @@ file_names[ 4]:
)
(then
;; code offset: 0x427
- (loop $label$10
+ (loop $label1
;; code offset: 0x433
(i32.store
;; code offset: 0x430
@@ -6086,7 +6094,7 @@ file_names[ 4]:
(local.get $0)
)
;; code offset: 0x440
- (br_if $label$10
+ (br_if $label1
;; code offset: 0x43f
(i32.ne
;; code offset: 0x43b
@@ -6115,7 +6123,7 @@ file_names[ 4]:
(local.get $3)
)
;; code offset: 0x44b
- (br $label$8)
+ (br $block2)
)
)
;; code offset: 0x450
@@ -6129,17 +6137,17 @@ file_names[ 4]:
(local.get $3)
)
;; code offset: 0x456
- (br $label$7)
+ (br $block3)
)
;; code offset: 0x459
- (loop $label$11
+ (loop $label6
;; code offset: 0x45d
(local.set $0
;; code offset: 0x45b
(i32.const 0)
)
;; code offset: 0x45f
- (loop $label$12
+ (loop $label2
;; code offset: 0x471
(i32.store offset=16
;; code offset: 0x461
@@ -6181,7 +6189,7 @@ file_names[ 4]:
)
)
;; code offset: 0x489
- (br_if $label$12
+ (br_if $label2
;; code offset: 0x488
(i32.ne
;; code offset: 0x484
@@ -6218,7 +6226,7 @@ file_names[ 4]:
)
(then
;; code offset: 0x498
- (loop $label$14
+ (loop $label3
;; code offset: 0x4a9
(i32.store
;; code offset: 0x4a6
@@ -6244,10 +6252,9 @@ file_names[ 4]:
;; code offset: 0x4a7
(local.get $2)
)
- ;; code offset: 0x4b5
- (br_if $label$14
+ (br_if $label3
(block (result i32)
- (local.set $9
+ (local.set $scratch
;; code offset: 0x4b0
(i32.gt_s
;; code offset: 0x4ac
@@ -6261,14 +6268,15 @@ file_names[ 4]:
;; code offset: 0x4b1
(local.get $0)
)
- (local.get $9)
+ ;; code offset: 0x4b5
+ (local.get $scratch)
)
)
)
)
)
;; code offset: 0x4be
- (br_if $label$6
+ (br_if $block4
;; code offset: 0x4bd
(i32.eq
;; code offset: 0x4b9
@@ -6288,7 +6296,7 @@ file_names[ 4]:
)
)
;; code offset: 0x4c7
- (loop $label$15
+ (loop $label5
;; code offset: 0x4cb
(local.set $0
;; code offset: 0x4c9
@@ -6313,7 +6321,7 @@ file_names[ 4]:
)
(then
;; code offset: 0x4db
- (loop $label$17
+ (loop $label4
;; code offset: 0x4f5
(i32.store
;; code offset: 0x4e4
@@ -6353,7 +6361,7 @@ file_names[ 4]:
)
)
;; code offset: 0x4fd
- (br_if $label$17
+ (br_if $label4
;; code offset: 0x4fc
(i32.ne
;; code offset: 0x4f8
@@ -6429,7 +6437,7 @@ file_names[ 4]:
)
(then
;; code offset: 0x53a
- (br_if $label$15
+ (br_if $label5
;; code offset: 0x539
(i32.ne
;; code offset: 0x535
@@ -6447,21 +6455,21 @@ file_names[ 4]:
)
)
;; code offset: 0x53c
- (br $label$6)
+ (br $block4)
)
)
)
;; code offset: 0x542
- (br_if $label$11
+ (br_if $label6
;; code offset: 0x540
(local.get $6)
)
)
;; code offset: 0x545
- (br $label$6)
+ (br $block4)
)
;; code offset: 0x548
- (loop $label$19
+ (loop $label10
;; code offset: 0x54e
(drop
;; code offset: 0x54c
@@ -6481,7 +6489,7 @@ file_names[ 4]:
)
(then
;; code offset: 0x556
- (loop $label$21
+ (loop $label7
;; code offset: 0x567
(i32.store
;; code offset: 0x564
@@ -6507,10 +6515,9 @@ file_names[ 4]:
;; code offset: 0x565
(local.get $2)
)
- ;; code offset: 0x573
- (br_if $label$21
+ (br_if $label7
(block (result i32)
- (local.set $10
+ (local.set $scratch_10
;; code offset: 0x56e
(i32.gt_s
;; code offset: 0x56a
@@ -6524,14 +6531,15 @@ file_names[ 4]:
;; code offset: 0x56f
(local.get $0)
)
- (local.get $10)
+ ;; code offset: 0x573
+ (local.get $scratch_10)
)
)
)
)
)
;; code offset: 0x57c
- (br_if $label$6
+ (br_if $block4
;; code offset: 0x57b
(i32.eq
;; code offset: 0x577
@@ -6551,7 +6559,7 @@ file_names[ 4]:
)
)
;; code offset: 0x585
- (loop $label$22
+ (loop $label9
;; code offset: 0x58c
(local.set $7
;; code offset: 0x589
@@ -6576,7 +6584,7 @@ file_names[ 4]:
)
(then
;; code offset: 0x599
- (loop $label$24
+ (loop $label8
;; code offset: 0x5b3
(i32.store
;; code offset: 0x5a2
@@ -6616,7 +6624,7 @@ file_names[ 4]:
)
)
;; code offset: 0x5bb
- (br_if $label$24
+ (br_if $label8
;; code offset: 0x5ba
(i32.ne
;; code offset: 0x5b6
@@ -6692,7 +6700,7 @@ file_names[ 4]:
)
(then
;; code offset: 0x5f8
- (br_if $label$22
+ (br_if $label9
;; code offset: 0x5f7
(i32.ne
;; code offset: 0x5f3
@@ -6710,12 +6718,12 @@ file_names[ 4]:
)
)
;; code offset: 0x5fa
- (br $label$6)
+ (br $block4)
)
)
)
;; code offset: 0x600
- (br_if $label$19
+ (br_if $label10
;; code offset: 0x5fe
(local.get $6)
)
@@ -6747,7 +6755,7 @@ file_names[ 4]:
(local.get $4)
(then
;; code offset: 0x618
- (loop $label$27
+ (loop $label11
;; code offset: 0x61e
(local.set $1
;; code offset: 0x61c
@@ -6792,7 +6800,7 @@ file_names[ 4]:
(local.get $2)
)
;; code offset: 0x63d
- (br_if $label$27
+ (br_if $label11
;; code offset: 0x63b
(local.get $2)
)
diff --git a/test/passes/fib2_dwarf.bin.txt b/test/passes/fib2_dwarf.bin.txt
index 9d633f78b..37c49c336 100644
--- a/test/passes/fib2_dwarf.bin.txt
+++ b/test/passes/fib2_dwarf.bin.txt
@@ -637,9 +637,9 @@ file_names[ 1]:
(i32.const 1)
)
;; code offset: 0x12
- (block $label$1
+ (block $block
;; code offset: 0x19
- (br_if $label$1
+ (br_if $block
;; code offset: 0x18
(i32.lt_s
;; code offset: 0x14
@@ -659,7 +659,7 @@ file_names[ 1]:
(i32.const 0)
)
;; code offset: 0x23
- (loop $label$2
+ (loop $label
;; code offset: 0x2c
(local.set $1
;; code offset: 0x2b
@@ -679,7 +679,7 @@ file_names[ 1]:
(local.get $4)
)
;; code offset: 0x3c
- (br_if $label$2
+ (br_if $label
;; code offset: 0x3b
(i32.ne
;; code offset: 0x37
diff --git a/test/passes/fib2_emptylocspan_dwarf.bin.txt b/test/passes/fib2_emptylocspan_dwarf.bin.txt
index 6d9078ccc..e59fe19bb 100644
--- a/test/passes/fib2_emptylocspan_dwarf.bin.txt
+++ b/test/passes/fib2_emptylocspan_dwarf.bin.txt
@@ -637,9 +637,9 @@ file_names[ 1]:
(i32.const 1)
)
;; code offset: 0x12
- (block $label$1
+ (block $block
;; code offset: 0x19
- (br_if $label$1
+ (br_if $block
;; code offset: 0x18
(i32.lt_s
;; code offset: 0x14
@@ -659,7 +659,7 @@ file_names[ 1]:
(i32.const 0)
)
;; code offset: 0x23
- (loop $label$2
+ (loop $label
;; code offset: 0x2c
(local.set $1
;; code offset: 0x2b
@@ -679,7 +679,7 @@ file_names[ 1]:
(local.get $4)
)
;; code offset: 0x3c
- (br_if $label$2
+ (br_if $label
;; code offset: 0x3b
(i32.ne
;; code offset: 0x37
diff --git a/test/passes/fib_nonzero-low-pc_dwarf.bin.txt b/test/passes/fib_nonzero-low-pc_dwarf.bin.txt
index 8d1c7faa8..a9294f7e1 100644
--- a/test/passes/fib_nonzero-low-pc_dwarf.bin.txt
+++ b/test/passes/fib_nonzero-low-pc_dwarf.bin.txt
@@ -539,9 +539,9 @@ file_names[ 1]:
(i32.const 1)
)
;; code offset: 0x19
- (block $label$1
+ (block $block
;; code offset: 0x20
- (br_if $label$1
+ (br_if $block
;; code offset: 0x1f
(i32.le_s
;; code offset: 0x1b
@@ -561,7 +561,7 @@ file_names[ 1]:
(i32.const 1)
)
;; code offset: 0x2a
- (loop $label$2
+ (loop $label
;; code offset: 0x33
(local.set $1
;; code offset: 0x32
@@ -601,7 +601,7 @@ file_names[ 1]:
(local.get $4)
)
;; code offset: 0x4a
- (br_if $label$2
+ (br_if $label
;; code offset: 0x49
(i32.eqz
;; code offset: 0x47
diff --git a/test/passes/flatten.bin.txt b/test/passes/flatten.bin.txt
index 53fbcc397..680f2c393 100644
--- a/test/passes/flatten.bin.txt
+++ b/test/passes/flatten.bin.txt
@@ -100,10 +100,120 @@
(local $6 i64)
(local $7 f32)
(local $8 f64)
- (block $label$1
+ (local $9 f32)
+ (local $10 f32)
+ (local $11 f64)
+ (local $12 f64)
+ (local $13 i32)
+ (local $14 i32)
+ (local $15 i32)
+ (local $16 i32)
+ (local $17 f32)
+ (local $18 f32)
+ (local $19 i64)
+ (local $20 i32)
+ (local $21 i64)
+ (local $22 i32)
+ (local $23 f64)
+ (local $24 f64)
+ (block
(nop)
(unreachable)
+ (i64.eqz
+ (unreachable)
+ )
+ (drop
+ (unreachable)
+ )
(unreachable)
+ (local.set $9
+ (local.get $1)
+ )
+ (local.set $10
+ (f32.neg
+ (local.get $9)
+ )
+ )
+ (drop
+ (local.get $10)
+ )
+ (local.set $11
+ (local.get $2)
+ )
+ (local.set $12
+ (f64.neg
+ (local.get $11)
+ )
+ )
+ (drop
+ (local.get $12)
+ )
+ (local.set $13
+ (local.get $3)
+ )
+ (local.set $14
+ (i32.eqz
+ (local.get $13)
+ )
+ )
+ (drop
+ (local.get $14)
+ )
+ (local.set $15
+ (local.get $4)
+ )
+ (local.set $16
+ (i32.eqz
+ (local.get $15)
+ )
+ )
+ (drop
+ (local.get $16)
+ )
+ (local.set $17
+ (local.get $7)
+ )
+ (local.set $18
+ (f32.neg
+ (local.get $17)
+ )
+ )
+ (drop
+ (local.get $18)
+ )
+ (local.set $19
+ (local.get $5)
+ )
+ (local.set $20
+ (i64.eqz
+ (local.get $19)
+ )
+ )
+ (drop
+ (local.get $20)
+ )
+ (local.set $21
+ (local.get $6)
+ )
+ (local.set $22
+ (i64.eqz
+ (local.get $21)
+ )
+ )
+ (drop
+ (local.get $22)
+ )
+ (local.set $23
+ (local.get $8)
+ )
+ (local.set $24
+ (f64.neg
+ (local.get $23)
+ )
+ )
+ (drop
+ (local.get $24)
+ )
)
(unreachable)
)
@@ -138,7 +248,7 @@
(local $32 f64)
(local $33 f64)
(local $34 f64)
- (block $label$1
+ (block
(local.set $7
(f32.const 5.5)
)
diff --git a/test/passes/print.bin.txt b/test/passes/print.bin.txt
index 25b2cc387..f54f883d1 100644
--- a/test/passes/print.bin.txt
+++ b/test/passes/print.bin.txt
@@ -27,8 +27,8 @@
(i32.const 55)
)
(then
- (loop $label$2
- (br_if $label$2
+ (loop $label
+ (br_if $label
(i32.ne
(i32.rem_s
(local.tee $0
@@ -120,8 +120,8 @@
(i32.const 55)
)
(then
- (loop $label$2
- (br_if $label$2
+ (loop $label
+ (br_if $label
(i32.ne
(i32.rem_s
(local.tee $0
diff --git a/test/passes/print_g.bin.txt b/test/passes/print_g.bin.txt
index 174230388..f9a2ac67b 100644
--- a/test/passes/print_g.bin.txt
+++ b/test/passes/print_g.bin.txt
@@ -35,9 +35,9 @@
)
(then
;; code offset: 0x12
- (loop $label$2
+ (loop $label
;; code offset: 0x2e
- (br_if $label$2
+ (br_if $label
;; code offset: 0x2d
(i32.ne
;; code offset: 0x2a
@@ -167,9 +167,9 @@
)
(then
;; code offset: 0x12
- (loop $label$2
+ (loop $label
;; code offset: 0x2e
- (br_if $label$2
+ (br_if $label
;; code offset: 0x2d
(i32.ne
;; code offset: 0x2a
diff --git a/test/passes/print_g_metrics.bin.txt b/test/passes/print_g_metrics.bin.txt
index 2acec546f..084dd6256 100644
--- a/test/passes/print_g_metrics.bin.txt
+++ b/test/passes/print_g_metrics.bin.txt
@@ -30,8 +30,8 @@
(i32.const 55)
)
(then
- (loop $label$2
- (br_if $label$2
+ (loop $label
+ (br_if $label
(i32.ne
(i32.rem_s
(local.tee $0
@@ -120,8 +120,8 @@ total
(i32.const 55)
)
(then
- (loop $label$2
- (br_if $label$2
+ (loop $label
+ (br_if $label
(i32.ne
(i32.rem_s
(local.tee $0
diff --git a/test/passes/print_g_strip-dwarf.bin.txt b/test/passes/print_g_strip-dwarf.bin.txt
index 967e03f3d..e9b36b975 100644
--- a/test/passes/print_g_strip-dwarf.bin.txt
+++ b/test/passes/print_g_strip-dwarf.bin.txt
@@ -27,8 +27,8 @@
(i32.const 55)
)
(then
- (loop $label$2
- (br_if $label$2
+ (loop $label
+ (br_if $label
(i32.ne
(i32.rem_s
(local.tee $0
@@ -120,8 +120,8 @@
(i32.const 55)
)
(then
- (loop $label$2
- (br_if $label$2
+ (loop $label
+ (br_if $label
(i32.ne
(i32.rem_s
(local.tee $0
diff --git a/test/passes/reverse_dwarf_abbrevs.bin.txt b/test/passes/reverse_dwarf_abbrevs.bin.txt
index 5427acc6c..7b3a5aaad 100644
--- a/test/passes/reverse_dwarf_abbrevs.bin.txt
+++ b/test/passes/reverse_dwarf_abbrevs.bin.txt
@@ -292,11 +292,11 @@ file_names[ 1]:
;; code offset: 0x18d
(local.set $4
;; code offset: 0x89
- (block $label$1 (result i32)
+ (block $block2 (result i32)
;; code offset: 0x8b
- (block $label$2
+ (block $block1
;; code offset: 0x8d
- (block $label$3
+ (block $block
;; code offset: 0xa5
(if
;; code offset: 0xa4
@@ -331,9 +331,9 @@ file_names[ 1]:
)
(then
;; code offset: 0xa7
- (loop $label$5
+ (loop $label
;; code offset: 0xb3
- (br_if $label$3
+ (br_if $block
;; code offset: 0xb2
(i32.eq
;; code offset: 0xa9
@@ -349,7 +349,7 @@ file_names[ 1]:
)
)
;; code offset: 0xba
- (br_if $label$2
+ (br_if $block1
;; code offset: 0xb9
(i32.le_s
;; code offset: 0xb5
@@ -456,7 +456,7 @@ file_names[ 1]:
)
)
;; code offset: 0x125
- (br_if $label$5
+ (br_if $label
;; code offset: 0x124
(i32.eqz
;; code offset: 0x122
@@ -517,7 +517,7 @@ file_names[ 1]:
(i32.const -1)
)
;; code offset: 0x135
- (br_if $label$2
+ (br_if $block1
;; code offset: 0x134
(i32.ne
;; code offset: 0x130
@@ -563,7 +563,7 @@ file_names[ 1]:
)
)
;; code offset: 0x15a
- (br $label$1
+ (br $block2
;; code offset: 0x158
(local.get $2)
)
@@ -600,7 +600,7 @@ file_names[ 1]:
;; code offset: 0x183
(drop
;; code offset: 0x181
- (br_if $label$1
+ (br_if $block2
;; code offset: 0x17a
(local.tee $4
;; code offset: 0x178
@@ -797,7 +797,7 @@ file_names[ 1]:
)
)
;; code offset: 0x222
- (block $label$2
+ (block $block2
;; code offset: 0x22d
(if
;; code offset: 0x22c
@@ -817,7 +817,7 @@ file_names[ 1]:
)
(then
;; code offset: 0x22f
- (block $label$4
+ (block $block
;; code offset: 0x236
(if
;; code offset: 0x235
@@ -834,7 +834,7 @@ file_names[ 1]:
(local.get $0)
)
;; code offset: 0x23c
- (br $label$4)
+ (br $block)
)
)
;; code offset: 0x245
@@ -856,7 +856,7 @@ file_names[ 1]:
(local.get $0)
)
;; code offset: 0x24b
- (br $label$4)
+ (br $block)
)
)
;; code offset: 0x250
@@ -865,7 +865,7 @@ file_names[ 1]:
(local.get $0)
)
;; code offset: 0x252
- (loop $label$7
+ (loop $label
;; code offset: 0x25b
(i32.store8
;; code offset: 0x254
@@ -887,7 +887,7 @@ file_names[ 1]:
)
)
;; code offset: 0x26f
- (br_if $label$4
+ (br_if $block
;; code offset: 0x26e
(i32.ge_u
;; code offset: 0x26a
@@ -905,7 +905,7 @@ file_names[ 1]:
)
)
;; code offset: 0x276
- (br_if $label$7
+ (br_if $label
;; code offset: 0x275
(i32.and
;; code offset: 0x271
@@ -917,9 +917,9 @@ file_names[ 1]:
)
)
;; code offset: 0x27a
- (block $label$8
+ (block $block1
;; code offset: 0x287
- (br_if $label$8
+ (br_if $block1
;; code offset: 0x286
(i32.lt_u
;; code offset: 0x281
@@ -937,7 +937,7 @@ file_names[ 1]:
)
)
;; code offset: 0x293
- (br_if $label$8
+ (br_if $block1
;; code offset: 0x292
(i32.gt_u
;; code offset: 0x289
@@ -955,7 +955,7 @@ file_names[ 1]:
)
)
;; code offset: 0x295
- (loop $label$9
+ (loop $label1
;; code offset: 0x29e
(i32.store
;; code offset: 0x297
@@ -1127,7 +1127,7 @@ file_names[ 1]:
)
)
;; code offset: 0x348
- (br_if $label$9
+ (br_if $label1
;; code offset: 0x347
(i32.le_u
;; code offset: 0x343
@@ -1147,7 +1147,7 @@ file_names[ 1]:
)
)
;; code offset: 0x351
- (br_if $label$2
+ (br_if $block2
;; code offset: 0x350
(i32.ge_u
;; code offset: 0x34c
@@ -1157,7 +1157,7 @@ file_names[ 1]:
)
)
;; code offset: 0x353
- (loop $label$10
+ (loop $label2
;; code offset: 0x35c
(i32.store
;; code offset: 0x355
@@ -1179,7 +1179,7 @@ file_names[ 1]:
)
)
;; code offset: 0x370
- (br_if $label$10
+ (br_if $label2
;; code offset: 0x36f
(i32.lt_u
;; code offset: 0x36b
@@ -1198,7 +1198,7 @@ file_names[ 1]:
)
)
;; code offset: 0x373
- (br $label$2)
+ (br $block2)
)
)
;; code offset: 0x37b
@@ -1217,7 +1217,7 @@ file_names[ 1]:
(local.get $0)
)
;; code offset: 0x381
- (br $label$2)
+ (br $block2)
)
)
;; code offset: 0x38e
@@ -1244,7 +1244,7 @@ file_names[ 1]:
(local.get $0)
)
;; code offset: 0x394
- (br $label$2)
+ (br $block2)
)
)
;; code offset: 0x399
@@ -1253,7 +1253,7 @@ file_names[ 1]:
(local.get $0)
)
;; code offset: 0x39b
- (loop $label$13
+ (loop $label3
;; code offset: 0x3a4
(i32.store8
;; code offset: 0x39d
@@ -1305,7 +1305,7 @@ file_names[ 1]:
)
)
;; code offset: 0x3d6
- (br_if $label$13
+ (br_if $label3
;; code offset: 0x3d5
(i32.le_u
;; code offset: 0x3d1
@@ -1335,7 +1335,7 @@ file_names[ 1]:
)
(then
;; code offset: 0x3e1
- (loop $label$15
+ (loop $label4
;; code offset: 0x3ea
(i32.store8
;; code offset: 0x3e3
@@ -1357,7 +1357,7 @@ file_names[ 1]:
)
)
;; code offset: 0x3fe
- (br_if $label$15
+ (br_if $label4
;; code offset: 0x3fd
(i32.ne
;; code offset: 0x3f9
@@ -1386,380 +1386,377 @@ file_names[ 1]:
(local $5 i32)
(local $6 i32)
;; code offset: 0x410
- (block $label$1
- ;; code offset: 0x43a
+ (block $block
+ ;; code offset: 0x41a
(if
- ;; code offset: 0x412
- (block $label$2 (result i32)
- ;; code offset: 0x41c
- (if
- ;; code offset: 0x41b
- (i32.eqz
- ;; code offset: 0x419
- (local.tee $3
- ;; code offset: 0x416
- (i32.load offset=16
- ;; code offset: 0x414
- (local.get $2)
- )
- )
+ ;; code offset: 0x419
+ (i32.eqz
+ ;; code offset: 0x417
+ (local.tee $3
+ ;; code offset: 0x414
+ (i32.load offset=16
+ ;; code offset: 0x412
+ (local.get $2)
+ )
+ )
+ )
+ (then
+ ;; code offset: 0x420
+ (br_if $block
+ ;; code offset: 0x41e
+ (call $8
+ ;; code offset: 0x41c
+ (local.get $2)
)
- (then
+ )
+ ;; code offset: 0x427
+ (local.set $3
+ ;; code offset: 0x424
+ (i32.load offset=16
;; code offset: 0x422
- (br_if $label$1
- ;; code offset: 0x420
- (call $8
- ;; code offset: 0x41e
- (local.get $2)
- )
- )
- ;; code offset: 0x429
- (local.set $3
- ;; code offset: 0x426
- (i32.load offset=16
- ;; code offset: 0x424
- (local.get $2)
- )
- )
+ (local.get $2)
)
)
- ;; code offset: 0x438
- (i32.lt_u
- ;; code offset: 0x435
- (i32.sub
- ;; code offset: 0x42c
- (local.get $3)
- ;; code offset: 0x433
- (local.tee $5
- ;; code offset: 0x430
- (i32.load offset=20
- ;; code offset: 0x42e
- (local.get $2)
- )
+ )
+ )
+ ;; code offset: 0x437
+ (if
+ ;; code offset: 0x436
+ (i32.lt_u
+ ;; code offset: 0x433
+ (i32.sub
+ ;; code offset: 0x42a
+ (local.get $3)
+ ;; code offset: 0x431
+ (local.tee $5
+ ;; code offset: 0x42e
+ (i32.load offset=20
+ ;; code offset: 0x42c
+ (local.get $2)
)
)
- ;; code offset: 0x436
- (local.get $1)
)
+ ;; code offset: 0x434
+ (local.get $1)
)
(then
- ;; code offset: 0x44a
+ ;; code offset: 0x447
(return
- ;; code offset: 0x447
+ ;; code offset: 0x444
(call_indirect (type $1)
- ;; code offset: 0x43c
+ ;; code offset: 0x439
(local.get $2)
- ;; code offset: 0x43e
+ ;; code offset: 0x43b
(local.get $0)
- ;; code offset: 0x440
+ ;; code offset: 0x43d
(local.get $1)
- ;; code offset: 0x444
+ ;; code offset: 0x441
(i32.load offset=36
- ;; code offset: 0x442
+ ;; code offset: 0x43f
(local.get $2)
)
)
)
)
)
- ;; code offset: 0x44c
- (block $label$5
- ;; code offset: 0x456
- (br_if $label$5
- ;; code offset: 0x455
+ ;; code offset: 0x449
+ (block $block1
+ ;; code offset: 0x453
+ (br_if $block1
+ ;; code offset: 0x452
(i32.lt_s
- ;; code offset: 0x450
+ ;; code offset: 0x44d
(i32.load8_s offset=75
- ;; code offset: 0x44e
+ ;; code offset: 0x44b
(local.get $2)
)
- ;; code offset: 0x453
+ ;; code offset: 0x450
(i32.const 0)
)
)
- ;; code offset: 0x45a
+ ;; code offset: 0x457
(local.set $4
- ;; code offset: 0x458
+ ;; code offset: 0x455
(local.get $1)
)
- ;; code offset: 0x45c
- (loop $label$6
- ;; code offset: 0x463
- (br_if $label$5
- ;; code offset: 0x462
+ ;; code offset: 0x459
+ (loop $label
+ ;; code offset: 0x460
+ (br_if $block1
+ ;; code offset: 0x45f
(i32.eqz
- ;; code offset: 0x460
+ ;; code offset: 0x45d
(local.tee $3
- ;; code offset: 0x45e
+ ;; code offset: 0x45b
(local.get $4)
)
)
)
- ;; code offset: 0x475
- (br_if $label$6
- ;; code offset: 0x474
+ ;; code offset: 0x472
+ (br_if $label
+ ;; code offset: 0x471
(i32.ne
- ;; code offset: 0x46f
+ ;; code offset: 0x46c
(i32.load8_u
- ;; code offset: 0x46e
+ ;; code offset: 0x46b
(i32.add
- ;; code offset: 0x465
+ ;; code offset: 0x462
(local.get $0)
- ;; code offset: 0x46c
+ ;; code offset: 0x469
(local.tee $4
- ;; code offset: 0x46b
+ ;; code offset: 0x468
(i32.add
- ;; code offset: 0x467
+ ;; code offset: 0x464
(local.get $3)
- ;; code offset: 0x469
+ ;; code offset: 0x466
(i32.const -1)
)
)
)
)
- ;; code offset: 0x472
+ ;; code offset: 0x46f
(i32.const 10)
)
)
)
- ;; code offset: 0x48b
- (br_if $label$1
- ;; code offset: 0x48a
+ ;; code offset: 0x488
+ (br_if $block
+ ;; code offset: 0x487
(i32.lt_u
- ;; code offset: 0x486
+ ;; code offset: 0x483
(local.tee $4
- ;; code offset: 0x483
+ ;; code offset: 0x480
(call_indirect (type $1)
- ;; code offset: 0x478
+ ;; code offset: 0x475
(local.get $2)
- ;; code offset: 0x47a
+ ;; code offset: 0x477
(local.get $0)
- ;; code offset: 0x47c
+ ;; code offset: 0x479
(local.get $3)
- ;; code offset: 0x480
+ ;; code offset: 0x47d
(i32.load offset=36
- ;; code offset: 0x47e
+ ;; code offset: 0x47b
(local.get $2)
)
)
)
- ;; code offset: 0x488
+ ;; code offset: 0x485
(local.get $3)
)
)
- ;; code offset: 0x492
+ ;; code offset: 0x48f
(local.set $0
- ;; code offset: 0x491
+ ;; code offset: 0x48e
(i32.add
- ;; code offset: 0x48d
+ ;; code offset: 0x48a
(local.get $0)
- ;; code offset: 0x48f
+ ;; code offset: 0x48c
(local.get $3)
)
)
- ;; code offset: 0x499
+ ;; code offset: 0x496
(local.set $1
- ;; code offset: 0x498
+ ;; code offset: 0x495
(i32.sub
- ;; code offset: 0x494
+ ;; code offset: 0x491
(local.get $1)
- ;; code offset: 0x496
+ ;; code offset: 0x493
(local.get $3)
)
)
- ;; code offset: 0x4a0
+ ;; code offset: 0x49d
(local.set $5
- ;; code offset: 0x49d
+ ;; code offset: 0x49a
(i32.load offset=20
- ;; code offset: 0x49b
+ ;; code offset: 0x498
(local.get $2)
)
)
- ;; code offset: 0x4a4
+ ;; code offset: 0x4a1
(local.set $6
- ;; code offset: 0x4a2
+ ;; code offset: 0x49f
(local.get $3)
)
)
- ;; code offset: 0x4af
+ ;; code offset: 0x4ac
(drop
- ;; code offset: 0x4ad
+ ;; code offset: 0x4aa
(call $9
- ;; code offset: 0x4a7
+ ;; code offset: 0x4a4
(local.get $5)
- ;; code offset: 0x4a9
+ ;; code offset: 0x4a6
(local.get $0)
- ;; code offset: 0x4ab
+ ;; code offset: 0x4a8
(local.get $1)
)
)
- ;; code offset: 0x4ba
+ ;; code offset: 0x4b7
(i32.store offset=20
- ;; code offset: 0x4b0
+ ;; code offset: 0x4ad
(local.get $2)
- ;; code offset: 0x4b9
+ ;; code offset: 0x4b6
(i32.add
- ;; code offset: 0x4b4
+ ;; code offset: 0x4b1
(i32.load offset=20
- ;; code offset: 0x4b2
+ ;; code offset: 0x4af
(local.get $2)
)
- ;; code offset: 0x4b7
+ ;; code offset: 0x4b4
(local.get $1)
)
)
- ;; code offset: 0x4c2
+ ;; code offset: 0x4bf
(local.set $4
- ;; code offset: 0x4c1
+ ;; code offset: 0x4be
(i32.add
- ;; code offset: 0x4bd
+ ;; code offset: 0x4ba
(local.get $1)
- ;; code offset: 0x4bf
+ ;; code offset: 0x4bc
(local.get $6)
)
)
)
- ;; code offset: 0x4c5
+ ;; code offset: 0x4c2
(local.get $4)
)
(func $11 (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32)
(local $4 i32)
(local $5 i32)
- ;; code offset: 0x4d3
+ ;; code offset: 0x4d0
(local.set $4
- ;; code offset: 0x4d2
+ ;; code offset: 0x4cf
(i32.mul
- ;; code offset: 0x4ce
+ ;; code offset: 0x4cb
(local.get $1)
- ;; code offset: 0x4d0
+ ;; code offset: 0x4cd
(local.get $2)
)
)
- ;; code offset: 0x4d5
- (block $label$1
- ;; code offset: 0x4df
+ ;; code offset: 0x4d2
+ (block $block
+ ;; code offset: 0x4dc
(if
- ;; code offset: 0x4de
+ ;; code offset: 0x4db
(i32.le_s
- ;; code offset: 0x4d9
+ ;; code offset: 0x4d6
(i32.load offset=76
- ;; code offset: 0x4d7
+ ;; code offset: 0x4d4
(local.get $3)
)
- ;; code offset: 0x4dc
+ ;; code offset: 0x4d9
(i32.const -1)
)
(then
- ;; code offset: 0x4e9
+ ;; code offset: 0x4e6
(local.set $0
- ;; code offset: 0x4e7
+ ;; code offset: 0x4e4
(call $10
- ;; code offset: 0x4e1
+ ;; code offset: 0x4de
(local.get $0)
- ;; code offset: 0x4e3
+ ;; code offset: 0x4e0
(local.get $4)
- ;; code offset: 0x4e5
+ ;; code offset: 0x4e2
(local.get $3)
)
)
- ;; code offset: 0x4eb
- (br $label$1)
+ ;; code offset: 0x4e8
+ (br $block)
)
)
- ;; code offset: 0x4f2
+ ;; code offset: 0x4ef
(local.set $5
- ;; code offset: 0x4f0
+ ;; code offset: 0x4ed
(call $15
- ;; code offset: 0x4ee
+ ;; code offset: 0x4eb
(local.get $3)
)
)
- ;; code offset: 0x4fc
+ ;; code offset: 0x4f9
(local.set $0
- ;; code offset: 0x4fa
+ ;; code offset: 0x4f7
(call $10
- ;; code offset: 0x4f4
+ ;; code offset: 0x4f1
(local.get $0)
- ;; code offset: 0x4f6
+ ;; code offset: 0x4f3
(local.get $4)
- ;; code offset: 0x4f8
+ ;; code offset: 0x4f5
(local.get $3)
)
)
- ;; code offset: 0x501
- (br_if $label$1
- ;; code offset: 0x500
+ ;; code offset: 0x4fe
+ (br_if $block
+ ;; code offset: 0x4fd
(i32.eqz
- ;; code offset: 0x4fe
+ ;; code offset: 0x4fb
(local.get $5)
)
)
- ;; code offset: 0x505
+ ;; code offset: 0x502
(call $16
- ;; code offset: 0x503
+ ;; code offset: 0x500
(local.get $3)
)
)
- ;; code offset: 0x50d
+ ;; code offset: 0x50a
(if
- ;; code offset: 0x50c
+ ;; code offset: 0x509
(i32.eq
- ;; code offset: 0x508
+ ;; code offset: 0x505
(local.get $0)
- ;; code offset: 0x50a
+ ;; code offset: 0x507
(local.get $4)
)
(then
- ;; code offset: 0x516
+ ;; code offset: 0x513
(return
- ;; code offset: 0x515
+ ;; code offset: 0x512
(select
- ;; code offset: 0x50f
+ ;; code offset: 0x50c
(local.get $2)
- ;; code offset: 0x511
+ ;; code offset: 0x50e
(i32.const 0)
- ;; code offset: 0x513
+ ;; code offset: 0x510
(local.get $1)
)
)
)
)
- ;; code offset: 0x51c
+ ;; code offset: 0x519
(i32.div_u
- ;; code offset: 0x518
+ ;; code offset: 0x515
(local.get $0)
- ;; code offset: 0x51a
+ ;; code offset: 0x517
(local.get $1)
)
)
(func $12 (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
- ;; code offset: 0x537
+ ;; code offset: 0x534
(select
- ;; code offset: 0x522
+ ;; code offset: 0x51f
(i32.const -1)
- ;; code offset: 0x524
+ ;; code offset: 0x521
(i32.const 0)
- ;; code offset: 0x536
+ ;; code offset: 0x533
(i32.ne
- ;; code offset: 0x532
+ ;; code offset: 0x52f
(call $11
- ;; code offset: 0x526
+ ;; code offset: 0x523
(local.get $0)
- ;; code offset: 0x528
+ ;; code offset: 0x525
(i32.const 1)
- ;; code offset: 0x52e
+ ;; code offset: 0x52b
(local.tee $2
- ;; code offset: 0x52c
+ ;; code offset: 0x529
(call $17
- ;; code offset: 0x52a
+ ;; code offset: 0x527
(local.get $0)
)
)
- ;; code offset: 0x530
+ ;; code offset: 0x52d
(local.get $1)
)
- ;; code offset: 0x534
+ ;; code offset: 0x531
(local.get $2)
)
)
@@ -1768,624 +1765,624 @@ file_names[ 1]:
(local $2 i32)
(local $3 i32)
(local $4 i32)
- ;; code offset: 0x549
+ ;; code offset: 0x546
(global.set $global$0
- ;; code offset: 0x547
+ ;; code offset: 0x544
(local.tee $3
- ;; code offset: 0x546
+ ;; code offset: 0x543
(i32.sub
- ;; code offset: 0x542
+ ;; code offset: 0x53f
(global.get $global$0)
- ;; code offset: 0x544
+ ;; code offset: 0x541
(i32.const 16)
)
)
)
- ;; code offset: 0x54f
+ ;; code offset: 0x54c
(i32.store8 offset=15
- ;; code offset: 0x54b
+ ;; code offset: 0x548
(local.get $3)
- ;; code offset: 0x54d
+ ;; code offset: 0x54a
(local.get $1)
)
- ;; code offset: 0x552
- (block $label$1
- ;; code offset: 0x55c
+ ;; code offset: 0x54f
+ (block $block
+ ;; code offset: 0x559
(if
- ;; code offset: 0x55b
+ ;; code offset: 0x558
(i32.eqz
- ;; code offset: 0x559
+ ;; code offset: 0x556
(local.tee $2
- ;; code offset: 0x556
+ ;; code offset: 0x553
(i32.load offset=16
- ;; code offset: 0x554
+ ;; code offset: 0x551
(local.get $0)
)
)
)
(then
- ;; code offset: 0x560
+ ;; code offset: 0x55d
(local.set $2
- ;; code offset: 0x55e
+ ;; code offset: 0x55b
(i32.const -1)
)
- ;; code offset: 0x566
- (br_if $label$1
- ;; code offset: 0x564
+ ;; code offset: 0x563
+ (br_if $block
+ ;; code offset: 0x561
(call $8
- ;; code offset: 0x562
+ ;; code offset: 0x55f
(local.get $0)
)
)
- ;; code offset: 0x56d
+ ;; code offset: 0x56a
(local.set $2
- ;; code offset: 0x56a
+ ;; code offset: 0x567
(i32.load offset=16
- ;; code offset: 0x568
+ ;; code offset: 0x565
(local.get $0)
)
)
)
)
- ;; code offset: 0x570
- (block $label$3
- ;; code offset: 0x57c
- (br_if $label$3
- ;; code offset: 0x57b
+ ;; code offset: 0x56d
+ (block $block1
+ ;; code offset: 0x579
+ (br_if $block1
+ ;; code offset: 0x578
(i32.ge_u
- ;; code offset: 0x577
+ ;; code offset: 0x574
(local.tee $4
- ;; code offset: 0x574
+ ;; code offset: 0x571
(i32.load offset=20
- ;; code offset: 0x572
+ ;; code offset: 0x56f
(local.get $0)
)
)
- ;; code offset: 0x579
+ ;; code offset: 0x576
(local.get $2)
)
)
- ;; code offset: 0x58c
- (br_if $label$3
- ;; code offset: 0x58b
+ ;; code offset: 0x589
+ (br_if $block1
+ ;; code offset: 0x588
(i32.eq
- ;; code offset: 0x584
+ ;; code offset: 0x581
(local.tee $2
- ;; code offset: 0x583
+ ;; code offset: 0x580
(i32.and
- ;; code offset: 0x57e
+ ;; code offset: 0x57b
(local.get $1)
- ;; code offset: 0x580
+ ;; code offset: 0x57d
(i32.const 255)
)
)
- ;; code offset: 0x588
+ ;; code offset: 0x585
(i32.load8_s offset=75
- ;; code offset: 0x586
+ ;; code offset: 0x583
(local.get $0)
)
)
)
- ;; code offset: 0x595
+ ;; code offset: 0x592
(i32.store offset=20
- ;; code offset: 0x58e
+ ;; code offset: 0x58b
(local.get $0)
- ;; code offset: 0x594
+ ;; code offset: 0x591
(i32.add
- ;; code offset: 0x590
+ ;; code offset: 0x58d
(local.get $4)
- ;; code offset: 0x592
+ ;; code offset: 0x58f
(i32.const 1)
)
)
- ;; code offset: 0x59c
+ ;; code offset: 0x599
(i32.store8
- ;; code offset: 0x598
+ ;; code offset: 0x595
(local.get $4)
- ;; code offset: 0x59a
+ ;; code offset: 0x597
(local.get $1)
)
- ;; code offset: 0x59f
- (br $label$1)
+ ;; code offset: 0x59c
+ (br $block)
)
- ;; code offset: 0x5a4
+ ;; code offset: 0x5a1
(local.set $2
- ;; code offset: 0x5a2
+ ;; code offset: 0x59f
(i32.const -1)
)
- ;; code offset: 0x5ba
- (br_if $label$1
- ;; code offset: 0x5b9
+ ;; code offset: 0x5b7
+ (br_if $block
+ ;; code offset: 0x5b6
(i32.ne
- ;; code offset: 0x5b4
+ ;; code offset: 0x5b1
(call_indirect (type $1)
- ;; code offset: 0x5a6
+ ;; code offset: 0x5a3
(local.get $0)
- ;; code offset: 0x5ac
+ ;; code offset: 0x5a9
(i32.add
- ;; code offset: 0x5a8
+ ;; code offset: 0x5a5
(local.get $3)
- ;; code offset: 0x5aa
+ ;; code offset: 0x5a7
(i32.const 15)
)
- ;; code offset: 0x5ad
+ ;; code offset: 0x5aa
(i32.const 1)
- ;; code offset: 0x5b1
+ ;; code offset: 0x5ae
(i32.load offset=36
- ;; code offset: 0x5af
+ ;; code offset: 0x5ac
(local.get $0)
)
)
- ;; code offset: 0x5b7
+ ;; code offset: 0x5b4
(i32.const 1)
)
)
- ;; code offset: 0x5c1
+ ;; code offset: 0x5be
(local.set $2
- ;; code offset: 0x5be
+ ;; code offset: 0x5bb
(i32.load8_u offset=15
- ;; code offset: 0x5bc
+ ;; code offset: 0x5b9
(local.get $3)
)
)
)
- ;; code offset: 0x5c9
+ ;; code offset: 0x5c6
(global.set $global$0
- ;; code offset: 0x5c8
+ ;; code offset: 0x5c5
(i32.add
- ;; code offset: 0x5c4
+ ;; code offset: 0x5c1
(local.get $3)
- ;; code offset: 0x5c6
+ ;; code offset: 0x5c3
(i32.const 16)
)
)
- ;; code offset: 0x5cb
+ ;; code offset: 0x5c8
(local.get $2)
)
(func $14 (param $0 i32) (result i32)
(local $1 i32)
(local $2 i32)
- ;; code offset: 0x5e2
+ ;; code offset: 0x5df
(if
- ;; code offset: 0x5e1
+ ;; code offset: 0x5de
(i32.ge_s
- ;; code offset: 0x5dc
+ ;; code offset: 0x5d9
(i32.load offset=76
- ;; code offset: 0x5da
+ ;; code offset: 0x5d7
(local.tee $1
- ;; code offset: 0x5d7
+ ;; code offset: 0x5d4
(i32.load
- ;; code offset: 0x5d4
+ ;; code offset: 0x5d1
(i32.const 1040)
)
)
)
- ;; code offset: 0x5df
+ ;; code offset: 0x5dc
(i32.const 0)
)
(then
- ;; code offset: 0x5e8
+ ;; code offset: 0x5e5
(local.set $2
- ;; code offset: 0x5e6
+ ;; code offset: 0x5e3
(call $15
- ;; code offset: 0x5e4
+ ;; code offset: 0x5e1
(local.get $1)
)
)
)
)
- ;; code offset: 0x636
+ ;; code offset: 0x633
(local.set $0
- ;; code offset: 0x5eb
- (block $label$2 (result i32)
- ;; code offset: 0x5fa
+ ;; code offset: 0x5e8
+ (block $block (result i32)
+ ;; code offset: 0x5f7
(drop
- ;; code offset: 0x5f8
- (br_if $label$2
- ;; code offset: 0x5ed
+ ;; code offset: 0x5f5
+ (br_if $block
+ ;; code offset: 0x5ea
(i32.const -1)
- ;; code offset: 0x5f7
+ ;; code offset: 0x5f4
(i32.lt_s
- ;; code offset: 0x5f3
+ ;; code offset: 0x5f0
(call $12
- ;; code offset: 0x5ef
+ ;; code offset: 0x5ec
(local.get $0)
- ;; code offset: 0x5f1
+ ;; code offset: 0x5ee
(local.get $1)
)
- ;; code offset: 0x5f5
+ ;; code offset: 0x5f2
(i32.const 0)
)
)
)
- ;; code offset: 0x5fb
- (block $label$3
- ;; code offset: 0x605
- (br_if $label$3
- ;; code offset: 0x604
+ ;; code offset: 0x5f8
+ (block $block1
+ ;; code offset: 0x602
+ (br_if $block1
+ ;; code offset: 0x601
(i32.eq
- ;; code offset: 0x5ff
+ ;; code offset: 0x5fc
(i32.load8_u offset=75
- ;; code offset: 0x5fd
+ ;; code offset: 0x5fa
(local.get $1)
)
- ;; code offset: 0x602
+ ;; code offset: 0x5ff
(i32.const 10)
)
)
- ;; code offset: 0x614
- (br_if $label$3
- ;; code offset: 0x613
+ ;; code offset: 0x611
+ (br_if $block1
+ ;; code offset: 0x610
(i32.ge_u
- ;; code offset: 0x60c
+ ;; code offset: 0x609
(local.tee $0
- ;; code offset: 0x609
+ ;; code offset: 0x606
(i32.load offset=20
- ;; code offset: 0x607
+ ;; code offset: 0x604
(local.get $1)
)
)
- ;; code offset: 0x610
+ ;; code offset: 0x60d
(i32.load offset=16
- ;; code offset: 0x60e
+ ;; code offset: 0x60b
(local.get $1)
)
)
)
- ;; code offset: 0x61d
+ ;; code offset: 0x61a
(i32.store offset=20
- ;; code offset: 0x616
+ ;; code offset: 0x613
(local.get $1)
- ;; code offset: 0x61c
+ ;; code offset: 0x619
(i32.add
- ;; code offset: 0x618
+ ;; code offset: 0x615
(local.get $0)
- ;; code offset: 0x61a
+ ;; code offset: 0x617
(i32.const 1)
)
)
- ;; code offset: 0x624
+ ;; code offset: 0x621
(i32.store8
- ;; code offset: 0x620
+ ;; code offset: 0x61d
(local.get $0)
- ;; code offset: 0x622
+ ;; code offset: 0x61f
(i32.const 10)
)
- ;; code offset: 0x629
- (br $label$2
- ;; code offset: 0x627
+ ;; code offset: 0x626
+ (br $block
+ ;; code offset: 0x624
(i32.const 0)
)
)
- ;; code offset: 0x634
+ ;; code offset: 0x631
(i32.shr_s
- ;; code offset: 0x630
+ ;; code offset: 0x62d
(call $13
- ;; code offset: 0x62c
+ ;; code offset: 0x629
(local.get $1)
- ;; code offset: 0x62e
+ ;; code offset: 0x62b
(i32.const 10)
)
- ;; code offset: 0x632
+ ;; code offset: 0x62f
(i32.const 31)
)
)
)
- ;; code offset: 0x63a
+ ;; code offset: 0x637
(if
- ;; code offset: 0x638
+ ;; code offset: 0x635
(local.get $2)
(then
- ;; code offset: 0x63e
+ ;; code offset: 0x63b
(call $16
- ;; code offset: 0x63c
+ ;; code offset: 0x639
(local.get $1)
)
)
)
- ;; code offset: 0x641
+ ;; code offset: 0x63e
(local.get $0)
)
(func $15 (param $0 i32) (result i32)
- ;; code offset: 0x646
+ ;; code offset: 0x643
(i32.const 1)
)
(func $16 (param $0 i32)
- ;; code offset: 0x64b
+ ;; code offset: 0x648
(nop)
)
(func $17 (param $0 i32) (result i32)
(local $1 i32)
(local $2 i32)
(local $3 i32)
- ;; code offset: 0x658
+ ;; code offset: 0x655
(local.set $1
- ;; code offset: 0x656
+ ;; code offset: 0x653
(local.get $0)
)
- ;; code offset: 0x65a
- (block $label$1
- ;; code offset: 0x65c
- (block $label$2
- ;; code offset: 0x664
- (br_if $label$2
- ;; code offset: 0x663
+ ;; code offset: 0x657
+ (block $block1
+ ;; code offset: 0x659
+ (block $block
+ ;; code offset: 0x661
+ (br_if $block
+ ;; code offset: 0x660
(i32.eqz
- ;; code offset: 0x662
+ ;; code offset: 0x65f
(i32.and
- ;; code offset: 0x65e
+ ;; code offset: 0x65b
(local.get $0)
- ;; code offset: 0x660
+ ;; code offset: 0x65d
(i32.const 3)
)
)
)
- ;; code offset: 0x66c
+ ;; code offset: 0x669
(if
- ;; code offset: 0x66b
+ ;; code offset: 0x668
(i32.eqz
- ;; code offset: 0x668
+ ;; code offset: 0x665
(i32.load8_u
- ;; code offset: 0x666
+ ;; code offset: 0x663
(local.get $0)
)
)
(then
- ;; code offset: 0x670
+ ;; code offset: 0x66d
(return
- ;; code offset: 0x66e
+ ;; code offset: 0x66b
(i32.const 0)
)
)
)
- ;; code offset: 0x672
- (loop $label$4
- ;; code offset: 0x67f
- (br_if $label$2
- ;; code offset: 0x67e
+ ;; code offset: 0x66f
+ (loop $label
+ ;; code offset: 0x67c
+ (br_if $block
+ ;; code offset: 0x67b
(i32.eqz
- ;; code offset: 0x67d
+ ;; code offset: 0x67a
(i32.and
- ;; code offset: 0x679
+ ;; code offset: 0x676
(local.tee $1
- ;; code offset: 0x678
+ ;; code offset: 0x675
(i32.add
- ;; code offset: 0x674
+ ;; code offset: 0x671
(local.get $1)
- ;; code offset: 0x676
+ ;; code offset: 0x673
(i32.const 1)
)
)
- ;; code offset: 0x67b
+ ;; code offset: 0x678
(i32.const 3)
)
)
)
- ;; code offset: 0x686
- (br_if $label$4
- ;; code offset: 0x683
+ ;; code offset: 0x683
+ (br_if $label
+ ;; code offset: 0x680
(i32.load8_u
- ;; code offset: 0x681
+ ;; code offset: 0x67e
(local.get $1)
)
)
)
- ;; code offset: 0x689
- (br $label$1)
+ ;; code offset: 0x686
+ (br $block1)
)
- ;; code offset: 0x68c
- (loop $label$5
- ;; code offset: 0x695
+ ;; code offset: 0x689
+ (loop $label1
+ ;; code offset: 0x692
(local.set $1
- ;; code offset: 0x694
+ ;; code offset: 0x691
(i32.add
- ;; code offset: 0x690
+ ;; code offset: 0x68d
(local.tee $2
- ;; code offset: 0x68e
+ ;; code offset: 0x68b
(local.get $1)
)
- ;; code offset: 0x692
+ ;; code offset: 0x68f
(i32.const 4)
)
)
- ;; code offset: 0x6b2
- (br_if $label$5
- ;; code offset: 0x6b1
+ ;; code offset: 0x6af
+ (br_if $label1
+ ;; code offset: 0x6ae
(i32.eqz
- ;; code offset: 0x6b0
+ ;; code offset: 0x6ad
(i32.and
- ;; code offset: 0x6a9
+ ;; code offset: 0x6a6
(i32.and
- ;; code offset: 0x6a0
+ ;; code offset: 0x69d
(i32.xor
- ;; code offset: 0x69c
+ ;; code offset: 0x699
(local.tee $3
- ;; code offset: 0x699
+ ;; code offset: 0x696
(i32.load
- ;; code offset: 0x697
+ ;; code offset: 0x694
(local.get $2)
)
)
- ;; code offset: 0x69e
+ ;; code offset: 0x69b
(i32.const -1)
)
- ;; code offset: 0x6a8
+ ;; code offset: 0x6a5
(i32.add
- ;; code offset: 0x6a1
+ ;; code offset: 0x69e
(local.get $3)
- ;; code offset: 0x6a3
+ ;; code offset: 0x6a0
(i32.const -16843009)
)
)
- ;; code offset: 0x6aa
+ ;; code offset: 0x6a7
(i32.const -2139062144)
)
)
)
)
- ;; code offset: 0x6bc
+ ;; code offset: 0x6b9
(if
- ;; code offset: 0x6bb
+ ;; code offset: 0x6b8
(i32.eqz
- ;; code offset: 0x6ba
+ ;; code offset: 0x6b7
(i32.and
- ;; code offset: 0x6b5
+ ;; code offset: 0x6b2
(local.get $3)
- ;; code offset: 0x6b7
+ ;; code offset: 0x6b4
(i32.const 255)
)
)
(then
- ;; code offset: 0x6c3
+ ;; code offset: 0x6c0
(return
- ;; code offset: 0x6c2
+ ;; code offset: 0x6bf
(i32.sub
- ;; code offset: 0x6be
+ ;; code offset: 0x6bb
(local.get $2)
- ;; code offset: 0x6c0
+ ;; code offset: 0x6bd
(local.get $0)
)
)
)
)
- ;; code offset: 0x6c5
- (loop $label$7
- ;; code offset: 0x6cc
+ ;; code offset: 0x6c2
+ (loop $label2
+ ;; code offset: 0x6c9
(local.set $3
- ;; code offset: 0x6c9
+ ;; code offset: 0x6c6
(i32.load8_u offset=1
- ;; code offset: 0x6c7
+ ;; code offset: 0x6c4
(local.get $2)
)
)
- ;; code offset: 0x6d5
+ ;; code offset: 0x6d2
(local.set $2
- ;; code offset: 0x6d3
+ ;; code offset: 0x6d0
(local.tee $1
- ;; code offset: 0x6d2
+ ;; code offset: 0x6cf
(i32.add
- ;; code offset: 0x6ce
+ ;; code offset: 0x6cb
(local.get $2)
- ;; code offset: 0x6d0
+ ;; code offset: 0x6cd
(i32.const 1)
)
)
)
- ;; code offset: 0x6d9
- (br_if $label$7
- ;; code offset: 0x6d7
+ ;; code offset: 0x6d6
+ (br_if $label2
+ ;; code offset: 0x6d4
(local.get $3)
)
)
)
- ;; code offset: 0x6e1
+ ;; code offset: 0x6de
(i32.sub
- ;; code offset: 0x6dd
+ ;; code offset: 0x6da
(local.get $1)
- ;; code offset: 0x6df
+ ;; code offset: 0x6dc
(local.get $0)
)
)
(func $18 (result i32)
- ;; code offset: 0x6e5
+ ;; code offset: 0x6e2
(global.get $global$0)
)
(func $19 (param $0 i32)
- ;; code offset: 0x6ec
+ ;; code offset: 0x6e9
(global.set $global$0
- ;; code offset: 0x6ea
+ ;; code offset: 0x6e7
(local.get $0)
)
)
(func $20 (param $0 i32) (result i32)
(local $1 i32)
- ;; code offset: 0x6fd
+ ;; code offset: 0x6fa
(global.set $global$0
- ;; code offset: 0x6fb
+ ;; code offset: 0x6f8
(local.tee $1
- ;; code offset: 0x6fa
+ ;; code offset: 0x6f7
(i32.and
- ;; code offset: 0x6f7
+ ;; code offset: 0x6f4
(i32.sub
- ;; code offset: 0x6f3
+ ;; code offset: 0x6f0
(global.get $global$0)
- ;; code offset: 0x6f5
+ ;; code offset: 0x6f2
(local.get $0)
)
- ;; code offset: 0x6f8
+ ;; code offset: 0x6f5
(i32.const -16)
)
)
)
- ;; code offset: 0x6ff
+ ;; code offset: 0x6fc
(local.get $1)
)
(func $21 (param $0 i32) (param $1 i32) (param $2 i64) (param $3 i32) (result i64)
- ;; code offset: 0x70c
+ ;; code offset: 0x709
(call_indirect (type $6)
- ;; code offset: 0x704
+ ;; code offset: 0x701
(local.get $1)
- ;; code offset: 0x706
+ ;; code offset: 0x703
(local.get $2)
- ;; code offset: 0x708
+ ;; code offset: 0x705
(local.get $3)
- ;; code offset: 0x70a
+ ;; code offset: 0x707
(local.get $0)
)
)
(func $22 (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (result i32)
(local $5 i64)
- ;; code offset: 0x72c
+ ;; code offset: 0x729
(call $fimport$2
- ;; code offset: 0x72b
+ ;; code offset: 0x728
(i32.wrap_i64
- ;; code offset: 0x72a
+ ;; code offset: 0x727
(i64.shr_u
- ;; code offset: 0x726
+ ;; code offset: 0x723
(local.tee $5
- ;; code offset: 0x724
+ ;; code offset: 0x721
(call $21
- ;; code offset: 0x714
+ ;; code offset: 0x711
(local.get $0)
- ;; code offset: 0x716
+ ;; code offset: 0x713
(local.get $1)
- ;; code offset: 0x721
+ ;; code offset: 0x71e
(i64.or
- ;; code offset: 0x71a
+ ;; code offset: 0x717
(i64.extend_i32_u
- ;; code offset: 0x718
+ ;; code offset: 0x715
(local.get $2)
)
- ;; code offset: 0x720
+ ;; code offset: 0x71d
(i64.shl
- ;; code offset: 0x71d
+ ;; code offset: 0x71a
(i64.extend_i32_u
- ;; code offset: 0x71b
+ ;; code offset: 0x718
(local.get $3)
)
- ;; code offset: 0x71e
+ ;; code offset: 0x71b
(i64.const 32)
)
)
- ;; code offset: 0x722
+ ;; code offset: 0x71f
(local.get $4)
)
)
- ;; code offset: 0x728
+ ;; code offset: 0x725
(i64.const 32)
)
)
)
- ;; code offset: 0x730
+ ;; code offset: 0x72d
(i32.wrap_i64
- ;; code offset: 0x72e
+ ;; code offset: 0x72b
(local.get $5)
)
)
(func $23 (param $0 i32) (result i32)
- ;; code offset: 0x736
+ ;; code offset: 0x733
(memory.grow
- ;; code offset: 0x734
+ ;; code offset: 0x731
(local.get $0)
)
)
diff --git a/test/stacky.wasm.fromBinary b/test/stacky.wasm.fromBinary
index 9891e1071..d7c85091e 100644
--- a/test/stacky.wasm.fromBinary
+++ b/test/stacky.wasm.fromBinary
@@ -3,16 +3,16 @@
(memory $0 256 256)
(export "add" (func $0))
(func $0 (param $0 i32) (param $1 i32) (result i32)
- (local $2 i32)
+ (local $scratch i32)
(i32.add
(block (result i32)
- (local.set $2
+ (local.set $scratch
(local.get $0)
)
(local.set $0
(i32.const 100)
)
- (local.get $2)
+ (local.get $scratch)
)
(local.get $1)
)
diff --git a/test/try-delegate.wasm.fromBinary b/test/try-delegate.wasm.fromBinary
index 07aee5611..a3e799627 100644
--- a/test/try-delegate.wasm.fromBinary
+++ b/test/try-delegate.wasm.fromBinary
@@ -2,14 +2,12 @@
(type $0 (func))
(tag $tag$0)
(func $0
- (try $label$6
+ (try $label
(do
- (block $label$1
- (try $label$4
- (do
- )
- (delegate $label$6)
+ (try
+ (do
)
+ (delegate $label)
)
)
(catch $tag$0
@@ -17,21 +15,19 @@
)
)
(func $1
- (try $label$9
+ (try $label
(do
- (block $label$1
- (try $label$7
- (do
+ (try
+ (do
+ )
+ (catch $tag$0
+ (drop
+ (i32.const 0)
)
- (catch $tag$0
- (drop
- (i32.const 0)
- )
- (try $label$6
- (do
- )
- (delegate $label$9)
+ (try
+ (do
)
+ (delegate $label)
)
)
)
diff --git a/test/unreachable-pops.wasm.fromBinary b/test/unreachable-pops.wasm.fromBinary
index 08af405f2..d4ed2ae70 100644
--- a/test/unreachable-pops.wasm.fromBinary
+++ b/test/unreachable-pops.wasm.fromBinary
@@ -1,7 +1,8 @@
(module
(type $0 (func (result i32)))
(func $0 (result i32)
- (block $label$1 (result i32)
+ (i32.add
+ (unreachable)
(unreachable)
)
)