Skip to main content

Opcode

Enum Opcode 

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

§

Splat = 16

a = splat x. (Unary)

§

Swizzle = 17

a = swizzle x, y. (Binary)

§

X86Pshufb = 18

a = x86_pshufb x, y. (Binary)

§

Insertlane = 19

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

§

Extractlane = 20

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

§

Smin = 21

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

§

Umin = 22

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

§

Smax = 23

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

§

Umax = 24

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

§

AvgRound = 25

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

§

UaddSat = 26

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

§

SaddSat = 27

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

§

UsubSat = 28

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

§

SsubSat = 29

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

§

Load = 30

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

§

Store = 31

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

§

Uload8 = 32

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

§

Sload8 = 33

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

§

Istore8 = 34

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

§

Uload16 = 35

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

§

Sload16 = 36

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

§

Istore16 = 37

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

§

Uload32 = 38

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

§

Sload32 = 39

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

§

Istore32 = 40

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

§

StackSwitch = 41

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

§

Uload8x8 = 42

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

§

Sload8x8 = 43

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

§

Uload16x4 = 44

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

§

Sload16x4 = 45

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

§

Uload32x2 = 46

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

§

Sload32x2 = 47

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

§

StackAddr = 48

addr = stack_addr SS, Offset. (StackAddr)

§

DynamicStackAddr = 49

addr = dynamic_stack_addr DSS. (DynamicStackAddr)

§

SymbolValue = 50

a = symbol_value GV. (UnaryGlobalValue)

§

TlsValue = 51

a = tls_value GV. (UnaryGlobalValue)

§

GetPinnedReg = 52

addr = get_pinned_reg. (NullAry)

§

SetPinnedReg = 53

set_pinned_reg addr. (Unary) Type inferred from addr.

§

GetFramePointer = 54

addr = get_frame_pointer. (NullAry)

§

GetStackPointer = 55

addr = get_stack_pointer. (NullAry)

§

GetReturnAddress = 56

addr = get_return_address. (NullAry)

§

GetExceptionHandlerAddress = 57

addr = get_exception_handler_address block, index. (ExceptionHandlerAddress)

§

Iconst = 58

a = iconst N. (UnaryImm)

§

F16const = 59

a = f16const N. (UnaryIeee16)

§

F32const = 60

a = f32const N. (UnaryIeee32)

§

F64const = 61

a = f64const N. (UnaryIeee64)

§

F128const = 62

a = f128const N. (UnaryConst)

§

Vconst = 63

a = vconst N. (UnaryConst)

§

Shuffle = 64

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

§

Nop = 65

nop. (NullAry)

§

Select = 66

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

§

SelectSpectreGuard = 67

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

§

Bitselect = 68

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

§

Blendv = 69

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

§

VanyTrue = 70

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

§

VallTrue = 71

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

§

VhighBits = 72

x = vhigh_bits a. (Unary)

§

Icmp = 73

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

§

Iadd = 74

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

§

Isub = 75

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

§

Ineg = 76

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

§

Iabs = 77

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

§

Imul = 78

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

§

Umulhi = 79

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

§

Smulhi = 80

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

§

SqmulRoundSat = 81

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

§

X86Pmulhrsw = 82

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

§

Udiv = 83

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

§

Sdiv = 84

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

§

Urem = 85

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

§

Srem = 86

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

§

SaddOverflowCin = 87

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

§

UaddOverflowCin = 88

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

§

UaddOverflow = 89

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

§

SaddOverflow = 90

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

§

UsubOverflow = 91

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

§

SsubOverflow = 92

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

§

UmulOverflow = 93

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

§

SmulOverflow = 94

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

§

UaddOverflowTrap = 95

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

§

SsubOverflowBin = 96

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

§

UsubOverflowBin = 97

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

§

Band = 98

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

§

Bor = 99

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

§

Bxor = 100

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

§

Bnot = 101

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

§

Rotl = 102

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

§

Rotr = 103

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

§

Ishl = 104

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

§

Ushr = 105

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

§

Sshr = 106

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

§

Bitrev = 107

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

§

Clz = 108

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

§

Cls = 109

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

§

Ctz = 110

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

§

Bswap = 111

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

§

Popcnt = 112

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

§

Fcmp = 113

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

§

Fadd = 114

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

§

Fsub = 115

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

§

Fmul = 116

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

§

Fdiv = 117

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

§

Sqrt = 118

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

§

Fma = 119

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

§

Fneg = 120

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

§

Fabs = 121

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

§

Fcopysign = 122

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

§

Fmin = 123

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

§

Fmax = 124

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

§

Ceil = 125

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

§

Floor = 126

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

§

Trunc = 127

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

§

Nearest = 128

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

§

Bitcast = 129

a = bitcast MemFlags, x. (LoadNoOffset)

§

ScalarToVector = 130

a = scalar_to_vector s. (Unary)

§

Bmask = 131

a = bmask x. (Unary)

§

Ireduce = 132

a = ireduce x. (Unary)

§

Snarrow = 133

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

§

Unarrow = 134

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

§

Uunarrow = 135

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

§

SwidenLow = 136

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

§

SwidenHigh = 137

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

§

UwidenLow = 138

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

§

UwidenHigh = 139

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

§

IaddPairwise = 140

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

§

X86Pmaddubsw = 141

a = x86_pmaddubsw x, y. (Binary)

§

Uextend = 142

a = uextend x. (Unary)

§

Sextend = 143

a = sextend x. (Unary)

§

Fpromote = 144

a = fpromote x. (Unary)

§

Fdemote = 145

a = fdemote x. (Unary)

§

Fvdemote = 146

a = fvdemote x. (Unary)

§

FvpromoteLow = 147

x = fvpromote_low a. (Unary)

§

FcvtToUint = 148

a = fcvt_to_uint x. (Unary)

§

FcvtToSint = 149

a = fcvt_to_sint x. (Unary)

§

FcvtToUintSat = 150

a = fcvt_to_uint_sat x. (Unary)

§

FcvtToSintSat = 151

a = fcvt_to_sint_sat x. (Unary)

§

X86Cvtt2dq = 152

a = x86_cvtt2dq x. (Unary)

§

FcvtFromUint = 153

a = fcvt_from_uint x. (Unary)

§

FcvtFromSint = 154

a = fcvt_from_sint x. (Unary)

§

Isplit = 155

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

§

Iconcat = 156

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

§

AtomicRmw = 157

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

§

AtomicCas = 158

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

§

AtomicLoad = 159

a = atomic_load MemFlags, p. (LoadNoOffset)

§

AtomicStore = 160

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

§

Fence = 161

fence. (NullAry)

§

ExtractVector = 162

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

§

SequencePoint = 163

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) -> Opcode

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

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: &Opcode) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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 Serialize for Opcode

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 = 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.