From 87821c53c3a73d3e35a0e50a7c159d9aa5d6b253 Mon Sep 17 00:00:00 2001 From: Christian Parpart Date: Wed, 14 Nov 2018 14:59:30 +0100 Subject: Isolating files shared between Yul- and Solidity language frontend. --- libsolidity/interface/AssemblyStack.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libsolidity/interface/AssemblyStack.h') diff --git a/libsolidity/interface/AssemblyStack.h b/libsolidity/interface/AssemblyStack.h index 8132ce63..aad65ffc 100644 --- a/libsolidity/interface/AssemblyStack.h +++ b/libsolidity/interface/AssemblyStack.h @@ -21,8 +21,8 @@ #pragma once -#include -#include +#include +#include #include -- cgit v1.2.3 From d67322a1861d60a88151f7c25d6c3478a9a39acf Mon Sep 17 00:00:00 2001 From: Christian Parpart Date: Wed, 14 Nov 2018 17:11:55 +0100 Subject: Introduce namespace `langutil` in liblangutil directory. Also: - Use {}-style list initialisation for SourceLocation construction - Introduce new system includes - Changes the API of the Scanner to take source as value (with move) as opposed to as a reference --- libsolidity/interface/AssemblyStack.h | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'libsolidity/interface/AssemblyStack.h') diff --git a/libsolidity/interface/AssemblyStack.h b/libsolidity/interface/AssemblyStack.h index aad65ffc..d6ee33cf 100644 --- a/libsolidity/interface/AssemblyStack.h +++ b/libsolidity/interface/AssemblyStack.h @@ -29,11 +29,15 @@ #include #include +namespace langutil +{ +class Scanner; +} + namespace dev { namespace solidity { -class Scanner; namespace assembly { struct AsmAnalysisInfo; @@ -61,7 +65,7 @@ public: {} /// @returns the scanner used during parsing - Scanner const& scanner() const; + langutil::Scanner const& scanner() const; /// Runs parsing and analysis steps, returns false if input cannot be assembled. /// Multiple calls overwrite the previous state. @@ -69,13 +73,13 @@ public: /// Runs analysis step on the supplied block, returns false if input cannot be assembled. /// Multiple calls overwrite the previous state. - bool analyze(assembly::Block const& _block, Scanner const* _scanner = nullptr); + bool analyze(assembly::Block const& _block, langutil::Scanner const* _scanner = nullptr); /// Run the assembly step (should only be called after parseAndAnalyze). MachineAssemblyObject assemble(Machine _machine) const; /// @returns the errors generated during parsing, analysis (and potentially assembly). - ErrorList const& errors() const { return m_errors; } + langutil::ErrorList const& errors() const { return m_errors; } /// Pretty-print the input after having parsed it. std::string print() const; @@ -86,13 +90,13 @@ private: Language m_language = Language::Assembly; EVMVersion m_evmVersion; - std::shared_ptr m_scanner; + std::shared_ptr m_scanner; bool m_analysisSuccessful = false; std::shared_ptr m_parserResult; std::shared_ptr m_analysisInfo; - ErrorList m_errors; - ErrorReporter m_errorReporter; + langutil::ErrorList m_errors; + langutil::ErrorReporter m_errorReporter; }; } -- cgit v1.2.3 From ec47c8946ba5f78563b7eca2512b3cee68db45b4 Mon Sep 17 00:00:00 2001 From: Christian Parpart Date: Wed, 21 Nov 2018 12:42:34 +0100 Subject: Isolating libyul library API into its own namespace `yul`. --- libsolidity/interface/AssemblyStack.h | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'libsolidity/interface/AssemblyStack.h') diff --git a/libsolidity/interface/AssemblyStack.h b/libsolidity/interface/AssemblyStack.h index d6ee33cf..03b811db 100644 --- a/libsolidity/interface/AssemblyStack.h +++ b/libsolidity/interface/AssemblyStack.h @@ -34,16 +34,17 @@ namespace langutil class Scanner; } -namespace dev -{ -namespace solidity -{ -namespace assembly +namespace yul { struct AsmAnalysisInfo; struct Block; } +namespace dev +{ +namespace solidity +{ + struct MachineAssemblyObject { std::shared_ptr bytecode; @@ -73,7 +74,7 @@ public: /// Runs analysis step on the supplied block, returns false if input cannot be assembled. /// Multiple calls overwrite the previous state. - bool analyze(assembly::Block const& _block, langutil::Scanner const* _scanner = nullptr); + bool analyze(yul::Block const& _block, langutil::Scanner const* _scanner = nullptr); /// Run the assembly step (should only be called after parseAndAnalyze). MachineAssemblyObject assemble(Machine _machine) const; @@ -93,8 +94,8 @@ private: std::shared_ptr m_scanner; bool m_analysisSuccessful = false; - std::shared_ptr m_parserResult; - std::shared_ptr m_analysisInfo; + std::shared_ptr m_parserResult; + std::shared_ptr m_analysisInfo; langutil::ErrorList m_errors; langutil::ErrorReporter m_errorReporter; }; -- cgit v1.2.3 From e016cb99e679c53708ca7294442e04f80df477cc Mon Sep 17 00:00:00 2001 From: chriseth Date: Sun, 4 Nov 2018 09:34:21 +0100 Subject: Yul objects. --- libsolidity/interface/AssemblyStack.h | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'libsolidity/interface/AssemblyStack.h') diff --git a/libsolidity/interface/AssemblyStack.h b/libsolidity/interface/AssemblyStack.h index 03b811db..b89faca0 100644 --- a/libsolidity/interface/AssemblyStack.h +++ b/libsolidity/interface/AssemblyStack.h @@ -24,6 +24,9 @@ #include #include +#include +#include + #include #include @@ -72,10 +75,6 @@ public: /// Multiple calls overwrite the previous state. bool parseAndAnalyze(std::string const& _sourceName, std::string const& _source); - /// Runs analysis step on the supplied block, returns false if input cannot be assembled. - /// Multiple calls overwrite the previous state. - bool analyze(yul::Block const& _block, langutil::Scanner const* _scanner = nullptr); - /// Run the assembly step (should only be called after parseAndAnalyze). MachineAssemblyObject assemble(Machine _machine) const; @@ -94,8 +93,7 @@ private: std::shared_ptr m_scanner; bool m_analysisSuccessful = false; - std::shared_ptr m_parserResult; - std::shared_ptr m_analysisInfo; + std::shared_ptr m_parserResult; langutil::ErrorList m_errors; langutil::ErrorReporter m_errorReporter; }; -- cgit v1.2.3 From 728119bb110b68be3df80b827f73e1d4f36d6bc5 Mon Sep 17 00:00:00 2001 From: chriseth Date: Wed, 7 Nov 2018 12:01:43 +0100 Subject: Use yul parser in assembly stack. --- libsolidity/interface/AssemblyStack.h | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'libsolidity/interface/AssemblyStack.h') diff --git a/libsolidity/interface/AssemblyStack.h b/libsolidity/interface/AssemblyStack.h index b89faca0..7ae0592e 100644 --- a/libsolidity/interface/AssemblyStack.h +++ b/libsolidity/interface/AssemblyStack.h @@ -24,8 +24,8 @@ #include #include -#include -#include +#include +#include #include @@ -37,12 +37,6 @@ namespace langutil class Scanner; } -namespace yul -{ -struct AsmAnalysisInfo; -struct Block; -} - namespace dev { namespace solidity @@ -93,7 +87,7 @@ private: std::shared_ptr m_scanner; bool m_analysisSuccessful = false; - std::shared_ptr m_parserResult; + std::shared_ptr m_parserResult; langutil::ErrorList m_errors; langutil::ErrorReporter m_errorReporter; }; -- cgit v1.2.3 From 6c44c5f0c93d6ce623bec773cc151a73d4b12bff Mon Sep 17 00:00:00 2001 From: chriseth Date: Sat, 3 Nov 2018 16:05:08 +0100 Subject: Apply the optimize commandline parameter to assembly mode. --- libsolidity/interface/AssemblyStack.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'libsolidity/interface/AssemblyStack.h') diff --git a/libsolidity/interface/AssemblyStack.h b/libsolidity/interface/AssemblyStack.h index 7ae0592e..0d04ffec 100644 --- a/libsolidity/interface/AssemblyStack.h +++ b/libsolidity/interface/AssemblyStack.h @@ -69,6 +69,9 @@ public: /// Multiple calls overwrite the previous state. bool parseAndAnalyze(std::string const& _sourceName, std::string const& _source); + /// Run the optimizer suite. Can only be used with Yul or strict assembly. + void optimize(); + /// Run the assembly step (should only be called after parseAndAnalyze). MachineAssemblyObject assemble(Machine _machine) const; -- cgit v1.2.3