Skip to main content

CraneliftInstr

Enum CraneliftInstr 

Source
pub enum CraneliftInstr {
Show 75 variants Iconst(CraneliftType, i64), Bconst(bool), F32Const(f32), F64Const(f64), Iadd(CraneliftValue, CraneliftValue), Isub(CraneliftValue, CraneliftValue), Imul(CraneliftValue, CraneliftValue), Sdiv(CraneliftValue, CraneliftValue), Udiv(CraneliftValue, CraneliftValue), Srem(CraneliftValue, CraneliftValue), Urem(CraneliftValue, CraneliftValue), Ineg(CraneliftValue), Iabs(CraneliftValue), IaddImm(CraneliftValue, i64), ImulImm(CraneliftValue, i64), Band(CraneliftValue, CraneliftValue), Bor(CraneliftValue, CraneliftValue), Bxor(CraneliftValue, CraneliftValue), Bnot(CraneliftValue), Ishl(CraneliftValue, CraneliftValue), Sshr(CraneliftValue, CraneliftValue), Ushr(CraneliftValue, CraneliftValue), Rotl(CraneliftValue, CraneliftValue), Rotr(CraneliftValue, CraneliftValue), Clz(CraneliftValue), Ctz(CraneliftValue), Popcnt(CraneliftValue), Fadd(CraneliftValue, CraneliftValue), Fsub(CraneliftValue, CraneliftValue), Fmul(CraneliftValue, CraneliftValue), Fdiv(CraneliftValue, CraneliftValue), Fneg(CraneliftValue), Fabs(CraneliftValue), Sqrt(CraneliftValue), Fma(CraneliftValue, CraneliftValue, CraneliftValue), Fmin(CraneliftValue, CraneliftValue), Fmax(CraneliftValue, CraneliftValue), Floor(CraneliftValue), Ceil(CraneliftValue), FTrunc(CraneliftValue), Nearest(CraneliftValue), Icmp(IntCC, CraneliftValue, CraneliftValue), Fcmp(FloatCC, CraneliftValue, CraneliftValue), Select(CraneliftValue, CraneliftValue, CraneliftValue), Sextend(CraneliftType, CraneliftValue), Uextend(CraneliftType, CraneliftValue), Ireduce(CraneliftType, CraneliftValue), Fpromote(CraneliftType, CraneliftValue), Fdemote(CraneliftType, CraneliftValue), FcvtToSint(CraneliftType, CraneliftValue), FcvtToUint(CraneliftType, CraneliftValue), FcvtFromSint(CraneliftType, CraneliftValue), FcvtFromUint(CraneliftType, CraneliftValue), Bitcast(CraneliftType, CraneliftValue), Load(CraneliftType, MemFlags, CraneliftValue, i32), Store(MemFlags, CraneliftValue, CraneliftValue, i32), StackAddr(CraneliftType, u32), GlobalValue(CraneliftType, u32), Jump(BlockRef, Vec<CraneliftValue>), Brif(CraneliftValue, BlockRef, Vec<CraneliftValue>, BlockRef, Vec<CraneliftValue>), BrTable(CraneliftValue, BlockRef, Vec<BlockRef>), Return(Vec<CraneliftValue>), Trap(String), Trapif(IntCC, CraneliftValue, String), Unreachable, Call(String, Vec<CraneliftValue>), CallIndirect(u32, CraneliftValue, Vec<CraneliftValue>), ReturnCall(String, Vec<CraneliftValue>), FuncAddr(CraneliftType, String), Null(CraneliftType), Splat(CraneliftType, CraneliftValue), ExtractLane(CraneliftValue, u8), InsertLane(CraneliftValue, u8, CraneliftValue), Copy(CraneliftValue), Nop,
}
Expand description

A Cranelift IR instruction.

Variants§

§

Iconst(CraneliftType, i64)

Integer constant: iconst.i64 42

§

Bconst(bool)

Boolean constant: bconst.b1 true

§

F32Const(f32)

32-bit float constant: f32const 3.14

§

F64Const(f64)

64-bit float constant: f64const 3.14

§

Iadd(CraneliftValue, CraneliftValue)

Add: iadd v1, v2

§

Isub(CraneliftValue, CraneliftValue)

Subtract: isub v1, v2

§

Imul(CraneliftValue, CraneliftValue)

Multiply: imul v1, v2

§

Sdiv(CraneliftValue, CraneliftValue)

Signed divide: sdiv v1, v2

§

Udiv(CraneliftValue, CraneliftValue)

Unsigned divide: udiv v1, v2

§

Srem(CraneliftValue, CraneliftValue)

Signed remainder: srem v1, v2

§

Urem(CraneliftValue, CraneliftValue)

Unsigned remainder: urem v1, v2

§

Ineg(CraneliftValue)

Negate: ineg v1

§

Iabs(CraneliftValue)

Absolute value: iabs v1

§

IaddImm(CraneliftValue, i64)

Add with immediate: iadd_imm v1, 5

§

ImulImm(CraneliftValue, i64)

Multiply with immediate: imul_imm v1, 5

§

Band(CraneliftValue, CraneliftValue)

Bitwise AND: band v1, v2

§

Bor(CraneliftValue, CraneliftValue)

Bitwise OR: bor v1, v2

§

Bxor(CraneliftValue, CraneliftValue)

Bitwise XOR: bxor v1, v2

§

Bnot(CraneliftValue)

Bitwise NOT: bnot v1

§

Ishl(CraneliftValue, CraneliftValue)

Shift left: ishl v1, v2

§

Sshr(CraneliftValue, CraneliftValue)

Arithmetic shift right: sshr v1, v2

§

