aboutsummaryrefslogtreecommitdiffstats
path: root/SemanticInformation.cpp
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2015-05-09 00:58:42 +0800
committerchriseth <c@ethdev.com>2015-05-09 00:58:42 +0800
commit6cc71a188f3c59b32ac1f131ee74c703f1f81a70 (patch)
treef5f228b61fd53b6072db548c705463d05e26e2be /SemanticInformation.cpp
parent4d62c463d143c93f7938db5b8f7d01d33aa1a698 (diff)
parent1dfcb4735011dfaa143d6592713ec6b4bf097934 (diff)
downloaddexon-solidity-6cc71a188f3c59b32ac1f131ee74c703f1f81a70.tar
dexon-solidity-6cc71a188f3c59b32ac1f131ee74c703f1f81a70.tar.gz
dexon-solidity-6cc71a188f3c59b32ac1f131ee74c703f1f81a70.tar.bz2
dexon-solidity-6cc71a188f3c59b32ac1f131ee74c703f1f81a70.tar.lz
dexon-solidity-6cc71a188f3c59b32ac1f131ee74c703f1f81a70.tar.xz
dexon-solidity-6cc71a188f3c59b32ac1f131ee74c703f1f81a70.tar.zst
dexon-solidity-6cc71a188f3c59b32ac1f131ee74c703f1f81a70.zip
Merge pull request #1813 from chriseth/sol_knowledgeEngine
Static Analysis Engine.
Diffstat (limited to 'SemanticInformation.cpp')
-rw-r--r--SemanticInformation.cpp53
1 files changed, 53 insertions, 0 deletions
diff --git a/SemanticInformation.cpp b/SemanticInformation.cpp
index 83d59efc..056162b5 100644
--- a/SemanticInformation.cpp
+++ b/SemanticInformation.cpp
@@ -122,3 +122,56 @@ bool SemanticInformation::altersControlFlow(AssemblyItem const& _item)
return false;
}
}
+
+
+bool SemanticInformation::isDeterministic(AssemblyItem const& _item)
+{
+ if (_item.type() != Operation)
+ return true;
+
+ switch (_item.instruction())
+ {
+ case Instruction::CALL:
+ case Instruction::CALLCODE:
+ case Instruction::CREATE:
+ case Instruction::GAS:
+ case Instruction::PC:
+ case Instruction::MSIZE: // depends on previous writes and reads, not only on content
+ case Instruction::BALANCE: // depends on previous calls
+ case Instruction::EXTCODESIZE:
+ return false;
+ default:
+ return true;
+ }
+}
+
+bool SemanticInformation::invalidatesMemory(Instruction _instruction)
+{
+ switch (_instruction)
+ {
+ case Instruction::CALLDATACOPY:
+ case Instruction::CODECOPY:
+ case Instruction::EXTCODECOPY:
+ case Instruction::MSTORE:
+ case Instruction::MSTORE8:
+ case Instruction::CALL:
+ case Instruction::CALLCODE:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool SemanticInformation::invalidatesStorage(Instruction _instruction)
+{
+ switch (_instruction)
+ {
+ case Instruction::CALL:
+ case Instruction::CALLCODE:
+ case Instruction::CREATE:
+ case Instruction::SSTORE:
+ return true;
+ default:
+ return false;
+ }
+}