Skip to main content

Op

Enum Op 

Source
pub enum Op {
Show 23 variants Binary { op: BinaryOp, lhs: ValueId, rhs: ValueId, }, Cast { op: CastOp, value: ValueId, }, Compare { predicate: u64, lhs: ValueId, rhs: ValueId, }, Select { condition: ValueId, then: ValueId, otherwise: ValueId, }, ExtractValue { aggregate: ValueId, indices: Vec<u64>, }, InsertValue { aggregate: ValueId, value: ValueId, indices: Vec<u64>, }, ExtractElement { vector: ValueId, index: ValueId, }, InsertElement { vector: ValueId, value: ValueId, index: ValueId, }, ShuffleVector { first: ValueId, second: ValueId, mask: ValueId, }, Call { function: ValueId, args: Vec<ValueId>, attributes: Option<usize>, calling_conv: u64, tail: TailCall, }, Phi { incoming: Vec<(ValueId, usize)>, }, Return(Option<ValueId>), Branch { target: usize, }, CondBranch { condition: ValueId, then: usize, otherwise: usize, }, Switch { value: ValueId, default: usize, cases: Vec<(ValueId, usize)>, }, Unreachable, Alloca { ty: TypeId, size: ValueId, align: u64, inalloca: bool, }, Load { pointer: ValueId, align: u64, volatile: bool, atomic: Option<Atomic>, }, Store { pointer: ValueId, value: ValueId, align: u64, volatile: bool, atomic: Option<Atomic>, }, Gep { base: ValueId, indices: Vec<ValueId>, source: TypeId, inbounds: bool, }, AtomicRmw { pointer: ValueId, value: ValueId, op: u64, volatile: bool, atomic: Atomic, }, CmpXchg { pointer: ValueId, compare: ValueId, value: ValueId, volatile: bool, weak: bool, success: Atomic, failure: Ordering, }, Fence(Atomic),
}
Expand description

An instruction, with the value ids (absolute) and block numbers it names.

Variants§

§

Binary

Integer opcodes apply to integers; for floating types Add, Sub, Mul, (S)Div, (S)Rem are the float forms.

Fields

§op: BinaryOp

The operation.

§lhs: ValueId

The left operand.

§rhs: ValueId

The right operand.

§

Cast

A conversion.

Fields

§op: CastOp

The conversion.

§value: ValueId

The value converted; the instruction’s result type is the target.

§

Compare

A comparison by its LLVM predicate (0..15 float, 32..41 integer).

Fields

§predicate: u64

The predicate.

§lhs: ValueId

The left operand.

§rhs: ValueId

The right operand.

§

Select

select: one of two values by a condition.

Fields

§condition: ValueId

The condition (an i1).

§then: ValueId

The value when the condition is true.

§otherwise: ValueId

The value when it is false.

§

ExtractValue

A field or element of an aggregate.

Fields

§aggregate: ValueId

The aggregate.

§indices: Vec<u64>

The indices into it, outermost first.

§

InsertValue

An aggregate with one field or element replaced.

Fields

§aggregate: ValueId

The aggregate.

§value: ValueId

The new field or element.

§indices: Vec<u64>

The indices of the replaced one, outermost first.

§

ExtractElement

One lane of a vector.

Fields

§vector: ValueId

The vector.

§index: ValueId

The lane number.

§

InsertElement

A vector with one lane replaced.

Fields

§vector: ValueId

The vector.

§value: ValueId

The new lane.

§index: ValueId

The lane number.

§

ShuffleVector

The lanes of two vectors the mask (a constant vector of lane numbers) picks.

Fields

§first: ValueId

The first vector.

§second: ValueId

The second vector.

§mask: ValueId

The constant vector of lane numbers.

§

Call

A call.

Fields

§function: ValueId

The callee.

§args: Vec<ValueId>

The arguments, one per parameter.

§attributes: Option<usize>

The attribute list of the call site (an index into Module::attribute_lists), where it names one.

§calling_conv: u64

