Skip to main content

Ptr

Struct Ptr 

Source
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,

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn insert_after(&self, ctx: &Context, mark: Ptr<T>)

Insert self after mark.

Source

pub fn insert_before(&self, ctx: &Context, mark: Ptr<T>)

Insert self before mark.

Source

pub fn insert_at_front( &self, container: Ptr<<T as LinkedList>::ContainerType>, ctx: &Context, )

Insert self as the head of the list.

Source

pub fn insert_at_back( &self, container: Ptr<<T as LinkedList>::ContainerType>, ctx: &Context, )

Insert self as the tail of the list.

Source

pub fn is_linked(&self, ctx: &Context) -> bool

Is this node part of a linked list?

Unlink self from list.

Source§

impl Ptr<BasicBlock>

Source

pub fn has_pred(&self, ctx: &Context) -> bool

Does this block a predecessor?

Source

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.

Source

pub fn num_preds(&self, ctx: &Context) -> usize

Number of predecessors to this block.

Source

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.

Source

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.

Source

pub fn uses(&self, ctx: &Context) -> Vec<Use<Ptr<BasicBlock>>>

Get uses (as successor operands in an Operation) of this block.

Source

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.

Source

pub fn retarget_some_preds_to<P>( &self, ctx: &Context, predicate: P, other: Ptr<BasicBlock>, )
where P: Fn(&Context, Ptr<BasicBlock>) -> bool,

Retarget predecessors (that satisfy pred) to other.

Source

pub fn retarget_all_preds_to(&self, ctx: &Context, other: Ptr<BasicBlock>)

Retarget all predecessors to other.

Source

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>

Source§

fn arguments(self, ctx: &Context) -> Vec<Value>

Source§

fn is_empty(&self, ctx: &Context) -> bool

Source§

fn is_entry_block(&self, ctx: &Context) -> bool

Source§

fn ops_with_interface<T: OpInterfaceMarker + ?Sized + 'static>( &self, ctx: &Context, ) -> impl Iterator<Item = TraitOp<T>>

Source§

impl<T> Clone for Ptr<T>
where T: ArenaObj,

Source§

fn clone(&self) -> Ptr<T>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl ControlFlowGraph<Context> for Ptr<Region>

Source§

type Node = Ptr<BasicBlock>

Source§

fn num_successors( &self, ctx: &Context, node: &<Ptr<Region> as ControlFlowGraph<Context>>::Node, ) -> usize

Number of successors of node.
Source§

fn get_successor( &self, ctx: &Context, node: &<Ptr<Region> as ControlFlowGraph<Context>>::Node, i: usize, ) -> <Ptr<Region> as ControlFlowGraph<Context>>::Node

Get the 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>

Get all successors of 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

Number of predecessors of node.
Source§

fn get_predecessor( &self, ctx: &Context, node: &<Ptr<Region> as ControlFlowGraph<Context>>::Node, i: usize, ) -> <Ptr<Region> as ControlFlowGraph<Context>>::Node

Get the 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>

Get all predecessors of 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>

Returns the entry node of the graph.
Source§

fn nodes<'a>( &'a self, ctx: &'a Context, ) -> Box<dyn Iterator<Item = <Ptr<Region> as ControlFlowGraph<Context>>::Node> + 'a>

Get all nodes in the graph.
Source§

impl<T> Copy for Ptr<T>
where T: ArenaObj,

Source§

impl<T> Debug for Ptr<T>
where T: ArenaObj,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<T> Eq for Ptr<T>
where T: ArenaObj,

Source§

impl From<Ptr<Region>> for RegionSuccessor

Source§

fn from(value: Ptr<Region>) -> Self

Converts to this type from the input type.
Source§

impl HasLabel<Context> for Ptr<BasicBlock>

Source§

fn label(&self, ctx: &Context) -> String

Source§

impl<T> Hash for Ptr<T>
where T: ArenaObj + 'static,

Source§

fn hash<H>(&self, state: &mut H)
where H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Named for Ptr<BasicBlock>