Ushr(CraneliftValue, CraneliftValue)

Logical shift right: ushr v1, v2

§

Rotl(CraneliftValue, CraneliftValue)

Rotate left: rotl v1, v2

§

Rotr(CraneliftValue, CraneliftValue)

Rotate right: rotr v1, v2

§

Clz(CraneliftValue)

Count leading zeros: clz v1

§

Ctz(CraneliftValue)

Count trailing zeros: ctz v1

§

Popcnt(CraneliftValue)

Population count: popcnt v1

§

Fadd(CraneliftValue, CraneliftValue)

Float add: fadd v1, v2

§

Fsub(CraneliftValue, CraneliftValue)

Float subtract: fsub v1, v2

§

Fmul(CraneliftValue, CraneliftValue)

Float multiply: fmul v1, v2

§

Fdiv(CraneliftValue, CraneliftValue)

Float divide: fdiv v1, v2

§

Fneg(CraneliftValue)

Float negate: fneg v1

§

Fabs(CraneliftValue)

Float absolute value: fabs v1

§

Sqrt(CraneliftValue)

Float square root: sqrt v1

§

Fma(CraneliftValue, CraneliftValue, CraneliftValue)

Fused multiply-add: fma v1, v2, v3

§

Fmin(CraneliftValue, CraneliftValue)

Float minimum: fmin v1, v2

§

Fmax(CraneliftValue, CraneliftValue)

Float maximum: fmax v1, v2

§

Floor(CraneliftValue)

Float floor: floor v1

§

Ceil(CraneliftValue)

Float ceiling: ceil v1

§

FTrunc(CraneliftValue)

Float truncate toward zero: trunc v1

§

Nearest(CraneliftValue)

Float round to nearest: nearest v1

§

Icmp(IntCC, CraneliftValue, CraneliftValue)

Integer compare: icmp eq v1, v2

§

Fcmp(FloatCC, CraneliftValue, CraneliftValue)

Float compare: fcmp lt v1, v2

§

Select(CraneliftValue, CraneliftValue, CraneliftValue)

Select: select v_cond, v_true, v_false

§

Sextend(CraneliftType, CraneliftValue)

Sign-extend: sextend.i64 v1

§

Uextend(CraneliftType, CraneliftValue)

Zero-extend: uextend.i64 v1

§

Ireduce(CraneliftType, CraneliftValue)

Truncate: ireduce.i32 v1

§

Fpromote(CraneliftType, CraneliftValue)

Float convert: fpromote.f64 v1

§

Fdemote(CraneliftType, CraneliftValue)

Float demote: fdemote.f32 v1

§

FcvtToSint(CraneliftType, CraneliftValue)

Float to int (trunc): fcvt_to_sint.i64 v1

§

FcvtToUint(CraneliftType, CraneliftValue)

Float to unsigned int (trunc): fcvt_to_uint.i64 v1

§

FcvtFromSint(CraneliftType, CraneliftValue)

Signed int to float: fcvt_from_sint.f64 v1

§

FcvtFromUint(CraneliftType, CraneliftValue)

Unsigned int to float: fcvt_from_uint.f64 v1

§

Bitcast(CraneliftType, CraneliftValue)

Bitcast: bitcast.f64 v1

§

Load(CraneliftType, MemFlags, CraneliftValue, i32)

Load: load.i64 notrap aligned v_addr+offset

§

Store(MemFlags, CraneliftValue, CraneliftValue, i32)

Store: store notrap aligned v_val, v_addr+offset

§

StackAddr(CraneliftType, u32)

Stack slot address: stack_addr.i64 ss0

§

GlobalValue(CraneliftType, u32)

Global value address: global_value.i64 gv0

§

Jump(BlockRef, Vec<CraneliftValue>)

Unconditional jump: jump block1(v1, v2)

§

Brif(CraneliftValue, BlockRef, Vec<CraneliftValue>, BlockRef, Vec<CraneliftValue>)

Conditional branch: brif v_cond, block1(args), block2(args)

§

BrTable(CraneliftValue, BlockRef, Vec<BlockRef>)

Branch table (indirect jump): br_table v, block_default, jt0

§

Return(Vec<CraneliftValue>)

Return: return v1, v2

§

Trap(String)

Trap: trap user1

§

Trapif(IntCC, CraneliftValue, String)

Trap if condition: trapif eq v1, user1

§

Unreachable

Unreachable trap

§

Call(String, Vec<CraneliftValue>)

Direct call: call func(args)

§

CallIndirect(u32, CraneliftValue, Vec<CraneliftValue>)

Indirect call: call_indirect sig0, v_callee(args)

§

ReturnCall(String, Vec<CraneliftValue>)

Return call (tail call): return_call func(args)

§

FuncAddr(CraneliftType, String)

Function argument: func_addr.i64 func_name

§

Null(CraneliftType)

Null reference constant: null.r64

§

Splat(CraneliftType, CraneliftValue)

Vector splat: splat.i32x4 v1

§

ExtractLane(CraneliftValue, u8)

Vector extract lane: extractlane v1, 0

§

InsertLane(CraneliftValue, u8, CraneliftValue)

Vector insert lane: insertlane v1, 0, v2

§

Copy(CraneliftValue)

Copy / identity: copy v1 (used for renames)

§

Nop

Nop

Trait Implementations§

Source§

impl Clone for CraneliftInstr

Source§

fn clone(&self) -> CraneliftInstr

Returns a duplicate 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 CraneliftInstr

Source§

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

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

impl PartialEq for CraneliftInstr

Source§

fn eq(&self, other: &CraneliftInstr) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for CraneliftInstr

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where 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> ToOwned for T
where T: Clone,

Source§

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 T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.