Skip to main content

Opcode

Enum Opcode 

Source
#[repr(u8)]
pub enum Opcode {
Show 164 variants Jump = 1, Brif = 2, BrTable = 3, Debugtrap = 4, Trap = 5, Trapz = 6, Trapnz = 7, Return = 8, Call = 9, CallIndirect = 10, ReturnCall = 11, ReturnCallIndirect = 12, FuncAddr = 13, TryCall = 14, TryCallIndirect = 15, InterruptPoll = 16, Splat = 17, Swizzle = 18, X86Pshufb = 19, Insertlane = 20, Extractlane = 21, Smin = 22, Umin = 23, Smax = 24, Umax = 25, AvgRound = 26, UaddSat = 27, SaddSat = 28, UsubSat = 29, SsubSat = 30, Load = 31, Store = 32, Uload8 = 33, Sload8 = 34, Istore8 = 35, Uload16 = 36, Sload16 = 37, Istore16 = 38, Uload32 = 39, Sload32 = 40, Istore32 = 41, StackSwitch = 42, Uload8x8 = 43, Sload8x8 = 44, Uload16x4 = 45, Sload16x4 = 46, Uload32x2 = 47, Sload32x2 = 48, StackAddr = 49, DynamicStackAddr = 50, SymbolValue = 51, TlsValue = 52, GetPinnedReg = 53, SetPinnedReg = 54, GetFramePointer = 55, GetStackPointer = 56, GetReturnAddress = 57, GetExceptionHandlerAddress = 58, Iconst = 59, F16const = 60, F32const = 61, F64const = 62, F128const = 63, Vconst = 64, Shuffle = 65, Nop = 66, Select = 67, SelectSpectreGuard = 68, Bitselect = 69, Blendv = 70, VanyTrue = 71, VallTrue = 72, VhighBits = 73, Icmp = 74, Iadd = 75, Isub = 76, Ineg = 77, Iabs = 78, Imul = 79, Umulhi = 80, Smulhi = 81, SqmulRoundSat = 82, X86Pmulhrsw = 83, Udiv = 84, Sdiv = 85, Urem = 86, Srem = 87, SaddOverflowCin = 88, UaddOverflowCin = 89, UaddOverflow = 90, SaddOverflow = 91, UsubOverflow = 92, SsubOverflow = 93, UmulOverflow = 94, SmulOverflow = 95, UaddOverflowTrap = 96, SsubOverflowBin = 97, UsubOverflowBin = 98, Band = 99, Bor = 100, Bxor = 101, Bnot = 102, Rotl = 103, Rotr = 104, Ishl = 105, Ushr = 106, Sshr = 107, Bitrev = 108, Clz = 109, Cls = 110, Ctz = 111, Bswap = 112, Popcnt = 113, Fcmp = 114, Fadd = 115, Fsub = 116, Fmul = 117, Fdiv = 118, Sqrt = 119, Fma = 120, Fneg = 121, Fabs = 122, Fcopysign = 123, Fmin = 124, Fmax = 125, Ceil = 126, Floor = 127, Trunc = 128, Nearest = 129, Bitcast = 130, ScalarToVector = 131, Bmask = 132, Ireduce = 133, Snarrow = 134, Unarrow = 135, Uunarrow = 136, SwidenLow = 137, SwidenHigh = 138, UwidenLow = 139, UwidenHigh = 140, IaddPairwise = 141, X86Pmaddubsw = 142, Uextend = 143, Sextend = 144, Fpromote = 145, Fdemote = 146, Fvdemote = 147, FvpromoteLow = 148, FcvtToUint = 149, FcvtToSint = 150, FcvtToUintSat = 151, FcvtToSintSat = 152, X86Cvtt2dq = 153, FcvtFromUint = 154, FcvtFromSint = 155, Isplit = 156, Iconcat = 157, AtomicRmw = 158, AtomicCas = 159, AtomicLoad = 160, AtomicStore = 161, Fence = 162, ExtractVector = 163, SequencePoint = 164,
}
Expand description

An instruction opcode.

All instructions from all supported ISAs are present.

Variants§

§

Jump = 1

