pub struct GEPOperation<'c> { /* private fields */ }
Expand description

A getelementptr operation.

This operation mirrors LLVM IRs ‘getelementptr’ operation that is used to perform pointer arithmetic.

Like in LLVM IR, it is possible to use both constants as well as SSA values as indices. In the case of indexing within a structure, it is required to either use constant indices directly, or supply a constant SSA value.

An optional ‘inbounds’ attribute specifies the low-level pointer arithmetic overflow behavior that LLVM uses after lowering the operation to LLVM IR.

Examples:

// GEP with an SSA value offset
%0 = llvm.getelementptr %1[%2] : (!llvm.ptr<f32>, i64) -> !llvm.ptr<f32>

// GEP with a constant offset and the inbounds attribute set
%0 = llvm.getelementptr inbounds %1[3] : (!llvm.ptr<f32>) -> !llvm.ptr<f32>

// GEP with constant offsets into a structure
%0 = llvm.getelementptr %1[0, 1]
   : (!llvm.ptr<struct(i32, f32)>) -> !llvm.ptr<f32>

Implementations§

source§

impl<'c> GEPOperation<'c>

source

pub fn name() -> &'static str

Returns a name.

source

pub fn as_operation(&self) -> &Operation<'c>

Returns a generic operation.

source

pub fn builder( context: &'c Context, location: Location<'c> ) -> GEPOperationBuilder<'c, Unset, Unset, Unset, Unset>

Creates a builder.

source

pub fn res(&self) -> Result<OperationResult<'c, '_>, Error>

source

pub fn base(&self) -> Result<Value<'c, '_>, Error>

source

pub fn dynamic_indices(&self) -> impl Iterator<Item = Value<'c, '_>>

source

pub fn raw_constant_indices(&self) -> Result<DenseI32ArrayAttribute<'c>, Error>

source

pub fn set_raw_constant_indices(&mut self, value: DenseI32ArrayAttribute<'c>)

source

pub fn elem_type(&self) -> Result<TypeAttribute<'c>, Error>

source

pub fn set_elem_type(&mut self, value: TypeAttribute<'c>)

source

pub fn remove_elem_type(&mut self) -> Result<(), Error>

source

pub fn inbounds(&self) -> Result<Attribute<'c>, Error>

source

pub fn set_inbounds(&mut self, value: Attribute<'c>)

source

pub fn remove_inbounds(&mut self) -> Result<(), Error>

Trait Implementations§

source§

impl<'c> From<GEPOperation<'c>> for Operation<'c>

source§

fn from(operation: GEPOperation<'c>) -> Self

Converts to this type from the input type.
source§

impl<'c> TryFrom<Operation<'c>> for GEPOperation<'c>

§

type Error = Error

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

fn try_from(operation: Operation<'c>) -> Result<Self, Self::Error>

Performs the conversion.

Auto Trait Implementations§

§

impl<'c> RefUnwindSafe for GEPOperation<'c>

§

impl<'c> !Send for GEPOperation<'c>

§

impl<'c> !Sync for GEPOperation<'c>

§

impl<'c> Unpin for GEPOperation<'c>

§

impl<'c> UnwindSafe for GEPOperation<'c>

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

§

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>,

§

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.