Trait orzir_core::PatternRewriter

source ·
pub trait PatternRewriter {
    // Required methods
    fn erase_op(
        &self,
        ctx: &mut Context,
        op: ArenaPtr<OpObj>
    ) -> RewriteResult<()>;
    fn replace_op(
        &self,
        ctx: &mut Context,
        op: ArenaPtr<OpObj>,
        new_ops: Vec<ArenaPtr<OpObj>>
    ) -> RewriteResult<()>;
}
Expand description

The trait for unified rewriting operations.

TODO: design a better API for this.

Required Methods§

source

fn erase_op(&self, ctx: &mut Context, op: ArenaPtr<OpObj>) -> RewriteResult<()>

Erase an operation from the IR.

source

fn replace_op( &self, ctx: &mut Context, op: ArenaPtr<OpObj>, new_ops: Vec<ArenaPtr<OpObj>> ) -> RewriteResult<()>

Replace an operation with new operation(s)

Implementors§