mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
[yul-phaser] Add ProgramCacheFactory class
This commit is contained in:
@@ -283,6 +283,25 @@ Population PopulationFactory::buildFromFile(
|
||||
return buildFromStrings(readLinesFromFile(_filePath), move(_fitnessMetric));
|
||||
}
|
||||
|
||||
ProgramCacheFactory::Options ProgramCacheFactory::Options::fromCommandLine(po::variables_map const& _arguments)
|
||||
{
|
||||
return {
|
||||
_arguments["program-cache"].as<bool>(),
|
||||
};
|
||||
}
|
||||
|
||||
vector<shared_ptr<ProgramCache>> ProgramCacheFactory::build(
|
||||
Options const& _options,
|
||||
vector<Program> _programs
|
||||
)
|
||||
{
|
||||
vector<shared_ptr<ProgramCache>> programCaches;
|
||||
for (Program& program: _programs)
|
||||
programCaches.push_back(_options.programCacheEnabled ? make_shared<ProgramCache>(move(program)) : nullptr);
|
||||
|
||||
return programCaches;
|
||||
}
|
||||
|
||||
ProgramFactory::Options ProgramFactory::Options::fromCommandLine(po::variables_map const& _arguments)
|
||||
{
|
||||
return {
|
||||
|
||||
@@ -45,6 +45,7 @@ class FitnessMetric;
|
||||
class GeneticAlgorithm;
|
||||
class Population;
|
||||
class Program;
|
||||
class ProgramCache;
|
||||
|
||||
enum class Algorithm
|
||||
{
|
||||
@@ -160,6 +161,25 @@ public:
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Builds and validates instances of @a ProgramCache.
|
||||
*/
|
||||
class ProgramCacheFactory
|
||||
{
|
||||
public:
|
||||
struct Options
|
||||
{
|
||||
bool programCacheEnabled;
|
||||
|
||||
static Options fromCommandLine(boost::program_options::variables_map const& _arguments);
|
||||
};
|
||||
|
||||
static std::vector<std::shared_ptr<ProgramCache>> build(
|
||||
Options const& _options,
|
||||
std::vector<Program> _programs
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Builds and validates instances of @a Program.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user