aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/interface/AssemblyStack.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libsolidity/interface/AssemblyStack.cpp')
-rw-r--r--libsolidity/interface/AssemblyStack.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/libsolidity/interface/AssemblyStack.cpp b/libsolidity/interface/AssemblyStack.cpp
index 24e190b3..f361c5da 100644
--- a/libsolidity/interface/AssemblyStack.cpp
+++ b/libsolidity/interface/AssemblyStack.cpp
@@ -34,6 +34,8 @@
#include <libevmasm/Assembly.h>
+#include <libyul/optimiser/Suite.h>
+
using namespace std;
using namespace dev;
using namespace langutil;
@@ -79,6 +81,13 @@ bool AssemblyStack::parseAndAnalyze(std::string const& _sourceName, std::string
return analyzeParsed();
}
+void AssemblyStack::optimize()
+{
+ solAssert(m_language != Language::Assembly, "Optimization requested for loose assembly.");
+ yul::OptimiserSuite::run(*m_parserResult->code, *m_parserResult->analysisInfo);
+ solAssert(analyzeParsed(), "Invalid source code after optimization.");
+}
+
bool AssemblyStack::analyzeParsed()
{
solAssert(m_parserResult, "");