forked from vyperlang/vyper
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor[venom]: add effects to instructions
- Loading branch information
1 parent
e2f6001
commit 2987d36
Showing
2 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
_ALL = ("storage", "transient", "memory", "immutables", "balance", "returndata") | ||
|
||
_writes = { | ||
"sstore": "storage", | ||
"tstore": "transient", | ||
"mstore": "memory", | ||
"istore": "immutables", | ||
"call": _ALL, | ||
"delegatecall": _ALL, | ||
"staticcall": "memory", | ||
"create": _ALL, | ||
"create2": _ALL, | ||
"invoke": _ALL, # could be smarter, look up the effects of the invoked function | ||
"dloadbytes": "memory", | ||
"returndatacopy": "memory", | ||
"calldatacopy": "memory", | ||
"codecopy": "memory", | ||
"extcodecopy": "memory", | ||
"mcopy": "memory", | ||
} | ||
_reads = { | ||
"sload": "storage", | ||
"tload": "transient", | ||
"iload": "immutables", | ||
"mload": "memory", | ||
"mcopy": "memory", | ||
"call": _ALL, | ||
"delegatecall": _ALL, | ||
"staticcall": _ALL, | ||
"returndatasize": "returndata", | ||
"returndatacopy": "returndata", | ||
"balance": "balance", | ||
"selfbalance": "balance", | ||
"log": "memory", | ||
"revert": "memory", | ||
"return": "memory", | ||
"sha3": "memory", | ||
} | ||
|
||
|
||
def _mktuple(x): | ||
if not isinstance(x, tuple): | ||
x = (x,) | ||
return x | ||
|
||
|
||
writes = {k: _mktuple(v) for k, v in _writes.items()} | ||
reads = {k: _mktuple(v) for k, v in _reads.items()} |