Struct melior::ir::block::Block

source ·
pub struct Block<'c> { /* private fields */ }
Expand description

A block.

Implementations§

source§

impl<'c> Block<'c>

source

pub fn new(arguments: &[(Type<'c>, Location<'c>)]) -> Self

Creates a block.

source

pub fn argument(&self, index: usize) -> Result<BlockArgument<'c, '_>, Error>

Returns an argument at a position.

source

pub fn argument_count(&self) -> usize

Returns a number of arguments.

source

pub fn first_operation(&self) -> Option<OperationRef<'c, '_>>

Returns a reference to the first operation.

source

pub fn first_operation_mut(&mut self) -> Option<OperationRefMut<'c, '_>>

Returns a mutable reference to the first operation.

source

pub fn terminator(&self) -> Option<OperationRef<'c, '_>>

Returns a reference to a terminator operation.

source

pub fn terminator_mut(&mut self) -> Option<OperationRefMut<'c, '_>>

Returns a mutable reference to a terminator operation.

source

pub fn parent_region(&self) -> Option<RegionRef<'c, '_>>

Returns a parent region.

source

pub fn parent_operation(&self) -> Option<OperationRef<'c, '_>>

Returns a parent operation.

source

pub fn add_argument( &self, type: Type<'c>, location: Location<'c> ) -> Value<'c, '_>

Adds an argument.

source

pub fn append_operation(&self, operation: Operation<'c>) -> OperationRef<'c, '_>

Appends an operation.

source

pub fn insert_operation( &self, position: usize, operation: Operation<'c> ) -> OperationRef<'c, '_>

Inserts an operation.

source

pub fn insert_operation_after( &self, one: OperationRef<'c, '_>, other: Operation<'c> ) -> OperationRef<'c, '_>

Inserts an operation after another.

source

pub fn insert_operation_before( &self, one: OperationRef<'c, '_>, other: Operation<'c> ) -> OperationRef<'c, '_>

Inserts an operation before another.

source

pub unsafe fn detach(&self) -> Option<Block<'c>>

Detaches a block from a region and assumes its ownership.

§Safety

This function might invalidate existing references to the block if you drop it too early.

source

pub fn next_in_region(&self) -> Option<BlockRef<'c, '_>>

Returns a next block in a region.

source

pub unsafe fn from_raw(raw: MlirBlock) -> Self

Creates a block from a raw object.

§Safety

A raw object must be valid.

source

pub fn into_raw(self) -> MlirBlock

Converts a block into a raw object.

source

pub const fn to_raw(&self) -> MlirBlock

Converts a block into a raw object.

Trait Implementations§

source§

impl<'c> Debug for Block<'c>

source§

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

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

impl<'c> Display for Block<'c>

source§

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

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

impl<'c> Drop for Block<'c>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl<'c> PartialEq for Block<'c>

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'c> Eq for Block<'c>

Auto Trait Implementations§

§

impl<'c> RefUnwindSafe for Block<'c>

§

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

§

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

§

impl<'c> Unpin for Block<'c>

§

impl<'c> UnwindSafe for Block<'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> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
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.