yz_basic_block

Struct Arena

Source
pub struct Arena<S, C> { /* private fields */ }

Implementations§

Source§

impl<S, C> Arena<S, C>
where BasicBlock<S, C, BbId>: ForeachTarget<JumpTarget = BbId>,

Source

pub fn check(&self) -> Result<(), OffendingIds>

Use this method to re-check all references in the Arena after modifications via Arena::bbs_mut.

Source

pub fn push( &mut self, bb: BasicBlock<S, C, BbId>, ) -> Result<usize, (BasicBlock<S, C, BbId>, OffendingIds)>

Returns the ID of the newly appended BB if successful, or $bb & the invalid BbIds.

Source

pub fn remove( &mut self, bbid: BbId, ) -> Option<Result<(BasicBlock<S, C, BbId>, Vec<String>), OffendingIds>>

Removes a BB, fails if any references to it exist. If successful, returns the removed BB and all labels which referenced it. Otherwise, returns the offending BBs (which still reference it)

Source§

impl<S, C> Arena<S, C>
where S: ForeachTarget<JumpTarget = BbId>, C: ForeachTarget<JumpTarget = BbId>,

Source

pub fn optimize(&mut self) -> bool

Source§

impl<S, C> Arena<S, C>

Source

pub fn new() -> Self

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn bbs(&self) -> &Map<BbId, BasicBlock<S, C, BbId>>

Source

pub fn bbs_mut(&mut self) -> &mut Map<BbId, BasicBlock<S, C, BbId>>

Source

pub fn labels(&self) -> &BTreeMap<String, BbId>

Source

pub fn labels_of_bb(&self, bbid: BbId) -> impl Iterator<Item = &str>

Source

pub fn label2bb(&self, label: &str) -> Option<(BbId, &BasicBlock<S, C, BbId>)>

Source

pub fn set_label( &mut self, label: Label, target: BbId, overwrite: bool, ) -> Result<Option<BbId>, SetBbLabelError>

If this call replaced the current label->BB-ID association, then the old associated BBID is returned.

Source

pub fn shrink_to_fit(&mut self)

Trait Implementations§

Source§

impl<S: Debug, C: Debug> Debug for Arena<S, C>

Source§

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

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

impl<S, C> Default for Arena<S, C>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<S, C> ForeachTarget for Arena<S, C>
where BasicBlock<S, C, BbId>: ForeachTarget<JumpTarget = BbId>,

Source§

type JumpTarget = usize

Source§

fn foreach_target<F>(&self, f: F)
where F: FnMut(&Self::JumpTarget),

Source§

fn foreach_target_mut<F>(&mut self, f: F)
where F: FnMut(&mut Self::JumpTarget),

Auto Trait Implementations§

§

impl<S, C> Freeze for Arena<S, C>

§

impl<S, C> RefUnwindSafe for Arena<S, C>

§

impl<S, C> Send for Arena<S, C>
where C: Send, S: Send,

§

impl<S, C> Sync for Arena<S, C>
where C: Sync, S: Sync,

§

impl<S, C> Unpin for Arena<S, C>

§

impl<S, C> UnwindSafe for Arena<S, C>

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