aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2016-10-26 08:16:29 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2016-10-26 08:16:29 +0800
commit6cb9c369774f9a1fc39bbaefcb3e50a5b4b68bef (patch)
tree83cf98a6655c6b0e46c046e2ba7b1c56f0719300
parentee3cfd8f528c9c950ab416b22d34ddfee978f999 (diff)
downloaddexon-solidity-6cb9c369774f9a1fc39bbaefcb3e50a5b4b68bef.tar.gz
dexon-solidity-6cb9c369774f9a1fc39bbaefcb3e50a5b4b68bef.tar.zst
dexon-solidity-6cb9c369774f9a1fc39bbaefcb3e50a5b4b68bef.zip
LLL: reorder arithmetic/binary instruction list for readability
-rw-r--r--liblll/CodeFragment.cpp29
1 files changed, 26 insertions, 3 deletions
diff --git a/liblll/CodeFragment.cpp b/liblll/CodeFragment.cpp
index ce3024f6..eadb0140 100644
--- a/liblll/CodeFragment.cpp
+++ b/liblll/CodeFragment.cpp
@@ -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;