diff options
author | chriseth <chris@ethereum.org> | 2018-02-14 12:00:41 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-14 12:00:41 +0800 |
commit | 3155dd8058672ce8f04bc2c0f2536cb549067d0a (patch) | |
tree | 7ddb56e276c74db30671eb17ffdde5eda027142d /libevmasm/SimplificationRules.h | |
parent | c4cbbb054b5ed3b8ceaa21ee5b47b0704762ff40 (diff) | |
parent | ef8292c6bb337d3c4b27836da6732b85021d1c5d (diff) | |
download | dexon-solidity-3155dd8058672ce8f04bc2c0f2536cb549067d0a.tar dexon-solidity-3155dd8058672ce8f04bc2c0f2536cb549067d0a.tar.gz dexon-solidity-3155dd8058672ce8f04bc2c0f2536cb549067d0a.tar.bz2 dexon-solidity-3155dd8058672ce8f04bc2c0f2536cb549067d0a.tar.lz dexon-solidity-3155dd8058672ce8f04bc2c0f2536cb549067d0a.tar.xz dexon-solidity-3155dd8058672ce8f04bc2c0f2536cb549067d0a.tar.zst dexon-solidity-3155dd8058672ce8f04bc2c0f2536cb549067d0a.zip |
Merge pull request #3503 from ethereum/develop
Merge develop into release for v0.4.20.
Diffstat (limited to 'libevmasm/SimplificationRules.h')
-rw-r--r-- | libevmasm/SimplificationRules.h | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/libevmasm/SimplificationRules.h b/libevmasm/SimplificationRules.h index a4da5849..53f7e595 100644 --- a/libevmasm/SimplificationRules.h +++ b/libevmasm/SimplificationRules.h @@ -24,6 +24,7 @@ #pragma once #include <libevmasm/ExpressionClasses.h> +#include <libevmasm/SimplificationRule.h> #include <functional> #include <vector> @@ -47,19 +48,21 @@ public: /// @returns a pointer to the first matching pattern and sets the match /// groups accordingly. - std::pair<Pattern, std::function<Pattern()>> const* findFirstMatch( + SimplificationRule<Pattern> const* findFirstMatch( Expression const& _expr, ExpressionClasses const& _classes ); private: - void addRules(std::vector<std::pair<Pattern, std::function<Pattern()>>> const& _rules); - void addRule(std::pair<Pattern, std::function<Pattern()>> const& _rule); + void addRules(std::vector<SimplificationRule<Pattern>> const& _rules); + void addRule(SimplificationRule<Pattern> const& _rule); void resetMatchGroups() { m_matchGroups.clear(); } std::map<unsigned, Expression const*> m_matchGroups; - std::vector<std::pair<Pattern, std::function<Pattern()>>> m_rules[256]; + /// Pattern to match, replacement to be applied and flag indicating whether + /// the replacement might remove some elements (except constants). + std::vector<SimplificationRule<Pattern>> m_rules[256]; }; /** |