diff options
author | Yoichi Hirai <i@yoichihirai.com> | 2016-10-24 23:33:57 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2016-11-30 19:16:43 +0800 |
commit | df4b405f9c1cd3ebfd2787b5f1f6925cabf789d3 (patch) | |
tree | 94b868e53f0527d5d7e50d2f135bc51bdef57954 /libevmasm/ExpressionClasses.cpp | |
parent | 4ff89dda1d9d81170b65775b33c1cfbd7e5e6b48 (diff) | |
download | dexon-solidity-df4b405f9c1cd3ebfd2787b5f1f6925cabf789d3.tar.gz dexon-solidity-df4b405f9c1cd3ebfd2787b5f1f6925cabf789d3.tar.zst dexon-solidity-df4b405f9c1cd3ebfd2787b5f1f6925cabf789d3.zip |
Add more optimization rules
Diffstat (limited to 'libevmasm/ExpressionClasses.cpp')
-rw-r--r-- | libevmasm/ExpressionClasses.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libevmasm/ExpressionClasses.cpp b/libevmasm/ExpressionClasses.cpp index bb71be2e..d5ccd7e3 100644 --- a/libevmasm/ExpressionClasses.cpp +++ b/libevmasm/ExpressionClasses.cpp @@ -255,6 +255,7 @@ Rules::Rules() {{Instruction::AND, {X, 0}}, [=]{ return u256(0); }}, {{Instruction::MUL, {X, 0}}, [=]{ return u256(0); }}, {{Instruction::DIV, {X, 0}}, [=]{ return u256(0); }}, + {{Instruction::DIV, {0, X}}, [=]{ return u256(0); }}, {{Instruction::MOD, {X, 0}}, [=]{ return u256(0); }}, {{Instruction::MOD, {0, X}}, [=]{ return u256(0); }}, {{Instruction::OR, {X, ~u256(0)}}, [=]{ return ~u256(0); }}, @@ -272,6 +273,11 @@ Rules::Rules() {{Instruction::MOD, {X, X}}, [=]{ return u256(0); }}, {{Instruction::NOT, {{Instruction::NOT, {X}}}}, [=]{ return X; }}, + {{Instruction::XOR, {{{X}, {Instruction::XOR, {X, Y}}}}}, [=]{ return Y; }}, + {{Instruction::OR, {{{X}, {Instruction::AND, {X, Y}}}}}, [=]{ return X; }}, + {{Instruction::AND, {{{X}, {Instruction::OR, {X, Y}}}}}, [=]{ return X; }}, + {{Instruction::AND, {{{X}, {Instruction::NOT, {X}}}}}, [=]{ return u256(0); }}, + {{Instruction::OR, {{{X}, {Instruction::NOT, {X}}}}}, [=]{ return ~u256(0); }}, }; // Double negation of opcodes with binary result for (auto const& op: vector<Instruction>{ |