diff options
Diffstat (limited to 'src/tools')
-rw-r--r-- | src/tools/asm2wasm.cpp | 2 | ||||
-rw-r--r-- | src/tools/fuzzing.h | 64 | ||||
-rw-r--r-- | src/tools/wasm-ctor-eval.cpp | 4 | ||||
-rw-r--r-- | src/tools/wasm-metadce.cpp | 8 |
4 files changed, 39 insertions, 39 deletions
diff --git a/src/tools/asm2wasm.cpp b/src/tools/asm2wasm.cpp index 0077b9448..cbd72abe0 100644 --- a/src/tools/asm2wasm.cpp +++ b/src/tools/asm2wasm.cpp @@ -237,7 +237,7 @@ int main(int argc, const char* argv[]) { Expression* init; const auto& memBase = options.extra.find("mem base"); if (memBase == options.extra.end()) { - init = Builder(wasm).makeGetGlobal(MEMORY_BASE, i32); + init = Builder(wasm).makeGlobalGet(MEMORY_BASE, i32); } else { init = Builder(wasm).makeConst( Literal(int32_t(atoi(memBase->second.c_str())))); diff --git a/src/tools/fuzzing.h b/src/tools/fuzzing.h index 965cb74fa..f7dd20e76 100644 --- a/src/tools/fuzzing.h +++ b/src/tools/fuzzing.h @@ -350,22 +350,22 @@ private: // } std::vector<Expression*> contents; contents.push_back( - builder.makeSetLocal(0, builder.makeConst(Literal(uint32_t(5381))))); + builder.makeLocalSet(0, builder.makeConst(Literal(uint32_t(5381))))); for (Index i = 0; i < USABLE_MEMORY; i++) { - contents.push_back(builder.makeSetLocal( + contents.push_back(builder.makeLocalSet( 0, builder.makeBinary( XorInt32, builder.makeBinary( AddInt32, builder.makeBinary(ShlInt32, - builder.makeGetLocal(0, i32), + builder.makeLocalGet(0, i32), builder.makeConst(Literal(uint32_t(5)))), - builder.makeGetLocal(0, i32)), + builder.makeLocalGet(0, i32)), builder.makeLoad( 1, false, i, 1, builder.makeConst(Literal(uint32_t(0))), i32)))); } - contents.push_back(builder.makeGetLocal(0, i32)); + contents.push_back(builder.makeLocalGet(0, i32)); auto* body = builder.makeBlock(contents); auto* hasher = wasm.addFunction(builder.makeFunction( "hashMemory", std::vector<Type>{}, i32, {i32}, body)); @@ -416,7 +416,7 @@ private: auto* func = new Function; func->name = "hangLimitInitializer"; func->result = none; - func->body = builder.makeSetGlobal( + func->body = builder.makeGlobalSet( glob->name, builder.makeConst(Literal(int32_t(HANG_LIMIT)))); wasm.addFunction(func); @@ -445,12 +445,12 @@ private: return builder.makeSequence( builder.makeIf( builder.makeUnary(UnaryOp::EqZInt32, - builder.makeGetGlobal(HANG_LIMIT_GLOBAL, i32)), + builder.makeGlobalGet(HANG_LIMIT_GLOBAL, i32)), makeTrivial(unreachable)), - builder.makeSetGlobal( + builder.makeGlobalSet( HANG_LIMIT_GLOBAL, builder.makeBinary(BinaryOp::SubInt32, - builder.makeGetGlobal(HANG_LIMIT_GLOBAL, i32), + builder.makeGlobalGet(HANG_LIMIT_GLOBAL, i32), builder.makeConst(Literal(int32_t(1)))))); } @@ -462,8 +462,8 @@ private: func->result = type; func->body = builder.makeIf( builder.makeBinary( - op, builder.makeGetLocal(0, type), builder.makeGetLocal(0, type)), - builder.makeGetLocal(0, type), + op, builder.makeLocalGet(0, type), builder.makeLocalGet(0, type)), + builder.makeLocalGet(0, type), builder.makeConst(literal)); wasm.addFunction(func); }; @@ -804,13 +804,13 @@ private: if (oneIn(2)) { return makeConst(type); } else { - return makeGetLocal(type); + return makeLocalGet(type); } } else if (type == none) { if (oneIn(2)) { return makeNop(type); } else { - return makeSetLocal(type); + return makeLocalSet(type); } } assert(type == unreachable); @@ -845,10 +845,10 @@ private: return makeConst(type); } if (choice < 30) { - return makeSetLocal(type); + return makeLocalSet(type); } if (choice < 50) { - return makeGetLocal(type); + return makeLocalGet(type); } if (choice < 60) { return makeBlock(type); @@ -871,14 +871,14 @@ private: &Self::makeBreak, &Self::makeCall, &Self::makeCallIndirect, - &Self::makeGetLocal, - &Self::makeSetLocal, + &Self::makeLocalGet, + &Self::makeLocalSet, &Self::makeLoad, &Self::makeConst, &Self::makeUnary, &Self::makeBinary, &Self::makeSelect, - &Self::makeGetGlobal) + &Self::makeGlobalGet) .add(FeatureSet::SIMD, &Self::makeSIMD); if (type == i32 || type == i64) { options.add(FeatureSet::Atomics, &Self::makeAtomic); @@ -897,7 +897,7 @@ private: } choice = upTo(100); if (choice < 50) { - return makeSetLocal(none); + return makeLocalSet(none); } if (choice < 60) { return makeBlock(none); @@ -920,11 +920,11 @@ private: &Self::makeBreak, &Self::makeCall, &Self::makeCallIndirect, - &Self::makeSetLocal, + &Self::makeLocalSet, &Self::makeStore, &Self::makeDrop, &Self::makeNop, - &Self::makeSetGlobal) + &Self::makeGlobalSet) .add(FeatureSet::BulkMemory, &Self::makeBulkMemory); return (this->*pick(options))(none); } @@ -944,7 +944,7 @@ private: case 5: return makeCallIndirect(unreachable); case 6: - return makeSetLocal(unreachable); + return makeLocalSet(unreachable); case 7: return makeStore(unreachable); case 8: @@ -969,7 +969,7 @@ private: Expression* makeTrivial(Type type) { if (isConcreteType(type)) { if (oneIn(2)) { - return makeGetLocal(type); + return makeLocalGet(type); } else { return makeConst(type); } @@ -1231,15 +1231,15 @@ private: return builder.makeCallIndirect(func->type, target, args, func->result); } - Expression* makeGetLocal(Type type) { + Expression* makeLocalGet(Type type) { auto& locals = typeLocals[type]; if (locals.empty()) { return makeConst(type); } - return builder.makeGetLocal(vectorPick(locals), type); + return builder.makeLocalGet(vectorPick(locals), type); } - Expression* makeSetLocal(Type type) { + Expression* makeLocalSet(Type type) { bool tee = type != none; Type valueType; if (tee) { @@ -1253,21 +1253,21 @@ private: } auto* value = make(valueType); if (tee) { - return builder.makeTeeLocal(vectorPick(locals), value); + return builder.makeLocalTee(vectorPick(locals), value); } else { - return builder.makeSetLocal(vectorPick(locals), value); + return builder.makeLocalSet(vectorPick(locals), value); } } - Expression* makeGetGlobal(Type type) { + Expression* makeGlobalGet(Type type) { auto& globals = globalsByType[type]; if (globals.empty()) { return makeConst(type); } - return builder.makeGetGlobal(vectorPick(globals), type); + return builder.makeGlobalGet(vectorPick(globals), type); } - Expression* makeSetGlobal(Type type) { + Expression* makeGlobalSet(Type type) { assert(type == none); type = getConcreteType(); auto& globals = globalsByType[type]; @@ -1275,7 +1275,7 @@ private: return makeTrivial(none); } auto* value = make(type); - return builder.makeSetGlobal(vectorPick(globals), value); + return builder.makeGlobalSet(vectorPick(globals), value); } Expression* makePointer() { diff --git a/src/tools/wasm-ctor-eval.cpp b/src/tools/wasm-ctor-eval.cpp index 293c675d1..af4d0d0b2 100644 --- a/src/tools/wasm-ctor-eval.cpp +++ b/src/tools/wasm-ctor-eval.cpp @@ -133,7 +133,7 @@ public: ModuleUtils::iterDefinedGlobals(wasm, [&](Global* global) { if (!global->init->is<Const>()) { // some constants are ok to use - if (auto* get = global->init->dynCast<GetGlobal>()) { + if (auto* get = global->init->dynCast<GlobalGet>()) { auto name = get->name; auto* import = wasm.getGlobal(name); if (import->module == Name(ENV) && @@ -228,7 +228,7 @@ struct CtorEvalExternalInterface : EvallingModuleInstance::ExternalInterface { // offset 0. if (auto* c = segment.offset->dynCast<Const>()) { start = c->value.getInteger(); - } else if (segment.offset->is<GetGlobal>()) { + } else if (segment.offset->is<GlobalGet>()) { start = 0; } else { WASM_UNREACHABLE(); // wasm spec only allows const and global.get there diff --git a/src/tools/wasm-metadce.cpp b/src/tools/wasm-metadce.cpp index 35fbc6357..c04286f59 100644 --- a/src/tools/wasm-metadce.cpp +++ b/src/tools/wasm-metadce.cpp @@ -154,8 +154,8 @@ struct MetaDCEGraph { InitScanner(MetaDCEGraph* parent, Name parentDceName) : parent(parent), parentDceName(parentDceName) {} - void visitGetGlobal(GetGlobal* curr) { handleGlobal(curr->name); } - void visitSetGlobal(SetGlobal* curr) { handleGlobal(curr->name); } + void visitGlobalGet(GlobalGet* curr) { handleGlobal(curr->name); } + void visitGlobalSet(GlobalSet* curr) { handleGlobal(curr->name); } private: MetaDCEGraph* parent; @@ -223,8 +223,8 @@ struct MetaDCEGraph { ->importIdToDCENode[parent->getFunctionImportId(curr->target)]); } } - void visitGetGlobal(GetGlobal* curr) { handleGlobal(curr->name); } - void visitSetGlobal(SetGlobal* curr) { handleGlobal(curr->name); } + void visitGlobalGet(GlobalGet* curr) { handleGlobal(curr->name); } + void visitGlobalSet(GlobalSet* curr) { handleGlobal(curr->name); } private: MetaDCEGraph* parent; |