diff options
author | Heejin Ahn <aheejin@gmail.com> | 2019-05-21 13:25:14 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-21 13:25:14 -0700 |
commit | 1a3c1a58cc7e97a846f612baf7f74a370980458f (patch) | |
tree | cbe62ea58b2c0dd6d98225265419fea0b829aeab /src/passes/OptimizeInstructions.cpp | |
parent | d78be9ac6c02910bbf8ac71118e68adff4fdc570 (diff) | |
download | binaryen-1a3c1a58cc7e97a846f612baf7f74a370980458f.tar.gz binaryen-1a3c1a58cc7e97a846f612baf7f74a370980458f.tar.bz2 binaryen-1a3c1a58cc7e97a846f612baf7f74a370980458f.zip |
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.
Diffstat (limited to 'src/passes/OptimizeInstructions.cpp')
-rw-r--r-- | src/passes/OptimizeInstructions.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
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<SetLocal>()) { + } else if (auto* set = curr->dynCast<LocalSet>()) { // a tee passes through the value return getMaxBits(set->value, localInfoProvider); - } else if (auto* get = curr->dynCast<GetLocal>()) { + } else if (auto* get = curr->dynCast<LocalGet>()) { return localInfoProvider->getMaxBitsForLocal(get); } else if (auto* load = curr->dynCast<Load>()) { // if signed, then the sign-extension might fill all the bits @@ -226,7 +226,7 @@ struct LocalScanner : PostWalker<LocalScanner> { } } - void visitSetLocal(SetLocal* curr) { + void visitLocalSet(LocalSet* curr) { auto* func = getFunction(); if (func->isParam(curr->index)) { return; @@ -257,7 +257,7 @@ struct LocalScanner : PostWalker<LocalScanner> { // 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<SetGlobal>()) { + } else if (auto* set = curr->dynCast<GlobalSet>()) { // optimize out a set of a get - auto* get = set->value->dynCast<GetGlobal>(); + auto* get = set->value->dynCast<GlobalGet>(); 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<GetLocal>() && !binary->right->is<GetLocal>()) { + if (binary->left->is<LocalGet>() && !binary->right->is<LocalGet>()) { return maybeSwap(); } // Sort by the node id type, if different. @@ -929,8 +929,8 @@ private: return maybeSwap(); } } - if (auto* left = binary->left->dynCast<GetLocal>()) { - auto* right = binary->right->cast<GetLocal>(); + if (auto* left = binary->left->dynCast<LocalGet>()) { + auto* right = binary->right->cast<LocalGet>(); 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<GetLocal>()) { + if (auto* get = curr->dynCast<LocalGet>()) { // check what we know about the local return localInfo[get->index].signExtedBits == bits; } |