diff options
author | Daniel Kirchner <daniel@ekpyron.org> | 2018-09-14 21:49:55 +0800 |
---|---|---|
committer | chriseth <chris@ethereum.org> | 2018-09-18 20:28:21 +0800 |
commit | a1d73a7befd2f3d72c18d4cb539edab5111c681f (patch) | |
tree | bd440467d4d2f4d2c275b47f51057933cac2aaef /libevmasm/SimplificationRules.cpp | |
parent | 06ffcd0502c1c06788bec9b1e1e4db3f7c42ed4d (diff) | |
download | dexon-solidity-a1d73a7befd2f3d72c18d4cb539edab5111c681f.tar.gz dexon-solidity-a1d73a7befd2f3d72c18d4cb539edab5111c681f.tar.zst dexon-solidity-a1d73a7befd2f3d72c18d4cb539edab5111c681f.zip |
Split simplification rules into two functions.
Diffstat (limited to 'libevmasm/SimplificationRules.cpp')
-rw-r--r-- | libevmasm/SimplificationRules.cpp | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/libevmasm/SimplificationRules.cpp b/libevmasm/SimplificationRules.cpp index 504dbc24..ba13a611 100644 --- a/libevmasm/SimplificationRules.cpp +++ b/libevmasm/SimplificationRules.cpp @@ -21,16 +21,19 @@ * Container for equivalence classes of expressions for use in common subexpression elimination. */ +#include <libevmasm/SimplificationRules.h> + #include <libevmasm/ExpressionClasses.h> -#include <utility> -#include <functional> -#include <boost/range/adaptor/reversed.hpp> -#include <boost/noncopyable.hpp> #include <libevmasm/Assembly.h> #include <libevmasm/CommonSubexpressionEliminator.h> -#include <libevmasm/SimplificationRules.h> - #include <libevmasm/RuleList.h> +#include <libdevcore/Assertions.h> + +#include <boost/range/adaptor/reversed.hpp> +#include <boost/noncopyable.hpp> + +#include <utility> +#include <functional> using namespace std; using namespace dev; @@ -54,6 +57,11 @@ SimplificationRule<Pattern> const* Rules::findFirstMatch( return nullptr; } +bool Rules::isInitialized() const +{ + return !m_rules[byte(Instruction::ADD)].empty(); +} + void Rules::addRules(std::vector<SimplificationRule<Pattern>> const& _rules) { for (auto const& r: _rules) @@ -82,6 +90,7 @@ Rules::Rules() Y.setMatchGroup(5, m_matchGroups); addRules(simplificationRuleList(A, B, C, X, Y)); + assertThrow(isInitialized(), OptimizerException, "Rule list not properly initialized."); } Pattern::Pattern(Instruction _instruction, std::vector<Pattern> const& _arguments): |