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.h | |
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.h')
-rw-r--r-- | libevmasm/SimplificationRules.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/libevmasm/SimplificationRules.h b/libevmasm/SimplificationRules.h index a4da5849..6040fd76 100644 --- a/libevmasm/SimplificationRules.h +++ b/libevmasm/SimplificationRules.h @@ -47,19 +47,21 @@ public: /// @returns a pointer to the first matching pattern and sets the match /// groups accordingly. - std::pair<Pattern, std::function<Pattern()>> const* findFirstMatch( + std::tuple<Pattern, std::function<Pattern()>, bool> 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<std::tuple<Pattern, std::function<Pattern()>, bool>> const& _rules); + void addRule(std::tuple<Pattern, std::function<Pattern()>, bool> 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<std::tuple<Pattern, std::function<Pattern()>, bool>> m_rules[256]; }; /** |