Enum sway_ir::instruction::Instruction
source · [−]pub enum Instruction {
Show 13 variants
AsmBlock(AsmBlock, Vec<AsmArg>),
Branch(Block),
Call(Function, Vec<Value>),
ConditionalBranch {
cond_value: Value,
true_block: Block,
false_block: Block,
},
ExtractElement {
array: Value,
ty: Aggregate,
index_val: Value,
},
ExtractValue {
aggregate: Value,
ty: Aggregate,
indices: Vec<u64>,
},
GetPointer(Pointer),
InsertElement {
array: Value,
ty: Aggregate,
value: Value,
index_val: Value,
},
InsertValue {
aggregate: Value,
ty: Aggregate,
value: Value,
indices: Vec<u64>,
},
Load(Pointer),
Phi(Vec<(Block, Value)>),
Ret(Value, Type),
Store {
ptr: Pointer,
stored_val: Value,
},
}
Variants
AsmBlock(AsmBlock, Vec<AsmArg>)
An opaque list of ASM instructions passed directly to codegen.
Branch(Block)
An unconditional jump.
Call(Function, Vec<Value>)
A function call with a list of arguments.
ConditionalBranch
A conditional jump with the boolean condition value and true or false destinations.
ExtractElement
Reading a specific element from an array.
ExtractValue
Reading a specific field from (nested) structs.
GetPointer(Pointer)
Return a pointer as a value.
InsertElement
Writing a specific value to an array.
InsertValue
Writing a specific value to a (nested) struct field.
Load(Pointer)
Read a value from a memory pointer.
Phi(Vec<(Block, Value)>)
Choose a value from a list depending on the preceding block.
Ret(Value, Type)
Return from a function.
Store
Write a value to a memory pointer.
Implementations
Some Instruction
s 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 Instruction
s 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
Auto Trait Implementations
impl RefUnwindSafe for Instruction
impl Send for Instruction
impl Sync for Instruction
impl Unpin for Instruction
impl UnwindSafe for Instruction
Blanket Implementations
Mutably borrows from an owned value. Read more