From c961a3079dda8735363872cdb84c489d61846003 Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 6 Feb 2018 12:20:00 +0100 Subject: Turn simplification rule tuple into struct. --- libevmasm/RuleList.h | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'libevmasm/RuleList.h') diff --git a/libevmasm/RuleList.h b/libevmasm/RuleList.h index f8a6ce73..2312d673 100644 --- a/libevmasm/RuleList.h +++ b/libevmasm/RuleList.h @@ -25,6 +25,7 @@ #include #include +#include #include @@ -45,12 +46,10 @@ template S modWorkaround(S const& _a, S const& _b) /// @returns a list of simplification rules given certain match placeholders. /// A, B and C should represent constants, X and Y arbitrary expressions. -/// The third element in the tuple is a boolean flag that indicates whether -/// any non-constant elements in the pattern are removed by applying it. /// The simplifications should neven change the order of evaluation of -/// arbitrary operations, though. +/// arbitrary operations. template -std::vector, bool>> simplificationRuleList( +std::vector> simplificationRuleList( Pattern A, Pattern B, Pattern C, @@ -58,8 +57,8 @@ std::vector, bool>> simplificationR Pattern Y ) { - std::vector, bool>> rules; - rules += std::vector, bool>>{ + std::vector> rules; + rules += std::vector>{ // arithmetics on constants {{Instruction::ADD, {A, B}}, [=]{ return A.d() + B.d(); }, false}, {{Instruction::MUL, {A, B}}, [=]{ return A.d() * B.d(); }, false}, @@ -196,7 +195,7 @@ std::vector, bool>> simplificationR // xa can be (X, A) or (A, X) for (auto xa: {std::vector{X, A}, std::vector{A, X}}) { - rules += std::vector, bool>>{{ + rules += std::vector>{{ // (X+A)+B -> X+(A+B) {op, {{op, xa}, B}}, [=]() -> Pattern { return {op, {X, fun(A.d(), B.d())}}; }, @@ -221,7 +220,7 @@ std::vector, bool>> simplificationR } // move constants across subtractions - rules += std::vector, bool>>{ + rules += std::vector>{ { // X - A -> X + (-A) {Instruction::SUB, {X, A}}, -- cgit v1.2.3