The calling convention (0 is C’s).

§tail: TailCall

Whether it is marked a tail call.

§

Phi

The value from the predecessor block control came from: (value, block) pairs.

Fields

§incoming: Vec<(ValueId, usize)>

The (value, predecessor block) pairs.

§

Return(Option<ValueId>)

ret, with the value returned where there is one.

§

Branch

An unconditional branch.

Fields

§target: usize

The block branched to.

§

CondBranch

A conditional branch.

Fields

§condition: ValueId

The condition (an i1).

§then: usize

The block when it is true.

§otherwise: usize

The block when it is false.

§

Switch

A multi-way branch: the value, the default block and the (case constant, block) pairs.

Fields

§value: ValueId

The value switched on.

§default: usize

The block when no case matches.

§cases: Vec<(ValueId, usize)>

The (case constant, block) pairs.

§

Unreachable

unreachable.

§

Alloca

A local variable of this type (the result is a pointer to it).

Fields

§ty: TypeId

The type of the variable.

§size: ValueId

The number of variables (an integer value; the compilers write the constant i32 1).

§align: u64

The alignment in bytes; 0 where the record states none.

§inalloca: bool

The variable is an argument passed in memory (inalloca).

§

Load

A load.

Fields

§pointer: ValueId

The pointer loaded from; the result type is the loaded type.

§align: u64

The alignment in bytes; 0 where the record states none.

§volatile: bool

volatile.

§atomic: Option<Atomic>

The ordering of an atomic load (FUNC_CODE_INST_LOADATOMIC).

§

Store

A store.

Fields

§pointer: ValueId

The pointer stored to.

§value: ValueId

The value stored.

§align: u64

The alignment in bytes; 0 where the record states none.

§volatile: bool

volatile.

§atomic: Option<Atomic>

The ordering of an atomic store (FUNC_CODE_INST_STOREATOMIC).

§

Gep

getelementptr: the base pointer and its indices (the first steps over the pointer itself).

Fields

§base: ValueId

The base pointer.

§indices: Vec<ValueId>

The indices.

§source: TypeId

The type the first index steps over: the base’s pointee, which the record states.

§inbounds: bool

inbounds.

§

AtomicRmw

atomicrmw: the operation (LLVM’s code: 0 xchg, 1 add, 2 sub, 3 and, 4 nand, 5 or, 6 xor, 7 max, 8 min, 9 umax, 10 umin); the result is the value the pointer held.

Fields

§pointer: ValueId

The pointer.

§value: ValueId

The value operated with.

§op: u64

The operation code.

§volatile: bool

volatile.

§atomic: Atomic

Its ordering.

§

CmpXchg

cmpxchg: the result is the pair (the value the pointer held, whether it was swapped).

Fields

§pointer: ValueId

The pointer.

§compare: ValueId

The value compared with.

§value: ValueId

The new value stored where the comparison holds.

§volatile: bool

volatile.

§weak: bool

weak: it may fail even where the comparison holds.

§success: Atomic

The ordering where it swaps, and the scope of both.

§failure: Ordering

The ordering where it does not.

§

Fence(Atomic)

fence: ordering between invocations, which a lockstep reading does not have.

Implementations§

Source§

impl Op

Source

pub fn operands(&self) -> Vec<ValueId> ⓘ

The values the operation reads (a call’s arguments, not its callee; a phi’s incoming values).

Source

pub fn blocks(&self) -> Vec<usize>

The basic blocks the operation names (a branch’s targets, a phi’s predecessors).

Trait Implementations§

Source§

impl Clone for Op

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 Debug for Op

Source§

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

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

impl PartialEq for Op

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 StructuralPartialEq for Op

Auto Trait Implementations§

§

impl Forget for Op

§

impl Freeze for Op

§

impl RefUnwindSafe for Op

§

impl Send for Op

§

impl Sync for Op

§

impl Unpin for Op

§

impl UnsafeUnpin for Op

§

impl UnwindSafe for Op

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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

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.