mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Optimise libevmasm in yul
This commit is contained in:
parent
f6cb933f24
commit
847e30e6ff
@ -4,6 +4,7 @@ Language Features:
|
||||
|
||||
|
||||
Compiler Features:
|
||||
* AssemblyStack: Also run opcode-based optimizer when compiling Yul code.
|
||||
* Yul EVM Code Transform: Do not reuse stack slots that immediately become unreachable.
|
||||
* Yul EVM Code Transform: Also pop unused argument slots for functions without return variables (under the same restrictions as for functions with return variables).
|
||||
* Yul Optimizer: Move function arguments and return variables to memory with the experimental Stack Limit Evader (which is not enabled by default).
|
||||
|
@ -36,8 +36,6 @@
|
||||
#include <libyul/ObjectParser.h>
|
||||
#include <libyul/optimiser/Suite.h>
|
||||
|
||||
#include <libsolidity/interface/OptimiserSettings.h>
|
||||
|
||||
#include <libevmasm/Assembly.h>
|
||||
#include <liblangutil/Scanner.h>
|
||||
#include <optional>
|
||||
@ -65,6 +63,28 @@ Dialect const& languageToDialect(AssemblyStack::Language _language, EVMVersion _
|
||||
return Dialect::yulDeprecated();
|
||||
}
|
||||
|
||||
// Duplicated from libsolidity/codegen/CompilerContext.cpp
|
||||
// TODO: refactor and remove duplication
|
||||
evmasm::Assembly::OptimiserSettings translateOptimiserSettings(
|
||||
frontend::OptimiserSettings const& _settings,
|
||||
langutil::EVMVersion _evmVersion
|
||||
)
|
||||
{
|
||||
// Constructing it this way so that we notice changes in the fields.
|
||||
evmasm::Assembly::OptimiserSettings asmSettings{false, false, false, false, false, false, false, _evmVersion, 0};
|
||||
asmSettings.isCreation = true;
|
||||
asmSettings.runInliner = _settings.runInliner;
|
||||
asmSettings.runJumpdestRemover = _settings.runJumpdestRemover;
|
||||
asmSettings.runPeephole = _settings.runPeephole;
|
||||
asmSettings.runDeduplicate = _settings.runDeduplicate;
|
||||
asmSettings.runCSE = _settings.runCSE;
|
||||
asmSettings.runConstantOptimiser = _settings.runConstantOptimiser;
|
||||
asmSettings.expectedExecutionsPerDeployment = _settings.expectedExecutionsPerDeployment;
|
||||
asmSettings.evmVersion = _evmVersion;
|
||||
|
||||
return asmSettings;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -261,6 +281,8 @@ AssemblyStack::assembleEVMWithDeployed(optional<string_view> _deployName) const
|
||||
EthAssemblyAdapter adapter(assembly);
|
||||
compileEVM(adapter, m_optimiserSettings.optimizeStackAllocation);
|
||||
|
||||
assembly.optimise(translateOptimiserSettings(m_optimiserSettings, m_evmVersion));
|
||||
|
||||
optional<size_t> subIndex;
|
||||
|
||||
// Pick matching assembly if name was given
|
||||
|
Loading…
Reference in New Issue
Block a user