diff options
author | chriseth <chris@ethereum.org> | 2018-01-18 02:18:42 +0800 |
---|---|---|
committer | chriseth <chris@ethereum.org> | 2018-02-07 05:51:30 +0800 |
commit | b8074cdf788ee1cae862929c0428a95cc5248269 (patch) | |
tree | 0a89ac871bc0cc23cfe5d6f6075e947ee4d0ec5b /libevmasm/SimplificationRules.cpp | |
parent | 491d6d3e0c131bcafc10d4bc86df0d6833955cd4 (diff) | |
download | dexon-solidity-b8074cdf788ee1cae862929c0428a95cc5248269.tar dexon-solidity-b8074cdf788ee1cae862929c0428a95cc5248269.tar.gz dexon-solidity-b8074cdf788ee1cae862929c0428a95cc5248269.tar.bz2 dexon-solidity-b8074cdf788ee1cae862929c0428a95cc5248269.tar.lz dexon-solidity-b8074cdf788ee1cae862929c0428a95cc5248269.tar.xz dexon-solidity-b8074cdf788ee1cae862929c0428a95cc5248269.tar.zst dexon-solidity-b8074cdf788ee1cae862929c0428a95cc5248269.zip |
Add flag to indicate whether it can be applied to expressions with side-effects.
Diffstat (limited to 'libevmasm/SimplificationRules.cpp')
-rw-r--r-- | libevmasm/SimplificationRules.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/libevmasm/SimplificationRules.cpp b/libevmasm/SimplificationRules.cpp index 01cad949..d81a993f 100644 --- a/libevmasm/SimplificationRules.cpp +++ b/libevmasm/SimplificationRules.cpp @@ -38,7 +38,7 @@ using namespace dev; using namespace dev::eth; -pair<Pattern, function<Pattern()> > const* Rules::findFirstMatch( +tuple<Pattern, function<Pattern()>, bool> const* Rules::findFirstMatch( Expression const& _expr, ExpressionClasses const& _classes ) @@ -48,22 +48,22 @@ pair<Pattern, function<Pattern()> > const* Rules::findFirstMatch( assertThrow(_expr.item, OptimizerException, ""); for (auto const& rule: m_rules[byte(_expr.item->instruction())]) { - if (rule.first.matches(_expr, _classes)) + if (std::get<0>(rule).matches(_expr, _classes)) return &rule; resetMatchGroups(); } return nullptr; } -void Rules::addRules(std::vector<std::pair<Pattern, std::function<Pattern ()> > > const& _rules) +void Rules::addRules(std::vector<std::tuple<Pattern, std::function<Pattern ()>, bool>> const& _rules) { for (auto const& r: _rules) addRule(r); } -void Rules::addRule(std::pair<Pattern, std::function<Pattern()> > const& _rule) +void Rules::addRule(std::tuple<Pattern, std::function<Pattern()>, bool> const& _rule) { - m_rules[byte(_rule.first.instruction())].push_back(_rule); + m_rules[byte(std::get<0>(_rule).instruction())].push_back(_rule); } Rules::Rules() |