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/wasm/wasm.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/wasm/wasm.cpp') diff --git a/src/wasm/wasm.cpp b/src/wasm/wasm.cpp index bf12c22d4..6afc22309 100644 --- a/src/wasm/wasm.cpp +++ b/src/wasm/wasm.cpp @@ -102,13 +102,13 @@ const char* getExpressionName(Expression* curr) { return "call"; case Expression::Id::CallIndirectId: return "call_indirect"; - case Expression::Id::GetLocalId: + case Expression::Id::LocalGetId: return "local.get"; - case Expression::Id::SetLocalId: + case Expression::Id::LocalSetId: return "local.set"; - case Expression::Id::GetGlobalId: + case Expression::Id::GlobalGetId: return "global.get"; - case Expression::Id::SetGlobalId: + case Expression::Id::GlobalSetId: return "global.set"; case Expression::Id::LoadId: return "load"; @@ -427,9 +427,9 @@ bool FunctionType::operator==(FunctionType& b) { } bool FunctionType::operator!=(FunctionType& b) { return !(*this == b); } -bool SetLocal::isTee() { return type != none; } +bool LocalSet::isTee() { return type != none; } -void SetLocal::setTee(bool is) { +void LocalSet::setTee(bool is) { if (is) { type = value->type; } else { @@ -438,7 +438,7 @@ void SetLocal::setTee(bool is) { finalize(); // type may need to be unreachable } -void SetLocal::finalize() { +void LocalSet::finalize() { if (value->type == unreachable) { type = unreachable; } else if (isTee()) { @@ -448,7 +448,7 @@ void SetLocal::finalize() { } } -void SetGlobal::finalize() { +void GlobalSet::finalize() { if (value->type == unreachable) { type = unreachable; } @@ -797,11 +797,11 @@ void Drop::finalize() { void Host::finalize() { switch (op) { - case CurrentMemory: { + case MemorySize: { type = i32; break; } - case GrowMemory: { + case MemoryGrow: { // if the single operand is not reachable, so are we if (operands[0]->type == unreachable) { type = unreachable; -- cgit v1.2.3