mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Rename EWasmObjectCompiler to WasmObjectCompiler
This commit is contained in:
parent
cec45a7df5
commit
018960ebb1
@ -51,10 +51,6 @@
|
|||||||
|
|
||||||
#include <libyul/YulString.h>
|
#include <libyul/YulString.h>
|
||||||
#include <libyul/AsmPrinter.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 <libyul/AssemblyStack.h>
|
||||||
|
|
||||||
#include <liblangutil/Scanner.h>
|
#include <liblangutil/Scanner.h>
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
#include <libyul/backends/evm/EVMObjectCompiler.h>
|
#include <libyul/backends/evm/EVMObjectCompiler.h>
|
||||||
#include <libyul/backends/evm/EVMMetrics.h>
|
#include <libyul/backends/evm/EVMMetrics.h>
|
||||||
#include <libyul/backends/wasm/WasmDialect.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/backends/wasm/EVMToEWasmTranslator.h>
|
||||||
#include <libyul/optimiser/Metrics.h>
|
#include <libyul/optimiser/Metrics.h>
|
||||||
#include <libyul/ObjectParser.h>
|
#include <libyul/ObjectParser.h>
|
||||||
@ -220,7 +220,7 @@ MachineAssemblyObject AssemblyStack::assemble(Machine _machine) const
|
|||||||
Dialect const& dialect = languageToDialect(m_language, EVMVersion{});
|
Dialect const& dialect = languageToDialect(m_language, EVMVersion{});
|
||||||
|
|
||||||
MachineAssemblyObject object;
|
MachineAssemblyObject object;
|
||||||
auto result = EWasmObjectCompiler::compile(*m_parserResult, dialect);
|
auto result = WasmObjectCompiler::compile(*m_parserResult, dialect);
|
||||||
object.assembly = std::move(result.first);
|
object.assembly = std::move(result.first);
|
||||||
object.bytecode = make_shared<dev::eth::LinkerObject>();
|
object.bytecode = make_shared<dev::eth::LinkerObject>();
|
||||||
object.bytecode->bytecode = std::move(result.second);
|
object.bytecode->bytecode = std::move(result.second);
|
||||||
|
@ -46,8 +46,6 @@ add_library(yul
|
|||||||
backends/evm/NoOutputAssembly.cpp
|
backends/evm/NoOutputAssembly.cpp
|
||||||
backends/wasm/EVMToEWasmTranslator.cpp
|
backends/wasm/EVMToEWasmTranslator.cpp
|
||||||
backends/wasm/EVMToEWasmTranslator.h
|
backends/wasm/EVMToEWasmTranslator.h
|
||||||
backends/wasm/EWasmObjectCompiler.cpp
|
|
||||||
backends/wasm/EWasmObjectCompiler.h
|
|
||||||
backends/wasm/BinaryTransform.cpp
|
backends/wasm/BinaryTransform.cpp
|
||||||
backends/wasm/BinaryTransform.h
|
backends/wasm/BinaryTransform.h
|
||||||
backends/wasm/TextTransform.cpp
|
backends/wasm/TextTransform.cpp
|
||||||
@ -56,6 +54,8 @@ add_library(yul
|
|||||||
backends/wasm/WasmCodeTransform.h
|
backends/wasm/WasmCodeTransform.h
|
||||||
backends/wasm/WasmDialect.cpp
|
backends/wasm/WasmDialect.cpp
|
||||||
backends/wasm/WasmDialect.h
|
backends/wasm/WasmDialect.h
|
||||||
|
backends/wasm/WasmObjectCompiler.cpp
|
||||||
|
backends/wasm/WasmObjectCompiler.h
|
||||||
backends/wasm/WordSizeTransform.cpp
|
backends/wasm/WordSizeTransform.cpp
|
||||||
backends/wasm/WordSizeTransform.h
|
backends/wasm/WordSizeTransform.h
|
||||||
optimiser/ASTCopier.cpp
|
optimiser/ASTCopier.cpp
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
* Compiler that transforms Yul Objects to Wasm text and binary representation (Ewasm flavoured).
|
* 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/WasmCodeTransform.h>
|
||||||
#include <libyul/backends/wasm/BinaryTransform.h>
|
#include <libyul/backends/wasm/BinaryTransform.h>
|
||||||
@ -32,14 +32,14 @@
|
|||||||
using namespace yul;
|
using namespace yul;
|
||||||
using namespace std;
|
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);
|
wasm::Module module = compiler.run(_object);
|
||||||
return {wasm::TextTransform().run(module), wasm::BinaryTransform::run(module)};
|
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.analysisInfo, "No analysis info.");
|
||||||
yulAssert(_object.code, "No code.");
|
yulAssert(_object.code, "No code.");
|
||||||
@ -50,7 +50,7 @@ wasm::Module EWasmObjectCompiler::run(Object& _object)
|
|||||||
if (Object* subObject = dynamic_cast<Object*>(subNode.get()))
|
if (Object* subObject = dynamic_cast<Object*>(subNode.get()))
|
||||||
module.subModules[subObject->name.str()] = run(*subObject);
|
module.subModules[subObject->name.str()] = run(*subObject);
|
||||||
else
|
else
|
||||||
yulAssert(false, "Data is not yet supported for EWasm.");
|
yulAssert(false, "Data is not yet supported for Wasm.");
|
||||||
|
|
||||||
return module;
|
return module;
|
||||||
}
|
}
|
@ -28,6 +28,7 @@ namespace dev
|
|||||||
{
|
{
|
||||||
using bytes = std::vector<uint8_t>;
|
using bytes = std::vector<uint8_t>;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace yul
|
namespace yul
|
||||||
{
|
{
|
||||||
struct Object;
|
struct Object;
|
||||||
@ -37,13 +38,13 @@ namespace wasm
|
|||||||
struct Module;
|
struct Module;
|
||||||
}
|
}
|
||||||
|
|
||||||
class EWasmObjectCompiler
|
class WasmObjectCompiler
|
||||||
{
|
{
|
||||||
public:
|
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);
|
static std::pair<std::string, dev::bytes> compile(Object& _object, Dialect const& _dialect);
|
||||||
private:
|
private:
|
||||||
EWasmObjectCompiler(Dialect const& _dialect):
|
WasmObjectCompiler(Dialect const& _dialect):
|
||||||
m_dialect(_dialect)
|
m_dialect(_dialect)
|
||||||
{}
|
{}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user