jump block_call. (Jump)

§

Brif = 2

brif c, block_then, block_else. (Brif) Type inferred from c.

§

BrTable = 3

br_table x, JT. (BranchTable)

§

Debugtrap = 4

debugtrap. (NullAry)

§

Trap = 5

trap code. (Trap)

§

Trapz = 6

trapz c, code. (CondTrap) Type inferred from c.

§

Trapnz = 7

trapnz c, code. (CondTrap) Type inferred from c.

§

Return = 8

return rvals. (MultiAry)

§

Call = 9

rvals = call FN, args. (Call)

§

CallIndirect = 10

rvals = call_indirect SIG, callee, args. (CallIndirect) Type inferred from callee.

§

ReturnCall = 11

return_call FN, args. (Call)

§

ReturnCallIndirect = 12

return_call_indirect SIG, callee, args. (CallIndirect) Type inferred from callee.

§

FuncAddr = 13

addr = func_addr FN. (FuncAddr)

§

TryCall = 14

try_call callee, args, ET. (TryCall)

§

TryCallIndirect = 15

try_call_indirect callee, args, ET. (TryCallIndirect) Type inferred from callee.

§

InterruptPoll = 16

next_load_ptr = interrupt_poll load_ptr, context, code. (IntAddTrap) Type inferred from load_ptr.

§

Splat = 17

a = splat x. (Unary)

§

Swizzle = 18

a = swizzle x, y. (Binary)

§

X86Pshufb = 19

a = x86_pshufb x, y. (Binary)

§

Insertlane = 20

a = insertlane x, y, Idx. (TernaryImm8) Type inferred from x.

§

Extractlane = 21

a = extractlane x, Idx. (BinaryImm8) Type inferred from x.

§

Smin = 22

a = smin x, y. (Binary) Type inferred from x.

§

Umin = 23

a = umin x, y. (Binary) Type inferred from x.

§

Smax = 24

a = smax x, y. (Binary) Type inferred from x.

§

Umax = 25

a = umax x, y. (Binary) Type inferred from x.

§

AvgRound = 26

a = avg_round x, y. (Binary) Type inferred from x.

§

UaddSat = 27

a = uadd_sat x, y. (Binary) Type inferred from x.

§

SaddSat = 28

a = sadd_sat x, y. (Binary) Type inferred from x.

§

UsubSat = 29

a = usub_sat x, y. (Binary) Type inferred from x.

§

SsubSat = 30

a = ssub_sat x, y. (Binary) Type inferred from x.

§

Load = 31

a = load MemFlags, p, Offset. (Load)

§

Store = 32

store MemFlags, x, p, Offset. (Store) Type inferred from x.

§

Uload8 = 33

a = uload8 MemFlags, p, Offset. (Load)

§

Sload8 = 34

a = sload8 MemFlags, p, Offset. (Load)

§

Istore8 = 35

istore8 MemFlags, x, p, Offset. (Store) Type inferred from x.

§

Uload16 = 36

a = uload16 MemFlags, p, Offset. (Load)

§

Sload16 = 37

a = sload16 MemFlags, p, Offset. (Load)

§

Istore16 = 38

istore16 MemFlags, x, p, Offset. (Store) Type inferred from x.

§

Uload32 = 39

a = uload32 MemFlags, p, Offset. (Load) Type inferred from p.

§

Sload32 = 40

a = sload32 MemFlags, p, Offset. (Load) Type inferred from p.

§

Istore32 = 41

istore32 MemFlags, x, p, Offset. (Store) Type inferred from x.

§

StackSwitch = 42

out_payload0 = stack_switch store_context_ptr, load_context_ptr, in_payload0. (Ternary) Type inferred from load_context_ptr.

§

Uload8x8 = 43

a = uload8x8 MemFlags, p, Offset. (Load) Type inferred from p.

§

Sload8x8 = 44

a = sload8x8 MemFlags, p, Offset. (Load) Type inferred from p.

§

Uload16x4 = 45

a = uload16x4 MemFlags, p, Offset. (Load) Type inferred from p.

§

Sload16x4 = 46

a = sload16x4 MemFlags, p, Offset. (Load) Type inferred from p.

