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/ir/LocalGraph.cpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'src/ir/LocalGraph.cpp') diff --git a/src/ir/LocalGraph.cpp b/src/ir/LocalGraph.cpp index a66009ec2..dd7046351 100644 --- a/src/ir/LocalGraph.cpp +++ b/src/ir/LocalGraph.cpp @@ -31,7 +31,7 @@ struct Info { // actions occurring in this block: local.gets and local.sets std::vector actions; // for each index, the last local.set for it - std::unordered_map lastSets; + std::unordered_map lastSets; }; // flow helper class. flows the gets to their sets @@ -55,8 +55,8 @@ struct Flower : public CFGWalker, Info> { // cfg traversal work - static void doVisitGetLocal(Flower* self, Expression** currp) { - auto* curr = (*currp)->cast(); + static void doVisitLocalGet(Flower* self, Expression** currp) { + auto* curr = (*currp)->cast(); // if in unreachable code, skip if (!self->currBasicBlock) { return; @@ -65,8 +65,8 @@ struct Flower : public CFGWalker, Info> { self->locations[curr] = currp; } - static void doVisitSetLocal(Flower* self, Expression** currp) { - auto* curr = (*currp)->cast(); + static void doVisitLocalSet(Flower* self, Expression** currp) { + auto* curr = (*currp)->cast(); // if in unreachable code, skip if (!self->currBasicBlock) { return; @@ -95,11 +95,11 @@ struct Flower : public CFGWalker, Info> { // scanning them linearly is efficient, avoiding hash computations (while // in Info, it's convenient to have a map so we can assign them easily, // where the last one seen overwrites the previous; and, we do that O(1)). - std::vector> lastSets; + std::vector> lastSets; }; auto numLocals = func->getNumLocals(); - std::vector> allGets; + std::vector> allGets; allGets.resize(numLocals); std::vector work; @@ -158,11 +158,11 @@ struct Flower : public CFGWalker, Info> { // move towards the front, handling things as we go for (int i = int(actions.size()) - 1; i >= 0; i--) { auto* action = actions[i]; - if (auto* get = action->dynCast()) { + if (auto* get = action->dynCast()) { allGets[get->index].push_back(get); } else { // This set is the only set for all those gets. - auto* set = action->cast(); + auto* set = action->cast(); auto& gets = allGets[set->index]; for (auto* get : gets) { getSetses[get].insert(set); @@ -202,7 +202,7 @@ struct Flower : public CFGWalker, Info> { auto lastSet = std::find_if(pred->lastSets.begin(), pred->lastSets.end(), - [&](std::pair& value) { + [&](std::pair& value) { return value.first == index; }); if (lastSet != pred->lastSets.end()) { @@ -248,13 +248,13 @@ LocalGraph::LocalGraph(Function* func) { void LocalGraph::computeInfluences() { for (auto& pair : locations) { auto* curr = pair.first; - if (auto* set = curr->dynCast()) { - FindAll findAll(set->value); + if (auto* set = curr->dynCast()) { + FindAll findAll(set->value); for (auto* get : findAll.list) { getInfluences[get].insert(set); } } else { - auto* get = curr->cast(); + auto* get = curr->cast(); for (auto* set : getSetses[get]) { setInfluences[set].insert(get); } @@ -263,7 +263,7 @@ void LocalGraph::computeInfluences() { } void LocalGraph::computeSSAIndexes() { - std::unordered_map> indexSets; + std::unordered_map> indexSets; for (auto& pair : getSetses) { auto* get = pair.first; auto& sets = pair.second; @@ -273,7 +273,7 @@ void LocalGraph::computeSSAIndexes() { } for (auto& pair : locations) { auto* curr = pair.first; - if (auto* set = curr->dynCast()) { + if (auto* set = curr->dynCast()) { auto& sets = indexSets[set->index]; if (sets.size() == 1 && *sets.begin() != curr) { // While it has just one set, it is not the right one (us), -- cgit v1.2.3