Block

Struct 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 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 unsafe fn from_raw(raw: MlirBlock) -> Self

Creates a block from a raw object.

§Safety

A raw object must be valid.

Source

pub const 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> ArithBlockExt<'c> for Block<'c>

Source§

fn addi( &self, lhs: Value<'c, '_>, rhs: Value<'c, '_>, location: Location<'c>, ) -> Result<Value<'c, '_>, Error>

Creates an arith.addi operation.
Source§

fn andi( &self, lhs: Value<'c, '_>, rhs: Value<'c, '_>, location: Location<'c>, ) -> Result<Value<'c, '_>, Error>

Creates an arith.andi operation.
Source§

fn divsi( &self, lhs: Value<'c, '_>, rhs: Value<'c, '_>, location: Location<'c>, ) -> Result<Value<'c, '_>, Error>

Creates an arith.divsi operation.
Source§

fn divui( &self, lhs: Value<'c, '_>, rhs: Value<'c, '_>, location: Location<'c>, ) -> Result<Value<'c, '_>, Error>

Creates an arith.divui operation.
Source§

fn muli( &self, lhs: Value<'c, '_>, rhs: Value<'c, '_>, location: Location<'c>, ) -> Result<Value<'c, '_>, Error>

Creates an arith.muli operation.
Source§

fn ori( &self, lhs: Value<'c, '_>, rhs: Value<'c, '_>, location: Location<'c>, ) -> Result<Value<'c, '_>, Error>

Creates an arith.ori operation.
Source§

fn shli( &self, lhs: Value<'c, '_>, rhs: Value<'c, '_>, location: Location<'c>, ) -> Result<Value<'c, '_>, Error>

Creates an arith.shli operation.
Source§

fn shrsi( &self, lhs: Value<'c, '_>, rhs: Value<'c, '_>, location: Location<'c>, ) -> Result<Value<'c, '_>, Error>

Creates an arith.shrsi operation.
Source§

fn shrui( &self, lhs: Value<'c, '_>, rhs: Value<'c, '_>, location: Location<'c>, ) -> Result<Value<'c, '_>, Error>

Creates an arith.shrui operation.
Source§

fn subi( &self, lhs: Value<'c, '_>, rhs: Value<'c, '_>, location: Location<'c>, ) -> Result<Value<'c, '_>, Error>

Creates an arith.subi operation.
Source§

fn xori( &self, lhs: Value<'c, '_>, rhs: Value<'c, '_>, location: Location<'c>, ) -> Result<Value<'c, '_>, Error>

Creates an arith.xori operation.
Source§

fn cmpi( &self, context: &'c Context, predicate: CmpiPredicate, lhs: Value<'c, '_>, rhs: Value<'c, '_>, location: Location<'c>, ) -> Result<Value<'c, '_>, Error>

Creates an arith.cmpi operation.
Source§

fn extsi( &self, value: Value<'c, '_>, target_type: Type<'c>, location: Location<'c>, ) -> Result<Value<'c, '_>, Error>

Creates an arith.extui operation.
Source§

fn extui( &self, value: Value<'c, '_>, target_type: Type<'c>, location: Location<'c>, ) -> Result<Value<'c, '_>, Error>

Creates an arith.extui operation.
Source§

fn trunci( &self, value: Value<'c, '_>, target_type: Type<'c>, location: Location<'c>, ) -> Result<Value<'c, '_>, Error>

Creates an arith.extui operation.
Source§

fn const_int( &self, context: &'c Context, location: Location<'c>, value: impl Display, bits: u32, ) -> Result<Value<'c, '_>, Error>

Creates a constant of the given integer bit width.
Source§

fn const_int_from_type( &self, context: &'c Context, location: Location<'c>, value: impl Display, type: Type<'c>, ) -> Result<Value<'c, '_>, Error>

Creates a constant of the given integer type.
Source§

impl<'c: 'a, 'a> BlockLike<'c, 'a> for Block<'c>

Source§

fn to_raw(&self) -> MlirBlock

Converts a block into a raw object.
Source§

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

Returns an argument at a position.
Source§

fn argument_count(&self) -> usize

Returns a number of arguments.
Source§

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

Returns a reference to the first operation.
Source§

fn first_operation_mut(&self) -> Option<OperationRefMut<'c, 'a>>

Returns a mutable reference to the first operation.
Source§

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

Returns a reference to a terminator operation.
Source§

fn terminator_mut(&self) -> Option<OperationRefMut<'c, 'a>>

Returns a mutable reference to a terminator operation.
Source§

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

Returns a parent region.
Source§

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

Returns a parent operation.
Source§

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

Adds an argument.
Source§

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

Appends an operation.
Source§

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

Inserts an operation.
Source§

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

Inserts an operation after another.
Source§

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

Inserts an operation before another.
Source§

fn insert_argument( &self, index: usize, type: Type<'c>, location: Location<'c>, ) -> Value<'c, 'a>

Inserts an argument at the given position. Read more
Source§

unsafe fn erase_argument(&self, index: usize)

Erases the argument at the given position. Read more
Source§

fn successor_count(&self) -> usize

Returns the number of successors.
Source§

fn successor(&self, index: usize) -> Result<BlockRef<'c, 'a>, Error>

Returns a successor block at a position.
Source§

fn predecessor_count(&self) -> usize

Returns the number of predecessors.
Source§

fn predecessor(&self, index: usize) -> Result<BlockRef<'c, 'a>, Error>

Returns a predecessor block at a position.
Source§

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

Returns a next block in a region.
Source§

impl<'c> BuiltinBlockExt<'c> for Block<'c>

Source§

fn arg(&self, index: usize) -> Result<Value<'c, '_>, Error>

Returns a block argument as a value.
Source§

fn append_op_result( &self, operation: Operation<'c>, ) -> Result<Value<'c, '_>, Error>

Appends an operation and returns its first value.
Source§

impl Debug for Block<'_>

Source§

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

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

impl Display for Block<'_>

Source§

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

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

impl Drop for Block<'_>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<'c> LlvmBlockExt<'c> for Block<'c>

Source§

fn extract_value( &self, context: &'c Context, location: Location<'c>, container: Value<'c, '_>, value_type: Type<'c>, index: usize, ) -> Result<Value<'c, '_>, Error>

Creates an llvm.extractvalue operation.
Source§

fn insert_value( &self, context: &'c Context, location: Location<'c>, container: Value<'c, '_>, value: Value<'c, '_>, index: usize, ) -> Result<Value<'c, '_>, Error>

Creates an llvm.insertvalue operation.
Source§

fn insert_values<'block>( &'block self, context: &'c Context, location: Location<'c>, container: Value<'c, 'block>, values: &[Value<'c, 'block>], ) -> Result<Value<'c, 'block>, Error>

Creates an llvm.insertvalue operation that insert multiple elements into an aggregate from the first index.
Source§

fn store( &self, context: &'c Context, location: Location<'c>, addr: Value<'c, '_>, value: Value<'c, '_>, ) -> Result<(), Error>

Creates an llvm.store operation.
Source§

fn load( &self, context: &'c Context, location: Location<'c>, addr: Value<'c, '_>, value_type: Type<'c>, ) -> Result<Value<'c, '_>, Error>

Creates an llvm.load operation.
Source§

fn memcpy( &self, context: &'c Context, location: Location<'c>, src: Value<'c, '_>, dst: Value<'c, '_>, len_bytes: Value<'c, '_>, )

Creates an llvm.memcpy operation.
Source§

fn alloca( &self, context: &'c Context, location: Location<'c>, element_type: Type<'c>, element_count: Value<'c, '_>, align: usize, ) -> Result<Value<'c, '_>, Error>

Creates an llvm.alloca operation.
Source§

fn alloca1( &self, context: &'c Context, location: Location<'c>, type: Type<'c>, align: usize, ) -> Result<Value<'c, '_>, Error>

Creates an llvm.alloca operation that allocates one element.
Source§

fn alloca_int( &self, context: &'c Context, location: Location<'c>, bits: u32, align: usize, ) -> Result<Value<'c, '_>, Error>

Creates an llvm.alloca operation that allocates one element of the given size of an integer.
Source§

fn gep( &self, context: &'c Context, location: Location<'c>, pointer: Value<'c, '_>, indexes: &[GepIndex<'c, '_>], element_type: Type<'c>, ) -> Result<Value<'c, '_>, Error>

Creates an llvm.getelementptr operation. Read more
Source§

impl PartialEq for Block<'_>

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for Block<'_>

Auto Trait Implementations§

§

impl<'c> Freeze for Block<'c>

§

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§

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

Source§

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

Source§

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.