Enum cranelift_codegen::ir::instructions::InstructionData
source · pub enum InstructionData {
Show 37 variants
AtomicCas {
opcode: Opcode,
args: [Value; 3],
flags: MemFlags,
},
AtomicRmw {
opcode: Opcode,
args: [Value; 2],
flags: MemFlags,
op: AtomicRmwOp,
},
Binary {
opcode: Opcode,
args: [Value; 2],
},
BinaryImm64 {
opcode: Opcode,
arg: Value,
imm: Imm64,
},
BinaryImm8 {
opcode: Opcode,
arg: Value,
imm: Uimm8,
},
BranchTable {
opcode: Opcode,
arg: Value,
table: JumpTable,
},
Brif {
opcode: Opcode,
arg: Value,
blocks: [BlockCall; 2],
},
Call {
opcode: Opcode,
args: ValueList,
func_ref: FuncRef,
},
CallIndirect {
opcode: Opcode,
args: ValueList,
sig_ref: SigRef,
},
CondTrap {
opcode: Opcode,
arg: Value,
code: TrapCode,
},
DynamicStackLoad {
opcode: Opcode,
dynamic_stack_slot: DynamicStackSlot,
},
DynamicStackStore {
opcode: Opcode,
arg: Value,
dynamic_stack_slot: DynamicStackSlot,
},
FloatCompare {
opcode: Opcode,
args: [Value; 2],
cond: FloatCC,
},
FuncAddr {
opcode: Opcode,
func_ref: FuncRef,
},
IntAddTrap {
opcode: Opcode,
args: [Value; 2],
code: TrapCode,
},
IntCompare {
opcode: Opcode,
args: [Value; 2],
cond: IntCC,
},
IntCompareImm {
opcode: Opcode,
arg: Value,
cond: IntCC,
imm: Imm64,
},
Jump {
opcode: Opcode,
destination: BlockCall,
},
Load {
opcode: Opcode,
arg: Value,
flags: MemFlags,
offset: Offset32,
},
LoadNoOffset {
opcode: Opcode,
arg: Value,
flags: MemFlags,
},
MultiAry {
opcode: Opcode,
args: ValueList,
},
NullAry {
opcode: Opcode,
},
Shuffle {
opcode: Opcode,
args: [Value; 2],
imm: Immediate,
},
StackLoad {
opcode: Opcode,
stack_slot: StackSlot,
offset: Offset32,
},
StackStore {
opcode: Opcode,
arg: Value,
stack_slot: StackSlot,
offset: Offset32,
},
Store {
opcode: Opcode,
args: [Value; 2],
flags: MemFlags,
offset: Offset32,
},
StoreNoOffset {
opcode: Opcode,
args: [Value; 2],
flags: MemFlags,
},
TableAddr {
opcode: Opcode,
arg: Value,
table: Table,
offset: Offset32,
},
Ternary {
opcode: Opcode,
args: [Value; 3],
},
TernaryImm8 {
opcode: Opcode,
args: [Value; 2],
imm: Uimm8,
},
Trap {
opcode: Opcode,
code: TrapCode,
},
Unary {
opcode: Opcode,
arg: Value,
},
UnaryConst {
opcode: Opcode,
constant_handle: Constant,
},
UnaryGlobalValue {
opcode: Opcode,
global_value: GlobalValue,
},
UnaryIeee32 {
opcode: Opcode,
imm: Ieee32,
},
UnaryIeee64 {
opcode: Opcode,
imm: Ieee64,
},
UnaryImm {
opcode: Opcode,
imm: Imm64,
},
}
Variants§
AtomicCas
AtomicRmw
Binary
BinaryImm64
BinaryImm8
BranchTable
Brif
Call
CallIndirect
CondTrap
DynamicStackLoad
DynamicStackStore
FloatCompare
FuncAddr
IntAddTrap
IntCompare
IntCompareImm
Jump
Load
LoadNoOffset
MultiAry
NullAry
Shuffle
StackLoad
StackStore
Store
StoreNoOffset
TableAddr
Ternary
TernaryImm8
Trap
Unary
UnaryConst
UnaryGlobalValue
UnaryIeee32
UnaryIeee64
UnaryImm
Implementations§
source§impl InstructionData
impl InstructionData
sourcepub fn typevar_operand(&self, pool: &ValueListPool) -> Option<Value>
pub fn typevar_operand(&self, pool: &ValueListPool) -> Option<Value>
Get the controlling type variable operand.
sourcepub fn arguments<'a>(&'a self, pool: &'a ValueListPool) -> &[Value]
pub fn arguments<'a>(&'a self, pool: &'a ValueListPool) -> &[Value]
Get the value arguments to this instruction.
sourcepub fn arguments_mut<'a>(
&'a mut self,
pool: &'a mut ValueListPool
) -> &mut [Value]
pub fn arguments_mut<'a>( &'a mut self, pool: &'a mut ValueListPool ) -> &mut [Value]
Get mutable references to the value arguments to this instruction.
sourcepub fn eq<F: Fn(Value) -> Value>(
&self,
other: &Self,
pool: &ValueListPool,
mapper: F
) -> bool
pub fn eq<F: Fn(Value) -> Value>( &self, other: &Self, pool: &ValueListPool, mapper: F ) -> bool
Compare two InstructionData
for equality.
This operation requires a reference to a ValueListPool
to
determine if the contents of any ValueLists
are equal.
This operation takes a closure that is allowed to map each argument value to some other value before the instructions are compared. This allows various forms of canonicalization.
sourcepub fn hash<H: Hasher, F: Fn(Value) -> Value>(
&self,
state: &mut H,
pool: &ValueListPool,
mapper: F
)
pub fn hash<H: Hasher, F: Fn(Value) -> Value>( &self, state: &mut H, pool: &ValueListPool, mapper: F )
Hash an InstructionData
.
This operation requires a reference to a ValueListPool
to
hash the contents of any ValueLists
.
This operation takes a closure that is allowed to map each argument value to some other value before it is hashed. This allows various forms of canonicalization.
sourcepub fn deep_clone(&self, pool: &mut ValueListPool) -> Self
pub fn deep_clone(&self, pool: &mut ValueListPool) -> Self
Deep-clone an InstructionData
, including any referenced lists.
This operation requires a reference to a ValueListPool
to
clone the ValueLists
.
source§impl InstructionData
impl InstructionData
Analyzing an instruction.
Avoid large matches on instruction formats by using the methods defined here to examine instructions.
sourcepub fn branch_destination<'a>(
&'a self,
jump_tables: &'a JumpTables
) -> &[BlockCall]
pub fn branch_destination<'a>( &'a self, jump_tables: &'a JumpTables ) -> &[BlockCall]
Get the destinations of this instruction, if it’s a branch.
br_table
returns the empty slice.
sourcepub fn branch_destination_mut<'a>(
&'a mut self,
jump_tables: &'a mut JumpTables
) -> &mut [BlockCall]
pub fn branch_destination_mut<'a>( &'a mut self, jump_tables: &'a mut JumpTables ) -> &mut [BlockCall]
Get a mutable slice of the destinations of this instruction, if it’s a branch.
br_table
returns the empty slice.
sourcepub fn trap_code(&self) -> Option<TrapCode>
pub fn trap_code(&self) -> Option<TrapCode>
If this is a trapping instruction, get its trap code. Otherwise, return
None
.
sourcepub fn cond_code(&self) -> Option<IntCC>
pub fn cond_code(&self) -> Option<IntCC>
If this is a control-flow instruction depending on an integer condition, gets its
condition. Otherwise, return None
.
sourcepub fn fp_cond_code(&self) -> Option<FloatCC>
pub fn fp_cond_code(&self) -> Option<FloatCC>
If this is a control-flow instruction depending on a floating-point condition, gets its
condition. Otherwise, return None
.
sourcepub fn trap_code_mut(&mut self) -> Option<&mut TrapCode>
pub fn trap_code_mut(&mut self) -> Option<&mut TrapCode>
If this is a trapping instruction, get an exclusive reference to its
trap code. Otherwise, return None
.
sourcepub fn atomic_rmw_op(&self) -> Option<AtomicRmwOp>
pub fn atomic_rmw_op(&self) -> Option<AtomicRmwOp>
If this is an atomic read/modify/write instruction, return its subopcode.
sourcepub fn load_store_offset(&self) -> Option<i32>
pub fn load_store_offset(&self) -> Option<i32>
If this is a load/store instruction, returns its immediate offset.
sourcepub fn memflags(&self) -> Option<MemFlags>
pub fn memflags(&self) -> Option<MemFlags>
If this is a load/store instruction, return its memory flags.
sourcepub fn stack_slot(&self) -> Option<StackSlot>
pub fn stack_slot(&self) -> Option<StackSlot>
If this instruction references a stack slot, return it
sourcepub fn analyze_call<'a>(&'a self, pool: &'a ValueListPool) -> CallInfo<'a>
pub fn analyze_call<'a>(&'a self, pool: &'a ValueListPool) -> CallInfo<'a>
Return information about a call instruction.
Any instruction that can call another function reveals its call signature here.
Trait Implementations§
source§impl Clone for InstructionData
impl Clone for InstructionData
source§fn clone(&self) -> InstructionData
fn clone(&self) -> InstructionData
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for InstructionData
impl Debug for InstructionData
source§impl<'a> From<&'a InstructionData> for InstructionFormat
impl<'a> From<&'a InstructionData> for InstructionFormat
source§fn from(inst: &'a InstructionData) -> Self
fn from(inst: &'a InstructionData) -> Self
source§impl Hash for InstructionData
impl Hash for InstructionData
source§impl PartialEq for InstructionData
impl PartialEq for InstructionData
source§fn eq(&self, other: &InstructionData) -> bool
fn eq(&self, other: &InstructionData) -> bool
self
and other
values to be equal, and is used
by ==
.impl Copy for InstructionData
impl Eq for InstructionData
impl StructuralPartialEq for InstructionData
Auto Trait Implementations§
impl Freeze for InstructionData
impl RefUnwindSafe for InstructionData
impl Send for InstructionData
impl Sync for InstructionData
impl Unpin for InstructionData
impl UnwindSafe for InstructionData
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.