aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/codegen/AsmCodeGen.h
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-12-04 23:26:38 +0800
committerchriseth <chris@ethereum.org>2018-12-06 21:32:04 +0800
commit4721cf332f0ca8af5fa16244c651cd6a635b3cdc (patch)
tree6542aee7f36e095ee402e1c5f8a12f79327b463c /libsolidity/codegen/AsmCodeGen.h
parent0e8841005ca7bf93545a1bc76bd8fa0ed67cb32d (diff)
downloaddexon-solidity-4721cf332f0ca8af5fa16244c651cd6a635b3cdc.tar
dexon-solidity-4721cf332f0ca8af5fa16244c651cd6a635b3cdc.tar.gz
dexon-solidity-4721cf332f0ca8af5fa16244c651cd6a635b3cdc.tar.bz2
dexon-solidity-4721cf332f0ca8af5fa16244c651cd6a635b3cdc.tar.lz
dexon-solidity-4721cf332f0ca8af5fa16244c651cd6a635b3cdc.tar.xz
dexon-solidity-4721cf332f0ca8af5fa16244c651cd6a635b3cdc.tar.zst
dexon-solidity-4721cf332f0ca8af5fa16244c651cd6a635b3cdc.zip
Expose EthAssemblyAdapter.
Diffstat (limited to 'libsolidity/codegen/AsmCodeGen.h')
-rw-r--r--libsolidity/codegen/AsmCodeGen.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/libsolidity/codegen/AsmCodeGen.h b/libsolidity/codegen/AsmCodeGen.h
index dc529e10..b5bd33d5 100644
--- a/libsolidity/codegen/AsmCodeGen.h
+++ b/libsolidity/codegen/AsmCodeGen.h
@@ -21,6 +21,9 @@
#pragma once
#include <libyul/AsmAnalysis.h>
+#include <libyul/backends/evm/AbstractAssembly.h>
+
+#include <liblangutil/SourceLocation.h>
#include <functional>
@@ -34,11 +37,39 @@ namespace dev
namespace eth
{
class Assembly;
+class AssemblyItem;
}
namespace solidity
{
+class EthAssemblyAdapter: public yul::AbstractAssembly
+{
+public:
+ explicit EthAssemblyAdapter(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 appendLabel(LabelID _labelId) override;
+ void appendLabelReference(LabelID _labelId) override;
+ size_t newLabelId() override;
+ size_t namedLabel(std::string const& _name) override;
+ void appendLinkerSymbol(std::string const& _linkerSymbol) override;
+ void appendJump(int _stackDiffAfter) override;
+ void appendJumpTo(LabelID _labelId, int _stackDiffAfter) override;
+ void appendJumpToIf(LabelID _labelId) override;
+ void appendBeginsub(LabelID, int) override;
+ void appendJumpsub(LabelID, int, int) override;
+ void appendReturnsub(int, int) override;
+ void appendAssemblySize() override;
+
+private:
+ static LabelID assemblyTagToIdentifier(eth::AssemblyItem const& _tag);
+
+ eth::Assembly& m_assembly;
+};
+
class CodeGenerator
{
public: