aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/inlineasm/AsmCodeGen.cpp
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-06-09 18:23:40 +0800
committerGitHub <noreply@github.com>2017-06-09 18:23:40 +0800
commit76667fed4f9865c4a3a5a267c469446f8bce1bef (patch)
tree4f8d0d9eee83e30912e78685d6c0fbdc916521a9 /libsolidity/inlineasm/AsmCodeGen.cpp
parent21e0b69dcb189fb52ac4e38959801582e02ca8fd (diff)
parent80227af08a72e37e35a0a8bfacadc1c201f1d114 (diff)
downloaddexon-solidity-76667fed4f9865c4a3a5a267c469446f8bce1bef.tar
dexon-solidity-76667fed4f9865c4a3a5a267c469446f8bce1bef.tar.gz
dexon-solidity-76667fed4f9865c4a3a5a267c469446f8bce1bef.tar.bz2
dexon-solidity-76667fed4f9865c4a3a5a267c469446f8bce1bef.tar.lz
dexon-solidity-76667fed4f9865c4a3a5a267c469446f8bce1bef.tar.xz
dexon-solidity-76667fed4f9865c4a3a5a267c469446f8bce1bef.tar.zst
dexon-solidity-76667fed4f9865c4a3a5a267c469446f8bce1bef.zip
Merge pull request #2304 from ethereum/evm15asm
Implementation of EVM 1.5 backend
Diffstat (limited to 'libsolidity/inlineasm/AsmCodeGen.cpp')
-rw-r--r--libsolidity/inlineasm/AsmCodeGen.cpp43
1 files changed, 38 insertions, 5 deletions
diff --git a/libsolidity/inlineasm/AsmCodeGen.cpp b/libsolidity/inlineasm/AsmCodeGen.cpp
index 11494c2d..0e4e744f 100644
--- a/libsolidity/inlineasm/AsmCodeGen.cpp
+++ b/libsolidity/inlineasm/AsmCodeGen.cpp
@@ -87,13 +87,46 @@ public:
{
m_assembly.appendLibraryAddress(_linkerSymbol);
}
+ virtual void appendJump(int _stackDiffAfter) override
+ {
+ appendInstruction(solidity::Instruction::JUMP);
+ m_assembly.adjustDeposit(_stackDiffAfter);
+ }
+ virtual void appendJumpTo(LabelID _labelId, int _stackDiffAfter) override
+ {
+ appendLabelReference(_labelId);
+ appendJump(_stackDiffAfter);
+ }
+ virtual void appendJumpToIf(LabelID _labelId) override
+ {
+ appendLabelReference(_labelId);
+ appendInstruction(solidity::Instruction::JUMPI);
+ }
+ virtual void appendBeginsub(LabelID, int) override
+ {
+ // TODO we could emulate that, though
+ solAssert(false, "BEGINSUB not implemented for EVM 1.0");
+ }
+ /// Call a subroutine.
+ virtual void appendJumpsub(LabelID, int, int) override
+ {
+ // TODO we could emulate that, though
+ solAssert(false, "JUMPSUB not implemented for EVM 1.0");
+ }
+
+ /// Return from a subroutine.
+ virtual void appendReturnsub(int, int) override
+ {
+ // TODO we could emulate that, though
+ solAssert(false, "RETURNSUB not implemented for EVM 1.0");
+ }
private:
- size_t assemblyTagToIdentifier(eth::AssemblyItem const& _tag) const
+ LabelID assemblyTagToIdentifier(eth::AssemblyItem const& _tag) const
{
u256 id = _tag.data();
- solAssert(id <= std::numeric_limits<size_t>::max(), "Tag id too large.");
- return size_t(id);
+ solAssert(id <= std::numeric_limits<LabelID>::max(), "Tag id too large.");
+ return LabelID(id);
}
eth::Assembly& m_assembly;
@@ -107,7 +140,7 @@ eth::Assembly assembly::CodeGenerator::assemble(
{
eth::Assembly assembly;
EthAssemblyAdapter assemblyAdapter(assembly);
- julia::CodeTransform(m_errorReporter, assemblyAdapter, _parsedData, _analysisInfo, _identifierAccess);
+ julia::CodeTransform(assemblyAdapter, _analysisInfo, false, _identifierAccess).run(_parsedData);
return assembly;
}
@@ -119,5 +152,5 @@ void assembly::CodeGenerator::assemble(
)
{
EthAssemblyAdapter assemblyAdapter(_assembly);
- julia::CodeTransform(m_errorReporter, assemblyAdapter, _parsedData, _analysisInfo, _identifierAccess);
+ julia::CodeTransform(assemblyAdapter, _analysisInfo, false, _identifierAccess).run(_parsedData);
}