pub struct RewriterBase<'c, 'a> { /* private fields */ }Expand description
A non-owning reference to a rewriter base.
Implementations§
Source§impl<'c, 'a> RewriterBase<'c, 'a>
impl<'c, 'a> RewriterBase<'c, 'a>
Sourcepub unsafe fn from_raw(raw: MlirRewriterBase) -> Self
pub unsafe fn from_raw(raw: MlirRewriterBase) -> Self
Sourcepub fn context(&self) -> ContextRef<'c>
pub fn context(&self) -> ContextRef<'c>
Returns the context.
Sourcepub fn clear_insertion_point(&self)
pub fn clear_insertion_point(&self)
Clears the insertion point.
Sourcepub fn set_insertion_point_before(&self, op: OperationRef<'_, '_>)
pub fn set_insertion_point_before(&self, op: OperationRef<'_, '_>)
Sets the insertion point before the given operation.
Sourcepub fn set_insertion_point_after(&self, op: OperationRef<'_, '_>)
pub fn set_insertion_point_after(&self, op: OperationRef<'_, '_>)
Sets the insertion point after the given operation.
Sourcepub fn set_insertion_point_to_start(&self, block: BlockRef<'_, '_>)
pub fn set_insertion_point_to_start(&self, block: BlockRef<'_, '_>)
Sets the insertion point to the start of the given block.
Sourcepub fn set_insertion_point_to_end(&self, block: BlockRef<'_, '_>)
pub fn set_insertion_point_to_end(&self, block: BlockRef<'_, '_>)
Sets the insertion point to the end of the given block.
Sourcepub fn insertion_block(&self) -> BlockRef<'c, '_>
pub fn insertion_block(&self) -> BlockRef<'c, '_>
Returns the block the insertion point belongs to.
Sourcepub fn insert(&self, op: Operation<'c>) -> OperationRef<'c, '_>
pub fn insert(&self, op: Operation<'c>) -> OperationRef<'c, '_>
Inserts the operation at the current insertion point and returns a reference to it.
Sourcepub fn clone_op<'b>(&self, op: OperationRef<'c, 'b>) -> OperationRef<'c, 'b>
pub fn clone_op<'b>(&self, op: OperationRef<'c, 'b>) -> OperationRef<'c, 'b>
Creates a deep copy of the operation.
Sourcepub fn clone_op_without_regions<'b>(
&self,
op: OperationRef<'c, 'b>,
) -> OperationRef<'c, 'b>
pub fn clone_op_without_regions<'b>( &self, op: OperationRef<'c, 'b>, ) -> OperationRef<'c, 'b>
Creates a deep copy of the operation without its regions.
Sourcepub fn clone_region_before(
&self,
region: RegionRef<'_, '_>,
before: BlockRef<'_, '_>,
)
pub fn clone_region_before( &self, region: RegionRef<'_, '_>, before: BlockRef<'_, '_>, )
Clones the blocks of the region before the given block.
Sourcepub fn inline_region_before(
&self,
region: RegionRef<'_, '_>,
before: BlockRef<'_, '_>,
)
pub fn inline_region_before( &self, region: RegionRef<'_, '_>, before: BlockRef<'_, '_>, )
Moves the blocks of the region before the given block.
Sourcepub fn replace_op_with_values(
&self,
op: OperationRef<'_, '_>,
values: &[Value<'_, '_>],
)
pub fn replace_op_with_values( &self, op: OperationRef<'_, '_>, values: &[Value<'_, '_>], )
Replaces the results of the operation with the given values. Erases the op.
Sourcepub fn replace_op_with_operation(
&self,
op: OperationRef<'_, '_>,
new_op: OperationRef<'_, '_>,
)
pub fn replace_op_with_operation( &self, op: OperationRef<'_, '_>, new_op: OperationRef<'_, '_>, )
Replaces the operation with another operation. Erases the original op.
Sourcepub fn erase_op(&self, op: OperationRef<'_, '_>)
pub fn erase_op(&self, op: OperationRef<'_, '_>)
Erases the operation. The operation must have no uses.
Sourcepub fn erase_block(&self, block: BlockRef<'_, '_>)
pub fn erase_block(&self, block: BlockRef<'_, '_>)
Erases the block along with all its operations.
Sourcepub fn move_op_before(
&self,
op: OperationRef<'_, '_>,
existing_op: OperationRef<'_, '_>,
)
pub fn move_op_before( &self, op: OperationRef<'_, '_>, existing_op: OperationRef<'_, '_>, )
Moves the operation immediately before the existing operation.
Sourcepub fn move_op_after(
&self,
op: OperationRef<'_, '_>,
existing_op: OperationRef<'_, '_>,
)
pub fn move_op_after( &self, op: OperationRef<'_, '_>, existing_op: OperationRef<'_, '_>, )
Moves the operation immediately after the existing operation.
Sourcepub fn move_block_before(
&self,
block: BlockRef<'_, '_>,
existing_block: BlockRef<'_, '_>,
)
pub fn move_block_before( &self, block: BlockRef<'_, '_>, existing_block: BlockRef<'_, '_>, )
Moves the block immediately before the existing block.
Sourcepub fn start_op_modification(&self, op: OperationRef<'_, '_>)
pub fn start_op_modification(&self, op: OperationRef<'_, '_>)
Signals the start of an in-place modification of the operation.
Sourcepub fn finalize_op_modification(&self, op: OperationRef<'_, '_>)
pub fn finalize_op_modification(&self, op: OperationRef<'_, '_>)
Signals the end of an in-place modification of the operation.
Sourcepub fn cancel_op_modification(&self, op: OperationRef<'_, '_>)
pub fn cancel_op_modification(&self, op: OperationRef<'_, '_>)
Cancels a pending in-place modification of the operation.
Sourcepub fn replace_all_uses_with(&self, from: Value<'_, '_>, to: Value<'_, '_>)
pub fn replace_all_uses_with(&self, from: Value<'_, '_>, to: Value<'_, '_>)
Replaces all uses of from with to.
Sourcepub fn set_insertion_point_after_value(&self, value: Value<'_, '_>)
pub fn set_insertion_point_after_value(&self, value: Value<'_, '_>)
Sets the insertion point right after the definition of the given value.
Sourcepub fn operation_after_insertion(&self) -> Option<OperationRef<'c, '_>>
pub fn operation_after_insertion(&self) -> Option<OperationRef<'c, '_>>
Returns the operation right after the insertion point, if any.
Sourcepub fn create_block_before(
&self,
before: BlockRef<'_, '_>,
arguments: &[(Type<'c>, Location<'c>)],
) -> BlockRef<'c, '_>
pub fn create_block_before( &self, before: BlockRef<'_, '_>, arguments: &[(Type<'c>, Location<'c>)], ) -> BlockRef<'c, '_>
Creates a block with the given arguments before the given block.
Sourcepub fn inline_block_before(
&self,
source: BlockRef<'_, '_>,
op: OperationRef<'_, '_>,
values: &[Value<'_, '_>],
)
pub fn inline_block_before( &self, source: BlockRef<'_, '_>, op: OperationRef<'_, '_>, values: &[Value<'_, '_>], )
Inlines the source block before the given operation and erases it, replacing its arguments with the given values.
Sourcepub fn merge_blocks(
&self,
source: BlockRef<'_, '_>,
destination: BlockRef<'_, '_>,
values: &[Value<'_, '_>],
)
pub fn merge_blocks( &self, source: BlockRef<'_, '_>, destination: BlockRef<'_, '_>, values: &[Value<'_, '_>], )
Inlines the source block at the end of the destination block and erases it, replacing its arguments with the given values.
Sourcepub fn replace_all_value_range_uses_with(
&self,
from: &[Value<'_, '_>],
to: &[Value<'_, '_>],
) -> Result<(), Error>
pub fn replace_all_value_range_uses_with( &self, from: &[Value<'_, '_>], to: &[Value<'_, '_>], ) -> Result<(), Error>
Replaces all uses of the from values with the corresponding to
values.
Sourcepub fn replace_all_op_uses_with_values(
&self,
from: OperationRef<'_, '_>,
to: &[Value<'_, '_>],
)
pub fn replace_all_op_uses_with_values( &self, from: OperationRef<'_, '_>, to: &[Value<'_, '_>], )
Replaces all uses of the operation results with the given values.
Sourcepub fn replace_all_op_uses_with_operation(
&self,
from: OperationRef<'_, '_>,
to: OperationRef<'_, '_>,
)
pub fn replace_all_op_uses_with_operation( &self, from: OperationRef<'_, '_>, to: OperationRef<'_, '_>, )
Replaces all uses of the results of an operation with the results of another.
Sourcepub fn replace_op_uses_within_block(
&self,
op: OperationRef<'_, '_>,
values: &[Value<'_, '_>],
block: BlockRef<'_, '_>,
)
pub fn replace_op_uses_within_block( &self, op: OperationRef<'_, '_>, values: &[Value<'_, '_>], block: BlockRef<'_, '_>, )
Replaces uses of the operation results with the given values within a block.
Sourcepub fn replace_all_uses_except(
&self,
from: Value<'_, '_>,
to: Value<'_, '_>,
excepted_user: OperationRef<'_, '_>,
)
pub fn replace_all_uses_except( &self, from: Value<'_, '_>, to: Value<'_, '_>, excepted_user: OperationRef<'_, '_>, )
Replaces all uses of from with to, except uses by the excepted
operation.
Trait Implementations§
Source§impl<'c, 'a> Clone for RewriterBase<'c, 'a>
impl<'c, 'a> Clone for RewriterBase<'c, 'a>
Source§fn clone(&self) -> RewriterBase<'c, 'a>
fn clone(&self) -> RewriterBase<'c, 'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more