diff options
author | Thomas Lively <7121787+tlively@users.noreply.github.com> | 2019-01-07 13:24:58 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-07 13:24:58 -0800 |
commit | 7d94900ded8e2e5ce8ef8ee2687528531d8f2a97 (patch) | |
tree | d8bba13d306b0c5ecba384384e602e6cccc83015 /src/passes | |
parent | 6f91af190effd7b8a5969314dd4fb3d2ec540524 (diff) | |
download | binaryen-7d94900ded8e2e5ce8ef8ee2687528531d8f2a97.tar.gz binaryen-7d94900ded8e2e5ce8ef8ee2687528531d8f2a97.tar.bz2 binaryen-7d94900ded8e2e5ce8ef8ee2687528531d8f2a97.zip |
Massive renaming (#1855)
Automated renaming according to
https://github.com/WebAssembly/spec/issues/884#issuecomment-426433329.
Diffstat (limited to 'src/passes')
-rw-r--r-- | src/passes/CodePushing.cpp | 4 | ||||
-rw-r--r-- | src/passes/ConstHoisting.cpp | 4 | ||||
-rw-r--r-- | src/passes/DataFlowOpts.cpp | 4 | ||||
-rw-r--r-- | src/passes/Flatten.cpp | 14 | ||||
-rw-r--r-- | src/passes/Inlining.cpp | 4 | ||||
-rw-r--r-- | src/passes/InstrumentLocals.cpp | 8 | ||||
-rw-r--r-- | src/passes/LocalCSE.cpp | 4 | ||||
-rw-r--r-- | src/passes/MergeLocals.cpp | 20 | ||||
-rw-r--r-- | src/passes/OptimizeInstructions.cpp | 2 | ||||
-rw-r--r-- | src/passes/Precompute.cpp | 6 | ||||
-rw-r--r-- | src/passes/Print.cpp | 103 | ||||
-rw-r--r-- | src/passes/RedundantSetElimination.cpp | 4 | ||||
-rw-r--r-- | src/passes/RemoveUnusedBrs.cpp | 20 | ||||
-rw-r--r-- | src/passes/SimplifyLocals.cpp | 56 | ||||
-rw-r--r-- | src/passes/Souperify.cpp | 2 | ||||
-rw-r--r-- | src/passes/StackIR.cpp | 6 | ||||
-rw-r--r-- | src/passes/Untee.cpp | 2 | ||||
-rw-r--r-- | src/passes/pass.cpp | 4 | ||||
-rw-r--r-- | src/passes/wasm-intrinsics.wast | 516 |
19 files changed, 394 insertions, 389 deletions
diff --git a/src/passes/CodePushing.cpp b/src/passes/CodePushing.cpp index fefceb6ec..931df140d 100644 --- a/src/passes/CodePushing.cpp +++ b/src/passes/CodePushing.cpp @@ -29,8 +29,8 @@ namespace wasm { // // Analyzers some useful local properties: # of sets and gets, and SFA. // -// Single First Assignment (SFA) form: the local has a single set_local, is -// not a parameter, and has no get_locals before the set_local in postorder. +// Single First Assignment (SFA) form: the local has a single local.set, is +// not a parameter, and has no local.gets before the local.set in postorder. // This is a much weaker property than SSA, obviously, but together with // our implicit dominance properties in the structured AST is quite useful. // diff --git a/src/passes/ConstHoisting.cpp b/src/passes/ConstHoisting.cpp index 77ac5d251..11188a9ba 100644 --- a/src/passes/ConstHoisting.cpp +++ b/src/passes/ConstHoisting.cpp @@ -15,7 +15,7 @@ */ // -// Hoists repeated constants to a local. A get_local takes 2 bytes +// Hoists repeated constants to a local. A local.get takes 2 bytes // in most cases, and if a const is larger than that, it may be // better to store it to a local, then get it from that local. // @@ -108,7 +108,7 @@ private: // or // num > (size+2)/(size-2) auto before = num * size; - auto after = size + 2 /* set_local */ + (2 /* get_local */ * num); + auto after = size + 2 /* local.set */ + (2 /* local.get */ * num); return after < before; } diff --git a/src/passes/DataFlowOpts.cpp b/src/passes/DataFlowOpts.cpp index e32fcb700..702b3e7f4 100644 --- a/src/passes/DataFlowOpts.cpp +++ b/src/passes/DataFlowOpts.cpp @@ -88,7 +88,7 @@ struct DataFlowOpts : public WalkerPass<PostWalker<DataFlowOpts>> { // then copy the result if it's smaller. if (node->isPhi() && DataFlow::allInputsIdentical(node)) { // Note we don't need to check for effects when replacing, as in - // flattened IR expression children are get_locals or consts. + // flattened IR expression children are local.gets or consts. auto* value = node->getValue(1); if (value->isConst()) { replaceAllUsesWith(node, value); @@ -112,7 +112,7 @@ struct DataFlowOpts : public WalkerPass<PostWalker<DataFlowOpts>> { //dump(node, std::cout); auto* expr = node->expr; // First, note that some of the expression's children may be - // get_locals that we inferred during SSA analysis as constant. + // local.gets that we inferred during SSA analysis as constant. // We can apply those now. for (Index i = 0; i < node->values.size(); i++) { if (node->values[i]->isConst()) { diff --git a/src/passes/Flatten.cpp b/src/passes/Flatten.cpp index aa5c1a491..61fc60b2b 100644 --- a/src/passes/Flatten.cpp +++ b/src/passes/Flatten.cpp @@ -27,26 +27,26 @@ // ) // => // (if (..condition..) -// (set_local $temp +// (local.set $temp // (..if true..) // ) -// (set_local $temp +// (local.set $temp // (..if false..) // ) // ) // (i32.add -// (get_local $temp) +// (local.get $temp) // (i32.const 1) // ) // // Formally, this pass flattens in the precise sense of // making the AST have these properties: // -// 1. The operands of an instruction must be a get_local or a const. +// 1. The operands of an instruction must be a local.get or a const. // anything else is written to a local earlier. // 2. Disallow block, loop, and if return values, i.e., do not use // control flow to pass around values. -// 3. Disallow tee_local, setting a local is always done in a set_local +// 3. Disallow local.tee, setting a local is always done in a local.set // on a non-nested-expression location. // @@ -62,7 +62,7 @@ namespace wasm { // We use the following algorithm: we maintain a list of "preludes", code // that runs right before an expression. When we visit an expression we // must handle it and its preludes. If the expression has side effects, -// we reduce it to a get_local and add a prelude for that. We then handle +// we reduce it to a local.get and add a prelude for that. We then handle // the preludes, by moving them to the parent or handling them directly. // we can move them to the parent if the parent is not a control flow // structure. Otherwise, if the parent is a control flow structure, it @@ -190,7 +190,7 @@ struct Flatten : public WalkerPass<ExpressionStackWalker<Flatten, UnifiedExpress // special handling if (auto* set = curr->dynCast<SetLocal>()) { if (set->isTee()) { - // we disallow tee_local + // we disallow local.tee if (set->value->type == unreachable) { replaceCurrent(set->value); // trivial, no set happens } else { diff --git a/src/passes/Inlining.cpp b/src/passes/Inlining.cpp index 35afc5776..f801662e0 100644 --- a/src/passes/Inlining.cpp +++ b/src/passes/Inlining.cpp @@ -55,11 +55,11 @@ static const int FLEXIBLE_SIZE_LIMIT = 20; // smaller than the call instruction itself. 2 is a safe number because // there is no risk of things like // (func $reverse (param $x i32) (param $y i32) -// (call $something (get_local $y) (get_local $x)) +// (call $something (local.get $y) (local.get $x)) // ) // in which case the reversing of the params means we'll possibly need // a block and a temp local. But that takes at least 3 nodes, and 2 < 3. -// More generally, with 2 items we may have a get_local, but no way to +// More generally, with 2 items we may have a local.get, but no way to // require it to be saved instead of directly consumed. static const int INLINING_OPTIMIZING_WILL_DECREASE_SIZE_LIMIT = 2; diff --git a/src/passes/InstrumentLocals.cpp b/src/passes/InstrumentLocals.cpp index f582004d5..a1835eb64 100644 --- a/src/passes/InstrumentLocals.cpp +++ b/src/passes/InstrumentLocals.cpp @@ -20,22 +20,22 @@ // gets: // // Before: -// (get_local $x) +// (local.get $x) // // After: // (call $get_TYPE // (i32.const n) // call id // (i32.const n) // local id -// (get_local $x) +// (local.get $x) // ) // // sets: // // Before: -// (set_local $x (i32.const 1)) +// (local.set $x (i32.const 1)) // // After: -// (set_local $x +// (local.set $x // (call $set_TYPE // (i32.const n) // call id // (i32.const n) // local id diff --git a/src/passes/LocalCSE.cpp b/src/passes/LocalCSE.cpp index 8faa5b47c..32cc97b34 100644 --- a/src/passes/LocalCSE.cpp +++ b/src/passes/LocalCSE.cpp @@ -20,7 +20,7 @@ // This requires --flatten to be run before in order to be effective, // and preserves flatness. The reason flatness is required is that // this pass assumes everything is stored in a local, and all it does -// is alter set_locals to do get_locals of an existing value when +// is alter local.sets to do local.gets of an existing value when // possible, replacing a recomputing of that value. That design means that // if there are block and if return values, nested expressions not stored // to a local, etc., then it can't operate on them (and will just not @@ -56,7 +56,7 @@ struct LocalCSE : public WalkerPass<LinearExecutionWalker<LocalCSE>> { // information for an expression we can reuse struct UsableInfo { Expression* value; // the value we can reuse - Index index; // the local we are assigned to, get_local that to reuse us + Index index; // the local we are assigned to, local.get that to reuse us EffectAnalyzer effects; UsableInfo(Expression* value, Index index, PassOptions& passOptions) : value(value), index(index), effects(passOptions, value) {} diff --git a/src/passes/MergeLocals.cpp b/src/passes/MergeLocals.cpp index 8dcaa0cb9..4092e1ea8 100644 --- a/src/passes/MergeLocals.cpp +++ b/src/passes/MergeLocals.cpp @@ -22,11 +22,11 @@ // example, in // // (if (result i32) -// (tee_local $x -// (get_local $y) +// (local.tee $x +// (local.get $y) // ) // (i32.const 100) -// (get_local $x) +// (local.get $x) // ) // // If that assignment of $y is never used again, everything is fine. But if @@ -60,13 +60,13 @@ struct MergeLocals : public WalkerPass<PostWalker<MergeLocals, UnifiedExpression void doWalkFunction(Function* func) { // first, instrument the graph by modifying each copy - // (set_local $x - // (get_local $y) + // (local.set $x + // (local.get $y) // ) // to - // (set_local $x - // (tee_local $y - // (get_local $y) + // (local.set $x + // (local.tee $y + // (local.get $y) // ) // ) // That is, we add a trivial assign of $y. This ensures we @@ -128,8 +128,8 @@ struct MergeLocals : public WalkerPass<PostWalker<MergeLocals, UnifiedExpression optimizedToCopy[copy] = trivial; } else { // alternatively, we can try to remove the conflict in the opposite way: given - // (set_local $x - // (get_local $y) + // (local.set $x + // (local.get $y) // ) // we can look for uses of $x that could instead be uses of $y. this extends // $y's live range, but if it removes the conflict between $x and $y, it may be diff --git a/src/passes/OptimizeInstructions.cpp b/src/passes/OptimizeInstructions.cpp index 181e8285e..7d4735686 100644 --- a/src/passes/OptimizeInstructions.cpp +++ b/src/passes/OptimizeInstructions.cpp @@ -48,7 +48,7 @@ Name I32_EXPR = "i32.expr", // returns the maximum amount of bits used in an integer expression // not extremely precise (doesn't look into add operands, etc.) // LocalInfoProvider is an optional class that can provide answers about -// get_local. +// local.get. template<typename LocalInfoProvider> Index getMaxBits(Expression* curr, LocalInfoProvider* localInfoProvider) { if (auto* const_ = curr->dynCast<Const>()) { diff --git a/src/passes/Precompute.cpp b/src/passes/Precompute.cpp index 042a8be20..c23babda4 100644 --- a/src/passes/Precompute.cpp +++ b/src/passes/Precompute.cpp @@ -46,7 +46,7 @@ class PrecomputingExpressionRunner : public ExpressionRunner<PrecomputingExpress GetValues& getValues; // Whether we are trying to precompute down to an expression (which we can do on - // say 5 + 6) or to a value (which we can't do on a tee_local that flows a 7 + // say 5 + 6) or to a value (which we can't do on a local.tee that flows a 7 // through it). When we want to replace the expression, we can only do so // when it has no side effects. When we don't care about replacing the expression, // we just want to know if it will contain a known constant. @@ -159,7 +159,7 @@ struct Precompute : public WalkerPass<PostWalker<Precompute, UnifiedExpressionVi } void visitExpression(Expression* curr) { - // TODO: if get_local, only replace with a constant if we don't care about size...? + // TODO: if local.get, only replace with a constant if we don't care about size...? if (curr->is<Const>() || curr->is<Nop>()) return; // Until engines implement v128.const and we have SIMD-aware optimizations // that can break large v128.const instructions into smaller consts and @@ -245,7 +245,7 @@ private: // itself. This differs from precomputeExpression in that we care about // the value the expression will have, which we cannot necessary replace // the expression with. For example, - // (tee_local (i32.const 1)) + // (local.tee (i32.const 1)) // will have value 1 which we can optimize here, but in precomputeExpression // we could not do anything. Literal precomputeValue(Expression* curr) { diff --git a/src/passes/Print.cpp b/src/passes/Print.cpp index 2cfa5092c..e544447fe 100644 --- a/src/passes/Print.cpp +++ b/src/passes/Print.cpp @@ -113,22 +113,22 @@ struct PrintExpressionContents : public Visitor<PrintExpressionContents> { printMedium(o, "call_indirect (type ") << curr->fullType << ')'; } void visitGetLocal(GetLocal* curr) { - printMedium(o, "get_local ") << printableLocal(curr->index, currFunction); + printMedium(o, "local.get ") << printableLocal(curr->index, currFunction); } void visitSetLocal(SetLocal* curr) { if (curr->isTee()) { - printMedium(o, "tee_local "); + printMedium(o, "local.tee "); } else { - printMedium(o, "set_local "); + printMedium(o, "local.set "); } o << printableLocal(curr->index, currFunction); } void visitGetGlobal(GetGlobal* curr) { - printMedium(o, "get_global "); + printMedium(o, "global.get "); printName(curr->name, o); } void visitSetGlobal(SetGlobal* curr) { - printMedium(o, "set_global "); + printMedium(o, "global.set "); printName(curr->name, o); } void visitLoad(Load* curr) { @@ -192,7 +192,6 @@ struct PrintExpressionContents : public Visitor<PrintExpressionContents> { } else { WASM_UNREACHABLE(); } - o << "_u"; } o << '.'; } @@ -207,6 +206,9 @@ struct PrintExpressionContents : public Visitor<PrintExpressionContents> { case Xor: o << "xor"; break; case Xchg: o << "xchg"; break; } + if (curr->bytes != getTypeSize(curr->type)) { + o << "_u"; + } restoreNormalColor(o); if (curr->offset) { o << " offset=" << curr->offset; @@ -215,7 +217,10 @@ struct PrintExpressionContents : public Visitor<PrintExpressionContents> { void visitAtomicCmpxchg(AtomicCmpxchg* curr) { prepareColor(o); printRMWSize(o, curr->type, curr->bytes); - o << "cmpxchg"; + o << "cmpxchg"; + if (curr->bytes != getTypeSize(curr->type)) { + o << "_u"; + } restoreNormalColor(o); if (curr->offset) { o << " offset=" << curr->offset; @@ -316,44 +321,44 @@ struct PrintExpressionContents : public Visitor<PrintExpressionContents> { case TruncFloat64: o << "f64.trunc"; break; case NearestFloat64: o << "f64.nearest"; break; case SqrtFloat64: o << "f64.sqrt"; break; - case ExtendSInt32: o << "i64.extend_s/i32"; break; - case ExtendUInt32: o << "i64.extend_u/i32"; break; - case WrapInt64: o << "i32.wrap/i64"; break; - case TruncSFloat32ToInt32: o << "i32.trunc_s/f32"; break; - case TruncSFloat32ToInt64: o << "i64.trunc_s/f32"; break; - case TruncUFloat32ToInt32: o << "i32.trunc_u/f32"; break; - case TruncUFloat32ToInt64: o << "i64.trunc_u/f32"; break; - case TruncSFloat64ToInt32: o << "i32.trunc_s/f64"; break; - case TruncSFloat64ToInt64: o << "i64.trunc_s/f64"; break; - case TruncUFloat64ToInt32: o << "i32.trunc_u/f64"; break; - case TruncUFloat64ToInt64: o << "i64.trunc_u/f64"; break; - case ReinterpretFloat32: o << "i32.reinterpret/f32"; break; - case ReinterpretFloat64: o << "i64.reinterpret/f64"; break; - case ConvertUInt32ToFloat32: o << "f32.convert_u/i32"; break; - case ConvertUInt32ToFloat64: o << "f64.convert_u/i32"; break; - case ConvertSInt32ToFloat32: o << "f32.convert_s/i32"; break; - case ConvertSInt32ToFloat64: o << "f64.convert_s/i32"; break; - case ConvertUInt64ToFloat32: o << "f32.convert_u/i64"; break; - case ConvertUInt64ToFloat64: o << "f64.convert_u/i64"; break; - case ConvertSInt64ToFloat32: o << "f32.convert_s/i64"; break; - case ConvertSInt64ToFloat64: o << "f64.convert_s/i64"; break; - case PromoteFloat32: o << "f64.promote/f32"; break; - case DemoteFloat64: o << "f32.demote/f64"; break; - case ReinterpretInt32: o << "f32.reinterpret/i32"; break; - case ReinterpretInt64: o << "f64.reinterpret/i64"; break; + case ExtendSInt32: o << "i64.extend_i32_s"; break; + case ExtendUInt32: o << "i64.extend_i32_u"; break; + case WrapInt64: o << "i32.wrap_i64"; break; + case TruncSFloat32ToInt32: o << "i32.trunc_f32_s"; break; + case TruncSFloat32ToInt64: o << "i64.trunc_f32_s"; break; + case TruncUFloat32ToInt32: o << "i32.trunc_f32_u"; break; + case TruncUFloat32ToInt64: o << "i64.trunc_f32_u"; break; + case TruncSFloat64ToInt32: o << "i32.trunc_f64_s"; break; + case TruncSFloat64ToInt64: o << "i64.trunc_f64_s"; break; + case TruncUFloat64ToInt32: o << "i32.trunc_f64_u"; break; + case TruncUFloat64ToInt64: o << "i64.trunc_f64_u"; break; + case ReinterpretFloat32: o << "i32.reinterpret_f32"; break; + case ReinterpretFloat64: o << "i64.reinterpret_f64"; break; + case ConvertUInt32ToFloat32: o << "f32.convert_i32_u"; break; + case ConvertUInt32ToFloat64: o << "f64.convert_i32_u"; break; + case ConvertSInt32ToFloat32: o << "f32.convert_i32_s"; break; + case ConvertSInt32ToFloat64: o << "f64.convert_i32_s"; break; + case ConvertUInt64ToFloat32: o << "f32.convert_i64_u"; break; + case ConvertUInt64ToFloat64: o << "f64.convert_i64_u"; break; + case ConvertSInt64ToFloat32: o << "f32.convert_i64_s"; break; + case ConvertSInt64ToFloat64: o << "f64.convert_i64_s"; break; + case PromoteFloat32: o << "f64.promote_f32"; break; + case DemoteFloat64: o << "f32.demote_f64"; break; + case ReinterpretInt32: o << "f32.reinterpret_i32"; break; + case ReinterpretInt64: o << "f64.reinterpret_i64"; break; case ExtendS8Int32: o << "i32.extend8_s"; break; case ExtendS16Int32: o << "i32.extend16_s"; break; case ExtendS8Int64: o << "i64.extend8_s"; break; case ExtendS16Int64: o << "i64.extend16_s"; break; case ExtendS32Int64: o << "i64.extend32_s"; break; - case TruncSatSFloat32ToInt32: o << "i32.trunc_s:sat/f32"; break; - case TruncSatUFloat32ToInt32: o << "i32.trunc_u:sat/f32"; break; - case TruncSatSFloat64ToInt32: o << "i32.trunc_s:sat/f64"; break; - case TruncSatUFloat64ToInt32: o << "i32.trunc_u:sat/f64"; break; - case TruncSatSFloat32ToInt64: o << "i64.trunc_s:sat/f32"; break; - case TruncSatUFloat32ToInt64: o << "i64.trunc_u:sat/f32"; break; - case TruncSatSFloat64ToInt64: o << "i64.trunc_s:sat/f64"; break; - case TruncSatUFloat64ToInt64: o << "i64.trunc_u:sat/f64"; break; + case TruncSatSFloat32ToInt32: o << "i32.trunc_sat_f32_s"; break; + case TruncSatUFloat32ToInt32: o << "i32.trunc_sat_f32_u"; break; + case TruncSatSFloat64ToInt32: o << "i32.trunc_sat_f64_s"; break; + case TruncSatUFloat64ToInt32: o << "i32.trunc_sat_f64_u"; break; + case TruncSatSFloat32ToInt64: o << "i64.trunc_sat_f32_s"; break; + case TruncSatUFloat32ToInt64: o << "i64.trunc_sat_f32_u"; break; + case TruncSatSFloat64ToInt64: o << "i64.trunc_sat_f64_s"; break; + case TruncSatUFloat64ToInt64: o << "i64.trunc_sat_f64_u"; break; case SplatVecI8x16: o << "i8x16.splat"; break; case SplatVecI16x8: o << "i16x8.splat"; break; case SplatVecI32x4: o << "i32x4.splat"; break; @@ -379,14 +384,14 @@ struct PrintExpressionContents : public Visitor<PrintExpressionContents> { case AbsVecF64x2: o << "f64x2.abs"; break; case NegVecF64x2: o << "f64x2.neg"; break; case SqrtVecF64x2: o << "f64x2.sqrt"; break; - case TruncSatSVecF32x4ToVecI32x4: o << "i32x4.trunc_s/f32x4:sat"; break; - case TruncSatUVecF32x4ToVecI32x4: o << "i32x4.trunc_u/f32x4:sat"; break; - case TruncSatSVecF64x2ToVecI64x2: o << "i64x2.trunc_s/f64x2:sat"; break; - case TruncSatUVecF64x2ToVecI64x2: o << "i64x2.trunc_u/f64x2:sat"; break; - case ConvertSVecI32x4ToVecF32x4: o << "f32x4.convert_s/i32x4"; break; - case ConvertUVecI32x4ToVecF32x4: o << "f32x4.convert_u/i32x4"; break; - case ConvertSVecI64x2ToVecF64x2: o << "f64x2.convert_s/i64x2"; break; - case ConvertUVecI64x2ToVecF64x2: o << "f64x2.convert_u/i64x2"; break; + case TruncSatSVecF32x4ToVecI32x4: o << "i32x4.trunc_sat_f32x4_s"; break; + case TruncSatUVecF32x4ToVecI32x4: o << "i32x4.trunc_sat_f32x4_u"; break; + case TruncSatSVecF64x2ToVecI64x2: o << "i64x2.trunc_sat_f64x2_s"; break; + case TruncSatUVecF64x2ToVecI64x2: o << "i64x2.trunc_sat_f64x2_u"; break; + case ConvertSVecI32x4ToVecF32x4: o << "f32x4.convert_i32x4_s"; break; + case ConvertUVecI32x4ToVecF32x4: o << "f32x4.convert_i32x4_u"; break; + case ConvertSVecI64x2ToVecF64x2: o << "f64x2.convert_i64x2_s"; break; + case ConvertUVecI64x2ToVecF64x2: o << "f64x2.convert_i64x2_u"; break; case InvalidUnary: WASM_UNREACHABLE(); } } @@ -1177,7 +1182,7 @@ struct PrintSExpression : public Visitor<PrintSExpression> { printName(curr->name, o) << ' '; o << curr->initial; if (curr->hasMax()) o << ' ' << curr->max; - o << " anyfunc)"; + o << " funcref)"; } void visitTable(Table* curr) { if (!curr->exists) return; diff --git a/src/passes/RedundantSetElimination.cpp b/src/passes/RedundantSetElimination.cpp index 8cd8fbf99..6f39fce9f 100644 --- a/src/passes/RedundantSetElimination.cpp +++ b/src/passes/RedundantSetElimination.cpp @@ -15,7 +15,7 @@ */ // -// Eliminate redundant set_locals: if a local already has a particular +// Eliminate redundant local.sets: if a local already has a particular // value, we don't need to set it again. A common case here is loops // that start at zero, since the default value is initialized to // zero anyhow. @@ -28,7 +28,7 @@ // values no longer necessary. // // So far this tracks constant values, and for everything else it considers -// them unique (so each set_local of a non-constant is a unique value, each +// them unique (so each local.set of a non-constant is a unique value, each // merge is a unique value, etc.; there is no sophisticated value numbering // here). // diff --git a/src/passes/RemoveUnusedBrs.cpp b/src/passes/RemoveUnusedBrs.cpp index 58694b25c..614503581 100644 --- a/src/passes/RemoveUnusedBrs.cpp +++ b/src/passes/RemoveUnusedBrs.cpp @@ -292,7 +292,7 @@ struct RemoveUnusedBrs : public WalkerPass<PostWalker<RemoveUnusedBrs>> { } } // TODO: if-else can be turned into a br_if as well, if one of the sides is a dead end - // we handle the case of a returned value to a set_local later down, see + // we handle the case of a returned value to a local.set later down, see // visitSetLocal. } @@ -847,7 +847,7 @@ struct RemoveUnusedBrs : public WalkerPass<PostWalker<RemoveUnusedBrs>> { } // If one arm is a br, we prefer a br_if and the set later: - // (set_local $x + // (local.set $x // (if (result i32) // (..condition..) // (br $somewhere) @@ -858,7 +858,7 @@ struct RemoveUnusedBrs : public WalkerPass<PostWalker<RemoveUnusedBrs>> { // (br_if $somewhere // (..condition..) // ) - // (set_local $x + // (local.set $x // (..result) // ) // TODO: handle a condition in the br? need to watch for side effects @@ -900,38 +900,38 @@ struct RemoveUnusedBrs : public WalkerPass<PostWalker<RemoveUnusedBrs>> { // we can remove. If this is not a tee, then we remove the get // as well as the if-else opcode in the binary format, which is // great: - // (set_local $x + // (local.set $x // (if (result i32) // (..condition..) // (..result) - // (get_local $x) + // (local.get $x) // ) // ) // => // (if // (..condition..) - // (set_local $x + // (local.set $x // (..result) // ) // ) // If this is a tee, then we can do the same operation but // inside a block, and keep the get: - // (tee_local $x + // (local.tee $x // (if (result i32) // (..condition..) // (..result) - // (get_local $x) + // (local.get $x) // ) // ) // => // (block (result i32) // (if // (..condition..) - // (set_local $x + // (local.set $x // (..result) // ) // ) - // (get_local $x) + // (local.get $x) // ) // We save the if-else opcode, and add the block's opcodes. // This may be detrimental, however, often the block can be diff --git a/src/passes/SimplifyLocals.cpp b/src/passes/SimplifyLocals.cpp index 75dadfbac..91f0f8d4f 100644 --- a/src/passes/SimplifyLocals.cpp +++ b/src/passes/SimplifyLocals.cpp @@ -17,15 +17,15 @@ // // Locals-related optimizations // -// This "sinks" set_locals, pushing them to the next get_local where possible, +// This "sinks" local.sets, pushing them to the next local.get where possible, // and removing the set if there are no gets remaining (the latter is // particularly useful in ssa mode, but not only). // -// We also note where set_locals coalesce: if all breaks of a block set +// We also note where local.sets coalesce: if all breaks of a block set // a specific local, we can use a block return value for it, in effect -// removing multiple set_locals and replacing them with one that the +// removing multiple local.sets and replacing them with one that the // block returns to. Further optimization rounds then have the opportunity -// to remove that set_local as well. TODO: support partial traces; right +// to remove that local.set as well. TODO: support partial traces; right // now, whenever control flow splits, we invalidate everything. // // After this pass, some locals may be completely unused. reorder-locals @@ -37,7 +37,7 @@ // * Tee: allow teeing, i.e., sinking a local with more than one use, // and so after sinking we have a tee for the first use. // * Structure: create block and if return values, by merging the -// internal set_locals into one on the outside, +// internal local.sets into one on the outside, // that can itself then be sunk further. // // There is also an option to disallow nesting entirely, which disallows @@ -67,7 +67,7 @@ struct SimplifyLocals : public WalkerPass<LinearExecutionWalker<SimplifyLocals<a Pass* create() override { return new SimplifyLocals<allowTee, allowStructure, allowNesting>(); } - // information for a set_local we can sink + // information for a local.set we can sink struct SinkableInfo { Expression** item; EffectAnalyzer effects; @@ -109,7 +109,7 @@ struct SimplifyLocals : public WalkerPass<LinearExecutionWalker<SimplifyLocals<a // whether this is the first cycle, in which we always disallow teeing bool firstCycle; - // local => # of get_locals for it + // local => # of local.gets for it GetLocalCounter getCounter; static void doNoteNonLinear(SimplifyLocals<allowTee, allowStructure, allowNesting>* self, Expression** currp) { @@ -373,7 +373,7 @@ struct SimplifyLocals : public WalkerPass<LinearExecutionWalker<SimplifyLocals<a blockBreaks.erase(block->name); if (breaks.size() == 0) return; // block has no branches TODO we might optimize trivial stuff here too assert(!(*breaks[0].brp)->template cast<Break>()->value); // block does not already have a return value (if one break has one, they all do) - // look for a set_local that is present in them all + // look for a local.set that is present in them all bool found = false; Index sharedIndex = -1; for (auto& sinkable : sinkables) { @@ -398,19 +398,19 @@ struct SimplifyLocals : public WalkerPass<LinearExecutionWalker<SimplifyLocals<a // (br_if // (block // ..use $x.. - // (set_local $x ..) + // (local.set $x ..) // ) // ) // => // (br_if - // (tee_local $x ..) ;; this now affects the use! + // (local.tee $x ..) ;; this now affects the use! // (block // ..use $x.. // ) // ) // so we must check for that. for (size_t j = 0; j < breaks.size(); j++) { - // move break set_local's value to the break + // move break local.set's value to the break auto* breakSetLocalPointer = breaks[j].sinkables.at(sharedIndex).item; auto* brp = breaks[j].brp; auto* br = (*brp)->template cast<Break>(); @@ -446,14 +446,14 @@ struct SimplifyLocals : public WalkerPass<LinearExecutionWalker<SimplifyLocals<a blocksToEnlarge.push_back(block); return; } - // move block set_local's value to the end, in return position, and nop the set + // move block local.set's value to the end, in return position, and nop the set auto* blockSetLocalPointer = sinkables.at(sharedIndex).item; auto* value = (*blockSetLocalPointer)->template cast<SetLocal>()->value; block->list[block->list.size() - 1] = value; block->type = value->type; ExpressionManipulator::nop(*blockSetLocalPointer); for (size_t j = 0; j < breaks.size(); j++) { - // move break set_local's value to the break + // move break local.set's value to the break auto* breakSetLocalPointer = breaks[j].sinkables.at(sharedIndex).item; auto* brp = breaks[j].brp; auto* br = (*brp)->template cast<Break>(); @@ -472,14 +472,14 @@ struct SimplifyLocals : public WalkerPass<LinearExecutionWalker<SimplifyLocals<a ExpressionManipulator::nop(set); } } - // finally, create a set_local on the block itself + // finally, create a local.set on the block itself auto* newSetLocal = Builder(*this->getModule()).makeSetLocal(sharedIndex, block); this->replaceCurrent(newSetLocal); sinkables.clear(); anotherCycle = true; } - // optimize set_locals from both sides of an if into a return value + // optimize local.sets from both sides of an if into a return value void optimizeIfElseReturn(If* iff, Expression** currp, Sinkables& ifTrue) { assert(iff->ifFalse); // if this if already has a result, or is unreachable code, we have @@ -491,10 +491,10 @@ struct SimplifyLocals : public WalkerPass<LinearExecutionWalker<SimplifyLocals<a // (if // (..) // (br $x) - // (set_local $y (..)) + // (local.set $y (..)) // ) // => - // (set_local $y + // (local.set $y // (if (result i32) // (..) // (br $x) @@ -562,27 +562,27 @@ struct SimplifyLocals : public WalkerPass<LinearExecutionWalker<SimplifyLocals<a } iff->finalize(); // update type assert(iff->type != none); - // finally, create a set_local on the iff itself + // finally, create a local.set on the iff itself auto* newSetLocal = Builder(*this->getModule()).makeSetLocal(goodIndex, iff); *currp = newSetLocal; anotherCycle = true; } - // Optimize set_locals from a one-sided iff, adding a get on the other: + // Optimize local.sets from a one-sided iff, adding a get on the other: // (if // (..condition..) // (block - // (set_local $x (..value..)) + // (local.set $x (..value..)) // ) // ) // => - // (set_local $x + // (local.set $x // (if (result ..) // (..condition..) // (block (result ..) // (..value..) // ) - // (get_local $x) + // (local.get $x) // ) // ) // This is a speculative optimization: we add a get here, as well as a branch @@ -617,7 +617,7 @@ struct SimplifyLocals : public WalkerPass<LinearExecutionWalker<SimplifyLocals<a // Update the get count. getCounter.num[set->index]++; assert(iff->type != none); - // Finally, reuse the set_local on the iff itself. + // Finally, reuse the local.set on the iff itself. set->value = iff; set->finalize(); *currp = set; @@ -648,7 +648,7 @@ struct SimplifyLocals : public WalkerPass<LinearExecutionWalker<SimplifyLocals<a } void doWalkFunction(Function* func) { - // scan get_locals + // scan local.gets getCounter.analyze(func); // multiple passes may be required per function, consider this: // x = load @@ -741,11 +741,11 @@ struct SimplifyLocals : public WalkerPass<LinearExecutionWalker<SimplifyLocals<a // we do that at the very end, and only after structure, as removing // the copy here: // (if - // (get_local $var$0) - // (set_local $var$0 - // (get_local $var$0) + // (local.get $var$0) + // (local.set $var$0 + // (local.get $var$0) // ) - // (set_local $var$0 + // (local.set $var$0 // (i32.const 208) // ) // ) diff --git a/src/passes/Souperify.cpp b/src/passes/Souperify.cpp index 5875c8f42..62ec133fe 100644 --- a/src/passes/Souperify.cpp +++ b/src/passes/Souperify.cpp @@ -131,7 +131,7 @@ struct UseFinder { }; // Generates a trace: all the information to generate a Souper LHS -// for a specific set_local whose value we want to infer. +// for a specific local.set whose value we want to infer. struct Trace { Graph& graph; Node* toInfer; diff --git a/src/passes/StackIR.cpp b/src/passes/StackIR.cpp index 3772500c4..a8d66ae42 100644 --- a/src/passes/StackIR.cpp +++ b/src/passes/StackIR.cpp @@ -118,12 +118,12 @@ private: } } - // If ordered properly, we can avoid a set_local/get_local pair, + // If ordered properly, we can avoid a local.set/local.get pair, // and use the value directly from the stack, for example // [..produce a value on the stack..] - // set_local $x + // local.set $x // [..much code..] - // get_local $x + // local.get $x // call $foo ;; use the value, foo(value) // As long as the code in between does not modify $x, and has // no control flow branching out, we can remove both the set diff --git a/src/passes/Untee.cpp b/src/passes/Untee.cpp index b61875243..00f2ffe5d 100644 --- a/src/passes/Untee.cpp +++ b/src/passes/Untee.cpp @@ -15,7 +15,7 @@ */ // -// Removes tee_locals, replacing them with gets and sets. +// Removes local.tees, replacing them with gets and sets. // // This makes the code "flatter", with less nested side // effects. That can make some passes, like CodePushing, diff --git a/src/passes/pass.cpp b/src/passes/pass.cpp index 63b73ac6a..cae69860a 100644 --- a/src/passes/pass.cpp +++ b/src/passes/pass.cpp @@ -122,7 +122,7 @@ void PassRegistry::registerPasses() { registerPass("reorder-functions", "sorts functions by access frequency", createReorderFunctionsPass); registerPass("reorder-locals", "sorts locals by access frequency", createReorderLocalsPass); registerPass("rereloop", "re-optimize control flow using the relooper algorithm", createReReloopPass); - registerPass("rse", "remove redundant set_locals", createRedundantSetEliminationPass); + registerPass("rse", "remove redundant local.sets", createRedundantSetEliminationPass); registerPass("safe-heap", "instrument loads and stores to check for invalid behavior", createSafeHeapPass); registerPass("simplify-locals", "miscellaneous locals-related optimizations", createSimplifyLocalsPass); registerPass("simplify-locals-nonesting", "miscellaneous locals-related optimizations (no nesting at all; preserves flatness)", createSimplifyLocalsNoNestingPass); @@ -136,7 +136,7 @@ void PassRegistry::registerPasses() { registerPass("strip", "strip debug info (including the names section)", createStripPass); registerPass("trap-mode-clamp", "replace trapping operations with clamping semantics", createTrapModeClamp); registerPass("trap-mode-js", "replace trapping operations with js semantics", createTrapModeJS); - registerPass("untee", "removes tee_locals, replacing them with sets and gets", createUnteePass); + registerPass("untee", "removes local.tees, replacing them with sets and gets", createUnteePass); registerPass("vacuum", "removes obviously unneeded code", createVacuumPass); // registerPass("lower-i64", "lowers i64 into pairs of i32s", createLowerInt64Pass); } diff --git a/src/passes/wasm-intrinsics.wast b/src/passes/wasm-intrinsics.wast index 8cd14d51d..26687508d 100644 --- a/src/passes/wasm-intrinsics.wast +++ b/src/passes/wasm-intrinsics.wast @@ -40,24 +40,24 @@ (loop $label$2 (drop (br_if $label$1 - (get_local $var$1) + (local.get $var$1) (i32.eqz - (get_local $var$0) + (local.get $var$0) ) ) ) - (set_local $var$0 + (local.set $var$0 (i32.and - (get_local $var$0) + (local.get $var$0) (i32.sub - (get_local $var$0) + (local.get $var$0) (i32.const 1) ) ) ) - (set_local $var$1 + (local.set $var$1 (i32.add - (get_local $var$1) + (local.get $var$1) (i32.const 1) ) ) @@ -73,24 +73,24 @@ (loop $label$2 (drop (br_if $label$1 - (get_local $var$1) + (local.get $var$1) (i64.eqz - (get_local $var$0) + (local.get $var$0) ) ) ) - (set_local $var$0 + (local.set $var$0 (i64.and - (get_local $var$0) + (local.get $var$0) (i64.sub - (get_local $var$0) + (local.get $var$0) (i64.const 1) ) ) ) - (set_local $var$1 + (local.set $var$1 (i64.add - (get_local $var$1) + (local.get $var$1) (i64.const 1) ) ) @@ -101,30 +101,30 @@ ;; lowering of the i64.div_s instruction, return $var0 / $var$1 (func $__wasm_i64_sdiv (; 0 ;) (type $0) (param $var$0 i64) (param $var$1 i64) (result i64) (call $_ZN17compiler_builtins3int4sdiv3Div3div17he78fc483e41d7ec7E - (get_local $var$0) - (get_local $var$1) + (local.get $var$0) + (local.get $var$1) ) ) ;; lowering of the i64.div_u instruction, return $var0 / $var$1 (func $__wasm_i64_udiv (; 1 ;) (type $0) (param $var$0 i64) (param $var$1 i64) (result i64) (call $_ZN17compiler_builtins3int4udiv10divmod_u6417h6026910b5ed08e40E - (get_local $var$0) - (get_local $var$1) + (local.get $var$0) + (local.get $var$1) ) ) ;; lowering of the i64.rem_s instruction, return $var0 % $var$1 (func $__wasm_i64_srem (; 2 ;) (type $0) (param $var$0 i64) (param $var$1 i64) (result i64) (call $_ZN17compiler_builtins3int4sdiv3Mod4mod_17h2cbb7bbf36e41d68E - (get_local $var$0) - (get_local $var$1) + (local.get $var$0) + (local.get $var$1) ) ) ;; lowering of the i64.rem_u instruction, return $var0 % $var$1 (func $__wasm_i64_urem (; 3 ;) (type $0) (param $var$0 i64) (param $var$1 i64) (result i64) (drop (call $_ZN17compiler_builtins3int4udiv10divmod_u6417h6026910b5ed08e40E - (get_local $var$0) - (get_local $var$1) + (local.get $var$0) + (local.get $var$1) ) ) (i64.load @@ -134,8 +134,8 @@ ;; lowering of the i64.mul instruction, return $var0 * $var$1 (func $__wasm_i64_mul (; 4 ;) (type $0) (param $var$0 i64) (param $var$1 i64) (result i64) (call $_ZN17compiler_builtins3int3mul3Mul3mul17h070e9a1c69faec5bE - (get_local $var$0) - (get_local $var$1) + (local.get $var$0) + (local.get $var$1) ) ) ;; lowering of the f32.trunc instruction, rounds to the nearest integer, @@ -143,13 +143,13 @@ (func $__wasm_trunc_f32 (; 5 ;) (type $1) (param $var$0 f32) (result f32) (select (f32.ceil - (get_local $var$0) + (local.get $var$0) ) (f32.floor - (get_local $var$0) + (local.get $var$0) ) (f32.lt - (get_local $var$0) + (local.get $var$0) (f32.const 0) ) ) @@ -159,13 +159,13 @@ (func $__wasm_trunc_f64 (; 6 ;) (type $2) (param $var$0 f64) (result f64) (select (f64.ceil - (get_local $var$0) + (local.get $var$0) ) (f64.floor - (get_local $var$0) + (local.get $var$0) ) (f64.lt - (get_local $var$0) + (local.get $var$0) (f64.const 0) ) ) @@ -173,17 +173,17 @@ ;; lowering of the i32.ctz instruction, counting the number of zeros in $var$0 (func $__wasm_ctz_i32 (; 7 ;) (type $3) (param $var$0 i32) (result i32) (if - (get_local $var$0) + (local.get $var$0) (return (i32.sub (i32.const 31) (i32.clz (i32.xor (i32.add - (get_local $var$0) + (local.get $var$0) (i32.const -1) ) - (get_local $var$0) + (local.get $var$0) ) ) ) @@ -196,7 +196,7 @@ (if (i32.eqz (i64.eqz - (get_local $var$0) + (local.get $var$0) ) ) (return @@ -205,10 +205,10 @@ (i64.clz (i64.xor (i64.add - (get_local $var$0) + (local.get $var$0) (i64.const -1) ) - (get_local $var$0) + (local.get $var$0) ) ) ) @@ -225,34 +225,34 @@ (i32.and (i32.shr_u (i32.const -1) - (tee_local $var$2 + (local.tee $var$2 (i32.and - (get_local $var$1) + (local.get $var$1) (i32.const 31) ) ) ) - (get_local $var$0) + (local.get $var$0) ) - (get_local $var$2) + (local.get $var$2) ) (i32.shr_u (i32.and (i32.shl (i32.const -1) - (tee_local $var$1 + (local.tee $var$1 (i32.and (i32.sub (i32.const 0) - (get_local $var$1) + (local.get $var$1) ) (i32.const 31) ) ) ) - (get_local $var$0) + (local.get $var$0) ) - (get_local $var$1) + (local.get $var$1) ) ) ) @@ -265,34 +265,34 @@ (i32.and (i32.shl (i32.const -1) - (tee_local $var$2 + (local.tee $var$2 (i32.and - (get_local $var$1) + (local.get $var$1) (i32.const 31) ) ) ) - (get_local $var$0) + (local.get $var$0) ) - (get_local $var$2) + (local.get $var$2) ) (i32.shl (i32.and (i32.shr_u (i32.const -1) - (tee_local $var$1 + (local.tee $var$1 (i32.and (i32.sub (i32.const 0) - (get_local $var$1) + (local.get $var$1) ) (i32.const 31) ) ) ) - (get_local $var$0) + (local.get $var$0) ) - (get_local $var$1) + (local.get $var$1) ) ) ) @@ -305,34 +305,34 @@ (i64.and (i64.shr_u (i64.const -1) - (tee_local $var$2 + (local.tee $var$2 (i64.and - (get_local $var$1) + (local.get $var$1) (i64.const 63) ) ) ) - (get_local $var$0) + (local.get $var$0) ) - (get_local $var$2) + (local.get $var$2) ) (i64.shr_u (i64.and (i64.shl (i64.const -1) - (tee_local $var$1 + (local.tee $var$1 (i64.and (i64.sub (i64.const 0) - (get_local $var$1) + (local.get $var$1) ) (i64.const 63) ) ) ) - (get_local $var$0) + (local.get $var$0) ) - (get_local $var$1) + (local.get $var$1) ) ) ) @@ -345,34 +345,34 @@ (i64.and (i64.shl (i64.const -1) - (tee_local $var$2 + (local.tee $var$2 (i64.and - (get_local $var$1) + (local.get $var$1) (i64.const 63) ) ) ) - (get_local $var$0) + (local.get $var$0) ) - (get_local $var$2) + (local.get $var$2) ) (i64.shl (i64.and (i64.shr_u (i64.const -1) - (tee_local $var$1 + (local.tee $var$1 (i64.and (i64.sub (i64.const 0) - (get_local $var$1) + (local.get $var$1) ) (i64.const 63) ) ) ) - (get_local $var$0) + (local.get $var$0) ) - (get_local $var$1) + (local.get $var$1) ) ) ) @@ -384,12 +384,12 @@ (if (i32.eqz (f32.lt - (tee_local $var$2 + (local.tee $var$2 (f32.sub - (get_local $var$0) - (tee_local $var$1 + (local.get $var$0) + (local.tee $var$1 (f32.floor - (get_local $var$0) + (local.get $var$0) ) ) ) @@ -398,34 +398,34 @@ ) ) (block - (set_local $var$0 + (local.set $var$0 (f32.ceil - (get_local $var$0) + (local.get $var$0) ) ) (if (f32.gt - (get_local $var$2) + (local.get $var$2) (f32.const 0.5) ) (return - (get_local $var$0) + (local.get $var$0) ) ) - (set_local $var$1 + (local.set $var$1 (select - (get_local $var$1) - (get_local $var$0) + (local.get $var$1) + (local.get $var$0) (f32.eq (f32.sub - (tee_local $var$2 + (local.tee $var$2 (f32.mul - (get_local $var$1) + (local.get $var$1) (f32.const 0.5) ) ) (f32.floor - (get_local $var$2) + (local.get $var$2) ) ) (f32.const 0) @@ -434,7 +434,7 @@ ) ) ) - (get_local $var$1) + (local.get $var$1) ) ;; lowering of the f64.nearest instruction, rounding the input to the nearest ;; integer while breaking ties by rounding to even @@ -444,12 +444,12 @@ (if (i32.eqz (f64.lt - (tee_local $var$2 + (local.tee $var$2 (f64.sub - (get_local $var$0) - (tee_local $var$1 + (local.get $var$0) + (local.tee $var$1 (f64.floor - (get_local $var$0) + (local.get $var$0) ) ) ) @@ -458,34 +458,34 @@ ) ) (block - (set_local $var$0 + (local.set $var$0 (f64.ceil - (get_local $var$0) + (local.get $var$0) ) ) (if (f64.gt - (get_local $var$2) + (local.get $var$2) (f64.const 0.5) ) (return - (get_local $var$0) + (local.get $var$0) ) ) - (set_local $var$1 + (local.set $var$1 (select - (get_local $var$1) - (get_local $var$0) + (local.get $var$1) + (local.get $var$0) (f64.eq (f64.sub - (tee_local $var$2 + (local.tee $var$2 (f64.mul - (get_local $var$1) + (local.get $var$1) (f64.const 0.5) ) ) (f64.floor - (get_local $var$2) + (local.get $var$2) ) ) (f64.const 0) @@ -494,7 +494,7 @@ ) ) ) - (get_local $var$1) + (local.get $var$1) ) (func $_ZN17compiler_builtins3int4udiv10divmod_u6417h6026910b5ed08e40E (; 14 ;) (type $0) (param $var$0 i64) (param $var$1 i64) (result i64) (local $var$2 i32) @@ -516,10 +516,10 @@ (block $label$10 (block $label$11 (if - (tee_local $var$2 - (i32.wrap/i64 + (local.tee $var$2 + (i32.wrap_i64 (i64.shr_u - (get_local $var$0) + (local.get $var$0) (i64.const 32) ) ) @@ -527,19 +527,19 @@ (block (br_if $label$11 (i32.eqz - (tee_local $var$3 - (i32.wrap/i64 - (get_local $var$1) + (local.tee $var$3 + (i32.wrap_i64 + (local.get $var$1) ) ) ) ) (br_if $label$9 (i32.eqz - (tee_local $var$4 - (i32.wrap/i64 + (local.tee $var$4 + (i32.wrap_i64 (i64.shr_u - (get_local $var$1) + (local.get $var$1) (i64.const 32) ) ) @@ -548,13 +548,13 @@ ) (br_if $label$8 (i32.le_u - (tee_local $var$2 + (local.tee $var$2 (i32.sub (i32.clz - (get_local $var$4) + (local.get $var$4) ) (i32.clz - (get_local $var$2) + (local.get $var$2) ) ) ) @@ -566,97 +566,97 @@ ) (br_if $label$2 (i64.ge_u - (get_local $var$1) + (local.get $var$1) (i64.const 4294967296) ) ) (i64.store (i32.const 1024) - (i64.extend_u/i32 + (i64.extend_i32_u (i32.sub - (tee_local $var$2 - (i32.wrap/i64 - (get_local $var$0) + (local.tee $var$2 + (i32.wrap_i64 + (local.get $var$0) ) ) (i32.mul - (tee_local $var$2 + (local.tee $var$2 (i32.div_u - (get_local $var$2) - (tee_local $var$3 - (i32.wrap/i64 - (get_local $var$1) + (local.get $var$2) + (local.tee $var$3 + (i32.wrap_i64 + (local.get $var$1) ) ) ) ) - (get_local $var$3) + (local.get $var$3) ) ) ) ) (return - (i64.extend_u/i32 - (get_local $var$2) + (i64.extend_i32_u + (local.get $var$2) ) ) ) - (set_local $var$3 - (i32.wrap/i64 + (local.set $var$3 + (i32.wrap_i64 (i64.shr_u - (get_local $var$1) + (local.get $var$1) (i64.const 32) ) ) ) (br_if $label$7 (i32.eqz - (i32.wrap/i64 - (get_local $var$0) + (i32.wrap_i64 + (local.get $var$0) ) ) ) (br_if $label$6 (i32.eqz - (get_local $var$3) + (local.get $var$3) ) ) (br_if $label$6 (i32.and - (tee_local $var$4 + (local.tee $var$4 (i32.add - (get_local $var$3) + (local.get $var$3) (i32.const -1) ) ) - (get_local $var$3) + (local.get $var$3) ) ) (i64.store (i32.const 1024) (i64.or (i64.shl - (i64.extend_u/i32 + (i64.extend_i32_u (i32.and - (get_local $var$4) - (get_local $var$2) + (local.get $var$4) + (local.get $var$2) ) ) (i64.const 32) ) (i64.and - (get_local $var$0) + (local.get $var$0) (i64.const 4294967295) ) ) ) (return - (i64.extend_u/i32 + (i64.extend_i32_u (i32.shr_u - (get_local $var$2) + (local.get $var$2) (i32.and (i32.ctz - (get_local $var$3) + (local.get $var$3) ) (i32.const 31) ) @@ -669,29 +669,29 @@ (br_if $label$5 (i32.eqz (i32.and - (tee_local $var$4 + (local.tee $var$4 (i32.add - (get_local $var$3) + (local.get $var$3) (i32.const -1) ) ) - (get_local $var$3) + (local.get $var$3) ) ) ) - (set_local $var$3 + (local.set $var$3 (i32.sub (i32.const 0) - (tee_local $var$2 + (local.tee $var$2 (i32.sub (i32.add (i32.clz - (get_local $var$3) + (local.get $var$3) ) (i32.const 33) ) (i32.clz - (get_local $var$2) + (local.get $var$2) ) ) ) @@ -699,15 +699,15 @@ ) (br $label$3) ) - (set_local $var$3 + (local.set $var$3 (i32.sub (i32.const 63) - (get_local $var$2) + (local.get $var$2) ) ) - (set_local $var$2 + (local.set $var$2 (i32.add - (get_local $var$2) + (local.get $var$2) (i32.const 1) ) ) @@ -716,17 +716,17 @@ (i64.store (i32.const 1024) (i64.shl - (i64.extend_u/i32 + (i64.extend_i32_u (i32.sub - (get_local $var$2) + (local.get $var$2) (i32.mul - (tee_local $var$4 + (local.tee $var$4 (i32.div_u - (get_local $var$2) - (get_local $var$3) + (local.get $var$2) + (local.get $var$3) ) ) - (get_local $var$3) + (local.get $var$3) ) ) ) @@ -734,20 +734,20 @@ ) ) (return - (i64.extend_u/i32 - (get_local $var$4) + (i64.extend_i32_u + (local.get $var$4) ) ) ) (br_if $label$4 (i32.lt_u - (tee_local $var$2 + (local.tee $var$2 (i32.sub (i32.clz - (get_local $var$3) + (local.get $var$3) ) (i32.clz - (get_local $var$2) + (local.get $var$2) ) ) ) @@ -758,62 +758,62 @@ ) (i64.store (i32.const 1024) - (i64.extend_u/i32 + (i64.extend_i32_u (i32.and - (get_local $var$4) - (i32.wrap/i64 - (get_local $var$0) + (local.get $var$4) + (i32.wrap_i64 + (local.get $var$0) ) ) ) ) (br_if $label$1 (i32.eq - (get_local $var$3) + (local.get $var$3) (i32.const 1) ) ) (return (i64.shr_u - (get_local $var$0) - (i64.extend_u/i32 + (local.get $var$0) + (i64.extend_i32_u (i32.ctz - (get_local $var$3) + (local.get $var$3) ) ) ) ) ) - (set_local $var$3 + (local.set $var$3 (i32.sub (i32.const 63) - (get_local $var$2) + (local.get $var$2) ) ) - (set_local $var$2 + (local.set $var$2 (i32.add - (get_local $var$2) + (local.get $var$2) (i32.const 1) ) ) ) - (set_local $var$5 + (local.set $var$5 (i64.shr_u - (get_local $var$0) - (i64.extend_u/i32 + (local.get $var$0) + (i64.extend_i32_u (i32.and - (get_local $var$2) + (local.get $var$2) (i32.const 63) ) ) ) ) - (set_local $var$0 + (local.set $var$0 (i64.shl - (get_local $var$0) - (i64.extend_u/i32 + (local.get $var$0) + (i64.extend_i32_u (i32.and - (get_local $var$3) + (local.get $var$3) (i32.const 63) ) ) @@ -821,64 +821,64 @@ ) (block $label$13 (if - (get_local $var$2) + (local.get $var$2) (block - (set_local $var$8 + (local.set $var$8 (i64.add - (get_local $var$1) + (local.get $var$1) (i64.const -1) ) ) (loop $label$15 - (set_local $var$5 + (local.set $var$5 (i64.sub - (tee_local $var$5 + (local.tee $var$5 (i64.or (i64.shl - (get_local $var$5) + (local.get $var$5) (i64.const 1) ) (i64.shr_u - (get_local $var$0) + (local.get $var$0) (i64.const 63) ) ) ) (i64.and - (tee_local $var$6 + (local.tee $var$6 (i64.shr_s (i64.sub - (get_local $var$8) - (get_local $var$5) + (local.get $var$8) + (local.get $var$5) ) (i64.const 63) ) ) - (get_local $var$1) + (local.get $var$1) ) ) ) - (set_local $var$0 + (local.set $var$0 (i64.or (i64.shl - (get_local $var$0) + (local.get $var$0) (i64.const 1) ) - (get_local $var$7) + (local.get $var$7) ) ) - (set_local $var$7 - (tee_local $var$6 + (local.set $var$7 + (local.tee $var$6 (i64.and - (get_local $var$6) + (local.get $var$6) (i64.const 1) ) ) ) (br_if $label$15 - (tee_local $var$2 + (local.tee $var$2 (i32.add - (get_local $var$2) + (local.get $var$2) (i32.const -1) ) ) @@ -890,27 +890,27 @@ ) (i64.store (i32.const 1024) - (get_local $var$5) + (local.get $var$5) ) (return (i64.or (i64.shl - (get_local $var$0) + (local.get $var$0) (i64.const 1) ) - (get_local $var$6) + (local.get $var$6) ) ) ) (i64.store (i32.const 1024) - (get_local $var$0) + (local.get $var$0) ) - (set_local $var$0 + (local.set $var$0 (i64.const 0) ) ) - (get_local $var$0) + (local.get $var$0) ) (func $_ZN17compiler_builtins3int3mul3Mul3mul17h070e9a1c69faec5bE (; 15 ;) (type $0) (param $var$0 i64) (param $var$1 i64) (result i64) (local $var$2 i32) @@ -920,27 +920,27 @@ (local $var$6 i32) (i64.or (i64.shl - (i64.extend_u/i32 + (i64.extend_i32_u (i32.add (i32.add (i32.add (i32.add (i32.mul - (tee_local $var$4 + (local.tee $var$4 (i32.shr_u - (tee_local $var$2 - (i32.wrap/i64 - (get_local $var$1) + (local.tee $var$2 + (i32.wrap_i64 + (local.get $var$1) ) ) (i32.const 16) ) ) - (tee_local $var$5 + (local.tee $var$5 (i32.shr_u - (tee_local $var$3 - (i32.wrap/i64 - (get_local $var$0) + (local.tee $var$3 + (i32.wrap_i64 + (local.get $var$0) ) ) (i32.const 16) @@ -948,40 +948,40 @@ ) ) (i32.mul - (get_local $var$2) - (i32.wrap/i64 + (local.get $var$2) + (i32.wrap_i64 (i64.shr_u - (get_local $var$0) + (local.get $var$0) (i64.const 32) ) ) ) ) (i32.mul - (i32.wrap/i64 + (i32.wrap_i64 (i64.shr_u - (get_local $var$1) + (local.get $var$1) (i64.const 32) ) ) - (get_local $var$3) + (local.get $var$3) ) ) (i32.shr_u - (tee_local $var$2 + (local.tee $var$2 (i32.add (i32.shr_u - (tee_local $var$6 + (local.tee $var$6 (i32.mul - (tee_local $var$2 + (local.tee $var$2 (i32.and - (get_local $var$2) + (local.get $var$2) (i32.const 65535) ) ) - (tee_local $var$3 + (local.tee $var$3 (i32.and - (get_local $var$3) + (local.get $var$3) (i32.const 65535) ) ) @@ -990,8 +990,8 @@ (i32.const 16) ) (i32.mul - (get_local $var$2) - (get_local $var$5) + (local.get $var$2) + (local.get $var$5) ) ) ) @@ -999,15 +999,15 @@ ) ) (i32.shr_u - (tee_local $var$2 + (local.tee $var$2 (i32.add (i32.and - (get_local $var$2) + (local.get $var$2) (i32.const 65535) ) (i32.mul - (get_local $var$4) - (get_local $var$3) + (local.get $var$4) + (local.get $var$3) ) ) ) @@ -1017,14 +1017,14 @@ ) (i64.const 32) ) - (i64.extend_u/i32 + (i64.extend_i32_u (i32.or (i32.shl - (get_local $var$2) + (local.get $var$2) (i32.const 16) ) (i32.and - (get_local $var$6) + (local.get $var$6) (i32.const 65535) ) ) @@ -1038,40 +1038,40 @@ (i64.div_u (i64.sub (i64.xor - (tee_local $var$2 + (local.tee $var$2 (i64.shr_s - (get_local $var$0) + (local.get $var$0) (i64.const 63) ) ) - (get_local $var$0) + (local.get $var$0) ) - (get_local $var$2) + (local.get $var$2) ) (i64.sub (i64.xor - (tee_local $var$2 + (local.tee $var$2 (i64.shr_s - (get_local $var$1) + (local.get $var$1) (i64.const 63) ) ) - (get_local $var$1) + (local.get $var$1) ) - (get_local $var$2) + (local.get $var$2) ) ) - (tee_local $var$0 + (local.tee $var$0 (i64.shr_s (i64.xor - (get_local $var$1) - (get_local $var$0) + (local.get $var$1) + (local.get $var$0) ) (i64.const 63) ) ) ) - (get_local $var$0) + (local.get $var$0) ) ) (func $_ZN17compiler_builtins3int4sdiv3Mod4mod_17h2cbb7bbf36e41d68E (; 17 ;) (type $0) (param $var$0 i64) (param $var$1 i64) (result i64) @@ -1081,32 +1081,32 @@ (i64.rem_u (i64.sub (i64.xor - (tee_local $var$2 + (local.tee $var$2 (i64.shr_s - (get_local $var$0) + (local.get $var$0) (i64.const 63) ) ) - (get_local $var$0) + (local.get $var$0) ) - (get_local $var$2) + (local.get $var$2) ) (i64.sub (i64.xor - (tee_local $var$0 + (local.tee $var$0 (i64.shr_s - (get_local $var$1) + (local.get $var$1) (i64.const 63) ) ) - (get_local $var$1) + (local.get $var$1) ) - (get_local $var$0) + (local.get $var$0) ) ) - (get_local $var$2) + (local.get $var$2) ) - (get_local $var$2) + (local.get $var$2) ) ) ;; custom section "linking", size 3 |