Rename EWasmObjectCompiler to WasmObjectCompiler

This commit is contained in:
Alex Beregszaszi 2019-12-12 12:48:43 +00:00
parent cec45a7df5
commit 018960ebb1
5 changed files with 13 additions and 16 deletions

View File

@ -51,10 +51,6 @@
#include <libyul/YulString.h>
#include <libyul/AsmPrinter.h>
#include <libyul/backends/wasm/EVMToEWasmTranslator.h>
#include <libyul/backends/wasm/EWasmObjectCompiler.h>
#include <libyul/backends/wasm/WasmDialect.h>
#include <libyul/backends/evm/EVMDialect.h>
#include <libyul/AssemblyStack.h>
#include <liblangutil/Scanner.h>

View File

@ -33,7 +33,7 @@
#include <libyul/backends/evm/EVMObjectCompiler.h>
#include <libyul/backends/evm/EVMMetrics.h>
#include <libyul/backends/wasm/WasmDialect.h>
#include <libyul/backends/wasm/EWasmObjectCompiler.h>
#include <libyul/backends/wasm/WasmObjectCompiler.h>
#include <libyul/backends/wasm/EVMToEWasmTranslator.h>
#include <libyul/optimiser/Metrics.h>
#include <libyul/ObjectParser.h>
@ -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<dev::eth::LinkerObject>();
object.bytecode->bytecode = std::move(result.second);

View File

@ -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

View File

@ -18,7 +18,7 @@
* Compiler that transforms Yul Objects to Wasm text and binary representation (Ewasm flavoured).
*/
#include <libyul/backends/wasm/EWasmObjectCompiler.h>
#include <libyul/backends/wasm/WasmObjectCompiler.h>
#include <libyul/backends/wasm/WasmCodeTransform.h>
#include <libyul/backends/wasm/BinaryTransform.h>
@ -32,14 +32,14 @@
using namespace yul;
using namespace std;
pair<string, dev::bytes> EWasmObjectCompiler::compile(Object& _object, Dialect const& _dialect)
pair<string, dev::bytes> 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<Object*>(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;
}

View File

@ -28,6 +28,7 @@ namespace dev
{
using bytes = std::vector<uint8_t>;
}
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<std::string, dev::bytes> compile(Object& _object, Dialect const& _dialect);
private:
EWasmObjectCompiler(Dialect const& _dialect):
WasmObjectCompiler(Dialect const& _dialect):
m_dialect(_dialect)
{}