diff options
Diffstat (limited to 'libsolidity/inlineasm/AsmCodeGen.cpp')
-rw-r--r-- | libsolidity/inlineasm/AsmCodeGen.cpp | 52 |
1 files changed, 37 insertions, 15 deletions
diff --git a/libsolidity/inlineasm/AsmCodeGen.cpp b/libsolidity/inlineasm/AsmCodeGen.cpp index 11494c2d..27750453 100644 --- a/libsolidity/inlineasm/AsmCodeGen.cpp +++ b/libsolidity/inlineasm/AsmCodeGen.cpp @@ -87,29 +87,51 @@ 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; }; -eth::Assembly assembly::CodeGenerator::assemble( - Block const& _parsedData, - AsmAnalysisInfo& _analysisInfo, - julia::ExternalIdentifierAccess const& _identifierAccess -) -{ - eth::Assembly assembly; - EthAssemblyAdapter assemblyAdapter(assembly); - julia::CodeTransform(m_errorReporter, assemblyAdapter, _parsedData, _analysisInfo, _identifierAccess); - return assembly; -} void assembly::CodeGenerator::assemble( Block const& _parsedData, @@ -119,5 +141,5 @@ void assembly::CodeGenerator::assemble( ) { EthAssemblyAdapter assemblyAdapter(_assembly); - julia::CodeTransform(m_errorReporter, assemblyAdapter, _parsedData, _analysisInfo, _identifierAccess); + julia::CodeTransform(assemblyAdapter, _analysisInfo, false, _identifierAccess).run(_parsedData); } |