§

Uload32x2 = 47

a = uload32x2 MemFlags, p, Offset. (Load) Type inferred from p.

§

Sload32x2 = 48

a = sload32x2 MemFlags, p, Offset. (Load) Type inferred from p.

§

StackAddr = 49

addr = stack_addr SS, Offset. (StackAddr)

§

DynamicStackAddr = 50

addr = dynamic_stack_addr DSS. (DynamicStackAddr)

§

SymbolValue = 51

a = symbol_value GV. (UnaryGlobalValue)

§

TlsValue = 52

a = tls_value GV. (UnaryGlobalValue)

§

GetPinnedReg = 53

addr = get_pinned_reg. (NullAry)

§

SetPinnedReg = 54

set_pinned_reg addr. (Unary) Type inferred from addr.

§

GetFramePointer = 55

addr = get_frame_pointer. (NullAry)

§

GetStackPointer = 56

addr = get_stack_pointer. (NullAry)

§

GetReturnAddress = 57

addr = get_return_address. (NullAry)

§

GetExceptionHandlerAddress = 58

addr = get_exception_handler_address block, index. (ExceptionHandlerAddress)

§

Iconst = 59

a = iconst N. (UnaryImm)

§

F16const = 60

a = f16const N. (UnaryIeee16)

§

F32const = 61

a = f32const N. (UnaryIeee32)

§

F64const = 62

a = f64const N. (UnaryIeee64)

§

F128const = 63

a = f128const N. (UnaryConst)

§

Vconst = 64

a = vconst N. (UnaryConst)

§

Shuffle = 65

a = shuffle a, b, mask. (Shuffle)

§

Nop = 66

nop. (NullAry)

§

Select = 67

a = select c, x, y. (Ternary) Type inferred from x.

§

SelectSpectreGuard = 68

a = select_spectre_guard c, x, y. (Ternary) Type inferred from x.

§

Bitselect = 69

a = bitselect c, x, y. (Ternary) Type inferred from x.

§

Blendv = 70

a = blendv c, x, y. (Ternary) Type inferred from x.

§

VanyTrue = 71

s = vany_true a. (Unary) Type inferred from a.

§

VallTrue = 72

s = vall_true a. (Unary) Type inferred from a.

§

VhighBits = 73

x = vhigh_bits a. (Unary)

§

Icmp = 74

a = icmp Cond, x, y. (IntCompare) Type inferred from x.

§

Iadd = 75

a = iadd x, y. (Binary) Type inferred from x.

§

Isub = 76

a = isub x, y. (Binary) Type inferred from x.

§

Ineg = 77

a = ineg x. (Unary) Type inferred from x.

§

Iabs = 78

a = iabs x. (Unary) Type inferred from x.

§

Imul = 79

a = imul x, y. (Binary) Type inferred from x.

§

Umulhi = 80

a = umulhi x, y. (Binary) Type inferred from x.

§

Smulhi = 81

a = smulhi x, y. (Binary) Type inferred from x.

§

SqmulRoundSat = 82

a = sqmul_round_sat x, y. (Binary) Type inferred from x.

§

X86Pmulhrsw = 83

a = x86_pmulhrsw x, y. (Binary) Type inferred from x.

§

Udiv = 84

a = udiv x, y. (Binary) Type inferred from x.

§

Sdiv = 85

a = sdiv x, y. (Binary) Type inferred from x.

§

Urem = 86

a = urem x, y. (Binary) Type inferred from x.

§

Srem = 87

a = srem x, y. (Binary) Type inferred from x.

§

SaddOverflowCin = 88

a, c_out = sadd_overflow_cin x, y, c_in. (Ternary) Type inferred from y.

§

UaddOverflowCin = 89

a, c_out = uadd_overflow_cin x, y, c_in. (Ternary) Type inferred from y.

§

UaddOverflow = 90

a, of = uadd_overflow x, y. (Binary) Type inferred from x.

§

SaddOverflow = 91

a, of = sadd_overflow x, y. (Binary) Type inferred from x.

§

UsubOverflow = 92

a, of = usub_overflow x, y. (Binary) Type inferred from x.

