Enum evmil::ll::Instruction
source · pub enum Instruction {
Show 79 variants
STOP,
ADD,
MUL,
SUB,
DIV,
SDIV,
MOD,
SMOD,
ADDMOD,
MULMOD,
EXP,
SIGNEXTEND,
LT,
GT,
SLT,
SGT,
EQ,
ISZERO,
AND,
OR,
XOR,
NOT,
BYTE,
SHL,
SHR,
SAR,
KECCAK256,
ADDRESS,
BALANCE,
ORIGIN,
CALLER,
CALLVALUE,
CALLDATALOAD,
CALLDATASIZE,
CALLDATACOPY,
CODESIZE,
CODECOPY,
GASPRICE,
EXTCODESIZE,
EXTCODECOPY,
RETURNDATASIZE,
RETURNDATACOPY,
EXTCODEHASH,
BLOCKHASH,
COINBASE,
TIMESTAMP,
NUMBER,
DIFFICULTY,
GASLIMIT,
CHAINID,
SELFBALANCE,
POP,
MLOAD,
MSTORE,
MSTORE8,
SLOAD,
SSTORE,
JUMP,
JUMPI,
PC,
MSIZE,
GAS,
JUMPDEST(usize),
PUSH(Vec<u8>),
PUSHL(usize),
DUP(u8),
SWAP(u8),
LOG(u8),
CREATE,
CALL,
CALLCODE,
RETURN,
DELEGATECALL,
CREATE2,
STATICCALL,
REVERT,
INVALID,
SELFDESTRUCT,
DATA(Vec<u8>),
}
Variants§
STOP
ADD
MUL
SUB
DIV
SDIV
MOD
SMOD
ADDMOD
MULMOD
EXP
SIGNEXTEND
LT
GT
SLT
SGT
EQ
ISZERO
AND
OR
XOR
NOT
BYTE
SHL
SHR
SAR
KECCAK256
ADDRESS
BALANCE
ORIGIN
CALLER
CALLVALUE
CALLDATALOAD
CALLDATASIZE
CALLDATACOPY
CODESIZE
CODECOPY
GASPRICE
EXTCODESIZE
EXTCODECOPY
RETURNDATASIZE
RETURNDATACOPY
EXTCODEHASH
BLOCKHASH
COINBASE
TIMESTAMP
NUMBER
DIFFICULTY
GASLIMIT
CHAINID
SELFBALANCE
POP
MLOAD
MSTORE
MSTORE8
SLOAD
SSTORE
JUMP
JUMPI
PC
MSIZE
GAS
JUMPDEST(usize)
PUSH(Vec<u8>)
PUSHL(usize)
DUP(u8)
SWAP(u8)
LOG(u8)
CREATE
CALL
CALLCODE
RETURN
DELEGATECALL
CREATE2
STATICCALL
REVERT
INVALID
SELFDESTRUCT
DATA(Vec<u8>)
Implementations§
source§impl Instruction
impl Instruction
sourcepub fn fallthru(&self) -> bool
pub fn fallthru(&self) -> bool
Determine whether or not control can continue to the next instruction.
sourcepub fn can_branch(&self) -> bool
pub fn can_branch(&self) -> bool
Determine whether or not this instruction can branch. That
is, whether or not it is a JUMP
or JUMPI
instruction.
sourcepub fn encode(&self, offsets: &[Offset], bytes: &mut Vec<u8>) -> Result<(), Error>
pub fn encode(&self, offsets: &[Offset], bytes: &mut Vec<u8>) -> Result<(), Error>
Encode an instruction into a byte sequence, assuming a given set of label offsets.
sourcepub fn length(&self, _offsets: &[Offset]) -> usize
pub fn length(&self, _offsets: &[Offset]) -> usize
Determine the length of this instruction (in bytes) assuming a given set of label offsets.
sourcepub fn opcode(&self, offsets: &[Offset]) -> Result<u8, Error>
pub fn opcode(&self, offsets: &[Offset]) -> Result<u8, Error>
Determine the opcode for a given instruction. In many cases, this is a straightforward mapping. However, in other cases, its slightly more involved as a calculation involving the operands is required.
sourcepub fn decode(pc: usize, bytes: &[u8]) -> Instruction
pub fn decode(pc: usize, bytes: &[u8]) -> Instruction
Decode the next instruction in a given sequence of bytes.
Observe that this never returns a PUSHL
instruction. This
is because it cannot determine whether a given operand will be
used as a jump destination. A separate analysis is required
to “lift” PUSH
instructions to PUSHL
instructions.
Trait Implementations§
source§impl Debug for Instruction
impl Debug for Instruction
source§impl Display for Instruction
impl Display for Instruction
source§impl PartialEq<Instruction> for Instruction
impl PartialEq<Instruction> for Instruction
source§fn eq(&self, other: &Instruction) -> bool
fn eq(&self, other: &Instruction) -> bool
self
and other
values to be equal, and is used
by ==
.