aboutsummaryrefslogtreecommitdiffstats
path: root/libevmasm/SemanticInformation.cpp
diff options
context:
space:
mode:
authorwbt <wbt@users.noreply.github.com>2018-01-23 22:44:37 +0800
committerGitHub <noreply@github.com>2018-01-23 22:44:37 +0800
commit761eae2499b172334e5ea3e75573af99fae2a975 (patch)
tree3ec324015e8d97e9b7ca43cb4dcc3c46b1b3bf31 /libevmasm/SemanticInformation.cpp
parent7c69d88f937324b64ed8825f9e611e417421434b (diff)
parente5def2da3d9b6cffbff42e2c9e1941831d2fe5ea (diff)
downloaddexon-solidity-761eae2499b172334e5ea3e75573af99fae2a975.tar
dexon-solidity-761eae2499b172334e5ea3e75573af99fae2a975.tar.gz
dexon-solidity-761eae2499b172334e5ea3e75573af99fae2a975.tar.bz2
dexon-solidity-761eae2499b172334e5ea3e75573af99fae2a975.tar.lz
dexon-solidity-761eae2499b172334e5ea3e75573af99fae2a975.tar.xz
dexon-solidity-761eae2499b172334e5ea3e75573af99fae2a975.tar.zst
dexon-solidity-761eae2499b172334e5ea3e75573af99fae2a975.zip
Update from official repo
Diffstat (limited to 'libevmasm/SemanticInformation.cpp')
-rw-r--r--libevmasm/SemanticInformation.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/libevmasm/SemanticInformation.cpp b/libevmasm/SemanticInformation.cpp
index 61a6ccda..4c2290c4 100644
--- a/libevmasm/SemanticInformation.cpp
+++ b/libevmasm/SemanticInformation.cpp
@@ -153,6 +153,31 @@ bool SemanticInformation::isDeterministic(AssemblyItem const& _item)
}
}
+bool SemanticInformation::movable(Instruction _instruction)
+{
+ // These are not really functional.
+ if (isDupInstruction(_instruction) || isSwapInstruction(_instruction))
+ return false;
+ InstructionInfo info = instructionInfo(_instruction);
+ if (info.sideEffects)
+ return false;
+ switch (_instruction)
+ {
+ case Instruction::KECCAK256:
+ case Instruction::BALANCE:
+ case Instruction::EXTCODESIZE:
+ case Instruction::RETURNDATASIZE:
+ case Instruction::SLOAD:
+ case Instruction::PC:
+ case Instruction::MSIZE:
+ case Instruction::GAS:
+ return false;
+ default:
+ return true;
+ }
+ return true;
+}
+
bool SemanticInformation::invalidatesMemory(Instruction _instruction)
{
switch (_instruction)