OptimiserSettings: Add preset() and OptimisationPreset enum

This commit is contained in:
Kamil Śliwak 2021-04-26 23:03:22 +02:00
parent 28b9d27fae
commit 5023cef382

View File

@ -23,12 +23,22 @@
#pragma once
#include <liblangutil/Exceptions.h>
#include <cstddef>
#include <string>
namespace solidity::frontend
{
enum class OptimisationPreset
{
None,
Minimal,
Standard,
Full,
};
struct OptimiserSettings
{
static char constexpr DefaultYulOptimiserSteps[] =
@ -84,6 +94,18 @@ struct OptimiserSettings
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
{
return