Struct melior::ir::operation::OperationRef
source · pub struct OperationRef<'c, 'a> { /* private fields */ }
Expand description
A reference to an operation.
Implementations§
source§impl<'c, 'a> OperationRef<'c, 'a>
impl<'c, 'a> OperationRef<'c, 'a>
sourcepub fn result(self, index: usize) -> Result<OperationResult<'c, 'a>, Error>
pub fn result(self, index: usize) -> Result<OperationResult<'c, 'a>, Error>
Returns a result at a position.
sourcepub unsafe fn to_ref(&self) -> &'a Operation<'c>
pub unsafe fn to_ref(&self) -> &'a Operation<'c>
Returns an operation.
This function is different from deref
because the correct lifetime is
kept for the return type.
Safety
The returned reference is safe to use only in the lifetime scope of the operation reference.
sourcepub const fn to_raw(self) -> MlirOperation
pub const fn to_raw(self) -> MlirOperation
Converts an operation reference into a raw object.
sourcepub unsafe fn from_raw(raw: MlirOperation) -> Self
pub unsafe fn from_raw(raw: MlirOperation) -> Self
sourcepub unsafe fn from_option_raw(raw: MlirOperation) -> Option<Self>
pub unsafe fn from_option_raw(raw: MlirOperation) -> Option<Self>
Methods from Deref<Target = Operation<'c>>§
sourcepub fn context(&self) -> ContextRef<'c>
pub fn context(&self) -> ContextRef<'c>
Returns a context.
sourcepub fn name(&self) -> Identifier<'c>
pub fn name(&self) -> Identifier<'c>
Returns a name.
sourcepub fn operand_count(&self) -> usize
pub fn operand_count(&self) -> usize
Returns the number of operands.
sourcepub fn operand(&self, index: usize) -> Result<Value<'c, '_>, Error>
pub fn operand(&self, index: usize) -> Result<Value<'c, '_>, Error>
Returns the operand at a position.
sourcepub fn result_count(&self) -> usize
pub fn result_count(&self) -> usize
Returns the number of results.
sourcepub fn result(&self, index: usize) -> Result<OperationResult<'c, '_>, Error>
pub fn result(&self, index: usize) -> Result<OperationResult<'c, '_>, Error>
Returns a result at a position.
sourcepub fn results(&self) -> impl Iterator<Item = OperationResult<'c, '_>>
pub fn results(&self) -> impl Iterator<Item = OperationResult<'c, '_>>
Returns all results.
sourcepub fn region_count(&self) -> usize
pub fn region_count(&self) -> usize
Returns the number of regions.
sourcepub fn region(&self, index: usize) -> Result<RegionRef<'c, '_>, Error>
pub fn region(&self, index: usize) -> Result<RegionRef<'c, '_>, Error>
Returns a region at a position.
sourcepub fn successor_count(&self) -> usize
pub fn successor_count(&self) -> usize
Returns the number of successors.
sourcepub fn successor(&self, index: usize) -> Result<BlockRef<'c, '_>, Error>
pub fn successor(&self, index: usize) -> Result<BlockRef<'c, '_>, Error>
Returns a successor at a position.
sourcepub fn successors(&self) -> impl Iterator<Item = BlockRef<'c, '_>>
pub fn successors(&self) -> impl Iterator<Item = BlockRef<'c, '_>>
Returns all successors.
sourcepub fn attribute_count(&self) -> usize
pub fn attribute_count(&self) -> usize
Returns the number of attributes.
sourcepub fn attribute_at(
&self,
index: usize
) -> Result<(Identifier<'c>, Attribute<'c>), Error>
pub fn attribute_at( &self, index: usize ) -> Result<(Identifier<'c>, Attribute<'c>), Error>
Returns a attribute at a position.
sourcepub fn attributes(
&self
) -> impl Iterator<Item = (Identifier<'c>, Attribute<'c>)> + '_
pub fn attributes( &self ) -> impl Iterator<Item = (Identifier<'c>, Attribute<'c>)> + '_
Returns all attributes.
sourcepub fn attribute(&self, name: &str) -> Result<Attribute<'c>, Error>
pub fn attribute(&self, name: &str) -> Result<Attribute<'c>, Error>
Returns a attribute with the given name.
sourcepub fn has_attribute(&self, name: &str) -> bool
pub fn has_attribute(&self, name: &str) -> bool
Checks if the operation has a attribute with the given name.
sourcepub fn next_in_block(&self) -> Option<OperationRef<'c, '_>>
pub fn next_in_block(&self) -> Option<OperationRef<'c, '_>>
Returns a reference to the next operation in the same block.
sourcepub fn next_in_block_mut(&self) -> Option<OperationRefMut<'c, '_>>
pub fn next_in_block_mut(&self) -> Option<OperationRefMut<'c, '_>>
Returns a mutable reference to the next operation in the same block.
sourcepub fn previous_in_block(&self) -> Option<OperationRef<'c, '_>>
pub fn previous_in_block(&self) -> Option<OperationRef<'c, '_>>
Returns a reference to the next operation in the same block.
sourcepub fn parent_operation(&self) -> Option<OperationRef<'c, '_>>
pub fn parent_operation(&self) -> Option<OperationRef<'c, '_>>
Returns a reference to a parent operation.
sourcepub fn to_string_with_flags(
&self,
flags: OperationPrintingFlags
) -> Result<String, Error>
pub fn to_string_with_flags( &self, flags: OperationPrintingFlags ) -> Result<String, Error>
Prints an operation with flags.
Trait Implementations§
source§impl<'c, 'a> Clone for OperationRef<'c, 'a>
impl<'c, 'a> Clone for OperationRef<'c, 'a>
source§fn clone(&self) -> OperationRef<'c, 'a>
fn clone(&self) -> OperationRef<'c, 'a>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more