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>
impl<'c> GEPOperation<'c>
sourcepub fn as_operation(&self) -> &Operation<'c>
pub fn as_operation(&self) -> &Operation<'c>
Returns a generic operation.
sourcepub fn builder(
context: &'c Context,
location: Location<'c>
) -> GEPOperationBuilder<'c, Unset, Unset, Unset, Unset>
pub fn builder( context: &'c Context, location: Location<'c> ) -> GEPOperationBuilder<'c, Unset, Unset, Unset, Unset>
Creates a builder.
pub fn res(&self) -> Result<OperationResult<'c, '_>, Error>
pub fn base(&self) -> Result<Value<'c, '_>, Error>
pub fn dynamic_indices(&self) -> impl Iterator<Item = Value<'c, '_>>
pub fn raw_constant_indices(&self) -> Result<DenseI32ArrayAttribute<'c>, Error>
pub fn set_raw_constant_indices(&mut self, value: DenseI32ArrayAttribute<'c>)
pub fn elem_type(&self) -> Result<TypeAttribute<'c>, Error>
pub fn set_elem_type(&mut self, value: TypeAttribute<'c>)
pub fn remove_elem_type(&mut self) -> Result<(), Error>
pub fn inbounds(&self) -> Result<Attribute<'c>, Error>
pub fn set_inbounds(&mut self, value: Attribute<'c>)
pub fn remove_inbounds(&mut self) -> Result<(), Error>
Trait Implementations§
source§impl<'c> From<GEPOperation<'c>> for Operation<'c>
impl<'c> From<GEPOperation<'c>> for Operation<'c>
source§fn from(operation: GEPOperation<'c>) -> Self
fn from(operation: GEPOperation<'c>) -> Self
Converts to this type from the input type.
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more