pub struct IRRewriter<L>where
L: RewriteListener,{ /* private fields */ }Expand description
An implementation of the rewriter trait. Use DummyListener if no listener is needed.
Implementations§
Source§impl<L> IRRewriter<L>where
L: RewriteListener,
impl<L> IRRewriter<L>where
L: RewriteListener,
Sourcepub fn set_listener(&mut self, listener: L)
pub fn set_listener(&mut self, listener: L)
Sets the listener for insertion events.
Sourcepub fn get_listener(&self) -> &L
pub fn get_listener(&self) -> &L
Gets a reference to the listener for insertion events.
Sourcepub fn get_listener_mut(&mut self) -> &mut L
pub fn get_listener_mut(&mut self) -> &mut L
Gets a mutable reference to the listener for insertion events.
Trait Implementations§
Source§impl<L> Default for IRRewriter<L>where
L: RewriteListener + Default,
impl<L> Default for IRRewriter<L>where
L: RewriteListener + Default,
Source§fn default() -> IRRewriter<L>
fn default() -> IRRewriter<L>
Returns the “default value” for a type. Read more
Source§impl<L> Inserter for IRRewriter<L>where
L: RewriteListener,
impl<L> Inserter for IRRewriter<L>where
L: RewriteListener,
Source§fn insert_operation(&mut self, ctx: &Context, operation: Ptr<Operation>)
fn insert_operation(&mut self, ctx: &Context, operation: Ptr<Operation>)
Inserts an Operation at the current insertion point.
To insert a sequence in-order, use append_operation.
Source§fn insert_block(
&mut self,
ctx: &Context,
insertion_point: BlockInsertionPoint,
block: Ptr<BasicBlock>,
)
fn insert_block( &mut self, ctx: &Context, insertion_point: BlockInsertionPoint, block: Ptr<BasicBlock>, )
Insert BasicBlock at the provided insertion point.
Source§fn create_block(
&mut self,
ctx: &mut Context,
insertion_point: BlockInsertionPoint,
label: Option<Identifier>,
arg_types: Vec<TypeHandle>,
) -> Ptr<BasicBlock>
fn create_block( &mut self, ctx: &mut Context, insertion_point: BlockInsertionPoint, label: Option<Identifier>, arg_types: Vec<TypeHandle>, ) -> Ptr<BasicBlock>
Create a new BasicBlock and insert it at the provided insertion point.
The internal OpInsertionPoint is updated to be at the end of the newly created block.
Source§fn get_insertion_point(&self) -> OpInsertionPoint
fn get_insertion_point(&self) -> OpInsertionPoint
Gets the current insertion point.
Source§fn get_insertion_block(&self, ctx: &Context) -> Option<Ptr<BasicBlock>>
fn get_insertion_block(&self, ctx: &Context) -> Option<Ptr<BasicBlock>>
Get the BasicBlock, if known, in which the next Op insertion will occur.
Source§fn set_insertion_point(&mut self, point: OpInsertionPoint)
fn set_insertion_point(&mut self, point: OpInsertionPoint)
Set the insertion point.
Source§fn is_insertion_point_set(&self) -> bool
fn is_insertion_point_set(&self) -> bool
Is insertion point set?
Source§fn set_insertion_point_to_block_start(&mut self, block: Ptr<BasicBlock>)
fn set_insertion_point_to_block_start(&mut self, block: Ptr<BasicBlock>)
Sets the insertion point to the start of the given block.
Source§fn set_insertion_point_to_block_end(&mut self, block: Ptr<BasicBlock>)
fn set_insertion_point_to_block_end(&mut self, block: Ptr<BasicBlock>)
Sets the insertion point to the end of the given block.
Source§fn set_insertion_point_after_operation(&mut self, op: Ptr<Operation>)
fn set_insertion_point_after_operation(&mut self, op: Ptr<Operation>)
Sets the insertion point to after the given operation.
Source§fn set_insertion_point_before_operation(&mut self, op: Ptr<Operation>)
fn set_insertion_point_before_operation(&mut self, op: Ptr<Operation>)
Sets the insertion point to before the given operation.
Source§impl<L> Rewriter for IRRewriter<L>where
L: RewriteListener,
impl<L> Rewriter for IRRewriter<L>where
L: RewriteListener,
Source§fn get_config(&self) -> &RewriterConfig
fn get_config(&self) -> &RewriterConfig
Get the configuration for this rewriter.
Source§fn get_config_mut(&mut self) -> &mut RewriterConfig
fn get_config_mut(&mut self) -> &mut RewriterConfig
Get a mutable reference to the configuration for this rewriter.
Source§fn replace_operation(
&mut self,
ctx: &mut Context,
op: Ptr<Operation>,
new_op: Ptr<Operation>,
)
fn replace_operation( &mut self, ctx: &mut Context, op: Ptr<Operation>, new_op: Ptr<Operation>, )
Replace an Operation (and delete it) with another operation.
Results of the new operation must match the results of the old operation.
Source§fn replace_operation_with_values(
&mut self,
ctx: &mut Context,
op: Ptr<Operation>,
new_values: Vec<Value>,
)
fn replace_operation_with_values( &mut self, ctx: &mut Context, op: Ptr<Operation>, new_values: Vec<Value>, )
Replace an Operation (and delete it) with a list of values.
Results of the new operation must match the list of values.
Source§fn replace_value_uses_with(
&mut self,
ctx: &Context,
old_value: Value,
new_value: Value,
)
fn replace_value_uses_with( &mut self, ctx: &Context, old_value: Value, new_value: Value, )
Replace all uses of a Value with another value.
Source§fn erase_operation(&mut self, ctx: &mut Context, op: Ptr<Operation>)
fn erase_operation(&mut self, ctx: &mut Context, op: Ptr<Operation>)
Erase an Operation. The operation must have no uses.
Source§fn erase_block(&mut self, ctx: &mut Context, block: Ptr<BasicBlock>)
fn erase_block(&mut self, ctx: &mut Context, block: Ptr<BasicBlock>)
Erase a BasicBlock. The block must have no uses.
Source§fn erase_region(&mut self, ctx: &mut Context, region: Ptr<Region>)
fn erase_region(&mut self, ctx: &mut Context, region: Ptr<Region>)
Erase a Region. Affects the index of all regions after it.
Source§fn unlink_operation(&mut self, ctx: &Context, op: Ptr<Operation>)
fn unlink_operation(&mut self, ctx: &Context, op: Ptr<Operation>)
Unlink an Operation from its current position
Source§fn unlink_block(&mut self, ctx: &Context, block: Ptr<BasicBlock>)
fn unlink_block(&mut self, ctx: &Context, block: Ptr<BasicBlock>)
Unlink a BasicBlock from its current position
Source§fn move_operation(
&mut self,
ctx: &Context,
op: Ptr<Operation>,
new_point: OpInsertionPoint,
)
fn move_operation( &mut self, ctx: &Context, op: Ptr<Operation>, new_point: OpInsertionPoint, )
Move an Operation to a new insertion point.
Source§fn move_block(
&mut self,
ctx: &Context,
block: Ptr<BasicBlock>,
new_point: BlockInsertionPoint,
)
fn move_block( &mut self, ctx: &Context, block: Ptr<BasicBlock>, new_point: BlockInsertionPoint, )
Move a BasicBlock to a new insertion point.
Source§fn split_block(
&mut self,
ctx: &mut Context,
block: Ptr<BasicBlock>,
position: OpInsertionPoint,
new_block_label: Option<Identifier>,
) -> Ptr<BasicBlock>
fn split_block( &mut self, ctx: &mut Context, block: Ptr<BasicBlock>, position: OpInsertionPoint, new_block_label: Option<Identifier>, ) -> Ptr<BasicBlock>
Split a BasicBlock at the given position.
Source§fn inline_region(
&mut self,
ctx: &Context,
src_region: Ptr<Region>,
dest_insertion_point: BlockInsertionPoint,
)
fn inline_region( &mut self, ctx: &Context, src_region: Ptr<Region>, dest_insertion_point: BlockInsertionPoint, )
Source§fn set_value_type(&mut self, ctx: &Context, value: Value, new_type: TypeHandle)
fn set_value_type(&mut self, ctx: &Context, value: Value, new_type: TypeHandle)
Change the type of a Value.
Source§fn is_modified(&self) -> bool
fn is_modified(&self) -> bool
Has the IR been modified via this rewriter?
Source§fn mark_modified(&mut self)
fn mark_modified(&mut self)
Mark that the IR has been modified via this rewriter.
Auto Trait Implementations§
impl<L> !RefUnwindSafe for IRRewriter<L>
impl<L> !UnwindSafe for IRRewriter<L>
impl<L> Freeze for IRRewriter<L>
impl<L> Send for IRRewriter<L>
impl<L> Sync for IRRewriter<L>
impl<L> Unpin for IRRewriter<L>
impl<L> UnsafeUnpin for IRRewriter<L>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more