diff options
Diffstat (limited to 'src/passes')
-rw-r--r-- | src/passes/AlignmentLowering.cpp | 8 | ||||
-rw-r--r-- | src/passes/Asyncify.cpp | 2 | ||||
-rw-r--r-- | src/passes/ConstHoisting.cpp | 5 | ||||
-rw-r--r-- | src/passes/DataFlowOpts.cpp | 11 | ||||
-rw-r--r-- | src/passes/DeadCodeElimination.cpp | 4 | ||||
-rw-r--r-- | src/passes/Flatten.cpp | 2 | ||||
-rw-r--r-- | src/passes/FuncCastEmulation.cpp | 18 | ||||
-rw-r--r-- | src/passes/I64ToI32Lowering.cpp | 12 | ||||
-rw-r--r-- | src/passes/InstrumentLocals.cpp | 5 | ||||
-rw-r--r-- | src/passes/OptimizeInstructions.cpp | 4 | ||||
-rw-r--r-- | src/passes/Print.cpp | 12 | ||||
-rw-r--r-- | src/passes/ReReloop.cpp | 4 | ||||
-rw-r--r-- | src/passes/RemoveUnusedNames.cpp | 2 | ||||
-rw-r--r-- | src/passes/Souperify.cpp | 17 | ||||
-rw-r--r-- | src/passes/SpillPointers.cpp | 4 | ||||
-rw-r--r-- | src/passes/TrapMode.cpp | 2 |
16 files changed, 48 insertions, 64 deletions
diff --git a/src/passes/AlignmentLowering.cpp b/src/passes/AlignmentLowering.cpp index 05ec2892f..d659fcb69 100644 --- a/src/passes/AlignmentLowering.cpp +++ b/src/passes/AlignmentLowering.cpp @@ -103,10 +103,10 @@ struct AlignmentLowering : public WalkerPass<PostWalker<AlignmentLowering>> { i32), builder.makeConst(Literal(int32_t(16))))); } else { - WASM_UNREACHABLE(); + WASM_UNREACHABLE("invalid alignment"); } } else { - WASM_UNREACHABLE(); + WASM_UNREACHABLE("invalid size"); } replaceCurrent( builder.makeBlock({builder.makeLocalSet(temp, curr->ptr), ret})); @@ -199,10 +199,10 @@ struct AlignmentLowering : public WalkerPass<PostWalker<AlignmentLowering>> { builder.makeConst(Literal(int32_t(16)))), i32)); } else { - WASM_UNREACHABLE(); + WASM_UNREACHABLE("invalid alignment"); } } else { - WASM_UNREACHABLE(); + WASM_UNREACHABLE("invalid size"); } block->finalize(); replaceCurrent(block); diff --git a/src/passes/Asyncify.cpp b/src/passes/Asyncify.cpp index 818d61907..d92181639 100644 --- a/src/passes/Asyncify.cpp +++ b/src/passes/Asyncify.cpp @@ -841,7 +841,7 @@ private: // the state, so there should be nothing that can reach here - add it // earlier as necessary. // std::cout << *curr << '\n'; - WASM_UNREACHABLE(); + WASM_UNREACHABLE("unexpected expression type"); } // Possibly skip some code, if rewinding. diff --git a/src/passes/ConstHoisting.cpp b/src/passes/ConstHoisting.cpp index 08fede1df..9eb853878 100644 --- a/src/passes/ConstHoisting.cpp +++ b/src/passes/ConstHoisting.cpp @@ -97,9 +97,8 @@ private: return false; } case none: - case unreachable: { - WASM_UNREACHABLE(); - } + case unreachable: + WASM_UNREACHABLE("unexpected type"); } // compute the benefit, of replacing the uses with // one use + a set and then a get for each use diff --git a/src/passes/DataFlowOpts.cpp b/src/passes/DataFlowOpts.cpp index dc8f6ca94..d4a3cc087 100644 --- a/src/passes/DataFlowOpts.cpp +++ b/src/passes/DataFlowOpts.cpp @@ -215,7 +215,7 @@ struct DataFlowOpts : public WalkerPass<PostWalker<DataFlowOpts>> { break; } default: - WASM_UNREACHABLE(); + WASM_UNREACHABLE("unexpected dataflow node type"); } } // No one is a user of this node after we replaced all the uses. @@ -234,9 +234,8 @@ struct DataFlowOpts : public WalkerPass<PostWalker<DataFlowOpts>> { return &binary->left; } else if (index == 1) { return &binary->right; - } else { - WASM_UNREACHABLE(); } + WASM_UNREACHABLE("unexpected index"); } else if (auto* select = expr->dynCast<Select>()) { if (index == 0) { return &select->condition; @@ -244,12 +243,10 @@ struct DataFlowOpts : public WalkerPass<PostWalker<DataFlowOpts>> { return &select->ifTrue; } else if (index == 2) { return &select->ifFalse; - } else { - WASM_UNREACHABLE(); } - } else { - WASM_UNREACHABLE(); + WASM_UNREACHABLE("unexpected index"); } + WASM_UNREACHABLE("unexpected expression type"); } }; diff --git a/src/passes/DeadCodeElimination.cpp b/src/passes/DeadCodeElimination.cpp index dcbac960e..be6f92ffa 100644 --- a/src/passes/DeadCodeElimination.cpp +++ b/src/passes/DeadCodeElimination.cpp @@ -356,9 +356,9 @@ struct DeadCodeElimination case Expression::Id::BrOnExnId: DELEGATE(BrOnExn); case Expression::Id::InvalidId: - WASM_UNREACHABLE(); + WASM_UNREACHABLE("unimp"); case Expression::Id::NumExpressionIds: - WASM_UNREACHABLE(); + WASM_UNREACHABLE("unimp"); } #undef DELEGATE return; diff --git a/src/passes/Flatten.cpp b/src/passes/Flatten.cpp index ee7a93b72..6f698367f 100644 --- a/src/passes/Flatten.cpp +++ b/src/passes/Flatten.cpp @@ -156,7 +156,7 @@ struct Flatten loop->finalize(); replaceCurrent(rep); } else { - WASM_UNREACHABLE(); + WASM_UNREACHABLE("unexpected expr type"); } } else { // for anything else, there may be existing preludes diff --git a/src/passes/FuncCastEmulation.cpp b/src/passes/FuncCastEmulation.cpp index f938da3b7..f36e1e909 100644 --- a/src/passes/FuncCastEmulation.cpp +++ b/src/passes/FuncCastEmulation.cpp @@ -63,16 +63,13 @@ static Expression* toABI(Expression* value, Module* module) { break; } case v128: { - assert(false && "v128 not implemented yet"); - WASM_UNREACHABLE(); + WASM_UNREACHABLE("v128 not implemented yet"); } case anyref: { - assert(false && "anyref cannot be converted to i64"); - WASM_UNREACHABLE(); + WASM_UNREACHABLE("anyref cannot be converted to i64"); } case exnref: { - assert(false && "exnref cannot be converted to i64"); - WASM_UNREACHABLE(); + WASM_UNREACHABLE("exnref cannot be converted to i64"); } case none: { // the value is none, but we need a value here @@ -109,16 +106,13 @@ static Expression* fromABI(Expression* value, Type type, Module* module) { break; } case v128: { - assert(false && "v128 not implemented yet"); - WASM_UNREACHABLE(); + WASM_UNREACHABLE("v128 not implemented yet"); } case anyref: { - assert(false && "anyref cannot be converted from i64"); - WASM_UNREACHABLE(); + WASM_UNREACHABLE("anyref cannot be converted from i64"); } case exnref: { - assert(false && "exnref cannot be converted from i64"); - WASM_UNREACHABLE(); + WASM_UNREACHABLE("exnref cannot be converted from i64"); } case none: { value = builder.makeDrop(value); diff --git a/src/passes/I64ToI32Lowering.cpp b/src/passes/I64ToI32Lowering.cpp index b51858474..e2f744957 100644 --- a/src/passes/I64ToI32Lowering.cpp +++ b/src/passes/I64ToI32Lowering.cpp @@ -130,7 +130,7 @@ struct I64ToI32Lowering : public WalkerPass<PostWalker<I64ToI32Lowering>> { } else if (auto* get = curr->init->dynCast<GlobalGet>()) { high->init = builder->makeGlobalGet(makeHighName(get->name), i32); } else { - WASM_UNREACHABLE(); + WASM_UNREACHABLE("unexpected expression type"); } curr->init->type = i32; } @@ -752,8 +752,7 @@ struct I64ToI32Lowering : public WalkerPass<PostWalker<I64ToI32Lowering>> { lower(result, ClzInt32, std::move(highBits), std::move(lowBits)); break; case CtzInt64: - std::cerr << "i64.ctz should be removed already" << std::endl; - WASM_UNREACHABLE(); + WASM_UNREACHABLE("i64.ctz should be removed already"); break; default: abort(); @@ -829,8 +828,7 @@ struct I64ToI32Lowering : public WalkerPass<PostWalker<I64ToI32Lowering>> { lowerConvertIntToFloat(curr); break; case PopcntInt64: - std::cerr << "i64.popcnt should already be removed" << std::endl; - WASM_UNREACHABLE(); + WASM_UNREACHABLE("i64.popcnt should already be removed"); default: std::cerr << "Unhandled unary operator: " << curr->op << std::endl; abort(); @@ -1328,9 +1326,7 @@ struct I64ToI32Lowering : public WalkerPass<PostWalker<I64ToI32Lowering>> { case RemUInt64: case RotLInt64: case RotRInt64: - std::cerr << "should have been removed by now " << curr->op - << std::endl; - WASM_UNREACHABLE(); + WASM_UNREACHABLE("should have been removed by now"); case AndInt64: case OrInt64: diff --git a/src/passes/InstrumentLocals.cpp b/src/passes/InstrumentLocals.cpp index 6e12b0f3a..0b21c5000 100644 --- a/src/passes/InstrumentLocals.cpp +++ b/src/passes/InstrumentLocals.cpp @@ -92,9 +92,8 @@ struct InstrumentLocals : public WalkerPass<PostWalker<InstrumentLocals>> { import = get_exnref; break; case none: - WASM_UNREACHABLE(); case unreachable: - WASM_UNREACHABLE(); + WASM_UNREACHABLE("unexpected type"); } replaceCurrent( builder.makeCall(import, @@ -137,7 +136,7 @@ struct InstrumentLocals : public WalkerPass<PostWalker<InstrumentLocals>> { case unreachable: return; // nothing to do here case none: - WASM_UNREACHABLE(); + WASM_UNREACHABLE("unexpected type"); } curr->value = builder.makeCall(import, diff --git a/src/passes/OptimizeInstructions.cpp b/src/passes/OptimizeInstructions.cpp index 64c49fc96..6de1d3d00 100644 --- a/src/passes/OptimizeInstructions.cpp +++ b/src/passes/OptimizeInstructions.cpp @@ -59,7 +59,7 @@ Index getMaxBits(Expression* curr, LocalInfoProvider* localInfoProvider) { case i64: return 64 - const_->value.countLeadingZeroes().geti64(); default: - WASM_UNREACHABLE(); + WASM_UNREACHABLE("invalid type"); } } else if (auto* binary = curr->dynCast<Binary>()) { switch (binary->op) { @@ -186,7 +186,7 @@ Index getMaxBits(Expression* curr, LocalInfoProvider* localInfoProvider) { case unreachable: return 64; // not interesting, but don't crash default: - WASM_UNREACHABLE(); + WASM_UNREACHABLE("invalid type"); } } diff --git a/src/passes/Print.cpp b/src/passes/Print.cpp index e35d9b57e..a8d9383bf 100644 --- a/src/passes/Print.cpp +++ b/src/passes/Print.cpp @@ -205,7 +205,7 @@ struct PrintExpressionContents } else if (bytes == 4) { o << "32"; } else { - WASM_UNREACHABLE(); + WASM_UNREACHABLE("invalid RMW byte length"); } } o << '.'; @@ -757,7 +757,7 @@ struct PrintExpressionContents o << "i32x4.widen_high_i16x8_u"; break; case InvalidUnary: - WASM_UNREACHABLE(); + WASM_UNREACHABLE("unvalid unary operator"); } } void visitBinary(Binary* curr) { @@ -1287,7 +1287,7 @@ struct PrintExpressionContents break; case InvalidBinary: - WASM_UNREACHABLE(); + WASM_UNREACHABLE("unvalid binary operator"); } restoreNormalColor(o); } @@ -1901,7 +1901,7 @@ struct PrintSExpression : public OverriddenVisitor<PrintSExpression> { o << "event"; break; case ExternalKind::Invalid: - WASM_UNREACHABLE(); + WASM_UNREACHABLE("invalid ExternalKind"); } o << ' '; printName(curr->value, o) << "))"; @@ -2389,7 +2389,7 @@ WasmPrinter::printStackInst(StackInst* inst, std::ostream& o, Function* func) { break; } default: - WASM_UNREACHABLE(); + WASM_UNREACHABLE("unexpeted op"); } return o; } @@ -2446,7 +2446,7 @@ WasmPrinter::printStackIR(StackIR* ir, std::ostream& o, Function* func) { break; } default: - WASM_UNREACHABLE(); + WASM_UNREACHABLE("unexpeted op"); } std::cout << '\n'; } diff --git a/src/passes/ReReloop.cpp b/src/passes/ReReloop.cpp index 0fbe22c71..5d4190d18 100644 --- a/src/passes/ReReloop.cpp +++ b/src/passes/ReReloop.cpp @@ -102,7 +102,7 @@ struct ReReloop final : public Pass { struct Task { ReReloop& parent; Task(ReReloop& parent) : parent(parent) {} - virtual void run() { WASM_UNREACHABLE(); } + virtual void run() { WASM_UNREACHABLE("unimpl"); } }; typedef std::shared_ptr<Task> TaskPtr; @@ -200,7 +200,7 @@ struct ReReloop final : public Pass { parent.addBranch(ifTrueEnd, after); parent.addBranch(ifFalseEnd, after); } else { - WASM_UNREACHABLE(); + WASM_UNREACHABLE("invalid phase"); } } }; diff --git a/src/passes/RemoveUnusedNames.cpp b/src/passes/RemoveUnusedNames.cpp index 3b04522ad..1cd974704 100644 --- a/src/passes/RemoveUnusedNames.cpp +++ b/src/passes/RemoveUnusedNames.cpp @@ -80,7 +80,7 @@ struct RemoveUnusedNames : public WalkerPass<PostWalker<RemoveUnusedNames>> { br->name = child->name; } } else { - WASM_UNREACHABLE(); + WASM_UNREACHABLE("unexpected expr type"); } } child->finalize(child->type); diff --git a/src/passes/Souperify.cpp b/src/passes/Souperify.cpp index c5dca51fa..fb0a9d7b9 100644 --- a/src/passes/Souperify.cpp +++ b/src/passes/Souperify.cpp @@ -308,7 +308,7 @@ struct Trace { return nullptr; } default: - WASM_UNREACHABLE(); + WASM_UNREACHABLE("unexpected node type"); } // Assert on no cycles assert(addedNodes.find(node) == addedNodes.end()); @@ -344,7 +344,7 @@ struct Trace { } else if (curr == iff->ifFalse) { index = 1; } else { - WASM_UNREACHABLE(); + WASM_UNREACHABLE("invalid expr"); } auto* condition = conditions[index]; // Add the condition itself as an instruction in the trace - @@ -353,7 +353,7 @@ struct Trace { // Add it as a pc, which we will emit directly. pathConditions.push_back(condition); } else { - WASM_UNREACHABLE(); + WASM_UNREACHABLE("invalid expr"); } } @@ -501,11 +501,10 @@ struct Printer { break; } case Node::Type::Bad: { - std::cout << "!!!BAD!!!"; - WASM_UNREACHABLE(); + WASM_UNREACHABLE("!!!BAD!!!"); } default: - WASM_UNREACHABLE(); + WASM_UNREACHABLE("unexpted type"); } if (node->isExpr() || node->isPhi()) { if (node->origin != trace.toInfer->origin && @@ -557,7 +556,7 @@ struct Printer { std::cout << "ctpop"; break; default: - WASM_UNREACHABLE(); + WASM_UNREACHABLE("invalid op"); } std::cout << ' '; auto* value = node->getValue(0); @@ -649,7 +648,7 @@ struct Printer { std::cout << "ule"; break; default: - WASM_UNREACHABLE(); + WASM_UNREACHABLE("invalid op"); } std::cout << ' '; auto* left = node->getValue(0); @@ -665,7 +664,7 @@ struct Printer { std::cout << ", "; printInternal(node->getValue(2)); } else { - WASM_UNREACHABLE(); + WASM_UNREACHABLE("unexecpted node type"); } } diff --git a/src/passes/SpillPointers.cpp b/src/passes/SpillPointers.cpp index 5c3d546ad..10fa58845 100644 --- a/src/passes/SpillPointers.cpp +++ b/src/passes/SpillPointers.cpp @@ -132,7 +132,7 @@ struct SpillPointers pointer, toSpill, spillLocal, pointerMap, func, getModule()); } } else { - WASM_UNREACHABLE(); + WASM_UNREACHABLE("unexpected action"); } } } @@ -179,7 +179,7 @@ struct SpillPointers } handleOperand(call->cast<CallIndirect>()->target); } else { - WASM_UNREACHABLE(); + WASM_UNREACHABLE("unexpected expr"); } // add the spills for (auto index : toSpill) { diff --git a/src/passes/TrapMode.cpp b/src/passes/TrapMode.cpp index df900a125..c00c34eca 100644 --- a/src/passes/TrapMode.cpp +++ b/src/passes/TrapMode.cpp @@ -183,7 +183,7 @@ Function* generateUnaryFunc(Module& wasm, Unary* curr) { makeClampLimitLiterals<uint64_t, double>(iMin, fMin, fMax); break; default: - WASM_UNREACHABLE(); + WASM_UNREACHABLE("unexpected op"); } auto func = new Function; |