pub enum Instruction {
Show 21 variants AsmBlock(AsmBlock, Vec<AsmArg>), UnaryOp { op: UnaryOpKind, arg: Value, }, BinaryOp { op: BinaryOpKind, arg1: Value, arg2: Value, }, BitCast(Value, Type), Branch(BranchToWithArgs), Call(Function, Vec<Value>), CastPtr(Value, Type), Cmp(Predicate, Value, Value), 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, }, FuelVm(FuelVmInstruction), GetLocal(LocalVar), GetElemPtr { base: Value, elem_ptr_ty: Type, indices: Vec<Value>, }, IntToPtr(Value, Type), Load(Value), MemCopyBytes { dst_val_ptr: Value, src_val_ptr: Value, byte_len: u64, }, MemCopyVal { dst_val_ptr: Value, src_val_ptr: Value, }, Nop, PtrToInt(Value, Type), Ret(Value, Type), Store { dst_val_ptr: Value, stored_val: Value, },
}

Variants§

§

AsmBlock(AsmBlock, Vec<AsmArg>)

An opaque list of ASM instructions passed directly to codegen.

§

UnaryOp

Fields

§arg: Value

Unary arithmetic operations

§

BinaryOp

Fields

§arg1: Value
§arg2: Value

Binary arithmetic operations

§

BitCast(Value, Type)

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

§

Branch(BranchToWithArgs)

An unconditional jump.

§

Call(Function, Vec<Value>)

A function call with a list of arguments.

§

CastPtr(Value, Type)

Cast a value’s type from one pointer to another.

§

Cmp(Predicate, Value, Value)

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

§

FuelVm(FuelVmInstruction)

Umbrella instruction variant for FuelVM-specific instructions

§

GetLocal(LocalVar)

Return a local variable.

§

GetElemPtr

Fields

§base: Value
§elem_ptr_ty: Type
§indices: Vec<Value>

Translate a pointer from a base to a nested element in an aggregate type.

§

IntToPtr(Value, Type)

Re-interpret an integer value as pointer of some type

§

Load(Value)

Read a value from a memory pointer.

§

MemCopyBytes

Fields

§dst_val_ptr: Value
§src_val_ptr: Value
§byte_len: u64

Copy a specified number of bytes between pointers.

§

MemCopyVal

Fields

§dst_val_ptr: Value
§src_val_ptr: Value

Copy a value from one pointer to another.

§

Nop

No-op, handy as a placeholder instruction.

§

PtrToInt(Value, Type)

Cast a pointer to an integer.

§

Ret(Value, Type)

Return from a function.

§

Store

Fields

§dst_val_ptr: Value
§stored_val: Value

Write a value to a memory pointer.

Implementations§

source§

impl Instruction

source

pub fn get_type(&self, context: &Context<'_>) -> Option<Type>

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.

source

pub fn get_operands(&self) -> Vec<Value>

source

pub fn replace_values(&mut self, replace_map: &FxHashMap<Value, Value>)

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

source

pub fn may_have_side_effect(&self) -> bool

source

pub fn is_terminator(&self) -> bool

Trait Implementations§

source§

impl Clone for Instruction

source§

fn clone(&self) -> Instruction

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Instruction

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl DebugWithContext for Instruction

source§

fn fmt_with_context<'a, 'c>( &'a self, formatter: &mut Formatter<'_>, context: &'c Context<'_> ) -> Result

source§

fn with_context<'a, 'c, 'eng>( &'a self, context: &'c Context<'eng> ) -> WithContext<'a, 'c, 'eng, Self>

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> Downcast for Twhere T: Any,

source§

fn into_any(self: Box<T, Global>) -> Box<dyn Any, Global>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
source§

fn into_any_rc(self: Rc<T, Global>) -> Rc<dyn Any, Global>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
source§

impl<T> DowncastSync for Twhere T: Any + Send + Sync,

source§

fn into_any_arc(self: Arc<T, Global>) -> Arc<dyn Any + Send + Sync, Global>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
§

impl<T> StorageAsMut for T

§

fn storage<Type>(&mut self) -> StorageMut<'_, Self, Type>where Type: Mappable,

§

fn storage_as_mut<Type>(&mut self) -> StorageMut<'_, Self, Type>where Type: Mappable,

§

impl<T> StorageAsRef for T

§

fn storage<Type>(&self) -> StorageRef<'_, Self, Type>where Type: Mappable,

§

fn storage_as_ref<Type>(&self) -> StorageRef<'_, Self, Type>where Type: Mappable,

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V