pub struct Ptr<T>where
T: ArenaObj,{ /* private fields */ }Expand description
Pointer to an IR Object owned by Context.
Implementations§
Source§impl<'a, T> Ptr<T>where
T: ArenaObj,
impl<'a, T> Ptr<T>where
T: ArenaObj,
Sourcepub fn deref(&self, ctx: &'a Context) -> Ref<'a, T>
pub fn deref(&self, ctx: &'a Context) -> Ref<'a, T>
Borrow the inner RefCell and return a Ref to the pointee.
The borrow is live as long as the returned Ref lives.
Panics on dangling Ptr or borrow interior mutability errors.
Run cargo with options +nightly -Zbuild-std -Zbuild-std-features="debug_refcell"
to enable printing the interior mutability violation locations.
Sourcepub fn deref_mut(&self, ctx: &'a Context) -> RefMut<'a, T>
pub fn deref_mut(&self, ctx: &'a Context) -> RefMut<'a, T>
Mutably borrow the inner RefCell and return a RefMut to the pointee.
The borrow is live as long as the returned RefMut lives.
Panics on dangling Ptr or borrow interior mutability errors.
Run cargo with options +nightly -Zbuild-std -Zbuild-std-features="debug_refcell"
to enable printing the interior mutability violation locations.
Sourcepub fn try_deref(&self, ctx: &'a Context) -> Result<Ref<'a, T>, Error>
pub fn try_deref(&self, ctx: &'a Context) -> Result<Ref<'a, T>, Error>
Try and borrow the inner RefCell and return a Ref to the pointee. The borrow is live as long as the returned Ref lives. If Ptr is dangling or already mutably borrowed, an Error with DanglingPtrDerefError or BorrowError is returned.
Sourcepub fn try_deref_mut(&self, ctx: &'a Context) -> Result<RefMut<'a, T>, Error>
pub fn try_deref_mut(&self, ctx: &'a Context) -> Result<RefMut<'a, T>, Error>
Try and mutably borrow the inner RefCell and return a RefMut to the pointee. The borrow is live as long as the returned RefMut lives. If Ptr is dangling or already borrowed, an Error with DanglingPtrDerefError or BorrowMutError is returned.
Source§impl<T> Ptr<T>where
T: LinkedList,
Linked list operations on Ptr<T: LinkedList> for convenience and safety.
impl<T> Ptr<T>where
T: LinkedList,
Linked list operations on Ptr<T: LinkedList> for convenience and safety.
Sourcepub fn insert_after(&self, ctx: &Context, mark: Ptr<T>)
pub fn insert_after(&self, ctx: &Context, mark: Ptr<T>)
Insert self after mark.
Sourcepub fn insert_before(&self, ctx: &Context, mark: Ptr<T>)
pub fn insert_before(&self, ctx: &Context, mark: Ptr<T>)
Insert self before mark.
Sourcepub fn insert_at_front(
&self,
container: Ptr<<T as LinkedList>::ContainerType>,
ctx: &Context,
)
pub fn insert_at_front( &self, container: Ptr<<T as LinkedList>::ContainerType>, ctx: &Context, )
Insert self as the head of the list.
Sourcepub fn insert_at_back(
&self,
container: Ptr<<T as LinkedList>::ContainerType>,
ctx: &Context,
)
pub fn insert_at_back( &self, container: Ptr<<T as LinkedList>::ContainerType>, ctx: &Context, )
Insert self as the tail of the list.
Source§impl Ptr<BasicBlock>
impl Ptr<BasicBlock>
Sourcepub fn is_pred(&self, ctx: &Context, pred: Ptr<BasicBlock>) -> bool
pub fn is_pred(&self, ctx: &Context, pred: Ptr<BasicBlock>) -> bool
Is pred a predecessor of this block?
Note: O(n) in the number of predecessors of this block.
Sourcepub fn get_pred(&self, ctx: &Context, i: usize) -> Ptr<BasicBlock>
pub fn get_pred(&self, ctx: &Context, i: usize) -> Ptr<BasicBlock>
Get the i-th predecessor of this block. Panics if i is out of bounds.
Note:
1. The order of predecessors is not guaranteed to be deterministic
across different platforms or rust compiler versions.
2. O(n) in the number of predecessors of this block.
Sourcepub fn preds(&self, ctx: &Context) -> Vec<Ptr<BasicBlock>>
pub fn preds(&self, ctx: &Context) -> Vec<Ptr<BasicBlock>>
Get all predecessors of this block. Note: The order of predecessors is not guaranteed to be deterministic across different platforms or rust compiler versions.
Sourcepub fn uses(&self, ctx: &Context) -> Vec<Use<Ptr<BasicBlock>>>
pub fn uses(&self, ctx: &Context) -> Vec<Use<Ptr<BasicBlock>>>
Get uses (as successor operands in an Operation) of this block.
Sourcepub fn is_succ_of(&self, ctx: &Context, pred: Ptr<BasicBlock>) -> bool
pub fn is_succ_of(&self, ctx: &Context, pred: Ptr<BasicBlock>) -> bool
Checks whether self is a successor of pred.
O(n) in the number of successors of pred.
Sourcepub fn retarget_some_preds_to<P>(
&self,
ctx: &Context,
predicate: P,
other: Ptr<BasicBlock>,
)
pub fn retarget_some_preds_to<P>( &self, ctx: &Context, predicate: P, other: Ptr<BasicBlock>, )
Retarget predecessors (that satisfy pred) to other.
Sourcepub fn retarget_all_preds_to(&self, ctx: &Context, other: Ptr<BasicBlock>)
pub fn retarget_all_preds_to(&self, ctx: &Context, other: Ptr<BasicBlock>)
Retarget all predecessors to other.
Sourcepub fn retarget_pred_to(
&self,
ctx: &Context,
block_use: Use<Ptr<BasicBlock>>,
other: Ptr<BasicBlock>,
)
pub fn retarget_pred_to( &self, ctx: &Context, block_use: Use<Ptr<BasicBlock>>, other: Ptr<BasicBlock>, )
Retarget the given pred (block_use) of this Ptr<BasicBlock> to other.
Trait Implementations§
Source§impl BlockPtrExt for Ptr<BasicBlock>
impl BlockPtrExt for Ptr<BasicBlock>
Source§impl ControlFlowGraph<Context> for Ptr<Region>
impl ControlFlowGraph<Context> for Ptr<Region>
type Node = Ptr<BasicBlock>
Source§fn num_successors(
&self,
ctx: &Context,
node: &<Ptr<Region> as ControlFlowGraph<Context>>::Node,
) -> usize
fn num_successors( &self, ctx: &Context, node: &<Ptr<Region> as ControlFlowGraph<Context>>::Node, ) -> usize
node.Source§fn get_successor(
&self,
ctx: &Context,
node: &<Ptr<Region> as ControlFlowGraph<Context>>::Node,
i: usize,
) -> <Ptr<Region> as ControlFlowGraph<Context>>::Node
fn get_successor( &self, ctx: &Context, node: &<Ptr<Region> as ControlFlowGraph<Context>>::Node, i: usize, ) -> <Ptr<Region> as ControlFlowGraph<Context>>::Node
i-th successor of node. Panics if i is out of bounds.Source§fn successors(
&self,
ctx: &Context,
node: &<Ptr<Region> as ControlFlowGraph<Context>>::Node,
) -> Vec<<Ptr<Region> as ControlFlowGraph<Context>>::Node>
fn successors( &self, ctx: &Context, node: &<Ptr<Region> as ControlFlowGraph<Context>>::Node, ) -> Vec<<Ptr<Region> as ControlFlowGraph<Context>>::Node>
node.
The default implementation provided may be overridden for better performance.Source§fn num_predecessors(
&self,
ctx: &Context,
node: &<Ptr<Region> as ControlFlowGraph<Context>>::Node,
) -> usize
fn num_predecessors( &self, ctx: &Context, node: &<Ptr<Region> as ControlFlowGraph<Context>>::Node, ) -> usize
node.Source§fn get_predecessor(
&self,
ctx: &Context,
node: &<Ptr<Region> as ControlFlowGraph<Context>>::Node,
i: usize,
) -> <Ptr<Region> as ControlFlowGraph<Context>>::Node
fn get_predecessor( &self, ctx: &Context, node: &<Ptr<Region> as ControlFlowGraph<Context>>::Node, i: usize, ) -> <Ptr<Region> as ControlFlowGraph<Context>>::Node
i-th predecessor of node. Panics if i is out of bounds.Source§fn predecessors(
&self,
ctx: &Context,
node: &<Ptr<Region> as ControlFlowGraph<Context>>::Node,
) -> Vec<<Ptr<Region> as ControlFlowGraph<Context>>::Node>
fn predecessors( &self, ctx: &Context, node: &<Ptr<Region> as ControlFlowGraph<Context>>::Node, ) -> Vec<<Ptr<Region> as ControlFlowGraph<Context>>::Node>
node.
The default implementation provided may be overridden for better performance.Source§fn entry_node(
&self,
ctx: &Context,
) -> Option<<Ptr<Region> as ControlFlowGraph<Context>>::Node>
fn entry_node( &self, ctx: &Context, ) -> Option<<Ptr<Region> as ControlFlowGraph<Context>>::Node>
impl<T> Copy for Ptr<T>where
T: ArenaObj,
impl<T> Eq for Ptr<T>where
T: ArenaObj,
Source§impl Named for Ptr<BasicBlock>
impl Named for Ptr<BasicBlock>
Source§fn given_name(&self, ctx: &Context) -> Option<Identifier>
fn given_name(&self, ctx: &Context) -> Option<Identifier>
Source§fn id(&self, ctx: &Context) -> Identifier
fn id(&self, ctx: &Context) -> Identifier
Source§fn unique_name(&self, ctx: &Context) -> Identifier
fn unique_name(&self, ctx: &Context) -> Identifier
Source§impl OperationPtrExt for Ptr<Operation>
impl OperationPtrExt for Ptr<Operation>
fn as_op<T: Op>(self, ctx: &Context) -> Option<T>
fn dyn_op(self, ctx: &Context) -> OpObj
fn cast<T: ?Sized + OpInterfaceMarker + 'static>( self, ctx: &Context, ) -> Option<TraitOp<T>>
fn operand(self, ctx: &Context, idx: usize) -> Value
fn operand_as_use(self, ctx: &Context, idx: usize) -> Use<Value>
fn operands(self, ctx: &Context) -> Vec<Value>
fn operands_as_uses(self, ctx: &Context) -> Vec<Use<Value>>
fn result(self, ctx: &Context) -> Value
fn results(self, ctx: &Context) -> Vec<Value>
fn result_types(self, ctx: &Context) -> Vec<TypeHandle>
fn regions(self, ctx: &Context) -> Vec<Ptr<Region>>
fn result_names(self, ctx: &Context) -> Vec<Option<Identifier>>
fn opt_result(self, ctx: &Context) -> Option<Value>
fn get_attr<'a, T: Attribute>( self, ctx: &'a Context, key: &Identifier, ) -> Option<Ref<'a, T>>
fn set_attr<T: Attribute>(self, ctx: &Context, key: &Identifier, value: T)
fn parent_module(self, ctx: &Context) -> ModuleOp
fn is_ancestor_of(self, ctx: &Context, child: Ptr<Operation>) -> bool
fn is_op<T: Op>(self, ctx: &Context) -> bool
fn is_terminator(self, ctx: &Context) -> bool
fn impls<T: ?Sized + OpInterfaceMarker + 'static>(self, ctx: &Context) -> bool
Source§impl<T> Printable for Ptr<T>where
T: ArenaObj + Printable,
impl<T> Printable for Ptr<T>where
T: ArenaObj + Printable,
Source§impl RegionPtrExt for Ptr<Region>
impl RegionPtrExt for Ptr<Region>
Auto Trait Implementations§
impl<T> Freeze for Ptr<T>where
PhantomData<T>: Freeze,
impl<T> RefUnwindSafe for Ptr<T>where
PhantomData<T>: RefUnwindSafe,
impl<T> Send for Ptr<T>where
PhantomData<T>: Send,
impl<T> Sync for Ptr<T>where
PhantomData<T>: Sync,
impl<T> Unpin for Ptr<T>where
PhantomData<T>: Unpin,
impl<T> UnsafeUnpin for Ptr<T>where
PhantomData<T>: UnsafeUnpin,
impl<T> UnwindSafe for Ptr<T>where
PhantomData<T>: UnwindSafe,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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)
&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)
&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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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> ⓘ
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> ⓘ
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