Trait orzir_core::Op

source ·
pub trait Op: Downcast + Print + Verify + DataFlow + ControlFlow + RegionInterface {
    // Required methods
    fn mnemonic(&self) -> Mnemonic;
    fn mnemonic_static() -> Mnemonic
       where Self: Sized;
    fn register(ctx: &mut Context, parse_fn: OpParseFn)
       where Self: Sized;
    fn metadata(&self) -> &OpMetadata;
    fn metadata_mut(&mut self) -> &mut OpMetadata;

    // Provided methods
    fn self_ptr(&self) -> ArenaPtr<OpObj> { ... }
    fn parent_block(&self) -> Option<ArenaPtr<Block>> { ... }
    fn set_parent_block(
        &mut self,
        parent_block: Option<ArenaPtr<Block>>
    ) -> Option<ArenaPtr<Block>> { ... }
    fn parent_region(&self, ctx: &Context) -> Option<ArenaPtr<Region>> { ... }
}
Expand description

The trait of all operations.

Required Methods§

source

fn mnemonic(&self) -> Mnemonic

Get the mnemonic of the type.

source

fn mnemonic_static() -> Mnemonic
where Self: Sized,

Get the mnemonic of the type statically.

source

fn register(ctx: &mut Context, parse_fn: OpParseFn)
where Self: Sized,

Register the operation to the context.

The Parse trait is not object-safe, so here just pass the parse function.

source

fn metadata(&self) -> &OpMetadata

source

fn metadata_mut(&mut self) -> &mut OpMetadata

Provided Methods§

source

fn self_ptr(&self) -> ArenaPtr<OpObj>

Get the self ptr.

source

fn parent_block(&self) -> Option<ArenaPtr<Block>>

Get the parent block of the operation.

source

fn set_parent_block( &mut self, parent_block: Option<ArenaPtr<Block>> ) -> Option<ArenaPtr<Block>>

Set the parent block of the operation.

source

fn parent_region(&self, ctx: &Context) -> Option<ArenaPtr<Region>>

Get the parent region of the operation.

If the operation has no parent block, the parent region will be None.

Implementations§

source§

impl dyn Op

source

pub fn is<__T: Op>(&self) -> bool

Returns true if the trait object wraps an object of type __T.

source

pub fn downcast<__T: Op>(self: Box<Self>) -> Result<Box<__T>, Box<Self>>

Returns a boxed object from a boxed trait object if the underlying object is of type __T. Returns the original boxed trait if it isn’t.

source

pub fn downcast_rc<__T: Op>(self: Rc<Self>) -> Result<Rc<__T>, Rc<Self>>

Returns an Rc-ed object from an Rc-ed trait object if the underlying object is of type __T. Returns the original Rc-ed trait if it isn’t.

source

pub fn downcast_ref<__T: Op>(&self) -> Option<&__T>

Returns a reference to the object within the trait object if it is of type __T, or None if it isn’t.

source

pub fn downcast_mut<__T: Op>(&mut self) -> Option<&mut __T>

Returns a mutable reference to the object within the trait object if it is of type __T, or None if it isn’t.

Trait Implementations§

source§

impl AsMut<dyn Op> for OpObj

source§

fn as_mut(&mut self) -> &mut dyn Op

Converts this type into a mutable reference of the (usually inferred) input type.
source§

impl AsRef<dyn Op> for OpObj

source§

fn as_ref(&self) -> &dyn Op

Converts this type into a shared reference of the (usually inferred) input type.

Implementors§