[yul-phaser] Remove Chromosome::allStepNamesExcept()

This commit is contained in:
cameel 2020-01-29 20:00:16 +01:00
parent f6d955db0b
commit f0fb046038
2 changed files with 1 additions and 46 deletions

View File

@ -26,7 +26,6 @@
using namespace std;
using namespace solidity;
using namespace solidity::util;
using namespace solidity::yul;
using namespace solidity::phaser;
@ -63,50 +62,9 @@ vector<string> Chromosome::allStepNames()
return stepNames;
}
vector<string> Chromosome::allStepNamesExcept(vector<string> const& _excludedStepNames)
{
// This is not very efficient but vectors are small and the caller will cache the results anyway.
// What matters a bit more is that using vector rather than a set gives us O(1) access to
// random elements in other functions.
return convertContainer<vector<string>>(
convertContainer<set<string>>(allStepNames()) -
convertContainer<set<string>>(_excludedStepNames)
);
}
string const& Chromosome::randomOptimisationStep()
{
static vector<string> stepNames = allStepNamesExcept({
// All possible steps, listed and commented-out for easy tweaking.
// The uncommented ones are not used (possibly because they fail).
//{BlockFlattener::name},
//{CommonSubexpressionEliminator::name},
//{ConditionalSimplifier::name},
//{ConditionalUnsimplifier::name},
//{ControlFlowSimplifier::name},
//{DeadCodeEliminator::name},
//{EquivalentFunctionCombiner::name},
//{ExpressionInliner::name},
//{ExpressionJoiner::name},
//{ExpressionSimplifier::name},
//{ExpressionSplitter::name},
//{ForLoopConditionIntoBody::name},
//{ForLoopConditionOutOfBody::name},
//{ForLoopInitRewriter::name},
//{FullInliner::name},
//{FunctionGrouper::name},
//{FunctionHoister::name},
//{LiteralRematerialiser::name},
//{LoadResolver::name},
//{LoopInvariantCodeMotion::name},
//{RedundantAssignEliminator::name},
//{Rematerialiser::name},
//{SSAReverser::name},
//{SSATransform::name},
//{StructuralSimplifier::name},
//{UnusedPruner::name},
//{VarDeclInitializer::name},
});
static vector<string> stepNames = allStepNames();
return stepNames[uniformRandomInt(0, stepNames.size() - 1)];
}

View File

@ -54,9 +54,6 @@ public:
private:
static std::vector<std::string> allStepNames();
static std::vector<std::string> allStepNamesExcept(
std::vector<std::string> const& _excludedStepNames
);
static std::string const& randomOptimisationStep();
std::vector<std::string> m_optimisationSteps;