Make enum Tier into an enum class

This commit is contained in:
Yoichi Hirai 2017-01-13 13:19:14 +01:00
parent e22672b7c7
commit 20c62a132d
No known key found for this signature in database
GPG Key ID: E7B75D080FCF7992
3 changed files with 141 additions and 141 deletions

View File

@ -223,14 +223,14 @@ unsigned GasMeter::runGas(Instruction _instruction)
switch (instructionInfo(_instruction).gasPriceTier)
{
case 0: return GasCosts::tier0Gas;
case 1: return GasCosts::tier1Gas;
case 2: return GasCosts::tier2Gas;
case 3: return GasCosts::tier3Gas;
case 4: return GasCosts::tier4Gas;
case 5: return GasCosts::tier5Gas;
case 6: return GasCosts::tier6Gas;
case 7: return GasCosts::tier7Gas;
case Tier::ZeroTier: return GasCosts::tier0Gas;
case Tier::BaseTier: return GasCosts::tier1Gas;
case Tier::VeryLowTier: return GasCosts::tier2Gas;
case Tier::LowTier: return GasCosts::tier3Gas;
case Tier::MidTier: return GasCosts::tier4Gas;
case Tier::HighTier: return GasCosts::tier5Gas;
case Tier::ExtTier: return GasCosts::tier6Gas;
case Tier::SpecialTier: return GasCosts::tier7Gas;
default: break;
}
assertThrow(false, OptimizerException, "Invalid gas tier.");

View File

