From 018960ebb197125816c99c0db3a3c868c1d20b89 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Thu, 12 Dec 2019 12:48:43 +0000 Subject: [PATCH] Rename EWasmObjectCompiler to WasmObjectCompiler --- libsolidity/interface/CompilerStack.cpp | 4 ---- libyul/AssemblyStack.cpp | 4 ++-- libyul/CMakeLists.txt | 4 ++-- ...{EWasmObjectCompiler.cpp => WasmObjectCompiler.cpp} | 10 +++++----- .../{EWasmObjectCompiler.h => WasmObjectCompiler.h} | 7 ++++--- 5 files changed, 13 insertions(+), 16 deletions(-) rename libyul/backends/wasm/{EWasmObjectCompiler.cpp => WasmObjectCompiler.cpp} (83%) rename libyul/backends/wasm/{EWasmObjectCompiler.h => WasmObjectCompiler.h} (88%) diff --git a/libsolidity/interface/CompilerStack.cpp b/libsolidity/interface/CompilerStack.cpp index 9d9a0a7b3..4cb085883 100644 --- a/libsolidity/interface/CompilerStack.cpp +++ b/libsolidity/interface/CompilerStack.cpp @@ -51,10 +51,6 @@ #include #include -#include -#include -#include -#include #include #include diff --git a/libyul/AssemblyStack.cpp b/libyul/AssemblyStack.cpp index 6dc84ac81..ce10727d2 100644 --- a/libyul/AssemblyStack.cpp +++ b/libyul/AssemblyStack.cpp @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include #include #include @@ -220,7 +220,7 @@ MachineAssemblyObject AssemblyStack::assemble(Machine _machine) const Dialect const& dialect = languageToDialect(m_language, EVMVersion{}); MachineAssemblyObject object; - auto result = EWasmObjectCompiler::compile(*m_parserResult, dialect); + auto result = WasmObjectCompiler::compile(*m_parserResult, dialect); object.assembly = std::move(result.first); object.bytecode = make_shared(); object.bytecode->bytecode = std::move(result.second); diff --git a/libyul/CMakeLists.txt b/libyul/CMakeLists.txt index 2fa66f432..2304e7666 100644 --- a/libyul/CMakeLists.txt +++ b/libyul/CMakeLists.txt @@ -46,8 +46,6 @@ add_library(yul backends/evm/NoOutputAssembly.cpp backends/wasm/EVMToEWasmTranslator.cpp backends/wasm/EVMToEWasmTranslator.h - backends/wasm/EWasmObjectCompiler.cpp - backends/wasm/EWasmObjectCompiler.h backends/wasm/BinaryTransform.cpp backends/wasm/BinaryTransform.h backends/wasm/TextTransform.cpp @@ -56,6 +54,8 @@ add_library(yul backends/wasm/WasmCodeTransform.h backends/wasm/WasmDialect.cpp backends/wasm/WasmDialect.h + backends/wasm/WasmObjectCompiler.cpp + backends/wasm/WasmObjectCompiler.h backends/wasm/WordSizeTransform.cpp backends/wasm/WordSizeTransform.h optimiser/ASTCopier.cpp diff --git a/libyul/backends/wasm/EWasmObjectCompiler.cpp b/libyul/backends/wasm/WasmObjectCompiler.cpp similarity index 83% rename from libyul/backends/wasm/EWasmObjectCompiler.cpp rename to libyul/backends/wasm/WasmObjectCompiler.cpp index f487884ab..b65318ae3 100644 --- a/libyul/backends/wasm/EWasmObjectCompiler.cpp +++ b/libyul/backends/wasm/WasmObjectCompiler.cpp @@ -18,7 +18,7 @@ * Compiler that transforms Yul Objects to Wasm text and binary representation (Ewasm flavoured). */ -#include +#include #include #include @@ -32,14 +32,14 @@ using namespace yul; using namespace std; -pair EWasmObjectCompiler::compile(Object& _object, Dialect const& _dialect) +pair WasmObjectCompiler::compile(Object& _object, Dialect const& _dialect) { - EWasmObjectCompiler compiler(_dialect); + WasmObjectCompiler compiler(_dialect); wasm::Module module = compiler.run(_object); return {wasm::TextTransform().run(module), wasm::BinaryTransform::run(module)}; } -wasm::Module EWasmObjectCompiler::run(Object& _object) +wasm::Module WasmObjectCompiler::run(Object& _object) { yulAssert(_object.analysisInfo, "No analysis info."); yulAssert(_object.code, "No code."); @@ -50,7 +50,7 @@ wasm::Module EWasmObjectCompiler::run(Object& _object) if (Object* subObject = dynamic_cast(subNode.get())) module.subModules[subObject->name.str()] = run(*subObject); else - yulAssert(false, "Data is not yet supported for EWasm."); + yulAssert(false, "Data is not yet supported for Wasm."); return module; } diff --git a/libyul/backends/wasm/EWasmObjectCompiler.h b/libyul/backends/wasm/WasmObjectCompiler.h similarity index 88% rename from libyul/backends/wasm/EWasmObjectCompiler.h rename to libyul/backends/wasm/WasmObjectCompiler.h index a4fcf1af8..2805f0b06 100644 --- a/libyul/backends/wasm/EWasmObjectCompiler.h +++ b/libyul/backends/wasm/WasmObjectCompiler.h @@ -28,6 +28,7 @@ namespace dev { using bytes = std::vector; } + namespace yul { struct Object; @@ -37,13 +38,13 @@ namespace wasm struct Module; } -class EWasmObjectCompiler +class WasmObjectCompiler { public: - /// Compiles the given object and returns the WAST and the binary representation. + /// Compiles the given object and returns the Wasm text and binary representation. static std::pair compile(Object& _object, Dialect const& _dialect); private: - EWasmObjectCompiler(Dialect const& _dialect): + WasmObjectCompiler(Dialect const& _dialect): m_dialect(_dialect) {}