mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Make dialect a shared pointer.
This commit is contained in:
parent
94607011dc
commit
b34e104173
@ -134,7 +134,7 @@ void AssemblyStack::optimize(yul::Object& _object)
|
||||
for (auto& subNode: _object.subObjects)
|
||||
if (auto subObject = dynamic_cast<yul::Object*>(subNode.get()))
|
||||
optimize(*subObject);
|
||||
yul::OptimiserSuite::run(*languageToDialect(m_language), *_object.code, *_object.analysisInfo);
|
||||
yul::OptimiserSuite::run(languageToDialect(m_language), *_object.code, *_object.analysisInfo);
|
||||
}
|
||||
|
||||
MachineAssemblyObject AssemblyStack::assemble(Machine _machine, bool _optimize) const
|
||||
|
@ -50,7 +50,7 @@ using namespace dev;
|
||||
using namespace yul;
|
||||
|
||||
void OptimiserSuite::run(
|
||||
Dialect const& _dialect,
|
||||
shared_ptr<Dialect> const& _dialect,
|
||||
Block& _ast,
|
||||
AsmAnalysisInfo const& _analysisInfo,
|
||||
set<YulString> const& _externallyUsedIdentifiers
|
||||
@ -58,52 +58,52 @@ void OptimiserSuite::run(
|
||||
{
|
||||
set<YulString> reservedIdentifiers = _externallyUsedIdentifiers;
|
||||
|
||||
Block ast = boost::get<Block>(Disambiguator(_dialect, _analysisInfo, reservedIdentifiers)(_ast));
|
||||
Block ast = boost::get<Block>(Disambiguator(*_dialect, _analysisInfo, reservedIdentifiers)(_ast));
|
||||
|
||||
(VarDeclInitializer{})(ast);
|
||||
(FunctionHoister{})(ast);
|
||||
(BlockFlattener{})(ast);
|
||||
(FunctionGrouper{})(ast);
|
||||
EquivalentFunctionCombiner::run(ast);
|
||||
UnusedPruner::runUntilStabilised(_dialect, ast, reservedIdentifiers);
|
||||
UnusedPruner::runUntilStabilised(*_dialect, ast, reservedIdentifiers);
|
||||
(ForLoopInitRewriter{})(ast);
|
||||
(BlockFlattener{})(ast);
|
||||
StructuralSimplifier{_dialect}(ast);
|
||||
StructuralSimplifier{*_dialect}(ast);
|
||||
|
||||
NameDispenser dispenser{_dialect, ast};
|
||||
NameDispenser dispenser{*_dialect, ast};
|
||||
|
||||
for (size_t i = 0; i < 4; i++)
|
||||
{
|
||||
ExpressionSplitter{_dialect, dispenser}(ast);
|
||||
ExpressionSplitter{*_dialect, dispenser}(ast);
|
||||
SSATransform::run(ast, dispenser);
|
||||
RedundantAssignEliminator::run(_dialect, ast);
|
||||
RedundantAssignEliminator::run(_dialect, ast);
|
||||
RedundantAssignEliminator::run(*_dialect, ast);
|
||||
RedundantAssignEliminator::run(*_dialect, ast);
|
||||
|
||||
ExpressionSimplifier::run(_dialect, ast);
|
||||
CommonSubexpressionEliminator{_dialect}(ast);
|
||||
StructuralSimplifier{_dialect}(ast);
|
||||
ExpressionSimplifier::run(*_dialect, ast);
|
||||
CommonSubexpressionEliminator{*_dialect}(ast);
|
||||
StructuralSimplifier{*_dialect}(ast);
|
||||
(BlockFlattener{})(ast);
|
||||
SSATransform::run(ast, dispenser);
|
||||
RedundantAssignEliminator::run(_dialect, ast);
|
||||
RedundantAssignEliminator::run(_dialect, ast);
|
||||
UnusedPruner::runUntilStabilised(_dialect, ast, reservedIdentifiers);
|
||||
CommonSubexpressionEliminator{_dialect}(ast);
|
||||
UnusedPruner::runUntilStabilised(_dialect, ast, reservedIdentifiers);
|
||||
RedundantAssignEliminator::run(*_dialect, ast);
|
||||
RedundantAssignEliminator::run(*_dialect, ast);
|
||||
UnusedPruner::runUntilStabilised(*_dialect, ast, reservedIdentifiers);
|
||||
CommonSubexpressionEliminator{*_dialect}(ast);
|
||||
UnusedPruner::runUntilStabilised(*_dialect, ast, reservedIdentifiers);
|
||||
|
||||
SSAReverser::run(ast);
|
||||
CommonSubexpressionEliminator{_dialect}(ast);
|
||||
UnusedPruner::runUntilStabilised(_dialect, ast, reservedIdentifiers);
|
||||
CommonSubexpressionEliminator{*_dialect}(ast);
|
||||
UnusedPruner::runUntilStabilised(*_dialect, ast, reservedIdentifiers);
|
||||
|
||||
ExpressionJoiner::run(ast);
|
||||
ExpressionJoiner::run(ast);
|
||||
ExpressionInliner(_dialect, ast).run();
|
||||
UnusedPruner::runUntilStabilised(_dialect, ast, reservedIdentifiers);
|
||||
ExpressionInliner(*_dialect, ast).run();
|
||||
UnusedPruner::runUntilStabilised(*_dialect, ast, reservedIdentifiers);
|
||||
|
||||
ExpressionSplitter{_dialect, dispenser}(ast);
|
||||
ExpressionSplitter{*_dialect, dispenser}(ast);
|
||||
SSATransform::run(ast, dispenser);
|
||||
RedundantAssignEliminator::run(_dialect, ast);
|
||||
RedundantAssignEliminator::run(_dialect, ast);
|
||||
CommonSubexpressionEliminator{_dialect}(ast);
|
||||
RedundantAssignEliminator::run(*_dialect, ast);
|
||||
RedundantAssignEliminator::run(*_dialect, ast);
|
||||
CommonSubexpressionEliminator{*_dialect}(ast);
|
||||
|
||||
(FunctionGrouper{})(ast);
|
||||
EquivalentFunctionCombiner::run(ast);
|
||||
@ -111,33 +111,33 @@ void OptimiserSuite::run(
|
||||
(BlockFlattener{})(ast);
|
||||
|
||||
SSATransform::run(ast, dispenser);
|
||||
RedundantAssignEliminator::run(_dialect, ast);
|
||||
RedundantAssignEliminator::run(_dialect, ast);
|
||||
ExpressionSimplifier::run(_dialect, ast);
|
||||
StructuralSimplifier{_dialect}(ast);
|
||||
RedundantAssignEliminator::run(*_dialect, ast);
|
||||
RedundantAssignEliminator::run(*_dialect, ast);
|
||||
ExpressionSimplifier::run(*_dialect, ast);
|
||||
StructuralSimplifier{*_dialect}(ast);
|
||||
(BlockFlattener{})(ast);
|
||||
CommonSubexpressionEliminator{_dialect}(ast);
|
||||
CommonSubexpressionEliminator{*_dialect}(ast);
|
||||
SSATransform::run(ast, dispenser);
|
||||
RedundantAssignEliminator::run(_dialect, ast);
|
||||
RedundantAssignEliminator::run(_dialect, ast);
|
||||
UnusedPruner::runUntilStabilised(_dialect, ast, reservedIdentifiers);
|
||||
CommonSubexpressionEliminator{_dialect}(ast);
|
||||
RedundantAssignEliminator::run(*_dialect, ast);
|
||||
RedundantAssignEliminator::run(*_dialect, ast);
|
||||
UnusedPruner::runUntilStabilised(*_dialect, ast, reservedIdentifiers);
|
||||
CommonSubexpressionEliminator{*_dialect}(ast);
|
||||
}
|
||||
ExpressionJoiner::run(ast);
|
||||
Rematerialiser::run(_dialect, ast);
|
||||
UnusedPruner::runUntilStabilised(_dialect, ast, reservedIdentifiers);
|
||||
Rematerialiser::run(*_dialect, ast);
|
||||
UnusedPruner::runUntilStabilised(*_dialect, ast, reservedIdentifiers);
|
||||
ExpressionJoiner::run(ast);
|
||||
UnusedPruner::runUntilStabilised(_dialect, ast, reservedIdentifiers);
|
||||
UnusedPruner::runUntilStabilised(*_dialect, ast, reservedIdentifiers);
|
||||
ExpressionJoiner::run(ast);
|
||||
UnusedPruner::runUntilStabilised(_dialect, ast, reservedIdentifiers);
|
||||
UnusedPruner::runUntilStabilised(*_dialect, ast, reservedIdentifiers);
|
||||
|
||||
SSAReverser::run(ast);
|
||||
CommonSubexpressionEliminator{_dialect}(ast);
|
||||
UnusedPruner::runUntilStabilised(_dialect, ast, reservedIdentifiers);
|
||||
CommonSubexpressionEliminator{*_dialect}(ast);
|
||||
UnusedPruner::runUntilStabilised(*_dialect, ast, reservedIdentifiers);
|
||||
|
||||
ExpressionJoiner::run(ast);
|
||||
Rematerialiser::run(_dialect, ast);
|
||||
UnusedPruner::runUntilStabilised(_dialect, ast, reservedIdentifiers);
|
||||
Rematerialiser::run(*_dialect, ast);
|
||||
UnusedPruner::runUntilStabilised(*_dialect, ast, reservedIdentifiers);
|
||||
|
||||
_ast = std::move(ast);
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ class OptimiserSuite
|
||||
{
|
||||
public:
|
||||
static void run(
|
||||
Dialect const& _dialect,
|
||||
std::shared_ptr<Dialect> const& _dialect,
|
||||
Block& _ast,
|
||||
AsmAnalysisInfo const& _analysisInfo,
|
||||
std::set<YulString> const& _externallyUsedIdentifiers = {}
|
||||
|
@ -242,7 +242,7 @@ bool YulOptimizerTest::run(ostream& _stream, string const& _linePrefix, bool con
|
||||
UnusedPruner::runUntilStabilised(*m_dialect, *m_ast);
|
||||
}
|
||||
else if (m_optimizerStep == "fullSuite")
|
||||
OptimiserSuite::run(*m_dialect, *m_ast, *m_analysisInfo);
|
||||
OptimiserSuite::run(m_dialect, *m_ast, *m_analysisInfo);
|
||||
else
|
||||
{
|
||||
FormattedScope(_stream, _formatted, {formatting::BOLD, formatting::RED}) << _linePrefix << "Invalid optimizer step: " << m_optimizerStep << endl;
|
||||
|
Loading…
Reference in New Issue
Block a user