diff options
author | chriseth <chris@ethereum.org> | 2018-02-06 19:20:00 +0800 |
---|---|---|
committer | chriseth <chris@ethereum.org> | 2018-02-07 05:51:30 +0800 |
commit | c961a3079dda8735363872cdb84c489d61846003 (patch) | |
tree | 8048fd3fbdd4f14031255344bfa1375a18d83e0f /libevmasm/SimplificationRules.cpp | |
parent | 5523296eaa68a591a331d9b75dc19cf11d1c538e (diff) | |
download | dexon-solidity-c961a3079dda8735363872cdb84c489d61846003.tar.gz dexon-solidity-c961a3079dda8735363872cdb84c489d61846003.tar.zst dexon-solidity-c961a3079dda8735363872cdb84c489d61846003.zip |
Turn simplification rule tuple into struct.
Diffstat (limited to 'libevmasm/SimplificationRules.cpp')
-rw-r--r-- | libevmasm/SimplificationRules.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/libevmasm/SimplificationRules.cpp b/libevmasm/SimplificationRules.cpp index d81a993f..53a5f9fc 100644 --- a/libevmasm/SimplificationRules.cpp +++ b/libevmasm/SimplificationRules.cpp @@ -23,7 +23,6 @@ #include <libevmasm/ExpressionClasses.h> #include <utility> -#include <tuple> #include <functional> #include <boost/range/adaptor/reversed.hpp> #include <boost/noncopyable.hpp> @@ -38,7 +37,7 @@ using namespace dev; using namespace dev::eth; -tuple<Pattern, function<Pattern()>, bool> const* Rules::findFirstMatch( +SimplificationRule<Pattern> const* Rules::findFirstMatch( Expression const& _expr, ExpressionClasses const& _classes ) @@ -48,22 +47,22 @@ tuple<Pattern, function<Pattern()>, bool> const* Rules::findFirstMatch( assertThrow(_expr.item, OptimizerException, ""); for (auto const& rule: m_rules[byte(_expr.item->instruction())]) { - if (std::get<0>(rule).matches(_expr, _classes)) + if (rule.pattern.matches(_expr, _classes)) return &rule; resetMatchGroups(); } return nullptr; } -void Rules::addRules(std::vector<std::tuple<Pattern, std::function<Pattern ()>, bool>> const& _rules) +void Rules::addRules(std::vector<SimplificationRule<Pattern>> const& _rules) { for (auto const& r: _rules) addRule(r); } -void Rules::addRule(std::tuple<Pattern, std::function<Pattern()>, bool> const& _rule) +void Rules::addRule(SimplificationRule<Pattern> const& _rule) { - m_rules[byte(std::get<0>(_rule).instruction())].push_back(_rule); + m_rules[byte(_rule.pattern.instruction())].push_back(_rule); } Rules::Rules() |