diff --git a/libsolidity/codegen/CompilerContext.cpp b/libsolidity/codegen/CompilerContext.cpp index d7839a0a4..4cc131434 100644 --- a/libsolidity/codegen/CompilerContext.cpp +++ b/libsolidity/codegen/CompilerContext.cpp @@ -23,7 +23,6 @@ #include #include -#include #include #include #include @@ -31,6 +30,7 @@ #include #include #include +#include #include #include @@ -407,7 +407,7 @@ void CompilerContext::appendInlineAssembly( } solAssert(errorReporter.errors().empty(), "Failed to analyze inline assembly block."); - CodeGenerator::assemble(*parserResult, analysisInfo, *m_asm, identifierAccess, _system); + yul::CodeGenerator::assemble(*parserResult, analysisInfo, *m_asm, identifierAccess, _system); // Reset the source location to the one of the node (instead of the CODEGEN source location) updateSourceLocation(); diff --git a/libsolidity/codegen/ContractCompiler.cpp b/libsolidity/codegen/ContractCompiler.cpp index f843e07a2..c3e37f4d2 100644 --- a/libsolidity/codegen/ContractCompiler.cpp +++ b/libsolidity/codegen/ContractCompiler.cpp @@ -21,14 +21,16 @@ */ #include -#include #include #include #include +#include + #include #include #include + #include #include @@ -713,7 +715,7 @@ bool ContractCompiler::visit(InlineAssembly const& _inlineAssembly) } }; solAssert(_inlineAssembly.annotation().analysisInfo, ""); - CodeGenerator::assemble( + yul::CodeGenerator::assemble( _inlineAssembly.operations(), *_inlineAssembly.annotation().analysisInfo, *m_context.assemblyPtr(), diff --git a/libsolidity/interface/AssemblyStack.cpp b/libsolidity/interface/AssemblyStack.cpp index a600cbee1..6eca638bc 100644 --- a/libsolidity/interface/AssemblyStack.cpp +++ b/libsolidity/interface/AssemblyStack.cpp @@ -22,7 +22,6 @@ #include -#include #include #include @@ -30,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -151,7 +151,7 @@ MachineAssemblyObject AssemblyStack::assemble(Machine _machine, bool _optimize) { MachineAssemblyObject object; eth::Assembly assembly; - EthAssemblyAdapter adapter(assembly); + yul::EthAssemblyAdapter adapter(assembly); compileEVM(adapter, false, _optimize); object.bytecode = make_shared(assembly.assemble()); object.assembly = assembly.assemblyString(); diff --git a/libyul/backends/evm/AsmCodeGen.cpp b/libyul/backends/evm/AsmCodeGen.cpp index fb39fea1a..eb973329c 100644 --- a/libyul/backends/evm/AsmCodeGen.cpp +++ b/libyul/backends/evm/AsmCodeGen.cpp @@ -18,7 +18,7 @@ * Adaptor between the abstract assembly and eth assembly. */ -#include +#include #include #include @@ -41,7 +41,6 @@ using namespace std; using namespace dev; using namespace langutil; using namespace yul; -using namespace dev::solidity; EthAssemblyAdapter::EthAssemblyAdapter(eth::Assembly& _assembly): m_assembly(_assembly) diff --git a/libyul/backends/evm/AsmCodeGen.h b/libyul/backends/evm/AsmCodeGen.h index 516b0a36a..99c7ff15d 100644 --- a/libyul/backends/evm/AsmCodeGen.h +++ b/libyul/backends/evm/AsmCodeGen.h @@ -20,16 +20,11 @@ #pragma once -#include #include +#include #include #include -namespace yul -{ -struct Block; -} - namespace dev { namespace eth @@ -37,18 +32,20 @@ namespace eth class Assembly; class AssemblyItem; } +} -namespace solidity +namespace yul { +struct Block; -class EthAssemblyAdapter: public yul::AbstractAssembly +class EthAssemblyAdapter: public AbstractAssembly { public: - explicit EthAssemblyAdapter(eth::Assembly& _assembly); + explicit EthAssemblyAdapter(dev::eth::Assembly& _assembly); void setSourceLocation(langutil::SourceLocation const& _location) override; int stackHeight() const override; - void appendInstruction(solidity::Instruction _instruction) override; - void appendConstant(u256 const& _constant) override; + void appendInstruction(dev::solidity::Instruction _instruction) override; + void appendConstant(dev::u256 const& _constant) override; void appendLabel(LabelID _labelId) override; void appendLabelReference(LabelID _labelId) override; size_t newLabelId() override; @@ -67,9 +64,9 @@ public: SubID appendData(dev::bytes const& _data) override; private: - static LabelID assemblyTagToIdentifier(eth::AssemblyItem const& _tag); + static LabelID assemblyTagToIdentifier(dev::eth::AssemblyItem const& _tag); - eth::Assembly& m_assembly; + dev::eth::Assembly& m_assembly; std::map m_dataHashBySubId; size_t m_nextDataCounter = std::numeric_limits::max() / 2; }; @@ -79,14 +76,13 @@ class CodeGenerator public: /// Performs code generation and appends generated to _assembly. static void assemble( - yul::Block const& _parsedData, - yul::AsmAnalysisInfo& _analysisInfo, + Block const& _parsedData, + AsmAnalysisInfo& _analysisInfo, dev::eth::Assembly& _assembly, - yul::ExternalIdentifierAccess const& _identifierAccess = yul::ExternalIdentifierAccess(), + ExternalIdentifierAccess const& _identifierAccess = ExternalIdentifierAccess(), bool _useNamedLabelsForFunctions = false, bool _optimize = false ); }; } -}