pub enum Instruction {
Show 29 variants AddrOf(Value), AsmBlock(AsmBlockVec<AsmArg>), BinaryOp { op: BinaryOpKind, arg1: Value, arg2: Value, }, BitCast(ValueType), Branch(BranchToWithArgs), Call(FunctionVec<Value>), Cmp(PredicateValueValue), ConditionalBranch { cond_value: Value, true_block: BranchToWithArgs, false_block: BranchToWithArgs, }, ContractCall { return_type: Type, name: String, params: Value, coins: Value, asset_id: Value, gas: Value, }, ExtractElement { array: Value, ty: Aggregate, index_val: Value, }, ExtractValue { aggregate: Value, ty: Aggregate, indices: Vec<u64>, }, GetStorageKey, Gtf { index: Value, tx_field_id: u64, }, GetPointer { base_ptr: Pointer, ptr_ty: Pointer, offset: u64, }, InsertElement { array: Value, ty: Aggregate, value: Value, index_val: Value, }, InsertValue { aggregate: Value, ty: Aggregate, value: Value, indices: Vec<u64>, }, IntToPtr(ValueType), Load(Value), Log { log_val: Value, log_ty: Type, log_id: Value, }, MemCopy { dst_val: Value, src_val: Value, byte_len: u64, }, Nop, ReadRegister(Register), Ret(ValueType), Revert(Value), StateLoadQuadWord { load_val: Value, key: Value, }, StateLoadWord(Value), StateStoreQuadWord { stored_val: Value, key: Value, }, StateStoreWord { stored_val: Value, key: Value, }, Store { dst_val: Value, stored_val: Value, },
}

Variants§

§

AddrOf(Value)

Address of a non-copy (memory) value

§

AsmBlock(AsmBlockVec<AsmArg>)

An opaque list of ASM instructions passed directly to codegen.

§

BinaryOp

Fields

§arg1: Value
§arg2: Value

Binary arithmetic operations

§

BitCast(ValueType)

Cast the type of a value without changing its actual content.

§

Branch(BranchToWithArgs)

An unconditional jump.

§

Call(FunctionVec<Value>)

A function call with a list of arguments.

§

Cmp(PredicateValueValue)

Comparison between two values using various comparators and returning a boolean.

§

ConditionalBranch

Fields

§cond_value: Value
§true_block: BranchToWithArgs
§false_block: BranchToWithArgs

A conditional jump with the boolean condition value and true or false destinations.

§

ContractCall

Fields

§return_type: Type
§name: String
§params: Value
§coins: Value
§asset_id: Value
§gas: Value

A contract call with a list of arguments

§

ExtractElement

Fields

§array: Value
§index_val: Value

Reading a specific element from an array.

§

ExtractValue

Fields

§aggregate: Value
§indices: Vec<u64>

Reading a specific field from (nested) structs.

§

GetStorageKey

Generate a unique integer value

§

Gtf

Fields

§index: Value
§tx_field_id: u64
§

GetPointer

Fields

§base_ptr: Pointer
§ptr_ty: Pointer
§offset: u64

Return a pointer as a value.

§

InsertElement

Fields

§array: Value
§value: Value
§index_val: Value

Writing a specific value to an array.

§

InsertValue

Fields

§aggregate: Value
§value: Value
§indices: Vec<u64>

Writing a specific value to a (nested) struct field.

§

IntToPtr(ValueType)

Re-interpret an integer value as pointer of some type

§

Load(Value)

Read a value from a memory pointer.

§

Log

Fields

§log_val: Value
§log_ty: Type
§log_id: Value

Logs a value along with an identifier.

§

MemCopy

Fields

§dst_val: Value
§src_val: Value
§byte_len: u64

Copy a specified number of bytes between pointers.

§

Nop

No-op, handy as a placeholder instruction.

§

ReadRegister(Register)

Reads a special register in the VM.

§

Ret(ValueType)

Return from a function.

§

Revert(Value)

Revert VM execution.

§

StateLoadQuadWord

Fields

§load_val: Value
§key: Value

Read a quad word from a storage slot. Type of load_val must be a B256 ptr.

§

StateLoadWord(Value)

Read a single word from a storage slot.

§

StateStoreQuadWord

Fields

§stored_val: Value
§key: Value

Write a value to a storage slot. Key must be a B256, type of stored_val must be a Uint(256) ptr.

§

StateStoreWord

Fields

§stored_val: Value
§key: Value

Write a value to a storage slot. Key must be a B256, type of stored_val must be a Uint(64) value.

§

Store

Fields

§dst_val: Value
§stored_val: Value

Write a value to a memory pointer.

Implementations§

Some Instructions can return a value, but for some a return value doesn’t make sense.

Those which perform side effects such as writing to memory and also terminators such as Ret do not have a type.

Some Instructions may have struct arguments. Return it if so for this instruction.

Replace old_val with new_val if it is referenced by this instruction’s arguments.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.