summaryrefslogtreecommitdiff
path: root/src/dataflow
diff options
context:
space:
mode:
authorHeejin Ahn <aheejin@gmail.com>2019-05-21 13:25:14 -0700
committerGitHub <noreply@github.com>2019-05-21 13:25:14 -0700
commit1a3c1a58cc7e97a846f612baf7f74a370980458f (patch)
treecbe62ea58b2c0dd6d98225265419fea0b829aeab /src/dataflow
parentd78be9ac6c02910bbf8ac71118e68adff4fdc570 (diff)
downloadbinaryen-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/dataflow')
-rw-r--r--src/dataflow/graph.h28
1 files changed, 14 insertions, 14 deletions
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<Graph, Node*> {
Node bad = Node(Node::Type::Bad);
// Connects a specific set to the data in its value.
- std::unordered_map<SetLocal*, Node*> setNodeMap;
+ std::unordered_map<LocalSet*, Node*> 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<Graph, Node*> {
std::unordered_map<Node*, Expression*> nodeParentMap;
// All the sets, in order of appearance.
- std::vector<SetLocal*> sets;
+ std::vector<LocalSet*> sets;
// The function being processed.
Function* func;
@@ -206,10 +206,10 @@ struct Graph : public UnifiedExpressionVisitor<Graph, Node*> {
return doVisitIf(iff);
} else if (auto* loop = curr->dynCast<Loop>()) {
return doVisitLoop(loop);
- } else if (auto* get = curr->dynCast<GetLocal>()) {
- return doVisitGetLocal(get);
- } else if (auto* set = curr->dynCast<SetLocal>()) {
- return doVisitSetLocal(set);
+ } else if (auto* get = curr->dynCast<LocalGet>()) {
+ return doVisitLocalGet(get);
+ } else if (auto* set = curr->dynCast<LocalSet>()) {
+ return doVisitLocalSet(set);
} else if (auto* br = curr->dynCast<Break>()) {
return doVisitBreak(br);
} else if (auto* sw = curr->dynCast<Switch>()) {
@@ -385,7 +385,7 @@ struct Graph : public UnifiedExpressionVisitor<Graph, Node*> {
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<Graph, Node*> {
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<Graph, Node*> {
// 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<SetLocal>();
+ return iter->second->dynCast<LocalSet>();
}
// Given an expression, return the parent if such exists.
@@ -753,9 +753,9 @@ struct Graph : public UnifiedExpressionVisitor<Graph, Node*> {
}
// 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<SetLocal>() : nullptr;
+ return parent ? parent->dynCast<LocalSet>() : nullptr;
}
// Creates an expression that uses a node. Generally, a node represents
@@ -766,13 +766,13 @@ struct Graph : public UnifiedExpressionVisitor<Graph, Node*> {
// 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<Const>()->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]);