Add bitwise shift operators to libevmasm (EIP145)

This commit is contained in:
Alex Beregszaszi 2017-02-06 22:14:17 +00:00
parent 9c31a0d8f5
commit 59e6ea601b
2 changed files with 16 additions and 1 deletions

View File

@ -50,6 +50,11 @@ const std::map<std::string, Instruction> dev::solidity::c_instructions =
{ "OR", Instruction::OR },
{ "XOR", Instruction::XOR },
{ "BYTE", Instruction::BYTE },
{ "SHL", Instruction::SHL },
{ "SHR", Instruction::SHR },
{ "SAR", Instruction::SAR },
{ "ROL", Instruction::ROL },
{ "ROR", Instruction::ROR },
{ "ADDMOD", Instruction::ADDMOD },
{ "MULMOD", Instruction::MULMOD },
{ "SIGNEXTEND", Instruction::SIGNEXTEND },
@ -190,6 +195,11 @@ static const std::map<Instruction, InstructionInfo> c_instructionInfo =
{ Instruction::OR, { "OR", 0, 2, 1, false, Tier::VeryLow } },
{ Instruction::XOR, { "XOR", 0, 2, 1, false, Tier::VeryLow } },
{ Instruction::BYTE, { "BYTE", 0, 2, 1, false, Tier::VeryLow } },
{ Instruction::SHL, { "SHL", 0, 2, 1, false, Tier::VeryLow } },
{ Instruction::SHR, { "SHR", 0, 2, 1, false, Tier::VeryLow } },
{ Instruction::SAR, { "SAR", 0, 2, 1, false, Tier::VeryLow } },
{ Instruction::ROL, { "ROL", 0, 2, 1, false, Tier::VeryLow } },
{ Instruction::ROR, { "ROR", 0, 2, 1, false, Tier::VeryLow } },
{ Instruction::ADDMOD, { "ADDMOD", 0, 3, 1, false, Tier::Mid } },
{ Instruction::MULMOD, { "MULMOD", 0, 3, 1, false, Tier::Mid } },
{ Instruction::SIGNEXTEND, { "SIGNEXTEND", 0, 2, 1, false, Tier::Low } },

View File

@ -59,8 +59,13 @@ enum class Instruction: uint8_t
AND, ///< bitwise AND operation
OR, ///< bitwise OR operation
XOR, ///< bitwise XOR operation
NOT, ///< bitwise NOT opertation
NOT, ///< bitwise NOT operation
BYTE, ///< retrieve single byte from word
SHL, ///< bitwise SHL operation
SHR, ///< bitwise SHR operation
SAR, ///< bitwise SAR operation
ROL, ///< bitwise ROL operation
ROR, ///< bitwise ROR operation
KECCAK256 = 0x20, ///< compute KECCAK-256 hash