@ -164,136 +164,136 @@ const std::map<std::string, Instruction> dev::solidity::c_instructions =
static const std::map<Instruction, InstructionInfo> c_instructionInfo =
{ // Add, Args, Ret, SideEffects, GasPriceTier
{ Instruction::STOP, { "STOP", 0, 0, 0, true, ZeroTier } },
{ Instruction::ADD, { "ADD", 0, 2, 1, false, VeryLowTier } },
{ Instruction::SUB, { "SUB", 0, 2, 1, false, VeryLowTier } },
{ Instruction::MUL, { "MUL", 0, 2, 1, false, LowTier } },
{ Instruction::DIV, { "DIV", 0, 2, 1, false, LowTier } },
{ Instruction::SDIV, { "SDIV", 0, 2, 1, false, LowTier } },
{ Instruction::MOD, { "MOD", 0, 2, 1, false, LowTier } },
{ Instruction::SMOD, { "SMOD", 0, 2, 1, false, LowTier } },
{ Instruction::EXP, { "EXP", 0, 2, 1, false, SpecialTier } },
{ Instruction::NOT, { "NOT", 0, 1, 1, false, VeryLowTier } },
{ Instruction::LT, { "LT", 0, 2, 1, false, VeryLowTier } },
{ Instruction::GT, { "GT", 0, 2, 1, false, VeryLowTier } },
{ Instruction::SLT, { "SLT", 0, 2, 1, false, VeryLowTier } },
{ Instruction::SGT, { "SGT", 0, 2, 1, false, VeryLowTier } },
{ Instruction::EQ, { "EQ", 0, 2, 1, false, VeryLowTier } },
{ Instruction::ISZERO, { "ISZERO", 0, 1, 1, false, VeryLowTier } },
{ Instruction::AND, { "AND", 0, 2, 1, false, VeryLowTier } },
{ Instruction::OR, { "OR", 0, 2, 1, false, VeryLowTier } },
{ Instruction::XOR, { "XOR", 0, 2, 1, false, VeryLowTier } },
{ Instruction::BYTE, { "BYTE", 0, 2, 1, false, VeryLowTier } },
{ Instruction::ADDMOD, { "ADDMOD", 0, 3, 1, false, MidTier } },
{ Instruction::MULMOD, { "MULMOD", 0, 3, 1, false, MidTier } },
{ Instruction::SIGNEXTEND, { "SIGNEXTEND", 0, 2, 1, false, LowTier } },
{ Instruction::SHA3, { "SHA3", 0, 2, 1, false, SpecialTier } },
{ Instruction::ADDRESS, { "ADDRESS", 0, 0, 1, false, BaseTier } },
{ Instruction::BALANCE, { "BALANCE", 0, 1, 1, false, ExtTier } },
{ Instruction::ORIGIN, { "ORIGIN", 0, 0, 1, false, BaseTier } },
{ Instruction::CALLER, { "CALLER", 0, 0, 1, false, BaseTier } },
{ Instruction::CALLVALUE, { "CALLVALUE", 0, 0, 1, false, BaseTier } },
{ Instruction::CALLDATALOAD,{ "CALLDATALOAD", 0, 1, 1, false, VeryLowTier } },
{ Instruction::CALLDATASIZE,{ "CALLDATASIZE", 0, 0, 1, false, BaseTier } },
{ Instruction::CALLDATACOPY,{ "CALLDATACOPY", 0, 3, 0, true, VeryLowTier } },
{ Instruction::CODESIZE, { "CODESIZE", 0, 0, 1, false, BaseTier } },
{ Instruction::CODECOPY, { "CODECOPY", 0, 3, 0, true, VeryLowTier } },
{ Instruction::GASPRICE, { "GASPRICE", 0, 0, 1, false, BaseTier } },
{ Instruction::EXTCODESIZE, { "EXTCODESIZE", 0, 1, 1, false, ExtTier } },
{ Instruction::EXTCODECOPY, { "EXTCODECOPY", 0, 4, 0, true, ExtTier } },
{ Instruction::BLOCKHASH, { "BLOCKHASH", 0, 1, 1, false, ExtTier } },
{ Instruction::COINBASE, { "COINBASE", 0, 0, 1, false, BaseTier } },
{ Instruction::TIMESTAMP, { "TIMESTAMP", 0, 0, 1, false, BaseTier } },
{ Instruction::NUMBER, { "NUMBER", 0, 0, 1, false, BaseTier } },
{ Instruction::DIFFICULTY, { "DIFFICULTY", 0, 0, 1, false, BaseTier } },
{ Instruction::GASLIMIT, { "GASLIMIT", 0, 0, 1, false, BaseTier } },
{ Instruction::POP, { "POP", 0, 1, 0, false, BaseTier } },
{ Instruction::MLOAD, { "MLOAD", 0, 1, 1, false, VeryLowTier } },
{ Instruction::MSTORE, { "MSTORE", 0, 2, 0, true, VeryLowTier } },
{ Instruction::MSTORE8, { "MSTORE8", 0, 2, 0, true, VeryLowTier } },
{ Instruction::SLOAD, { "SLOAD", 0, 1, 1, false, SpecialTier } },
{ Instruction::SSTORE, { "SSTORE", 0, 2, 0, true, SpecialTier } },
{ Instruction::JUMP, { "JUMP", 0, 1, 0, true, MidTier } },
{ Instruction::JUMPI, { "JUMPI", 0, 2, 0, true, HighTier } },
{ Instruction::PC, { "PC", 0, 0, 1, false, BaseTier } },
{ Instruction::MSIZE, { "MSIZE", 0, 0, 1, false, BaseTier } },
{ Instruction::GAS, { "GAS", 0, 0, 1, false, BaseTier } },
{ Instruction::JUMPDEST, { "JUMPDEST", 0, 0, 0, true, SpecialTier } },
{ Instruction::PUSH1, { "PUSH1", 1, 0, 1, false, VeryLowTier } },
{ Instruction::PUSH2, { "PUSH2", 2, 0, 1, false, VeryLowTier } },
{ Instruction::PUSH3, { "PUSH3", 3, 0, 1, false, VeryLowTier } },
{ Instruction::PUSH4, { "PUSH4", 4, 0, 1, false, VeryLowTier } },
{ Instruction::PUSH5, { "PUSH5", 5, 0, 1, false, VeryLowTier } },
{ Instruction::PUSH6, { "PUSH6", 6, 0, 1, false, VeryLowTier } },
{ Instruction::PUSH7, { "PUSH7", 7, 0, 1, false, VeryLowTier } },
{ Instruction::PUSH8, { "PUSH8", 8, 0, 1, false, VeryLowTier } },
{ Instruction::PUSH9, { "PUSH9", 9, 0, 1, false, VeryLowTier } },
{ Instruction::PUSH10, { "PUSH10", 10, 0, 1, false, VeryLowTier } },
{ Instruction::PUSH11, { "PUSH11", 11, 0, 1, false, VeryLowTier } },
{ Instruction::PUSH12, { "PUSH12", 12, 0, 1, false, VeryLowTier } },
{ Instruction::PUSH13, { "PUSH13", 13, 0, 1, false, VeryLowTier } },
{ Instruction::PUSH14, { "PUSH14", 14, 0, 1, false, VeryLowTier } },
{ Instruction::PUSH15, { "PUSH15", 15, 0, 1, false, VeryLowTier } },
{ Instruction::PUSH16, { "PUSH16", 16, 0, 1, false, VeryLowTier } },
{ Instruction::PUSH17, { "PUSH17", 17, 0, 1, false, VeryLowTier } },
{ Instruction::PUSH18, { "PUSH18", 18, 0, 1, false, VeryLowTier } },
{ Instruction::PUSH19, { "PUSH19", 19, 0, 1, false, VeryLowTier } },
{ Instruction::PUSH20, { "PUSH20", 20, 0, 1, false, VeryLowTier } },
{ Instruction::PUSH21, { "PUSH21", 21, 0, 1, false, VeryLowTier } },
{ Instruction::PUSH22, { "PUSH22", 22, 0, 1, false, VeryLowTier } },
{ Instruction::PUSH23, { "PUSH23", 23, 0, 1, false, VeryLowTier } },
{ Instruction::PUSH24, { "PUSH24", 24, 0, 1, false, VeryLowTier } },
{ Instruction::PUSH25, { "PUSH25", 25, 0, 1, false, VeryLowTier } },
{ Instruction::PUSH26, { "PUSH26", 26, 0, 1, false, VeryLowTier } },
{ Instruction::PUSH27, { "PUSH27", 27, 0, 1, false, VeryLowTier } },
{ Instruction::PUSH28, { "PUSH28", 28, 0, 1, false, VeryLowTier } },
{ Instruction::PUSH29, { "PUSH29", 29, 0, 1, false, VeryLowTier } },
{ Instruction::PUSH30, { "PUSH30", 30, 0, 1, false, VeryLowTier } },
{ Instruction::PUSH31, { "PUSH31", 31, 0, 1, false, VeryLowTier } },
{ Instruction::PUSH32, { "PUSH32", 32, 0, 1, false, VeryLowTier } },
{ Instruction::DUP1, { "DUP1", 0, 1, 2, false, VeryLowTier } },
{ Instruction::DUP2, { "DUP2", 0, 2, 3, false, VeryLowTier } },
{ Instruction::DUP3, { "DUP3", 0, 3, 4, false, VeryLowTier } },
{ Instruction::DUP4, { "DUP4", 0, 4, 5, false, VeryLowTier } },
{ Instruction::DUP5, { "DUP5", 0, 5, 6, false, VeryLowTier } },
{ Instruction::DUP6, { "DUP6", 0, 6, 7, false, VeryLowTier } },
{ Instruction::DUP7, { "DUP7", 0, 7, 8, false, VeryLowTier } },
{ Instruction::DUP8, { "DUP8", 0, 8, 9, false, VeryLowTier } },
{ Instruction::DUP9, { "DUP9", 0, 9, 10, false, VeryLowTier } },
{ Instruction::DUP10, { "DUP10", 0, 10, 11, false, VeryLowTier } },
{ Instruction::DUP11, { "DUP11", 0, 11, 12, false, VeryLowTier } },
{ Instruction::DUP12, { "DUP12", 0, 12, 13, false, VeryLowTier } },
{ Instruction::DUP13, { "DUP13", 0, 13, 14, false, VeryLowTier } },
{ Instruction::DUP14, { "DUP14", 0, 14, 15, false, VeryLowTier } },
{ Instruction::DUP15, { "DUP15", 0, 15, 16, false, VeryLowTier } },
{ Instruction::DUP16, { "DUP16", 0, 16, 17, false, VeryLowTier } },
{ Instruction::SWAP1, { "SWAP1", 0, 2, 2, false, VeryLowTier } },
{ Instruction::SWAP2, { "SWAP2", 0, 3, 3, false, VeryLowTier } },
{ Instruction::SWAP3, { "SWAP3", 0, 4, 4, false, VeryLowTier } },
{ Instruction::SWAP4, { "SWAP4", 0, 5, 5, false, VeryLowTier } },
{ Instruction::SWAP5, { "SWAP5", 0, 6, 6, false, VeryLowTier } },
{ Instruction::SWAP6, { "SWAP6", 0, 7, 7, false, VeryLowTier } },
{ Instruction::SWAP7, { "SWAP7", 0, 8, 8, false, VeryLowTier } },
{ Instruction::SWAP8, { "SWAP8", 0, 9, 9, false, VeryLowTier } },
{ Instruction::SWAP9, { "SWAP9", 0, 10, 10, false, VeryLowTier } },
{ Instruction::SWAP10, { "SWAP10", 0, 11, 11, false, VeryLowTier } },
{ Instruction::SWAP11, { "SWAP11", 0, 12, 12, false, VeryLowTier } },
{ Instruction::SWAP12, { "SWAP12", 0, 13, 13, false, VeryLowTier } },
{ Instruction::SWAP13, { "SWAP13", 0, 14, 14, false, VeryLowTier } },
{ Instruction::SWAP14, { "SWAP14", 0, 15, 15, false, VeryLowTier } },
{ Instruction::SWAP15, { "SWAP15", 0, 16, 16, false, VeryLowTier } },
{ Instruction::SWAP16, { "SWAP16", 0, 17, 17, false, VeryLowTier } },
{ Instruction::LOG0, { "LOG0", 0, 2, 0, true, SpecialTier } },
{ Instruction::LOG1, { "LOG1", 0, 3, 0, true, SpecialTier } },
{ Instruction::LOG2, { "LOG2", 0, 4, 0, true, SpecialTier } },
{ Instruction::LOG3, { "LOG3", 0, 5, 0, true, SpecialTier } },
{ Instruction::LOG4, { "LOG4", 0, 6, 0, true, SpecialTier } },
{ Instruction::CREATE, { "CREATE", 0, 3, 1, true, SpecialTier } },
{ Instruction::CALL, { "CALL", 0, 7, 1, true, SpecialTier } },
{ Instruction::CALLCODE, { "CALLCODE", 0, 7, 1, true, SpecialTier } },
{ Instruction::RETURN, { "RETURN", 0, 2, 0, true, ZeroTier } },
{ Instruction::DELEGATECALL,{ "DELEGATECALL", 0, 6, 1, true, SpecialTier } },
{ Instruction::SUICIDE, { "SUICIDE", 0, 1, 0, true, ZeroTier } }
{ Instruction::STOP, { "STOP", 0, 0, 0, true, Tier::ZeroTier } },
{ Instruction::ADD, { "ADD", 0, 2, 1, false, Tier::VeryLowTier } },
{ Instruction::SUB, { "SUB", 0, 2, 1, false, Tier::VeryLowTier } },
{ Instruction::MUL, { "MUL", 0, 2, 1, false, Tier::LowTier } },
{ Instruction::DIV, { "DIV", 0, 2, 1, false, Tier::LowTier } },
{ Instruction::SDIV, { "SDIV", 0, 2, 1, false, Tier::LowTier } },
{ Instruction::MOD, { "MOD", 0, 2, 1, false, Tier::LowTier } },
{ Instruction::SMOD, { "SMOD", 0, 2, 1, false, Tier::LowTier } },
{ Instruction::EXP, { "EXP", 0, 2, 1, false, Tier::SpecialTier } },
{ Instruction::NOT, { "NOT", 0, 1, 1, false, Tier::VeryLowTier } },
{ Instruction::LT, { "LT", 0, 2, 1, false, Tier::VeryLowTier } },
{ Instruction::GT, { "GT", 0, 2, 1, false, Tier::VeryLowTier } },
{ Instruction::SLT, { "SLT", 0, 2, 1, false, Tier::VeryLowTier } },
{ Instruction::SGT, { "SGT", 0, 2, 1, false, Tier::VeryLowTier } },
{ Instruction::EQ, { "EQ", 0, 2, 1, false, Tier::VeryLowTier } },
{ Instruction::ISZERO, { "ISZERO", 0, 1, 1, false, Tier::VeryLowTier } },
{ Instruction::AND, { "AND", 0, 2, 1, false, Tier::VeryLowTier } },
{ Instruction::OR, { "OR", 0, 2, 1, false, Tier::VeryLowTier } },
{ Instruction::XOR, { "XOR", 0, 2, 1, false, Tier::VeryLowTier } },
{ Instruction::BYTE, { "BYTE", 0, 2, 1, false, Tier::VeryLowTier } },
{ Instruction::ADDMOD, { "ADDMOD", 0, 3, 1, false, Tier::MidTier } },
{ Instruction::MULMOD, { "MULMOD", 0, 3, 1, false, Tier::MidTier } },
{ Instruction::SIGNEXTEND, { "SIGNEXTEND", 0, 2, 1, false, Tier::LowTier } },
{ Instruction::SHA3, { "SHA3", 0, 2, 1, false, Tier::SpecialTier } },
{ Instruction::ADDRESS, { "ADDRESS", 0, 0, 1, false, Tier::BaseTier } },
{ Instruction::BALANCE, { "BALANCE", 0, 1, 1, false, Tier::ExtTier } },
{ Instruction::ORIGIN, { "ORIGIN", 0, 0, 1, false, Tier::BaseTier } },
{ Instruction::CALLER, { "CALLER", 0, 0, 1, false, Tier::BaseTier } },
{ Instruction::CALLVALUE, { "CALLVALUE", 0, 0, 1, false, Tier::BaseTier } },
{ Instruction::CALLDATALOAD,{ "CALLDATALOAD", 0, 1, 1, false, Tier::VeryLowTier } },
{ Instruction::CALLDATASIZE,{ "CALLDATASIZE", 0, 0, 1, false, Tier::BaseTier } },
{ Instruction::CALLDATACOPY,{ "CALLDATACOPY", 0, 3, 0, true, Tier::VeryLowTier } },
{ Instruction::CODESIZE, { "CODESIZE", 0, 0, 1, false, Tier::BaseTier } },
{ Instruction::CODECOPY, { "CODECOPY", 0, 3, 0, true, Tier::VeryLowTier } },
{ Instruction::GASPRICE, { "GASPRICE", 0, 0, 1, false, Tier::BaseTier } },
{ Instruction::EXTCODESIZE, { "EXTCODESIZE", 0, 1, 1, false, Tier::ExtTier } },
{ Instruction::EXTCODECOPY, { "EXTCODECOPY", 0, 4, 0, true, Tier::ExtTier } },
{ Instruction::BLOCKHASH, { "BLOCKHASH", 0, 1, 1, false, Tier::ExtTier } },
{ Instruction::COINBASE, { "COINBASE", 0, 0, 1, false, Tier::BaseTier } },
{ Instruction::TIMESTAMP, { "TIMESTAMP", 0, 0, 1, false, Tier::BaseTier } },
{ Instruction::NUMBER, { "NUMBER", 0, 0, 1, false, Tier::BaseTier } },
{ Instruction::DIFFICULTY, { "DIFFICULTY", 0, 0, 1, false, Tier::BaseTier } },
{ Instruction::GASLIMIT, { "GASLIMIT", 0, 0, 1, false, Tier::BaseTier } },
{ Instruction::POP, { "POP", 0, 1, 0, false, Tier::BaseTier } },
{ Instruction::MLOAD, { "MLOAD", 0, 1, 1, false, Tier::VeryLowTier } },
{ Instruction::MSTORE, { "MSTORE", 0, 2, 0, true, Tier::VeryLowTier } },
{ Instruction::MSTORE8, { "MSTORE8", 0, 2, 0, true, Tier::VeryLowTier } },
{ Instruction::SLOAD, { "SLOAD", 0, 1, 1, false, Tier::SpecialTier } },
{ Instruction::SSTORE, { "SSTORE", 0, 2, 0, true, Tier::SpecialTier } },
{ Instruction::JUMP, { "JUMP", 0, 1, 0, true, Tier::MidTier } },
{ Instruction::JUMPI, { "JUMPI", 0, 2, 0, true, Tier::HighTier } },
{ Instruction::PC, { "PC", 0, 0, 1, false, Tier::BaseTier } },
{ Instruction::MSIZE, { "MSIZE", 0, 0, 1, false, Tier::BaseTier } },
{ Instruction::GAS, { "GAS", 0, 0, 1, false, Tier::BaseTier } },
{ Instruction::JUMPDEST, { "JUMPDEST", 0, 0, 0, true, Tier::SpecialTier } },
{ Instruction::PUSH1, { "PUSH1", 1, 0, 1, false, Tier::VeryLowTier } },
{ Instruction::PUSH2, { "PUSH2", 2, 0, 1, false, Tier::VeryLowTier } },
{ Instruction::PUSH3, { "PUSH3", 3, 0, 1, false, Tier::VeryLowTier } },
{ Instruction::PUSH4, { "PUSH4", 4, 0, 1, false, Tier::VeryLowTier } },
{ Instruction::PUSH5, { "PUSH5", 5, 0, 1, false, Tier::VeryLowTier } },
{ Instruction::PUSH6, { "PUSH6", 6, 0, 1, false, Tier::VeryLowTier } },
{ Instruction::PUSH7, { "PUSH7", 7, 0, 1, false, Tier::VeryLowTier } },
{ Instruction::PUSH8, { "PUSH8", 8, 0, 1, false, Tier::VeryLowTier } },
{ Instruction::PUSH9, { "PUSH9", 9, 0, 1, false, Tier::VeryLowTier } },
{ Instruction::PUSH10, { "PUSH10", 10, 0, 1, false, Tier::VeryLowTier } },
{ Instruction::PUSH11, { "PUSH11", 11, 0, 1, false, Tier::VeryLowTier } },
{ Instruction::PUSH12, { "PUSH12", 12, 0, 1, false, Tier::VeryLowTier } },
{ Instruction::PUSH13, { "PUSH13", 13, 0, 1, false, Tier::VeryLowTier } },
{ Instruction::PUSH14, { "PUSH14", 14, 0, 1, false, Tier::VeryLowTier } },
{ Instruction::PUSH15, { "PUSH15", 15, 0, 1, false, Tier::VeryLowTier } },
{ Instruction::PUSH16, { "PUSH16", 16, 0, 1, false, Tier::VeryLowTier } },
{ Instruction::PUSH17, { "PUSH17", 17, 0, 1, false, Tier::VeryLowTier } },
{ Instruction::PUSH18, { "PUSH18", 18, 0, 1, false, Tier::VeryLowTier } },
{ Instruction::PUSH19, { "PUSH19", 19, 0, 1, false, Tier::VeryLowTier } },
{ Instruction::PUSH20, { "PUSH20", 20, 0, 1, false, Tier::VeryLowTier } },
{ Instruction::PUSH21, { "PUSH21", 21, 0, 1, false, Tier::VeryLowTier } },
{ Instruction::PUSH22, { "PUSH22", 22, 0, 1, false, Tier::VeryLowTier } },
{ Instruction::PUSH23, { "PUSH23", 23, 0, 1, false, Tier::VeryLowTier } },
{ Instruction::PUSH24, { "PUSH24", 24, 0, 1, false, Tier::VeryLowTier } },
{ Instruction::PUSH25, { "PUSH25", 25, 0, 1, false, Tier::VeryLowTier } },
{ Instruction::PUSH26, { "PUSH26", 26, 0, 1, false, Tier::VeryLowTier } },
{ Instruction::PUSH27, { "PUSH27", 27, 0, 1, false, Tier::VeryLowTier } },
{ Instruction::PUSH28, { "PUSH28", 28, 0, 1, false, Tier::VeryLowTier } },
{ Instruction::PUSH29, { "PUSH29", 29, 0, 1, false, Tier::VeryLowTier } },
{ Instruction::PUSH30, { "PUSH30", 30, 0, 1, false, Tier::VeryLowTier } },
{ Instruction::PUSH31, { "PUSH31", 31, 0, 1, false, Tier::VeryLowTier } },
{ Instruction::PUSH32, { "PUSH32", 32, 0, 1, false, Tier::VeryLowTier } },
{ Instruction::DUP1, { "DUP1", 0, 1, 2, false, Tier::VeryLowTier } },
{ Instruction::DUP2, { "DUP2", 0, 2, 3, false, Tier::VeryLowTier } },
{ Instruction::DUP3, { "DUP3", 0, 3, 4, false, Tier::VeryLowTier } },
{ Instruction::DUP4, { "DUP4", 0, 4, 5, false, Tier::VeryLowTier } },
{ Instruction::DUP5, { "DUP5", 0, 5, 6, false, Tier::VeryLowTier } },
{ Instruction::DUP6, { "DUP6", 0, 6, 7, false, Tier::VeryLowTier } },
{ Instruction::DUP7, { "DUP7", 0, 7, 8, false, Tier::VeryLowTier } },
{ Instruction::DUP8, { "DUP8", 0, 8, 9, false, Tier::VeryLowTier } },
{ Instruction::DUP9, { "DUP9", 0, 9, 10, false, Tier::VeryLowTier } },
{ Instruction::DUP10, { "DUP10", 0, 10, 11, false, Tier::VeryLowTier } },
{ Instruction::DUP11, { "DUP11", 0, 11, 12, false, Tier::VeryLowTier } },
{ Instruction::DUP12, { "DUP12", 0, 12, 13, false, Tier::VeryLowTier } },
{ Instruction::DUP13, { "DUP13", 0, 13, 14, false, Tier::VeryLowTier } },
{ Instruction::DUP14, { "DUP14", 0, 14, 15, false, Tier::VeryLowTier } },
{ Instruction::DUP15, { "DUP15", 0, 15, 16, false, Tier::VeryLowTier } },
{ Instruction::DUP16, { "DUP16", 0, 16, 17, false, Tier::VeryLowTier } },
{ Instruction::SWAP1, { "SWAP1", 0, 2, 2, false, Tier::VeryLowTier } },
{ Instruction::SWAP2, { "SWAP2", 0, 3, 3, false, Tier::VeryLowTier } },
{ Instruction::SWAP3, { "SWAP3", 0, 4, 4, false, Tier::VeryLowTier } },
{ Instruction::SWAP4, { "SWAP4", 0, 5, 5, false, Tier::VeryLowTier } },
{ Instruction::SWAP5, { "SWAP5", 0, 6, 6, false, Tier::VeryLowTier } },
{ Instruction::SWAP6, { "SWAP6", 0, 7, 7, false, Tier::VeryLowTier } },
{ Instruction::SWAP7, { "SWAP7", 0, 8, 8, false, Tier::VeryLowTier } },
{ Instruction::SWAP8, { "SWAP8", 0, 9, 9, false, Tier::VeryLowTier } },
{ Instruction::SWAP9, { "SWAP9", 0, 10, 10, false, Tier::VeryLowTier } },
{ Instruction::SWAP10, { "SWAP10", 0, 11, 11, false, Tier::VeryLowTier } },
{ Instruction::SWAP11, { "SWAP11", 0, 12, 12, false, Tier::VeryLowTier } },
{ Instruction::SWAP12, { "SWAP12", 0, 13, 13, false, Tier::VeryLowTier } },
{ Instruction::SWAP13, { "SWAP13", 0, 14, 14, false, Tier::VeryLowTier } },
{ Instruction::SWAP14, { "SWAP14", 0, 15, 15, false, Tier::VeryLowTier } },
{ Instruction::SWAP15, { "SWAP15", 0, 16, 16, false, Tier::VeryLowTier } },
{ Instruction::SWAP16, { "SWAP16", 0, 17, 17, false, Tier::VeryLowTier } },
{ Instruction::LOG0, { "LOG0", 0, 2, 0, true, Tier::SpecialTier } },
{ Instruction::LOG1, { "LOG1", 0, 3, 0, true, Tier::SpecialTier } },
{ Instruction::LOG2, { "LOG2", 0, 4, 0, true, Tier::SpecialTier } },
{ Instruction::LOG3, { "LOG3", 0, 5, 0, true, Tier::SpecialTier } },
{ Instruction::LOG4, { "LOG4", 0, 6, 0, true, Tier::SpecialTier } },
{ Instruction::CREATE, { "CREATE", 0, 3, 1, true, Tier::SpecialTier } },
{ Instruction::CALL, { "CALL", 0, 7, 1, true, Tier::SpecialTier } },
{ Instruction::CALLCODE, { "CALLCODE", 0, 7, 1, true, Tier::SpecialTier } },
{ Instruction::RETURN, { "RETURN", 0, 2, 0, true, Tier::ZeroTier } },
{ Instruction::DELEGATECALL,{ "DELEGATECALL", 0, 6, 1, true, Tier::SpecialTier } },
{ Instruction::SUICIDE, { "SUICIDE", 0, 1, 0, true, Tier::ZeroTier } }
};
void dev::solidity::eachInstruction(
@ -343,7 +343,7 @@ InstructionInfo dev::solidity::instructionInfo(Instruction _inst)
}
catch (...)
{
return InstructionInfo({"<INVALID_INSTRUCTION: " + toString((unsigned)_inst) + ">", 0, 0, 0, false, InvalidTier});
return InstructionInfo({"<INVALID_INSTRUCTION: " + toString((unsigned)_inst) + ">", 0, 0, 0, false, Tier::InvalidTier});
}
}

View File

@ -225,7 +225,7 @@ inline Instruction logInstruction(unsigned _number)
return Instruction(unsigned(Instruction::LOG0) + _number);
}
enum Tier
enum class Tier : int
{
ZeroTier = 0, // 0, Zero
BaseTier, // 2, Quick
@ -246,7 +246,7 @@ struct InstructionInfo
int args; ///< Number of items required on the stack for this instruction (and, for the purposes of ret, the number taken from the stack).
int ret; ///< Number of items placed (back) on the stack by this instruction, assuming args items were removed.
bool sideEffects; ///< false if the only effect on the execution environment (apart from gas usage) is a change to a topmost segment of the stack
int gasPriceTier; ///< Tier for gas pricing.
Tier gasPriceTier; ///< Tier for gas pricing.
};
/// Information on all the instructions.