mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
LLL: reorder arithmetic/binary instruction list for readability
This commit is contained in:
parent
ee3cfd8f52
commit
6cb9c36977
@ -330,9 +330,32 @@ void CodeFragment::constructOperation(sp::utree const& _t, CompilerState& _s)
|
||||
if (nonStandard)
|
||||
return;
|
||||
|
||||
std::map<std::string, Instruction> const c_arith = { { "+", Instruction::ADD }, { "-", Instruction::SUB }, { "*", Instruction::MUL }, { "/", Instruction::DIV }, { "%", Instruction::MOD }, { "&", Instruction::AND }, { "|", Instruction::OR }, { "^", Instruction::XOR } };
|
||||
std::map<std::string, pair<Instruction, bool>> const c_binary = { { "<", { Instruction::LT, false } }, { "<=", { Instruction::GT, true } }, { ">", { Instruction::GT, false } }, { ">=", { Instruction::LT, true } }, { "S<", { Instruction::SLT, false } }, { "S<=", { Instruction::SGT, true } }, { "S>", { Instruction::SGT, false } }, { "S>=", { Instruction::SLT, true } }, { "=", { Instruction::EQ, false } }, { "!=", { Instruction::EQ, true } } };
|
||||
std::map<std::string, Instruction> const c_unary = { { "!", Instruction::ISZERO }, { "~", Instruction::NOT } };
|
||||
std::map<std::string, Instruction> const c_arith = {
|
||||
{ "+", Instruction::ADD },
|
||||
{ "-", Instruction::SUB },
|
||||
{ "*", Instruction::MUL },
|
||||
{ "/", Instruction::DIV },
|
||||
{ "%", Instruction::MOD },
|
||||
{ "&", Instruction::AND },
|
||||
{ "|", Instruction::OR },
|
||||
{ "^", Instruction::XOR }
|
||||
};
|
||||
std::map<std::string, pair<Instruction, bool>> const c_binary = {
|
||||
{ "<", { Instruction::LT, false } },
|
||||
{ "<=", { Instruction::GT, true } },
|
||||
{ ">", { Instruction::GT, false } },
|
||||
{ ">=", { Instruction::LT, true } },
|
||||
{ "S<", { Instruction::SLT, false } },
|
||||
{ "S<=", { Instruction::SGT, true } },
|
||||
{ "S>", { Instruction::SGT, false } },
|
||||
{ "S>=", { Instruction::SLT, true } },
|
||||
{ "=", { Instruction::EQ, false } },
|
||||
{ "!=", { Instruction::EQ, true } }
|
||||
};
|
||||
std::map<std::string, Instruction> const c_unary = {
|
||||
{ "!", Instruction::ISZERO },
|
||||
{ "~", Instruction::NOT }
|
||||
};
|
||||
|
||||
vector<CodeFragment> code;
|
||||
CompilerState ns = _s;
|
||||
|
Loading…
Reference in New Issue
Block a user