mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Allow assembly stack to translate its source.
This commit is contained in:
1 parent
c1db89161b
commit
ccfc1840a9
4 files changed
+45
-24
No files matched your search
@@ -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>
|
||||
@@ -102,6 +103,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, "");
|
||||
|
||||
Reference in new issue
Block a user