mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
OptimiserSettings: Add preset() and OptimisationPreset enum
This commit is contained in:
parent
28b9d27fae
commit
5023cef382
@ -23,12 +23,22 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <liblangutil/Exceptions.h>
|
||||||
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace solidity::frontend
|
namespace solidity::frontend
|
||||||
{
|
{
|
||||||
|
|
||||||
|
enum class OptimisationPreset
|
||||||
|
{
|
||||||
|
None,
|
||||||
|
Minimal,
|
||||||
|
Standard,
|
||||||
|
Full,
|
||||||
|
};
|
||||||
|
|
||||||
struct OptimiserSettings
|
struct OptimiserSettings
|
||||||
{
|
{
|
||||||
static char constexpr DefaultYulOptimiserSteps[] =
|
static char constexpr DefaultYulOptimiserSteps[] =
|
||||||
@ -84,6 +94,18 @@ struct OptimiserSettings
|
|||||||
return standard();
|
return standard();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static OptimiserSettings preset(OptimisationPreset _preset)
|
||||||
|
{
|
||||||
|
switch (_preset)
|
||||||
|
{
|
||||||
|
case OptimisationPreset::None: return none();
|
||||||
|
case OptimisationPreset::Minimal: return minimal();
|
||||||
|
case OptimisationPreset::Standard: return standard();
|
||||||
|
case OptimisationPreset::Full: return full();
|
||||||
|
default: solAssert(false, "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool operator==(OptimiserSettings const& _other) const
|
bool operator==(OptimiserSettings const& _other) const
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user