mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
OptimiserSuite: Replace full step names in run() with abbreviations
This commit is contained in:
parent
9d7df5db69
commit
9db7d2bde9
@ -93,161 +93,30 @@ void OptimiserSuite::run(
|
|||||||
|
|
||||||
OptimiserSuite suite(_dialect, reservedIdentifiers, Debug::None, ast);
|
OptimiserSuite suite(_dialect, reservedIdentifiers, Debug::None, ast);
|
||||||
|
|
||||||
suite.runSequence({
|
suite.runSequence(
|
||||||
VarDeclInitializer::name,
|
"dhfoDgvulfnTUtnIf" // None of these can make stack problems worse
|
||||||
FunctionHoister::name,
|
"("
|
||||||
BlockFlattener::name,
|
"xarrscLM" // Turn into SSA and simplify
|
||||||
ForLoopInitRewriter::name,
|
"cCTUtTOntnfDIul" // Perform structural simplification
|
||||||
DeadCodeEliminator::name,
|
"Lcul" // Simplify again
|
||||||
FunctionGrouper::name,
|
"Vcul jj" // Reverse SSA
|
||||||
EquivalentFunctionCombiner::name,
|
|
||||||
UnusedPruner::name,
|
|
||||||
CircularReferencesPruner::name,
|
|
||||||
BlockFlattener::name,
|
|
||||||
ControlFlowSimplifier::name,
|
|
||||||
LiteralRematerialiser::name,
|
|
||||||
ConditionalUnsimplifier::name,
|
|
||||||
StructuralSimplifier::name,
|
|
||||||
ControlFlowSimplifier::name,
|
|
||||||
ForLoopConditionIntoBody::name,
|
|
||||||
BlockFlattener::name
|
|
||||||
}, ast);
|
|
||||||
|
|
||||||
// None of the above can make stack problems worse.
|
// should have good "compilability" property here.
|
||||||
|
|
||||||
suite.runSequenceUntilStable({
|
"eul" // Run functional expression inliner
|
||||||
// Turn into SSA and simplify
|
"xarulrul" // Prune a bit more in SSA
|
||||||
ExpressionSplitter::name,
|
"xarrcL" // Turn into SSA again and simplify
|
||||||
SSATransform::name,
|
"gvif" // Run full inliner
|
||||||
RedundantAssignEliminator::name,
|
"CTUcarrLsTOtfDncarrIulc" // SSA plus simplify
|
||||||
RedundantAssignEliminator::name,
|
")"
|
||||||
ExpressionSimplifier::name,
|
"jmuljuljul VcTOcul jmul", // Make source short and pretty
|
||||||
CommonSubexpressionEliminator::name,
|
ast
|
||||||
LoadResolver::name,
|
);
|
||||||
LoopInvariantCodeMotion::name,
|
|
||||||
|
|
||||||
// perform structural simplification
|
|
||||||
CommonSubexpressionEliminator::name,
|
|
||||||
ConditionalSimplifier::name,
|
|
||||||
LiteralRematerialiser::name,
|
|
||||||
ConditionalUnsimplifier::name,
|
|
||||||
StructuralSimplifier::name,
|
|
||||||
LiteralRematerialiser::name,
|
|
||||||
ForLoopConditionOutOfBody::name,
|
|
||||||
ControlFlowSimplifier::name,
|
|
||||||
StructuralSimplifier::name,
|
|
||||||
ControlFlowSimplifier::name,
|
|
||||||
BlockFlattener::name,
|
|
||||||
DeadCodeEliminator::name,
|
|
||||||
ForLoopConditionIntoBody::name,
|
|
||||||
UnusedPruner::name,
|
|
||||||
CircularReferencesPruner::name,
|
|
||||||
|
|
||||||
// simplify again
|
|
||||||
LoadResolver::name,
|
|
||||||
CommonSubexpressionEliminator::name,
|
|
||||||
UnusedPruner::name,
|
|
||||||
CircularReferencesPruner::name,
|
|
||||||
|
|
||||||
// reverse SSA
|
|
||||||
SSAReverser::name,
|
|
||||||
CommonSubexpressionEliminator::name,
|
|
||||||
UnusedPruner::name,
|
|
||||||
CircularReferencesPruner::name,
|
|
||||||
|
|
||||||
ExpressionJoiner::name,
|
|
||||||
ExpressionJoiner::name,
|
|
||||||
|
|
||||||
// should have good "compilability" property here.
|
|
||||||
|
|
||||||
// run functional expression inliner
|
|
||||||
ExpressionInliner::name,
|
|
||||||
UnusedPruner::name,
|
|
||||||
CircularReferencesPruner::name,
|
|
||||||
|
|
||||||
// Prune a bit more in SSA
|
|
||||||
ExpressionSplitter::name,
|
|
||||||
SSATransform::name,
|
|
||||||
RedundantAssignEliminator::name,
|
|
||||||
UnusedPruner::name,
|
|
||||||
CircularReferencesPruner::name,
|
|
||||||
RedundantAssignEliminator::name,
|
|
||||||
UnusedPruner::name,
|
|
||||||
CircularReferencesPruner::name,
|
|
||||||
|
|
||||||
// Turn into SSA again and simplify
|
|
||||||
ExpressionSplitter::name,
|
|
||||||
SSATransform::name,
|
|
||||||
RedundantAssignEliminator::name,
|
|
||||||
RedundantAssignEliminator::name,
|
|
||||||
CommonSubexpressionEliminator::name,
|
|
||||||
LoadResolver::name,
|
|
||||||
|
|
||||||
// run full inliner
|
|
||||||
FunctionGrouper::name,
|
|
||||||
EquivalentFunctionCombiner::name,
|
|
||||||
FullInliner::name,
|
|
||||||
BlockFlattener::name,
|
|
||||||
|
|
||||||
// SSA plus simplify
|
|
||||||
ConditionalSimplifier::name,
|
|
||||||
LiteralRematerialiser::name,
|
|
||||||
ConditionalUnsimplifier::name,
|
|
||||||
CommonSubexpressionEliminator::name,
|
|
||||||
SSATransform::name,
|
|
||||||
RedundantAssignEliminator::name,
|
|
||||||
RedundantAssignEliminator::name,
|
|
||||||
LoadResolver::name,
|
|
||||||
ExpressionSimplifier::name,
|
|
||||||
LiteralRematerialiser::name,
|
|
||||||
ForLoopConditionOutOfBody::name,
|
|
||||||
StructuralSimplifier::name,
|
|
||||||
BlockFlattener::name,
|
|
||||||
DeadCodeEliminator::name,
|
|
||||||
ControlFlowSimplifier::name,
|
|
||||||
CommonSubexpressionEliminator::name,
|
|
||||||
SSATransform::name,
|
|
||||||
RedundantAssignEliminator::name,
|
|
||||||
RedundantAssignEliminator::name,
|
|
||||||
ForLoopConditionIntoBody::name,
|
|
||||||
UnusedPruner::name,
|
|
||||||
CircularReferencesPruner::name,
|
|
||||||
CommonSubexpressionEliminator::name,
|
|
||||||
}, ast);
|
|
||||||
|
|
||||||
// Make source short and pretty.
|
|
||||||
|
|
||||||
suite.runSequence({
|
|
||||||
ExpressionJoiner::name,
|
|
||||||
Rematerialiser::name,
|
|
||||||
UnusedPruner::name,
|
|
||||||
CircularReferencesPruner::name,
|
|
||||||
ExpressionJoiner::name,
|
|
||||||
UnusedPruner::name,
|
|
||||||
CircularReferencesPruner::name,
|
|
||||||
ExpressionJoiner::name,
|
|
||||||
UnusedPruner::name,
|
|
||||||
CircularReferencesPruner::name,
|
|
||||||
|
|
||||||
SSAReverser::name,
|
|
||||||
CommonSubexpressionEliminator::name,
|
|
||||||
LiteralRematerialiser::name,
|
|
||||||
ForLoopConditionOutOfBody::name,
|
|
||||||
CommonSubexpressionEliminator::name,
|
|
||||||
UnusedPruner::name,
|
|
||||||
CircularReferencesPruner::name,
|
|
||||||
|
|
||||||
ExpressionJoiner::name,
|
|
||||||
Rematerialiser::name,
|
|
||||||
UnusedPruner::name,
|
|
||||||
CircularReferencesPruner::name,
|
|
||||||
}, ast);
|
|
||||||
|
|
||||||
// This is a tuning parameter, but actually just prevents infinite loops.
|
// This is a tuning parameter, but actually just prevents infinite loops.
|
||||||
size_t stackCompressorMaxIterations = 16;
|
size_t stackCompressorMaxIterations = 16;
|
||||||
suite.runSequence(vector<string>{
|
suite.runSequence("g", ast);
|
||||||
FunctionGrouper::name,
|
|
||||||
}, ast);
|
|
||||||
// We ignore the return value because we will get a much better error
|
// We ignore the return value because we will get a much better error
|
||||||
// message once we perform code generation.
|
// message once we perform code generation.
|
||||||
StackCompressor::run(
|
StackCompressor::run(
|
||||||
@ -256,16 +125,7 @@ void OptimiserSuite::run(
|
|||||||
_optimizeStackAllocation,
|
_optimizeStackAllocation,
|
||||||
stackCompressorMaxIterations
|
stackCompressorMaxIterations
|
||||||
);
|
);
|
||||||
suite.runSequence({
|
suite.runSequence("fDnTOc g", ast);
|
||||||
BlockFlattener::name,
|
|
||||||
DeadCodeEliminator::name,
|
|
||||||
ControlFlowSimplifier::name,
|
|
||||||
LiteralRematerialiser::name,
|
|
||||||
ForLoopConditionOutOfBody::name,
|
|
||||||
CommonSubexpressionEliminator::name,
|
|
||||||
|
|
||||||
FunctionGrouper::name,
|
|
||||||
}, ast);
|
|
||||||
|
|
||||||
if (EVMDialect const* dialect = dynamic_cast<EVMDialect const*>(&_dialect))
|
if (EVMDialect const* dialect = dynamic_cast<EVMDialect const*>(&_dialect))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user