§

SsubOverflow = 93

a, of = ssub_overflow x, y. (Binary) Type inferred from x.

§

UmulOverflow = 94

a, of = umul_overflow x, y. (Binary) Type inferred from x.

§

SmulOverflow = 95

a, of = smul_overflow x, y. (Binary) Type inferred from x.

§

UaddOverflowTrap = 96

a = uadd_overflow_trap x, y, code. (IntAddTrap) Type inferred from x.

§

SsubOverflowBin = 97

a, b_out = ssub_overflow_bin x, y, b_in. (Ternary) Type inferred from y.

§

UsubOverflowBin = 98

a, b_out = usub_overflow_bin x, y, b_in. (Ternary) Type inferred from y.

§

Band = 99

a = band x, y. (Binary) Type inferred from x.

§

Bor = 100

a = bor x, y. (Binary) Type inferred from x.

§

Bxor = 101

a = bxor x, y. (Binary) Type inferred from x.

§

Bnot = 102

a = bnot x. (Unary) Type inferred from x.

§

Rotl = 103

a = rotl x, y. (Binary) Type inferred from x.

§

Rotr = 104

a = rotr x, y. (Binary) Type inferred from x.

§

Ishl = 105

a = ishl x, y. (Binary) Type inferred from x.

§

Ushr = 106

a = ushr x, y. (Binary) Type inferred from x.

§

Sshr = 107

a = sshr x, y. (Binary) Type inferred from x.

§

Bitrev = 108

a = bitrev x. (Unary) Type inferred from x.

§

Clz = 109

a = clz x. (Unary) Type inferred from x.

§

Cls = 110

a = cls x. (Unary) Type inferred from x.

§

Ctz = 111

a = ctz x. (Unary) Type inferred from x.

§

Bswap = 112

a = bswap x. (Unary) Type inferred from x.

§

Popcnt = 113

a = popcnt x. (Unary) Type inferred from x.

§

Fcmp = 114

a = fcmp Cond, x, y. (FloatCompare) Type inferred from x.

§

Fadd = 115

a = fadd x, y. (Binary) Type inferred from x.

§

Fsub = 116

a = fsub x, y. (Binary) Type inferred from x.

§

Fmul = 117

a = fmul x, y. (Binary) Type inferred from x.

§

Fdiv = 118

a = fdiv x, y. (Binary) Type inferred from x.

§

Sqrt = 119

a = sqrt x. (Unary) Type inferred from x.

§

Fma = 120

a = fma x, y, z. (Ternary) Type inferred from y.

§

Fneg = 121

a = fneg x. (Unary) Type inferred from x.

§

Fabs = 122

a = fabs x. (Unary) Type inferred from x.

§

Fcopysign = 123

a = fcopysign x, y. (Binary) Type inferred from x.

§

Fmin = 124

a = fmin x, y. (Binary) Type inferred from x.

§

Fmax = 125

a = fmax x, y. (Binary) Type inferred from x.

§

Ceil = 126

a = ceil x. (Unary) Type inferred from x.

§

Floor = 127

a = floor x. (Unary) Type inferred from x.

§

Trunc = 128

a = trunc x. (Unary) Type inferred from x.

§

Nearest = 129

a = nearest x. (Unary) Type inferred from x.

§

Bitcast = 130

a = bitcast MemFlags, x. (LoadNoOffset)

§

ScalarToVector = 131

a = scalar_to_vector s. (Unary)

§

Bmask = 132

a = bmask x. (Unary)

§

Ireduce = 133

a = ireduce x. (Unary)

§

Snarrow = 134

a = snarrow x, y. (Binary) Type inferred from x.

§

Unarrow = 135

a = unarrow x, y. (Binary) Type inferred from x.

§

Uunarrow = 136

a = uunarrow x, y. (Binary) Type inferred from x.

§

SwidenLow = 137

a = swiden_low x. (Unary) Type inferred from x.

§

SwidenHigh = 138

a = swiden_high x. (Unary) Type inferred from x.

§

UwidenLow = 139

a = uwiden_low x. (Unary) Type inferred from x.

§

UwidenHigh = 140

