diff options
author | chriseth <chris@ethereum.org> | 2018-02-08 23:50:17 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-08 23:50:17 +0800 |
commit | 9b61fb2e99a29ae97f6c29bc7309d70622b73886 (patch) | |
tree | 97445fee1a1124a2296e76c76d20fa379c56409f /libevmasm/SimplificationRules.h | |
parent | 63fb319db3dd927320d28bec2cbf926350cec01c (diff) | |
parent | 7dd99a62c56e50b3deeccd77588c3a65fe6f7107 (diff) | |
download | dexon-solidity-9b61fb2e99a29ae97f6c29bc7309d70622b73886.tar dexon-solidity-9b61fb2e99a29ae97f6c29bc7309d70622b73886.tar.gz dexon-solidity-9b61fb2e99a29ae97f6c29bc7309d70622b73886.tar.bz2 dexon-solidity-9b61fb2e99a29ae97f6c29bc7309d70622b73886.tar.lz dexon-solidity-9b61fb2e99a29ae97f6c29bc7309d70622b73886.tar.xz dexon-solidity-9b61fb2e99a29ae97f6c29bc7309d70622b73886.tar.zst dexon-solidity-9b61fb2e99a29ae97f6c29bc7309d70622b73886.zip |
Merge pull request #3456 from ethereum/simplifier
Use simplification rules also for IULIA
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]; }; /** |