Merge commit '4d2f20570' into develop_060

This commit is contained in:
chriseth
2019-12-03 21:01:31 +01:00
17 changed files with 594 additions and 70 deletions
+18
View File
@@ -34,6 +34,7 @@
#include <libyul/backends/evm/EVMMetrics.h>
#include <libyul/backends/wasm/WasmDialect.h>
#include <libyul/backends/wasm/EWasmObjectCompiler.h>
#include <libyul/backends/wasm/EVMToEWasmTranslator.h>
#include <libyul/optimiser/Metrics.h>
#include <libyul/ObjectParser.h>
#include <libyul/optimiser/Suite.h>
@@ -101,6 +102,23 @@ void AssemblyStack::optimize()
solAssert(analyzeParsed(), "Invalid source code after optimization.");
}
void AssemblyStack::translate(AssemblyStack::Language _targetLanguage)
{
if (m_language == _targetLanguage)
return;
solAssert(
m_language == Language::StrictAssembly && _targetLanguage == Language::EWasm,
"Invalid language combination"
);
*m_parserResult = EVMToEWasmTranslator(
languageToDialect(m_language, m_evmVersion)
).run(*parserResult());
m_language = _targetLanguage;
}
bool AssemblyStack::analyzeParsed()
{
solAssert(m_parserResult, "");
+3
View File
@@ -81,6 +81,9 @@ public:
/// If the settings (see constructor) disabled the optimizer, nothing is done here.
void optimize();
/// Translate the source to a different language / dialect.
void translate(Language _targetLanguage);
/// Run the assembly step (should only be called after parseAndAnalyze).
MachineAssemblyObject assemble(Machine _machine) const;