Ptr

Struct Ptr 

Source
pub struct Ptr<T: ArenaObj> { /* private fields */ }
Expand description

Pointer to an IR Object owned by Context.

Implementations§

Source§

impl<'a, T: ArenaObj> Ptr<T>

Source

pub fn deref(&self, ctx: &'a Context) -> Ref<'a, T>

Return a Ref to the pointee. This borrows from a RefCell and the borrow is live as long as the returned Ref lives. 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>

Return a RefMut to the pointee. This mutably borrows from a RefCell and the borrow is live as long as the returned RefMut lives. 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) -> Option<Ref<'a, T>>

Try and return a Ref to the pointee. This borrows from a RefCell and the borrow is live as long as the returned Ref lives.

Source

pub fn try_deref_mut(&self, ctx: &'a Context) -> Option<RefMut<'a, T>>

Try and return a RefMut to the pointee. This mutably borrows from a RefCell and the borrow is live as long as the returned RefMut lives.

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::ContainerType>, ctx: &Context)

Insert self as the head of the list.

Source

pub fn insert_at_back(&self, container: Ptr<T::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 num_preds(&self, ctx: &Context) -> usize

Number of predecessors to this block.

Source

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

Get all predecessors 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: Fn(&Context, Ptr<BasicBlock>) -> bool>( &self, ctx: &Context, predicate: P, other: Ptr<BasicBlock>, )

Retarget predecessors (that satisfy pred) 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<T: ArenaObj> Clone for Ptr<T>

Source§

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

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<T: Debug + ArenaObj> Debug for Ptr<T>

Source§

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

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

impl<T: Type> From<TypePtr<T>> for Ptr<TypeObj>

Source§

fn from(value: TypePtr<T>) -> Self

Converts to this type from the input type.
Source§

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

Source§

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

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§

impl Parsable for Ptr<TypeObj>

Source§

type Arg = ()

Type of the argument that must be passed to the parser.
Source§

type Parsed = Ptr<Box<dyn Type>>

The type of the parsed entity.
Source§

fn parse<'a>( state_stream: &mut StateStream<'a>, _arg: Self::Arg, ) -> ParseResult<'a, Self::Parsed>

Define a parser using existing combinators and call into on Parser::parse_stream to get the final ParseResult. Use state_stream.state as necessary.
Source§

fn parser<'a>( arg: Self::Arg, ) -> Box<dyn Parser<StateStream<'a>, Output = Self::Parsed, PartialState = ()> + 'a>

Get a parser combinator that can work on StateStream as its input.
Source§

fn parser_fn<'a>( _: &'a (), arg: Self::Arg, ) -> Box<dyn Parser<StateStream<'a>, Output = Self::Parsed, PartialState = ()> + 'a>

Same as Self::parser but takes a unit reference for use as ParserFn
Source§

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

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

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

Source§

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

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 Typed for Ptr<TypeObj>

Source§

fn get_type(&self, _ctx: &Context) -> Ptr<TypeObj>

Get the Type of the current entity.
Source§

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

Source§

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

Source§

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

Source§

impl DefUseParticipant for Ptr<BasicBlock>

Source§

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

Auto Trait Implementations§

§

impl<T> Freeze for Ptr<T>

§

impl<T> RefUnwindSafe for Ptr<T>
where T: RefUnwindSafe,

§

impl<T> Send for Ptr<T>
where T: Send,

§

impl<T> Sync for Ptr<T>
where T: Sync,

§

impl<T> Unpin for Ptr<T>
where T: Unpin,

§

impl<T> UnwindSafe for Ptr<T>
where T: UnwindSafe,

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<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 + Sync + Send>

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 + Sync + Send>

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<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> 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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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

impl<T> ClonableAny for T
where T: Any + DynClone + Downcast,