diff options
| author | Alex Beregszaszi <alex@rtfs.hu> | 2018-04-18 20:36:20 +0800 |
|---|---|---|
| committer | Alex Beregszaszi <alex@rtfs.hu> | 2018-04-20 06:59:06 +0800 |
| commit | 38460d8b473052bd9d4871ed7f10e72f8fb65615 (patch) | |
| tree | 907f8f132c325df13bfdc2df1506fe0e2fedab09 /libevmasm | |
| parent | 27d7990684dcd16486f107b61f8d6540530a2200 (diff) | |
| download | dexon-solidity-38460d8b473052bd9d4871ed7f10e72f8fb65615.tar dexon-solidity-38460d8b473052bd9d4871ed7f10e72f8fb65615.tar.gz dexon-solidity-38460d8b473052bd9d4871ed7f10e72f8fb65615.tar.bz2 dexon-solidity-38460d8b473052bd9d4871ed7f10e72f8fb65615.tar.lz dexon-solidity-38460d8b473052bd9d4871ed7f10e72f8fb65615.tar.xz dexon-solidity-38460d8b473052bd9d4871ed7f10e72f8fb65615.tar.zst dexon-solidity-38460d8b473052bd9d4871ed7f10e72f8fb65615.zip | |
Remove unnecessary masking of the result of known short instructions
Diffstat (limited to 'libevmasm')
| -rw-r--r-- | libevmasm/RuleList.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/libevmasm/RuleList.h b/libevmasm/RuleList.h index abcf170c..2b7da01b 100644 --- a/libevmasm/RuleList.h +++ b/libevmasm/RuleList.h @@ -174,6 +174,26 @@ std::vector<SimplificationRule<Pattern>> simplificationRuleList( }); } + for (auto const& op: std::vector<Instruction>{ + Instruction::ADDRESS, + Instruction::CALLER, + Instruction::ORIGIN, + Instruction::COINBASE + }) + { + u256 const mask = (u256(1) << 160) - 1; + rules.push_back({ + {Instruction::AND, {{op, mask}}}, + [=]() -> Pattern { return op; }, + false + }); + rules.push_back({ + {Instruction::AND, {{mask, op}}}, + [=]() -> Pattern { return op; }, + false + }); + } + // Double negation of opcodes with boolean result for (auto const& op: std::vector<Instruction>{ Instruction::EQ, |
