aboutsummaryrefslogtreecommitdiffstats
path: root/libyul/optimiser/SimplificationRules.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libyul/optimiser/SimplificationRules.cpp')
-rw-r--r--libyul/optimiser/SimplificationRules.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/libyul/optimiser/SimplificationRules.cpp b/libyul/optimiser/SimplificationRules.cpp
index 45b0ca2c..da9c7d9d 100644
--- a/libyul/optimiser/SimplificationRules.cpp
+++ b/libyul/optimiser/SimplificationRules.cpp
@@ -36,6 +36,7 @@ using namespace yul;
SimplificationRule<Pattern> const* SimplificationRules::findFirstMatch(
Expression const& _expr,
+ Dialect const& _dialect,
map<YulString, Expression const*> const& _ssaValues
)
{
@@ -49,7 +50,7 @@ SimplificationRule<Pattern> const* SimplificationRules::findFirstMatch(
for (auto const& rule: rules.m_rules[uint8_t(instruction.instruction)])
{
rules.resetMatchGroups();
- if (rule.pattern.matches(_expr, _ssaValues))
+ if (rule.pattern.matches(_expr, _dialect, _ssaValues))
return &rule;
}
return nullptr;
@@ -104,7 +105,11 @@ void Pattern::setMatchGroup(unsigned _group, map<unsigned, Expression const*>& _
m_matchGroups = &_matchGroups;
}
-bool Pattern::matches(Expression const& _expr, map<YulString, Expression const*> const& _ssaValues) const
+bool Pattern::matches(
+ Expression const& _expr,
+ Dialect const& _dialect,
+ map<YulString, Expression const*> const& _ssaValues
+) const
{
Expression const* expr = &_expr;
@@ -139,7 +144,7 @@ bool Pattern::matches(Expression const& _expr, map<YulString, Expression const*>
return false;
assertThrow(m_arguments.size() == instr.arguments.size(), OptimizerException, "");
for (size_t i = 0; i < m_arguments.size(); ++i)
- if (!m_arguments[i].matches(instr.arguments.at(i), _ssaValues))
+ if (!m_arguments[i].matches(instr.arguments.at(i), _dialect, _ssaValues))
return false;
}
else
@@ -167,7 +172,7 @@ bool Pattern::matches(Expression const& _expr, map<YulString, Expression const*>
assertThrow(firstMatch, OptimizerException, "Match set but to null.");
return
SyntacticalEqualityChecker::equal(*firstMatch, _expr) &&
- MovableChecker(_expr).movable();
+ MovableChecker(_dialect, _expr).movable();
}
else if (m_kind == PatternKind::Any)
(*m_matchGroups)[m_matchGroup] = &_expr;