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/dataflow/graph.h | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'src/dataflow/graph.h') diff --git a/src/dataflow/graph.h b/src/dataflow/graph.h index f41346857..5c01714f5 100644 --- a/src/dataflow/graph.h +++ b/src/dataflow/graph.h @@ -46,7 +46,7 @@ struct Graph : public UnifiedExpressionVisitor { Node bad = Node(Node::Type::Bad); // Connects a specific set to the data in its value. - std::unordered_map setNodeMap; + std::unordered_map setNodeMap; // Maps a control-flow expression to the conditions for it. Currently, // this maps an if to the conditions for its arms @@ -65,7 +65,7 @@ struct Graph : public UnifiedExpressionVisitor { std::unordered_map nodeParentMap; // All the sets, in order of appearance. - std::vector sets; + std::vector sets; // The function being processed. Function* func; @@ -206,10 +206,10 @@ struct Graph : public UnifiedExpressionVisitor { return doVisitIf(iff); } else if (auto* loop = curr->dynCast()) { return doVisitLoop(loop); - } else if (auto* get = curr->dynCast()) { - return doVisitGetLocal(get); - } else if (auto* set = curr->dynCast()) { - return doVisitSetLocal(set); + } else if (auto* get = curr->dynCast()) { + return doVisitLocalGet(get); + } else if (auto* set = curr->dynCast()) { + return doVisitLocalSet(set); } else if (auto* br = curr->dynCast()) { return doVisitBreak(br); } else if (auto* sw = curr->dynCast()) { @@ -385,7 +385,7 @@ struct Graph : public UnifiedExpressionVisitor { setInUnreachable(); return &bad; } - Node* doVisitGetLocal(GetLocal* curr) { + Node* doVisitLocalGet(LocalGet* curr) { if (!isRelevantLocal(curr->index) || isInUnreachable()) { return &bad; } @@ -393,7 +393,7 @@ struct Graph : public UnifiedExpressionVisitor { auto* node = locals[curr->index]; return node; } - Node* doVisitSetLocal(SetLocal* curr) { + Node* doVisitLocalSet(LocalSet* curr) { if (!isRelevantLocal(curr->index) || isInUnreachable()) { return &bad; } @@ -735,12 +735,12 @@ struct Graph : public UnifiedExpressionVisitor { // Given a node representing something that is local.set'd, return // the set. - SetLocal* getSet(Node* node) { + LocalSet* getSet(Node* node) { auto iter = nodeParentMap.find(node); if (iter == nodeParentMap.end()) { return nullptr; } - return iter->second->dynCast(); + return iter->second->dynCast(); } // Given an expression, return the parent if such exists. @@ -753,9 +753,9 @@ struct Graph : public UnifiedExpressionVisitor { } // Given an expression, return the set for it if such exists. - SetLocal* getSet(Expression* curr) { + LocalSet* getSet(Expression* curr) { auto* parent = getParent(curr); - return parent ? parent->dynCast() : nullptr; + return parent ? parent->dynCast() : nullptr; } // Creates an expression that uses a node. Generally, a node represents @@ -766,13 +766,13 @@ struct Graph : public UnifiedExpressionVisitor { // The index is the wasm local that we assign to when implementing // the phi; get from there. auto index = node->index; - return builder.makeGetLocal(index, func->getLocalType(index)); + return builder.makeLocalGet(index, func->getLocalType(index)); } else if (node->isConst()) { return builder.makeConst(node->expr->cast()->value); } else if (node->isExpr()) { // Find the set we are a value of. auto index = getSet(node)->index; - return builder.makeGetLocal(index, func->getLocalType(index)); + return builder.makeLocalGet(index, func->getLocalType(index)); } else if (node->isZext()) { // i1 zexts are a no-op for wasm return makeUse(node->values[0]); -- cgit v1.2.3