diff options
36 files changed, 68 insertions, 547 deletions
diff --git a/scripts/gen-s-parser.py b/scripts/gen-s-parser.py index b657ea909..836ca4dba 100755 --- a/scripts/gen-s-parser.py +++ b/scripts/gen-s-parser.py @@ -43,7 +43,6 @@ instructions = [ ("data.drop", "makeDataDrop(s)"), ("memory.copy", "makeMemoryCopy(s)"), ("memory.fill", "makeMemoryFill(s)"), - ("push", "makePush(s)"), ("i32.pop", "makePop(Type::i32)"), ("i64.pop", "makePop(Type::i64)"), ("f32.pop", "makePop(Type::f32)"), diff --git a/src/binaryen-c.cpp b/src/binaryen-c.cpp index be3b651f7..c94867032 100644 --- a/src/binaryen-c.cpp +++ b/src/binaryen-c.cpp @@ -269,7 +269,6 @@ BinaryenExpressionId BinaryenTupleMakeId(void) { BinaryenExpressionId BinaryenTupleExtractId(void) { return Expression::Id::TupleExtractId; } -BinaryenExpressionId BinaryenPushId(void) { return Expression::Id::PushId; } BinaryenExpressionId BinaryenPopId(void) { return Expression::Id::PopId; } // External kinds @@ -1249,11 +1248,6 @@ BinaryenExpressionRef BinaryenTupleExtract(BinaryenModuleRef module, Builder(*(Module*)module).makeTupleExtract((Expression*)tuple, index)); } -BinaryenExpressionRef BinaryenPush(BinaryenModuleRef module, - BinaryenExpressionRef value) { - return static_cast<Expression*>( - Builder(*(Module*)module).makePush((Expression*)value)); -} BinaryenExpressionRef BinaryenPop(BinaryenModuleRef module, BinaryenType type) { return static_cast<Expression*>( Builder(*(Module*)module).makePop(Type(type))); @@ -2033,12 +2027,6 @@ BinaryenIndex BinaryenTupleExtractGetIndex(BinaryenExpressionRef expr) { assert(expression->is<TupleExtract>()); return static_cast<TupleExtract*>(expression)->index; } -// Push -BinaryenExpressionRef BinaryenPushGetValue(BinaryenExpressionRef expr) { - auto* expression = (Expression*)expr; - assert(expression->is<Push>()); - return static_cast<Push*>(expression)->value; -} // Functions diff --git a/src/binaryen-c.h b/src/binaryen-c.h index b21a028ac..53fe69b92 100644 --- a/src/binaryen-c.h +++ b/src/binaryen-c.h @@ -169,7 +169,6 @@ BINARYEN_API BinaryenExpressionId BinaryenRethrowId(void); BINARYEN_API BinaryenExpressionId BinaryenBrOnExnId(void); BINARYEN_API BinaryenExpressionId BinaryenTupleMakeId(void); BINARYEN_API BinaryenExpressionId BinaryenTupleExtractId(void); -BINARYEN_API BinaryenExpressionId BinaryenPushId(void); BINARYEN_API BinaryenExpressionId BinaryenPopId(void); // External kinds (call to get the value of each; you can cache them) @@ -844,8 +843,6 @@ BinaryenTupleMake(BinaryenModuleRef module, BinaryenIndex numOperands); BINARYEN_API BinaryenExpressionRef BinaryenTupleExtract( BinaryenModuleRef module, BinaryenExpressionRef tuple, BinaryenIndex index); -BINARYEN_API BinaryenExpressionRef BinaryenPush(BinaryenModuleRef module, - BinaryenExpressionRef value); BINARYEN_API BinaryenExpressionRef BinaryenPop(BinaryenModuleRef module, BinaryenType type); @@ -1105,9 +1102,6 @@ BinaryenTupleExtractGetTuple(BinaryenExpressionRef expr); BINARYEN_API BinaryenIndex BinaryenTupleExtractGetIndex(BinaryenExpressionRef expr); -BINARYEN_API BinaryenExpressionRef -BinaryenPushGetValue(BinaryenExpressionRef expr); - // Functions BINARYEN_REF(Function); diff --git a/src/gen-s-parser.inc b/src/gen-s-parser.inc index 4c8e991c6..3a7569a61 100644 --- a/src/gen-s-parser.inc +++ b/src/gen-s-parser.inc @@ -2537,9 +2537,6 @@ switch (op[0]) { default: goto parse_error; } } - case 'p': - if (strcmp(op, "push") == 0) { return makePush(s); } - goto parse_error; case 'r': { switch (op[2]) { case 'f': { diff --git a/src/ir/ExpressionAnalyzer.cpp b/src/ir/ExpressionAnalyzer.cpp index 4c87bae28..a6f4b601f 100644 --- a/src/ir/ExpressionAnalyzer.cpp +++ b/src/ir/ExpressionAnalyzer.cpp @@ -231,7 +231,6 @@ template<typename T> void visitImmediates(Expression* curr, T& visitor) { } void visitNop(Nop* curr) {} void visitUnreachable(Unreachable* curr) {} - void visitPush(Push* curr) {} void visitPop(Pop* curr) {} void visitTupleMake(TupleMake* curr) {} void visitTupleExtract(TupleExtract* curr) { diff --git a/src/ir/ExpressionManipulator.cpp b/src/ir/ExpressionManipulator.cpp index 590d0c1ba..a9fd3c599 100644 --- a/src/ir/ExpressionManipulator.cpp +++ b/src/ir/ExpressionManipulator.cpp @@ -257,9 +257,6 @@ flexibleCopy(Expression* original, Module& wasm, CustomCopier custom) { Expression* visitUnreachable(Unreachable* curr) { return builder.makeUnreachable(); } - Expression* visitPush(Push* curr) { - return builder.makePush(copy(curr->value)); - } Expression* visitPop(Pop* curr) { return builder.makePop(curr->type); } Expression* visitTupleMake(TupleMake* curr) { std::vector<Expression*> operands; diff --git a/src/ir/ReFinalize.cpp b/src/ir/ReFinalize.cpp index 1de2e97a6..41bca48d4 100644 --- a/src/ir/ReFinalize.cpp +++ b/src/ir/ReFinalize.cpp @@ -136,7 +136,6 @@ void ReFinalize::visitBrOnExn(BrOnExn* curr) { } void ReFinalize::visitNop(Nop* curr) { curr->finalize(); } void ReFinalize::visitUnreachable(Unreachable* curr) { curr->finalize(); } -void ReFinalize::visitPush(Push* curr) { curr->finalize(); } void ReFinalize::visitPop(Pop* curr) { curr->finalize(); } void ReFinalize::visitTupleMake(TupleMake* curr) { curr->finalize(); } void ReFinalize::visitTupleExtract(TupleExtract* curr) { curr->finalize(); } diff --git a/src/ir/effects.h b/src/ir/effects.h index 55c78f05a..79233e6a8 100644 --- a/src/ir/effects.h +++ b/src/ir/effects.h @@ -458,7 +458,6 @@ struct EffectAnalyzer } void visitNop(Nop* curr) {} void visitUnreachable(Unreachable* curr) { branches = true; } - void visitPush(Push* curr) { calls = true; } void visitPop(Pop* curr) { calls = true; } void visitTupleMake(TupleMake* curr) {} void visitTupleExtract(TupleExtract* curr) {} diff --git a/src/ir/utils.h b/src/ir/utils.h index ded7059ca..a06598095 100644 --- a/src/ir/utils.h +++ b/src/ir/utils.h @@ -155,7 +155,6 @@ struct ReFinalize void visitBrOnExn(BrOnExn* curr); void visitNop(Nop* curr); void visitUnreachable(Unreachable* curr); - void visitPush(Push* curr); void visitPop(Pop* curr); void visitTupleMake(TupleMake* curr); void visitTupleExtract(TupleExtract* curr); @@ -224,7 +223,6 @@ struct ReFinalizeNode : public OverriddenVisitor<ReFinalizeNode> { void visitBrOnExn(BrOnExn* curr) { curr->finalize(); } void visitNop(Nop* curr) { curr->finalize(); } void visitUnreachable(Unreachable* curr) { curr->finalize(); } - void visitPush(Push* curr) { curr->finalize(); } void visitPop(Pop* curr) { curr->finalize(); } void visitTupleMake(TupleMake* curr) { curr->finalize(); } void visitTupleExtract(TupleExtract* curr) { curr->finalize(); } diff --git a/src/js/binaryen.js-post.js b/src/js/binaryen.js-post.js index 1902bddfa..8a2d60a2f 100644 --- a/src/js/binaryen.js-post.js +++ b/src/js/binaryen.js-post.js @@ -97,7 +97,6 @@ function initializeConstants() { 'BrOnExn', 'TupleMake', 'TupleExtract', - 'Push', 'Pop' ].forEach(function(name) { Module['ExpressionIds'][name] = Module[name + 'Id'] = Module['_Binaryen' + name + 'Id'](); @@ -2119,9 +2118,6 @@ function wrapModule(module, self) { return Module['_BinaryenBrOnExn'](module, strToStack(label), strToStack(event_), exnref); }); }; - self['push'] = function(value) { - return Module['_BinaryenPush'](module, value); - }; self['tuple'] = { 'make': function(elements) { @@ -2869,11 +2865,6 @@ Module['getExpressionInfo'] = function(expr) { 'tuple': Module['_BinaryenTupleExtractGetTuple'](expr), 'index': Module['_BinaryenTupleExtractGetIndex'](expr) }; - case Module['PushId']: - return { - 'id': id, - 'value': Module['_BinaryenPushGetValue'](expr) - }; default: throw Error('unexpected id: ' + id); diff --git a/src/passes/DeadCodeElimination.cpp b/src/passes/DeadCodeElimination.cpp index 400252e8f..9e2e194cb 100644 --- a/src/passes/DeadCodeElimination.cpp +++ b/src/passes/DeadCodeElimination.cpp @@ -351,8 +351,6 @@ struct DeadCodeElimination DELEGATE(MemoryCopy); case Expression::Id::MemoryFillId: DELEGATE(MemoryFill); - case Expression::Id::PushId: - DELEGATE(Push); case Expression::Id::PopId: DELEGATE(Pop); case Expression::Id::RefNullId: diff --git a/src/passes/Print.cpp b/src/passes/Print.cpp index 62eac9b06..efa31cac0 100644 --- a/src/passes/Print.cpp +++ b/src/passes/Print.cpp @@ -1436,7 +1436,6 @@ struct PrintExpressionContents } void visitNop(Nop* curr) { printMinor(o, "nop"); } void visitUnreachable(Unreachable* curr) { printMinor(o, "unreachable"); } - void visitPush(Push* curr) { prepareColor(o) << "push"; } void visitPop(Pop* curr) { prepareColor(o) << curr->type; o << ".pop"; @@ -2008,13 +2007,6 @@ struct PrintSExpression : public OverriddenVisitor<PrintSExpression> { PrintExpressionContents(currFunction, o).visit(curr); o << ')'; } - void visitPush(Push* curr) { - o << '('; - PrintExpressionContents(currFunction, o).visit(curr); - incIndent(); - printFullLine(curr->value); - decIndent(); - } void visitPop(Pop* curr) { o << '('; PrintExpressionContents(currFunction, o).visit(curr); @@ -2600,9 +2592,9 @@ WasmPrinter::printStackIR(StackIR* ir, std::ostream& o, Function* func) { switch (inst->op) { case StackInst::Basic: { doIndent(); - // push and pop are pseudo instructions and should not be printed in the - // stack IR format to make it valid wat form. - if (inst->origin->is<Push>() || inst->origin->is<Pop>()) { + // Pop is a pseudo instruction and should not be printed in the stack IR + // format to make it valid wat form. + if (inst->origin->is<Pop>()) { break; } PrintExpressionContents(func, o).visit(inst->origin); diff --git a/src/wasm-builder.h b/src/wasm-builder.h index 6d57ae438..5df512745 100644 --- a/src/wasm-builder.h +++ b/src/wasm-builder.h @@ -589,12 +589,6 @@ public: return ret; } Unreachable* makeUnreachable() { return allocator.alloc<Unreachable>(); } - Push* makePush(Expression* value) { - auto* ret = allocator.alloc<Push>(); - ret->value = value; - ret->finalize(); - return ret; - } Pop* makePop(Type type) { auto* ret = allocator.alloc<Pop>(); ret->type = type; diff --git a/src/wasm-interpreter.h b/src/wasm-interpreter.h index 56e453b64..c47786a08 100644 --- a/src/wasm-interpreter.h +++ b/src/wasm-interpreter.h @@ -1222,7 +1222,6 @@ public: Flow visitSIMDLoad(SIMDLoad* curr) { WASM_UNREACHABLE("unimp"); } Flow visitSIMDLoadSplat(SIMDLoad* curr) { WASM_UNREACHABLE("unimp"); } Flow visitSIMDLoadExtend(SIMDLoad* curr) { WASM_UNREACHABLE("unimp"); } - Flow visitPush(Push* curr) { WASM_UNREACHABLE("unimp"); } Flow visitPop(Pop* curr) { WASM_UNREACHABLE("unimp"); } Flow visitRefNull(RefNull* curr) { NOTE_ENTER("RefNull"); @@ -1521,10 +1520,6 @@ public: NOTE_ENTER("SIMDLoadExtend"); return Flow(NONCONSTANT_FLOW); } - Flow visitPush(Push* curr) { - NOTE_ENTER("Push"); - return Flow(NONCONSTANT_FLOW); - } Flow visitPop(Pop* curr) { NOTE_ENTER("Pop"); return Flow(NONCONSTANT_FLOW); @@ -2425,15 +2420,6 @@ private: return this->visit(curr->catchBody); } } - Flow visitPush(Push* curr) { - NOTE_ENTER("Push"); - Flow value = this->visit(curr->value); - if (value.breaking()) { - return value; - } - instance.multiValues.push_back(value.getSingleValue()); - return Flow(); - } Flow visitPop(Pop* curr) { NOTE_ENTER("Pop"); assert(!instance.multiValues.empty()); diff --git a/src/wasm-stack.h b/src/wasm-stack.h index e00fde5eb..09c8589b0 100644 --- a/src/wasm-stack.h +++ b/src/wasm-stack.h @@ -141,7 +141,6 @@ public: void visitNop(Nop* curr); void visitUnreachable(Unreachable* curr); void visitDrop(Drop* curr); - void visitPush(Push* curr); void visitPop(Pop* curr); void visitTupleMake(TupleMake* curr); void visitTupleExtract(TupleExtract* curr); @@ -234,7 +233,6 @@ public: void visitNop(Nop* curr); void visitUnreachable(Unreachable* curr); void visitDrop(Drop* curr); - void visitPush(Push* curr); void visitPop(Pop* curr); void visitTupleMake(TupleMake* curr); void visitTupleExtract(TupleExtract* curr); @@ -794,12 +792,6 @@ void BinaryenIRWriter<SubType>::visitDrop(Drop* curr) { emit(curr); } -template<typename SubType> -void BinaryenIRWriter<SubType>::visitPush(Push* curr) { - visit(curr->value); - emit(curr); -} - template<typename SubType> void BinaryenIRWriter<SubType>::visitPop(Pop* curr) { emit(curr); } diff --git a/src/wasm-traversal.h b/src/wasm-traversal.h index 4cf318db9..fc6b1cbb8 100644 --- a/src/wasm-traversal.h +++ b/src/wasm-traversal.h @@ -81,7 +81,6 @@ template<typename SubType, typename ReturnType = void> struct Visitor { ReturnType visitBrOnExn(BrOnExn* curr) { return ReturnType(); } ReturnType visitNop(Nop* curr) { return ReturnType(); } ReturnType visitUnreachable(Unreachable* curr) { return ReturnType(); } - ReturnType visitPush(Push* curr) { return ReturnType(); } ReturnType visitPop(Pop* curr) { return ReturnType(); } ReturnType visitTupleMake(TupleMake* curr) { return ReturnType(); } ReturnType visitTupleExtract(TupleExtract* curr) { return ReturnType(); } @@ -190,8 +189,6 @@ template<typename SubType, typename ReturnType = void> struct Visitor { DELEGATE(Nop); case Expression::Id::UnreachableId: DELEGATE(Unreachable); - case Expression::Id::PushId: - DELEGATE(Push); case Expression::Id::PopId: DELEGATE(Pop); case Expression::Id::TupleMakeId: @@ -265,7 +262,6 @@ struct OverriddenVisitor { UNIMPLEMENTED(BrOnExn); UNIMPLEMENTED(Nop); UNIMPLEMENTED(Unreachable); - UNIMPLEMENTED(Push); UNIMPLEMENTED(Pop); UNIMPLEMENTED(TupleMake); UNIMPLEMENTED(TupleExtract); @@ -375,8 +371,6 @@ struct OverriddenVisitor { DELEGATE(Nop); case Expression::Id::UnreachableId: DELEGATE(Unreachable); - case Expression::Id::PushId: - DELEGATE(Push); case Expression::Id::PopId: DELEGATE(Pop); case Expression::Id::TupleMakeId: @@ -533,9 +527,6 @@ struct UnifiedExpressionVisitor : public Visitor<SubType, ReturnType> { ReturnType visitUnreachable(Unreachable* curr) { return static_cast<SubType*>(this)->visitExpression(curr); } - ReturnType visitPush(Push* curr) { - return static_cast<SubType*>(this)->visitExpression(curr); - } ReturnType visitPop(Pop* curr) { return static_cast<SubType*>(this)->visitExpression(curr); } @@ -850,9 +841,6 @@ struct Walker : public VisitorType { static void doVisitUnreachable(SubType* self, Expression** currp) { self->visitUnreachable((*currp)->cast<Unreachable>()); } - static void doVisitPush(SubType* self, Expression** currp) { - self->visitPush((*currp)->cast<Push>()); - } static void doVisitPop(SubType* self, Expression** currp) { self->visitPop((*currp)->cast<Pop>()); } @@ -1141,11 +1129,6 @@ struct PostWalker : public Walker<SubType, VisitorType> { self->pushTask(SubType::doVisitUnreachable, currp); break; } - case Expression::Id::PushId: { - self->pushTask(SubType::doVisitPush, currp); - self->pushTask(SubType::scan, &curr->cast<Push>()->value); - break; - } case Expression::Id::PopId: { self->pushTask(SubType::doVisitPop, currp); break; diff --git a/src/wasm.h b/src/wasm.h index c43544cc1..0afe5ab28 100644 --- a/src/wasm.h +++ b/src/wasm.h @@ -540,7 +540,6 @@ public: DataDropId, MemoryCopyId, MemoryFillId, - PushId, PopId, RefNullId, RefIsNullId, @@ -1067,25 +1066,8 @@ public: Unreachable(MixedArena& allocator) : Unreachable() {} }; -// A multivalue push. This represents a push of a value, which will be -// used in the next return. That is, a multivalue return is done by -// pushing some values, then doing a return (with a value as well). -// For more on this design, see the readme. -class Push : public SpecificExpression<Expression::PushId> { -public: - Push() = default; - Push(MixedArena& allocator) {} - - Expression* value; - - void finalize(); -}; - -// A multivalue pop. This represents a pop of a value, which arrived -// from a multivalue call or other situation where there are things on -// the stack. That is, a multivalue-returning call is done by doing -// the call, receiving the first value normally, and receiving the others -// via calls to pop. +// Represents a pop of a value that arrives as an implicit argument to the +// current block. Currently used in exception handling. class Pop : public SpecificExpression<Expression::PopId> { public: Pop() = default; diff --git a/src/wasm/wasm-s-parser.cpp b/src/wasm/wasm-s-parser.cpp index 65351fe99..7ca8dd131 100644 --- a/src/wasm/wasm-s-parser.cpp +++ b/src/wasm/wasm-s-parser.cpp @@ -1581,13 +1581,6 @@ Expression* SExpressionWasmBuilder::makeMemoryFill(Element& s) { return ret; } -Expression* SExpressionWasmBuilder::makePush(Element& s) { - auto ret = allocator.alloc<Push>(); - ret->value = parseExpression(s[1]); - ret->finalize(); - return ret; -} - Expression* SExpressionWasmBuilder::makePop(Type type) { auto ret = allocator.alloc<Pop>(); ret->type = type; diff --git a/src/wasm/wasm-stack.cpp b/src/wasm/wasm-stack.cpp index 3c5122c10..58fa3f2ef 100644 --- a/src/wasm/wasm-stack.cpp +++ b/src/wasm/wasm-stack.cpp @@ -1707,10 +1707,6 @@ void BinaryInstWriter::visitDrop(Drop* curr) { } } -void BinaryInstWriter::visitPush(Push* curr) { - // Turns into nothing in the binary format -} - void BinaryInstWriter::visitPop(Pop* curr) { // Turns into nothing in the binary format } diff --git a/src/wasm/wasm.cpp b/src/wasm/wasm.cpp index bce1aa4de..704e48e88 100644 --- a/src/wasm/wasm.cpp +++ b/src/wasm/wasm.cpp @@ -171,8 +171,6 @@ const char* getExpressionName(Expression* curr) { return "memory_copy"; case Expression::Id::MemoryFillId: return "memory_fill"; - case Expression::Id::PushId: - return "push"; case Expression::Id::PopId: return "pop"; case Expression::Id::RefNullId: @@ -913,14 +911,6 @@ void BrOnExn::finalize() { } } -void Push::finalize() { - if (value->type == Type::unreachable) { - type = Type::unreachable; - } else { - type = Type::none; - } -} - void TupleMake::finalize() { std::vector<Type> types; for (auto* op : operands) { diff --git a/src/wasm2js.h b/src/wasm2js.h index 1d8003323..e5f473e21 100644 --- a/src/wasm2js.h +++ b/src/wasm2js.h @@ -1889,10 +1889,6 @@ Ref Wasm2JSBuilder::processFunctionBody(Module* m, unimplemented(curr); WASM_UNREACHABLE("unimp"); } - Ref visitPush(Push* curr) { - unimplemented(curr); - WASM_UNREACHABLE("unimp"); - } Ref visitPop(Pop* curr) { unimplemented(curr); WASM_UNREACHABLE("unimp"); diff --git a/test/binaryen.js/exception-handling.js.txt b/test/binaryen.js/exception-handling.js.txt index a2b10d37f..380ce34d6 100644 --- a/test/binaryen.js/exception-handling.js.txt +++ b/test/binaryen.js/exception-handling.js.txt @@ -28,7 +28,7 @@ ) ) -getExpressionInfo(throw) = {"id":44,"type":1,"event":"e"} -getExpressionInfo(br_on_exn) = {"id":46,"type":10,"name":"l","event":"e"} -getExpressionInfo(rethrow) = {"id":45,"type":1} -getExpressionInfo(try) = {"id":43,"type":0} +getExpressionInfo(throw) = {"id":43,"type":1,"event":"e"} +getExpressionInfo(br_on_exn) = {"id":45,"type":10,"name":"l","event":"e"} +getExpressionInfo(rethrow) = {"id":44,"type":1} +getExpressionInfo(try) = {"id":42,"type":0} diff --git a/test/binaryen.js/kitchen-sink.js b/test/binaryen.js/kitchen-sink.js index b0b81433d..6c5afa169 100644 --- a/test/binaryen.js/kitchen-sink.js +++ b/test/binaryen.js/kitchen-sink.js @@ -145,7 +145,6 @@ function test_ids() { console.log("ThrowId: " + binaryen.ThrowId); console.log("RethrowId: " + binaryen.RethrowId); console.log("BrOnExnId: " + binaryen.BrOnExnId); - console.log("PushId: " + binaryen.PushId); console.log("PopId: " + binaryen.PopId); } @@ -548,16 +547,16 @@ function test_core() { ), 2 ), - // Push and pop - module.push(module.i32.pop()), - module.push(module.i64.pop()), - module.push(module.f32.pop()), - module.push(module.f64.pop()), - module.push(module.v128.pop()), - module.push(module.anyref.pop()), - module.push(module.funcref.pop()), - module.push(module.nullref.pop()), - module.push(module.exnref.pop()), + // Pop + module.i32.pop(), + module.i64.pop(), + module.f32.pop(), + module.f64.pop(), + module.v128.pop(), + module.anyref.pop(), + module.funcref.pop(), + module.nullref.pop(), + module.exnref.pop(), // TODO: Host module.nop(), module.unreachable(), diff --git a/test/binaryen.js/kitchen-sink.js.txt b/test/binaryen.js/kitchen-sink.js.txt index b27d147b3..14f8c0d03 100644 --- a/test/binaryen.js/kitchen-sink.js.txt +++ b/test/binaryen.js/kitchen-sink.js.txt @@ -69,12 +69,11 @@ MemoryInitId: 34 DataDropId: 35 MemoryCopyId: 36 MemoryFillId: 37 -TryId: 43 -ThrowId: 44 -RethrowId: 45 -BrOnExnId: 46 -PushId: 38 -PopId: 39 +TryId: 42 +ThrowId: 43 +RethrowId: 44 +BrOnExnId: 45 +PopId: 38 getExpressionInfo={"id":15,"type":4,"op":6} (f32.neg (f32.const -33.61199951171875) @@ -1846,31 +1845,31 @@ getExpressionInfo(tuple[3])={"id":14,"type":5,"value":3.7} ) ) ) - (push + (drop (i32.pop) ) - (push + (drop (i64.pop) ) - (push + (drop (f32.pop) ) - (push + (drop (f64.pop) ) - (push + (drop (v128.pop) ) - (push + (drop (anyref.pop) ) - (push + (drop (funcref.pop) ) - (push + (drop (nullref.pop) ) - (push + (drop (exnref.pop) ) (nop) @@ -3644,31 +3643,31 @@ getExpressionInfo(tuple[3])={"id":14,"type":5,"value":3.7} ) ) ) - (push + (drop (i32.pop) ) - (push + (drop (i64.pop) ) - (push + (drop (f32.pop) ) - (push + (drop (f64.pop) ) - (push + (drop (v128.pop) ) - (push + (drop (anyref.pop) ) - (push + (drop (funcref.pop) ) - (push + (drop (nullref.pop) ) - (push + (drop (exnref.pop) ) (nop) diff --git a/test/binaryen.js/push-pop.js b/test/binaryen.js/push-pop.js deleted file mode 100644 index 042ed17d6..000000000 --- a/test/binaryen.js/push-pop.js +++ /dev/null @@ -1,43 +0,0 @@ -function cleanInfo(info) { - var ret = {}; - for (var x in info) { - if (x !== 'value') { - ret[x] = info[x]; - } - } - return ret; -} - -function stringify(expr) { - return JSON.stringify(cleanInfo(binaryen.getExpressionInfo(expr))); -} - -var module = new binaryen.Module(); - -var func = module.addFunction("func", binaryen.none, binaryen.none, [], - module.block(null, [ - module.push(module.i32.pop()), - module.push(module.i64.pop()), - module.push(module.f32.pop()), - module.push(module.f64.pop()), - module.push(module.v128.pop()), - module.push(module.funcref.pop()), - module.push(module.anyref.pop()), - module.push(module.nullref.pop()), - module.push(module.exnref.pop()) - ]) -) - -assert(module.validate()); -console.log(module.emitText()); - -console.log("getExpressionInfo(i32.pop) = " + stringify(module.i32.pop())); -console.log("getExpressionInfo(i64.pop) = " + stringify(module.i64.pop())); -console.log("getExpressionInfo(f32.pop) = " + stringify(module.f32.pop())); -console.log("getExpressionInfo(f64.pop) = " + stringify(module.f64.pop())); -console.log("getExpressionInfo(v128.pop) = " + stringify(module.v128.pop())); -console.log("getExpressionInfo(funcref.pop) = " + stringify(module.funcref.pop())); -console.log("getExpressionInfo(anyref.pop) = " + stringify(module.anyref.pop())); -console.log("getExpressionInfo(nullref.pop) = " + stringify(module.nullref.pop())); -console.log("getExpressionInfo(exnref.pop) = " + stringify(module.exnref.pop())); -console.log("getExpressionInfo(push) = " + stringify(module.push(module.i32.const(0)))); diff --git a/test/binaryen.js/push-pop.js.txt b/test/binaryen.js/push-pop.js.txt deleted file mode 100644 index e5d5437f9..000000000 --- a/test/binaryen.js/push-pop.js.txt +++ /dev/null @@ -1,43 +0,0 @@ -(module - (type $none_=>_none (func)) - (func $func - (push - (i32.pop) - ) - (push - (i64.pop) - ) - (push - (f32.pop) - ) - (push - (f64.pop) - ) - (push - (v128.pop) - ) - (push - (funcref.pop) - ) - (push - (anyref.pop) - ) - (push - (nullref.pop) - ) - (push - (exnref.pop) - ) - ) -) - -getExpressionInfo(i32.pop) = {"id":39,"type":2} -getExpressionInfo(i64.pop) = {"id":39,"type":3} -getExpressionInfo(f32.pop) = {"id":39,"type":4} -getExpressionInfo(f64.pop) = {"id":39,"type":5} -getExpressionInfo(v128.pop) = {"id":39,"type":6} -getExpressionInfo(funcref.pop) = {"id":39,"type":7} -getExpressionInfo(anyref.pop) = {"id":39,"type":8} -getExpressionInfo(nullref.pop) = {"id":39,"type":9} -getExpressionInfo(exnref.pop) = {"id":39,"type":10} -getExpressionInfo(push) = {"id":38} diff --git a/test/example/c-api-kitchen-sink.c b/test/example/c-api-kitchen-sink.c index 3ea6c4ef0..764cc0ba6 100644 --- a/test/example/c-api-kitchen-sink.c +++ b/test/example/c-api-kitchen-sink.c @@ -733,18 +733,18 @@ void test_core() { BinaryenTupleMake(module, tupleElements4a, 4), BinaryenTupleExtract( module, BinaryenTupleMake(module, tupleElements4b, 4), 2), - // Push and pop - BinaryenPush(module, BinaryenPop(module, BinaryenTypeInt32())), - BinaryenPush(module, BinaryenPop(module, BinaryenTypeInt64())), - BinaryenPush(module, BinaryenPop(module, BinaryenTypeFloat32())), - BinaryenPush(module, BinaryenPop(module, BinaryenTypeFloat64())), - BinaryenPush(module, BinaryenPop(module, BinaryenTypeFuncref())), - BinaryenPush(module, BinaryenPop(module, BinaryenTypeAnyref())), - BinaryenPush(module, BinaryenPop(module, BinaryenTypeNullref())), - BinaryenPush(module, BinaryenPop(module, BinaryenTypeExnref())), - BinaryenPush(module, BinaryenPop(module, BinaryenTypeFuncref())), - BinaryenPush(module, BinaryenPop(module, BinaryenTypeNullref())), - BinaryenPush(module, BinaryenPop(module, BinaryenTypeExnref())), + // Pop + BinaryenPop(module, BinaryenTypeInt32()), + BinaryenPop(module, BinaryenTypeInt64()), + BinaryenPop(module, BinaryenTypeFloat32()), + BinaryenPop(module, BinaryenTypeFloat64()), + BinaryenPop(module, BinaryenTypeFuncref()), + BinaryenPop(module, BinaryenTypeAnyref()), + BinaryenPop(module, BinaryenTypeNullref()), + BinaryenPop(module, BinaryenTypeExnref()), + BinaryenPop(module, BinaryenTypeFuncref()), + BinaryenPop(module, BinaryenTypeNullref()), + BinaryenPop(module, BinaryenTypeExnref()), // TODO: Host BinaryenNop(module), diff --git a/test/example/c-api-kitchen-sink.txt b/test/example/c-api-kitchen-sink.txt index ced13ac72..fda846fcb 100644 --- a/test/example/c-api-kitchen-sink.txt +++ b/test/example/c-api-kitchen-sink.txt @@ -1779,37 +1779,37 @@ BinaryenFeatureAll: 1023 ) ) ) - (push + (drop (i32.pop) ) - (push + (drop (i64.pop) ) - (push + (drop (f32.pop) ) - (push + (drop (f64.pop) ) - (push + (drop (funcref.pop) ) - (push + (drop (anyref.pop) ) - (push + (drop (nullref.pop) ) - (push + (drop (exnref.pop) ) - (push + (drop (funcref.pop) ) - (push + (drop (nullref.pop) ) - (push + (drop (exnref.pop) ) (nop) diff --git a/test/passes/Os_print-stack-ir.txt b/test/passes/Os_print-stack-ir.txt index 02af45e21..9fbde2f4a 100644 --- a/test/passes/Os_print-stack-ir.txt +++ b/test/passes/Os_print-stack-ir.txt @@ -49,23 +49,15 @@ (export "ppf32" (func $2)) (export "ppf64" (func $3)) (func $0 (result i32) - i32.const 1 - ) (func $1 (result i64) - i64.const 1 - ) (func $2 (result f32) - f32.const 1 - ) (func $3 (result f64) - f64.const 1 - ) ) @@ -79,27 +71,15 @@ (export "ppf32" (func $2)) (export "ppf64" (func $3)) (func $0 (; has Stack IR ;) (result i32) - (push - (i32.const 1) - ) (i32.pop) ) (func $1 (; has Stack IR ;) (result i64) - (push - (i64.const 1) - ) (i64.pop) ) (func $2 (; has Stack IR ;) (result f32) - (push - (f32.const 1) - ) (f32.pop) ) (func $3 (; has Stack IR ;) (result f64) - (push - (f64.const 1) - ) (f64.pop) ) ) diff --git a/test/passes/Os_print-stack-ir.wast b/test/passes/Os_print-stack-ir.wast index 7318d8bef..6944a3207 100644 --- a/test/passes/Os_print-stack-ir.wast +++ b/test/passes/Os_print-stack-ir.wast @@ -15,25 +15,19 @@ ) ) (module - ;; These are not quite valid usages of push/pop - they are not meant to be used - ;; with each other. This just tests we can emit them/handle them in the optimizer. - ;; Once we have proper places to use them, we can tighten up the validation and - ;; replace this test with something correct. + ;; These are not valid usages of pops - they are not meant to be + ;; used alone. This just tests we can emit them/handle them in the + ;; optimizer. (func "ppi32" (result i32) - (push (i32.const 1)) (i32.pop) ) (func "ppi64" (result i64) - (push (i64.const 1)) (i64.pop) ) (func "ppf32" (result f32) - (push (f32.const 1)) (f32.pop) ) (func "ppf64" (result f64) - (push (f64.const 1)) (f64.pop) ) ) - diff --git a/test/passes/dce_all-features.txt b/test/passes/dce_all-features.txt index d1d116046..59f32f1be 100644 --- a/test/passes/dce_all-features.txt +++ b/test/passes/dce_all-features.txt @@ -551,14 +551,3 @@ ) ) ) -(module - (type $none_=>_none (func)) - (func $foo - (nop) - ) - (func $push_unreachable - (push - (unreachable) - ) - ) -) diff --git a/test/passes/dce_all-features.wast b/test/passes/dce_all-features.wast index 641211eab..77e781097 100644 --- a/test/passes/dce_all-features.wast +++ b/test/passes/dce_all-features.wast @@ -811,14 +811,3 @@ ) ) ) - -;; Push-pop -(module - (func $foo) - (func $push_unreachable - (push - (unreachable) - ) - (call $foo) ;; should be dce'd - ) -) diff --git a/test/push_pop.wast b/test/push_pop.wast deleted file mode 100644 index d73e0dc68..000000000 --- a/test/push_pop.wast +++ /dev/null @@ -1,39 +0,0 @@ -(module - ;; These are not quite valid usages of push/pop - they are not meant to be used - ;; with each other. This just tests we can emit them/handle them in the optimizer. - ;; Once we have proper places to use them, we can tighten up the validation and - ;; replace this test with something correct. - (func "ppi32" (result i32) - (push (i32.const 1)) - (i32.pop) - ) - (func "ppi64" (result i64) - (push (i64.const 1)) - (i64.pop) - ) - (func "ppf32" (result f32) - (push (f32.const 1)) - (f32.pop) - ) - (func "ppf64" (result f64) - (push (f64.const 1)) - (f64.pop) - ) - (func "ppanyref" (result anyref) (local $any anyref) - (push (local.get $any)) - (anyref.pop) - ) - (func "ppfuncref" (result funcref) (local $fn funcref) - (push (local.get $fn)) - (funcref.pop) - ) - (func "ppnullref" - (push (ref.null)) - (drop (nullref.pop)) - ) - (func "ppexnref" (result exnref) (local $exn exnref) - (push (local.get $exn)) - (exnref.pop) - ) -) - diff --git a/test/push_pop.wast.from-wast b/test/push_pop.wast.from-wast deleted file mode 100644 index 72309a0d0..000000000 --- a/test/push_pop.wast.from-wast +++ /dev/null @@ -1,71 +0,0 @@ -(module - (type $none_=>_none (func)) - (type $none_=>_i32 (func (result i32))) - (type $none_=>_i64 (func (result i64))) - (type $none_=>_f32 (func (result f32))) - (type $none_=>_f64 (func (result f64))) - (type $none_=>_funcref (func (result funcref))) - (type $none_=>_anyref (func (result anyref))) - (type $none_=>_exnref (func (result exnref))) - (export "ppi32" (func $0)) - (export "ppi64" (func $1)) - (export "ppf32" (func $2)) - (export "ppf64" (func $3)) - (export "ppanyref" (func $4)) - (export "ppfuncref" (func $5)) - (export "ppnullref" (func $6)) - (export "ppexnref" (func $7)) - (func $0 (result i32) - (push - (i32.const 1) - ) - (i32.pop) - ) - (func $1 (result i64) - (push - (i64.const 1) - ) - (i64.pop) - ) - (func $2 (result f32) - (push - (f32.const 1) - ) - (f32.pop) - ) - (func $3 (result f64) - (push - (f64.const 1) - ) - (f64.pop) - ) - (func $4 (result anyref) - (local $any anyref) - (push - (local.get $any) - ) - (anyref.pop) - ) - (func $5 (result funcref) - (local $fn funcref) - (push - (local.get $fn) - ) - (funcref.pop) - ) - (func $6 - (push - (ref.null) - ) - (drop - (nullref.pop) - ) - ) - (func $7 (result exnref) - (local $exn exnref) - (push - (local.get $exn) - ) - (exnref.pop) - ) -) diff --git a/test/push_pop.wast.fromBinary b/test/push_pop.wast.fromBinary deleted file mode 100644 index 489897df6..000000000 --- a/test/push_pop.wast.fromBinary +++ /dev/null @@ -1,48 +0,0 @@ -(module - (type $none_=>_none (func)) - (type $none_=>_i32 (func (result i32))) - (type $none_=>_i64 (func (result i64))) - (type $none_=>_f32 (func (result f32))) - (type $none_=>_f64 (func (result f64))) - (type $none_=>_funcref (func (result funcref))) - (type $none_=>_anyref (func (result anyref))) - (type $none_=>_exnref (func (result exnref))) - (export "ppi32" (func $0)) - (export "ppi64" (func $1)) - (export "ppf32" (func $2)) - (export "ppf64" (func $3)) - (export "ppanyref" (func $4)) - (export "ppfuncref" (func $5)) - (export "ppnullref" (func $6)) - (export "ppexnref" (func $7)) - (func $0 (result i32) - (i32.const 1) - ) - (func $1 (result i64) - (i64.const 1) - ) - (func $2 (result f32) - (f32.const 1) - ) - (func $3 (result f64) - (f64.const 1) - ) - (func $4 (result anyref) - (local $0 anyref) - (local.get $0) - ) - (func $5 (result funcref) - (local $0 funcref) - (local.get $0) - ) - (func $6 - (drop - (ref.null) - ) - ) - (func $7 (result exnref) - (local $0 exnref) - (local.get $0) - ) -) - diff --git a/test/push_pop.wast.fromBinary.noDebugInfo b/test/push_pop.wast.fromBinary.noDebugInfo deleted file mode 100644 index 489897df6..000000000 --- a/test/push_pop.wast.fromBinary.noDebugInfo +++ /dev/null @@ -1,48 +0,0 @@ -(module - (type $none_=>_none (func)) - (type $none_=>_i32 (func (result i32))) - (type $none_=>_i64 (func (result i64))) - (type $none_=>_f32 (func (result f32))) - (type $none_=>_f64 (func (result f64))) - (type $none_=>_funcref (func (result funcref))) - (type $none_=>_anyref (func (result anyref))) - (type $none_=>_exnref (func (result exnref))) - (export "ppi32" (func $0)) - (export "ppi64" (func $1)) - (export "ppf32" (func $2)) - (export "ppf64" (func $3)) - (export "ppanyref" (func $4)) - (export "ppfuncref" (func $5)) - (export "ppnullref" (func $6)) - (export "ppexnref" (func $7)) - (func $0 (result i32) - (i32.const 1) - ) - (func $1 (result i64) - (i64.const 1) - ) - (func $2 (result f32) - (f32.const 1) - ) - (func $3 (result f64) - (f64.const 1) - ) - (func $4 (result anyref) - (local $0 anyref) - (local.get $0) - ) - (func $5 (result funcref) - (local $0 funcref) - (local.get $0) - ) - (func $6 - (drop - (ref.null) - ) - ) - (func $7 (result exnref) - (local $0 exnref) - (local.get $0) - ) -) - |