summaryrefslogtreecommitdiff
path: root/src/passes/Precompute.cpp
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/passes/Precompute.cpp
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/passes/Precompute.cpp')
-rw-r--r--src/passes/Precompute.cpp16
1 files changed, 8 insertions, 8 deletions
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<GetLocal*, Literal> GetValues;
+typedef std::unordered_map<LocalGet*, Literal> 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<SetLocal*, Literal> setValues;
+ std::unordered_map<LocalSet*, Literal> 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<SetLocal>()) {
+ if (auto* set = curr->dynCast<LocalSet>()) {
if (setValues[set].isConcrete()) {
continue; // already known constant
}
@@ -317,7 +317,7 @@ private:
}
}
} else {
- auto* get = curr->cast<GetLocal>();
+ auto* get = curr->cast<LocalGet>();
if (getValues[get].isConcrete()) {
continue; // already known constant
}