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/Precompute.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/passes/Precompute.cpp') diff --git a/src/passes/Precompute.cpp b/src/passes/Precompute.cpp index d5cfdc968..2e8c8fe31 100644 --- a/src/passes/Precompute.cpp +++ b/src/passes/Precompute.cpp @@ -41,7 +41,7 @@ namespace wasm { static const Name NOTPRECOMPUTABLE_FLOW("Binaryen|notprecomputable"); -typedef std::unordered_map GetValues; +typedef std::unordered_map GetValues; // Precomputes an expression. Errors if we hit anything that can't be // precomputed. @@ -80,7 +80,7 @@ public: Flow visitCallIndirect(CallIndirect* curr) { return Flow(NOTPRECOMPUTABLE_FLOW); } - Flow visitGetLocal(GetLocal* curr) { + Flow visitLocalGet(LocalGet* curr) { auto iter = getValues.find(curr); if (iter != getValues.end()) { auto value = iter->second; @@ -90,7 +90,7 @@ public: } return Flow(NOTPRECOMPUTABLE_FLOW); } - Flow visitSetLocal(SetLocal* curr) { + Flow visitLocalSet(LocalSet* curr) { // If we don't need to replace the whole expression, see if there // is a value flowing through a tee. if (!replaceExpression) { @@ -101,14 +101,14 @@ public: } return Flow(NOTPRECOMPUTABLE_FLOW); } - Flow visitGetGlobal(GetGlobal* curr) { + Flow visitGlobalGet(GlobalGet* curr) { auto* global = module->getGlobal(curr->name); if (!global->imported() && !global->mutable_) { return visit(global->init); } return Flow(NOTPRECOMPUTABLE_FLOW); } - Flow visitSetGlobal(SetGlobal* curr) { return Flow(NOTPRECOMPUTABLE_FLOW); } + Flow visitGlobalSet(GlobalSet* curr) { return Flow(NOTPRECOMPUTABLE_FLOW); } Flow visitLoad(Load* curr) { return Flow(NOTPRECOMPUTABLE_FLOW); } Flow visitStore(Store* curr) { return Flow(NOTPRECOMPUTABLE_FLOW); } Flow visitAtomicRMW(AtomicRMW* curr) { return Flow(NOTPRECOMPUTABLE_FLOW); } @@ -296,7 +296,7 @@ private: work.insert(curr); } // the constant value, or none if not a constant - std::unordered_map setValues; + std::unordered_map setValues; // propagate constant values while (!work.empty()) { auto iter = work.begin(); @@ -305,7 +305,7 @@ private: // see if this set or get is actually a constant value, and if so, // mark it as such and add everything it influences to the work list, // as they may be constant too. - if (auto* set = curr->dynCast()) { + if (auto* set = curr->dynCast()) { if (setValues[set].isConcrete()) { continue; // already known constant } @@ -317,7 +317,7 @@ private: } } } else { - auto* get = curr->cast(); + auto* get = curr->cast(); if (getValues[get].isConcrete()) { continue; // already known constant } -- cgit v1.2.3