From 1a3c1a58cc7e97a846f612baf7f74a370980458f Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Tue, 21 May 2019 13:25:14 -0700 Subject: Reflect instruction renaming in code (#2128) - Reflected new renamed instruction names in code and tests: - `get_local` -> `local.get` - `set_local` -> `local.set` - `tee_local` -> `local.tee` - `get_global` -> `global.get` - `set_global` -> `global.set` - `current_memory` -> `memory.size` - `grow_memory` -> `memory.grow` - Removed APIs related to old instruction names in Binaryen.js and added APIs with new names if they are missing. - Renamed `typedef SortedVector LocalSet` to `SetsOfLocals` to prevent name clashes. - Resolved several TODO renaming items in wasm-binary.h: - `TableSwitch` -> `BrTable` - `I32ConvertI64` -> `I32WrapI64` - `I64STruncI32` -> `I64SExtendI32` - `I64UTruncI32` -> `I64UExtendI32` - `F32ConvertF64` -> `F32DemoteI64` - `F64ConvertF32` -> `F64PromoteF32` - Renamed `BinaryenGetFeatures` and `BinaryenSetFeatures` to `BinaryenModuleGetFeatures` and `BinaryenModuleSetFeatures` for consistency. --- src/passes/OptimizeInstructions.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'src/passes/OptimizeInstructions.cpp') diff --git a/src/passes/OptimizeInstructions.cpp b/src/passes/OptimizeInstructions.cpp index 85258dbb8..cf764ac49 100644 --- a/src/passes/OptimizeInstructions.cpp +++ b/src/passes/OptimizeInstructions.cpp @@ -166,10 +166,10 @@ Index getMaxBits(Expression* curr, LocalInfoProvider* localInfoProvider) { return std::min(Index(32), getMaxBits(unary->value, localInfoProvider)); default: {} } - } else if (auto* set = curr->dynCast()) { + } else if (auto* set = curr->dynCast()) { // a tee passes through the value return getMaxBits(set->value, localInfoProvider); - } else if (auto* get = curr->dynCast()) { + } else if (auto* get = curr->dynCast()) { return localInfoProvider->getMaxBitsForLocal(get); } else if (auto* load = curr->dynCast()) { // if signed, then the sign-extension might fill all the bits @@ -226,7 +226,7 @@ struct LocalScanner : PostWalker { } } - void visitSetLocal(SetLocal* curr) { + void visitLocalSet(LocalSet* curr) { auto* func = getFunction(); if (func->isParam(curr->index)) { return; @@ -257,7 +257,7 @@ struct LocalScanner : PostWalker { // define this for the templated getMaxBits method. we know nothing here yet // about locals, so return the maxes - Index getMaxBitsForLocal(GetLocal* get) { return getBitsForType(get->type); } + Index getMaxBitsForLocal(LocalGet* get) { return getBitsForType(get->type); } Index getBitsForType(Type type) { switch (type) { @@ -728,9 +728,9 @@ struct OptimizeInstructions return unary; } } - } else if (auto* set = curr->dynCast()) { + } else if (auto* set = curr->dynCast()) { // optimize out a set of a get - auto* get = set->value->dynCast(); + auto* get = set->value->dynCast(); if (get && get->name == set->name) { ExpressionManipulator::nop(curr); } @@ -874,7 +874,7 @@ struct OptimizeInstructions return nullptr; } - Index getMaxBitsForLocal(GetLocal* get) { + Index getMaxBitsForLocal(LocalGet* get) { // check what we know about the local return localInfo[get->index].maxBits; } @@ -906,7 +906,7 @@ private: return; } // Prefer a get on the right. - if (binary->left->is() && !binary->right->is()) { + if (binary->left->is() && !binary->right->is()) { return maybeSwap(); } // Sort by the node id type, if different. @@ -929,8 +929,8 @@ private: return maybeSwap(); } } - if (auto* left = binary->left->dynCast()) { - auto* right = binary->right->cast(); + if (auto* left = binary->left->dynCast()) { + auto* right = binary->right->cast(); if (left->index > right->index) { return maybeSwap(); } @@ -1270,7 +1270,7 @@ private: if (Properties::getSignExtValue(curr)) { return Properties::getSignExtBits(curr) == bits; } - if (auto* get = curr->dynCast()) { + if (auto* get = curr->dynCast()) { // check what we know about the local return localInfo[get->index].signExtedBits == bits; } -- cgit v1.2.3