pub struct OperandRef<'tcx, V> {
    pub val: OperandValue<V>,
    pub layout: TyAndLayout<'tcx>,
}
Expand description

An OperandRef is an “SSA” reference to a Rust value, along with its type.

NOTE: unless you know a value’s type exactly, you should not generate LLVM opcodes acting on it and instead act via methods, to avoid nasty edge cases. In particular, using Builder::store directly is sure to cause problems – use OperandRef::store instead.

Fields§

§val: OperandValue<V>

The value.

§layout: TyAndLayout<'tcx>

The layout of value, based on its Rust type.

Implementations§

source§

impl<'a, 'tcx, V: CodegenObject> OperandRef<'tcx, V>

source

pub fn new_zst<Bx: BuilderMethods<'a, 'tcx, Value = V>>(
    bx: &mut Bx,
    layout: TyAndLayout<'tcx>
) -> OperandRef<'tcx, V>

source

pub fn from_const<Bx: BuilderMethods<'a, 'tcx, Value = V>>(
    bx: &mut Bx,
    val: ConstValue<'tcx>,
    ty: Ty<'tcx>
) -> Self

source

pub fn immediate(self) -> V

Asserts that this operand refers to a scalar and returns a reference to its value.

source

pub fn deref<Cx: LayoutTypeMethods<'tcx>>(self, cx: &Cx) -> PlaceRef<'tcx, V>

source

pub fn immediate_or_packed_pair<Bx: BuilderMethods<'a, 'tcx, Value = V>>(
    self,
    bx: &mut Bx
) -> V

If this operand is a Pair, we return an aggregate with the two values. For other cases, see immediate.

source

pub fn from_immediate_or_packed_pair<Bx: BuilderMethods<'a, 'tcx, Value = V>>(
    bx: &mut Bx,
    llval: V,
    layout: TyAndLayout<'tcx>
) -> Self

If the type is a pair, we return a Pair, otherwise, an Immediate.

source

pub fn extract_field<Bx: BuilderMethods<'a, 'tcx, Value = V>>(
    &self,
    bx: &mut Bx,
    i: usize
) -> Self

Trait Implementations§

source§

impl<'tcx, V: Clone> Clone for OperandRef<'tcx, V>

source§

fn clone(&self) -> OperandRef<'tcx, V>

Returns a copy 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<V: CodegenObject> Debug for OperandRef<'_, V>

source§

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

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

impl<'tcx, V: Copy> Copy for OperandRef<'tcx, V>

Auto Trait Implementations§

§

impl<'tcx, V> !RefUnwindSafe for OperandRef<'tcx, V>

§

impl<'tcx, V> !Send for OperandRef<'tcx, V>

§

impl<'tcx, V> !Sync for OperandRef<'tcx, V>

§

impl<'tcx, V> Unpin for OperandRef<'tcx, V>where
    V: Unpin,

§

impl<'tcx, V> !UnwindSafe for OperandRef<'tcx, V>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere
    U: From<T>,

const: unstable · 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 Twhere
    T: Clone,

§

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

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere
    U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.

Layout§

Note: Unable to compute type layout, possibly due to this type having generic parameters. Layout can only be computed for concrete, fully-instantiated types.