a = uwiden_high x. (Unary) Type inferred from x.

§

IaddPairwise = 141

a = iadd_pairwise x, y. (Binary) Type inferred from x.

§

X86Pmaddubsw = 142

a = x86_pmaddubsw x, y. (Binary)

§

Uextend = 143

a = uextend x. (Unary)

§

Sextend = 144

a = sextend x. (Unary)

§

Fpromote = 145

a = fpromote x. (Unary)

§

Fdemote = 146

a = fdemote x. (Unary)

§

Fvdemote = 147

a = fvdemote x. (Unary)

§

FvpromoteLow = 148

x = fvpromote_low a. (Unary)

§

FcvtToUint = 149

a = fcvt_to_uint x. (Unary)

§

FcvtToSint = 150

a = fcvt_to_sint x. (Unary)

§

FcvtToUintSat = 151

a = fcvt_to_uint_sat x. (Unary)

§

FcvtToSintSat = 152

a = fcvt_to_sint_sat x. (Unary)

§

X86Cvtt2dq = 153

a = x86_cvtt2dq x. (Unary)

§

FcvtFromUint = 154

a = fcvt_from_uint x. (Unary)

§

FcvtFromSint = 155

a = fcvt_from_sint x. (Unary)

§

Isplit = 156

lo, hi = isplit x. (Unary) Type inferred from x.

§

Iconcat = 157

a = iconcat lo, hi. (Binary) Type inferred from lo.

§

AtomicRmw = 158

a = atomic_rmw MemFlags, AtomicRmwOp, p, x. (AtomicRmw)

§

AtomicCas = 159

a = atomic_cas MemFlags, p, e, x. (AtomicCas) Type inferred from x.

§

AtomicLoad = 160

a = atomic_load MemFlags, p. (LoadNoOffset)

§

AtomicStore = 161

atomic_store MemFlags, x, p. (StoreNoOffset) Type inferred from x.

§

Fence = 162

fence. (NullAry)

§

ExtractVector = 163

a = extract_vector x, y. (BinaryImm8) Type inferred from x.

§

SequencePoint = 164

sequence_point. (NullAry)

Implementations§

Source§

impl Opcode

Source

pub fn is_terminator(self) -> bool

True for instructions that terminate the block

Source

pub fn is_branch(self) -> bool

True for all branch or jump instructions.

Source

pub fn is_call(self) -> bool

Is this a call instruction?

Source

pub fn is_return(self) -> bool

Is this a return instruction?

Source

pub fn can_load(self) -> bool

Can this instruction read from memory?

Source

pub fn can_store(self) -> bool

Can this instruction write to memory?

Source

pub fn can_trap(self) -> bool

Can this instruction cause a trap?

Source

pub fn other_side_effects(self) -> bool

Does this instruction have other side effects besides can_* flags?

Source

pub fn side_effects_idempotent(self) -> bool

Despite having side effects, is this instruction okay to GVN?

Source

pub fn all() -> &'static [Opcode]

All cranelift opcodes.

Source§

impl Opcode

Source

pub fn format(self) -> InstructionFormat

Get the instruction format for this opcode.

Source

pub fn constraints(self) -> OpcodeConstraints

Get the constraint descriptor for this opcode. Panic if this is called on NotAnOpcode.

Source

pub fn is_safepoint(self) -> bool

Is this instruction a GC safepoint?

Safepoints are all kinds of calls, except for tail calls.

Trait Implementations§

Source§

impl Clone for Opcode

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for Opcode

Source§

impl Debug for Opcode

Source§

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

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

impl<'de> Deserialize<'de> for Opcode

Available on crate feature enable-serde only.
Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for Opcode

Source§

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

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

impl Eq for Opcode

Source§

impl FromStr for Opcode

Source§

fn from_str(s: &str) -> Result<Self, &'static str>

Parse an Opcode name from a string.

Source§

type Err = &'static str

The associated error which can be returned from parsing.
Source§

impl Hash for Opcode

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Opcode

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl Serialize for Opcode

Available on crate feature enable-serde only.
Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Opcode

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> Same for T

Source§

type Output = T

Should always be Self
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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.