aboutsummaryrefslogtreecommitdiffstats
path: root/libevmasm/SemanticInformation.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libevmasm/SemanticInformation.cpp')
-rw-r--r--libevmasm/SemanticInformation.cpp52
1 files changed, 52 insertions, 0 deletions
diff --git a/libevmasm/SemanticInformation.cpp b/libevmasm/SemanticInformation.cpp
index f63f0c61..abe47e10 100644
--- a/libevmasm/SemanticInformation.cpp
+++ b/libevmasm/SemanticInformation.cpp
@@ -188,3 +188,55 @@ bool SemanticInformation::invalidatesStorage(Instruction _instruction)
return false;
}
}
+
+bool SemanticInformation::invalidInPureFunctions(Instruction _instruction)
+{
+ switch (_instruction)
+ {
+ case Instruction::ADDRESS:
+ case Instruction::BALANCE:
+ case Instruction::ORIGIN:
+ case Instruction::CALLER:
+ case Instruction::CALLVALUE:
+ case Instruction::GASPRICE:
+ case Instruction::EXTCODESIZE:
+ case Instruction::EXTCODECOPY:
+ case Instruction::BLOCKHASH:
+ case Instruction::COINBASE:
+ case Instruction::TIMESTAMP:
+ case Instruction::NUMBER:
+ case Instruction::DIFFICULTY:
+ case Instruction::GASLIMIT:
+ case Instruction::SLOAD:
+ return true;
+ default:
+ break;
+ }
+ return invalidInViewFunctions(_instruction);
+}
+
+bool SemanticInformation::invalidInViewFunctions(Instruction _instruction)
+{
+ switch (_instruction)
+ {
+ case Instruction::SSTORE:
+ case Instruction::JUMP:
+ case Instruction::JUMPI:
+ case Instruction::GAS:
+ case Instruction::LOG0:
+ case Instruction::LOG1:
+ case Instruction::LOG2:
+ case Instruction::LOG3:
+ case Instruction::LOG4:
+ case Instruction::CREATE:
+ case Instruction::CALL:
+ case Instruction::CALLCODE:
+ case Instruction::DELEGATECALL:
+ case Instruction::CREATE2:
+ case Instruction::SELFDESTRUCT:
+ return true;
+ default:
+ break;
+ }
+ return false;
+}