Source§

fn given_name(&self, ctx: &Context) -> Option<Identifier>

A (not necessarily unique) name.
Source§

fn id(&self, ctx: &Context) -> Identifier

A Unique (within the context) ID.
Source§

fn unique_name(&self, ctx: &Context) -> Identifier

A unique name; concatenation of name and id.
Source§

impl OperationPtrExt for Ptr<Operation>

Source§

fn as_op<T: Op>(self, ctx: &Context) -> Option<T>

Source§

fn dyn_op(self, ctx: &Context) -> OpObj

Source§

fn cast<T: ?Sized + OpInterfaceMarker + 'static>( self, ctx: &Context, ) -> Option<TraitOp<T>>

Source§

fn operand(self, ctx: &Context, idx: usize) -> Value

Source§

fn operand_as_use(self, ctx: &Context, idx: usize) -> Use<Value>

Source§

fn operands(self, ctx: &Context) -> Vec<Value>

Source§

fn operands_as_uses(self, ctx: &Context) -> Vec<Use<Value>>

Source§

fn result(self, ctx: &Context) -> Value

Source§

fn results(self, ctx: &Context) -> Vec<Value>

Source§

fn result_types(self, ctx: &Context) -> Vec<TypeHandle>

Source§

fn regions(self, ctx: &Context) -> Vec<Ptr<Region>>

Source§

fn result_names(self, ctx: &Context) -> Vec<Option<Identifier>>

Source§

fn opt_result(self, ctx: &Context) -> Option<Value>

Source§

fn get_attr<'a, T: Attribute>( self, ctx: &'a Context, key: &Identifier, ) -> Option<Ref<'a, T>>

Source§

fn set_attr<T: Attribute>(self, ctx: &Context, key: &Identifier, value: T)

Source§

fn parent_module(self, ctx: &Context) -> ModuleOp

Source§

fn is_ancestor_of(self, ctx: &Context, child: Ptr<Operation>) -> bool

Source§

fn is_op<T: Op>(self, ctx: &Context) -> bool

Source§

fn is_terminator(self, ctx: &Context) -> bool

Source§

fn impls<T: ?Sized + OpInterfaceMarker + 'static>(self, ctx: &Context) -> bool

Source§

impl<T> PartialEq for Ptr<T>
where T: ArenaObj,

Source§

fn eq(&self, other: &Ptr<T>) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<T> Printable for Ptr<T>
where T: ArenaObj + Printable,

Source§

fn fmt( &self, ctx: &Context, state: &State, f: &mut Formatter<'_>, ) -> Result<(), Error>

Source§

fn disp<'t, 'c>(&'t self, ctx: &'c Context) -> Box<dyn Display + 'c>
where 't: 'c,

Get a Display’able object from the given Context and default State.
Source§

fn print<'t, 'c>( &'t self, ctx: &'c Context, state: &State, ) -> Box<dyn Display + 'c>
where 't: 'c,

Get a Display’able object from the given Context and State.
Source§

impl RegionPtrExt for Ptr<Region>

Source§

fn arguments(self, ctx: &Context) -> Vec<Value>

Source§

fn is_empty(&self, ctx: &Context) -> bool

Source§

impl<T> Verify for Ptr<T>
where T: ArenaObj + Verify,

Source§

fn verify(&self, ctx: &Context) -> Result<(), Error>

Auto Trait Implementations§

§

impl<T> Freeze for Ptr<T>
where PhantomData<T>: Freeze,

§

impl<T> RefUnwindSafe for Ptr<T>

§

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>

§

impl<T> UnwindSafe for Ptr<T>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Downcast for T
where T: Any,

Source§

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>

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)

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)

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
where T: Any + Send,

Source§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_sync(self: Box<T>) -> Box<dyn Any + Send + Sync>

Converts Box<Trait> (where Trait: DowncastSync) to Box<dyn Any + Send + Sync>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync> ⓘ

Converts Arc<Trait> (where Trait: DowncastSync) to Arc<Any>, which can then be downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.