mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Enable for IR code generation with stack optimization > homestead.
This commit is contained in:
parent
a7b137829f
commit
b2c9b69de2
@ -139,9 +139,9 @@ public:
|
||||
private:
|
||||
bool analyzeParsed();
|
||||
bool analyzeParsed(yul::Object& _object);
|
||||
|
||||
public:
|
||||
void compileEVM(yul::AbstractAssembly& _assembly, bool _optimize) const;
|
||||
|
||||
private:
|
||||
void optimize(yul::Object& _object, bool _isCreation);
|
||||
|
||||
Language m_language = Language::Assembly;
|
||||
|
@ -23,6 +23,7 @@
|
||||
|
||||
#include <libyul/backends/evm/EVMCodeTransform.h>
|
||||
#include <libyul/backends/evm/EVMDialect.h>
|
||||
#include <libyul/backends/evm/OptimizedEVMCodeTransform.h>
|
||||
|
||||
#include <libyul/Object.h>
|
||||
#include <libyul/Exceptions.h>
|
||||
@ -62,19 +63,29 @@ void EVMObjectCompiler::run(Object& _object, bool _optimize)
|
||||
|
||||
yulAssert(_object.analysisInfo, "No analysis info.");
|
||||
yulAssert(_object.code, "No code.");
|
||||
// We do not catch and re-throw the stack too deep exception here because it is a YulException,
|
||||
// which should be native to this part of the code.
|
||||
CodeTransform transform{
|
||||
m_assembly,
|
||||
*_object.analysisInfo,
|
||||
*_object.code,
|
||||
m_dialect,
|
||||
context,
|
||||
_optimize,
|
||||
{},
|
||||
CodeTransform::UseNamedLabels::ForFirstFunctionOfEachName
|
||||
};
|
||||
transform(*_object.code);
|
||||
if (!transform.stackErrors().empty())
|
||||
BOOST_THROW_EXCEPTION(transform.stackErrors().front());
|
||||
if (_optimize && m_dialect.evmVersion().canOverchargeGasForCall())
|
||||
{
|
||||
|
||||
auto stackErrors = OptimizedEVMCodeTransform::run(m_assembly, *_object.analysisInfo, *_object.code, m_dialect, context);
|
||||
if (!stackErrors.empty())
|
||||
BOOST_THROW_EXCEPTION(stackErrors.front());
|
||||
}
|
||||
else
|
||||
{
|
||||
// We do not catch and re-throw the stack too deep exception here because it is a YulException,
|
||||
// which should be native to this part of the code.
|
||||
CodeTransform transform{
|
||||
m_assembly,
|
||||
*_object.analysisInfo,
|
||||
*_object.code,
|
||||
m_dialect,
|
||||
context,
|
||||
_optimize,
|
||||
{},
|
||||
CodeTransform::UseNamedLabels::ForFirstFunctionOfEachName
|
||||
};
|
||||
transform(*_object.code);
|
||||
if (!transform.stackErrors().empty())
|
||||
BOOST_THROW_EXCEPTION(transform.stackErrors().front());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user