From a1d73a7befd2f3d72c18d4cb539edab5111c681f Mon Sep 17 00:00:00 2001 From: Daniel Kirchner Date: Fri, 14 Sep 2018 15:49:55 +0200 Subject: Split simplification rules into two functions. --- libjulia/optimiser/SimplificationRules.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'libjulia/optimiser/SimplificationRules.cpp') diff --git a/libjulia/optimiser/SimplificationRules.cpp b/libjulia/optimiser/SimplificationRules.cpp index a5e296c3..56cb96ac 100644 --- a/libjulia/optimiser/SimplificationRules.cpp +++ b/libjulia/optimiser/SimplificationRules.cpp @@ -40,6 +40,7 @@ SimplificationRule const* SimplificationRules::findFirstMatch(Expressio return nullptr; static SimplificationRules rules; + assertThrow(rules.isInitialized(), OptimizerException, "Rule list not properly initialized."); FunctionalInstruction const& instruction = boost::get(_expr); for (auto const& rule: rules.m_rules[byte(instruction.instruction)]) @@ -51,6 +52,11 @@ SimplificationRule const* SimplificationRules::findFirstMatch(Expressio return nullptr; } +bool SimplificationRules::isInitialized() const +{ + return !m_rules[byte(solidity::Instruction::ADD)].empty(); +} + void SimplificationRules::addRules(vector> const& _rules) { for (auto const& r: _rules) @@ -79,6 +85,7 @@ SimplificationRules::SimplificationRules() Y.setMatchGroup(5, m_matchGroups); addRules(simplificationRuleList(A, B, C, X, Y)); + assertThrow(isInitialized(), OptimizerException, "Rule list not properly initialized."); } Pattern::Pattern(solidity::Instruction _instruction, vector const& _arguments): -- cgit