pub struct BodyOrder { /* private fields */ }Expand description
Represents basic block order and instruction order.
Implementations§
Source§impl BodyOrder
impl BodyOrder
pub fn new(entry_block: BasicBlockId) -> Self
Sourcepub fn entry(&self) -> BasicBlockId
pub fn entry(&self) -> BasicBlockId
Returns an entry block of a function body.
Sourcepub fn last_block(&self) -> BasicBlockId
pub fn last_block(&self) -> BasicBlockId
Returns a last block of a function body.
Sourcepub fn is_block_empty(&self, block: BasicBlockId) -> bool
pub fn is_block_empty(&self, block: BasicBlockId) -> bool
Returns true if a block doesn’t contain any block.
Sourcepub fn is_block_inserted(&self, block: BasicBlockId) -> bool
pub fn is_block_inserted(&self, block: BasicBlockId) -> bool
Returns true if a function body contains a given block.
Sourcepub fn prev_block(&self, block: BasicBlockId) -> Option<BasicBlockId>
pub fn prev_block(&self, block: BasicBlockId) -> Option<BasicBlockId>
Sourcepub fn next_block(&self, block: BasicBlockId) -> Option<BasicBlockId>
pub fn next_block(&self, block: BasicBlockId) -> Option<BasicBlockId>
Sourcepub fn is_inst_inserted(&self, inst: InstId) -> bool
pub fn is_inst_inserted(&self, inst: InstId) -> bool
Returns true is a given inst is inserted.
Sourcepub fn first_inst(&self, block: BasicBlockId) -> Option<InstId>
pub fn first_inst(&self, block: BasicBlockId) -> Option<InstId>
Sourcepub fn terminator(
&self,
store: &BodyDataStore,
block: BasicBlockId,
) -> Option<InstId>
pub fn terminator( &self, store: &BodyDataStore, block: BasicBlockId, ) -> Option<InstId>
Sourcepub fn is_terminated(&self, store: &BodyDataStore, block: BasicBlockId) -> bool
pub fn is_terminated(&self, store: &BodyDataStore, block: BasicBlockId) -> bool
Returns true if a block is terminated.
Sourcepub fn last_inst(&self, block: BasicBlockId) -> Option<InstId>
pub fn last_inst(&self, block: BasicBlockId) -> Option<InstId>
Sourcepub fn inst_block(&self, inst: InstId) -> BasicBlockId
pub fn inst_block(&self, inst: InstId) -> BasicBlockId
Sourcepub fn iter_block(&self) -> impl Iterator<Item = BasicBlockId> + '_
pub fn iter_block(&self) -> impl Iterator<Item = BasicBlockId> + '_
Returns an iterator which iterates all basic blocks in a function body in pre-order.
Sourcepub fn iter_inst(
&self,
block: BasicBlockId,
) -> impl Iterator<Item = InstId> + '_
pub fn iter_inst( &self, block: BasicBlockId, ) -> impl Iterator<Item = InstId> + '_
Returns an iterator which iterates all instruction in a given block in
pre-order.
§Panics
Panics if block is not inserted yet.
Sourcepub fn append_block(&mut self, block: BasicBlockId)
pub fn append_block(&mut self, block: BasicBlockId)
Appends a given block to a function body.
§Panics
Panics if a given block is already inserted to a function.
Sourcepub fn insert_block_before_block(
&mut self,
block: BasicBlockId,
before: BasicBlockId,
)
pub fn insert_block_before_block( &mut self, block: BasicBlockId, before: BasicBlockId, )
Inserts a given block before a before block.
§Panics
Panics if
- a given
blockis already inserted. - a given
beforeblock is NOTE inserted yet.
Sourcepub fn insert_block_after_block(
&mut self,
block: BasicBlockId,
after: BasicBlockId,
)
pub fn insert_block_after_block( &mut self, block: BasicBlockId, after: BasicBlockId, )
Inserts a given block after a after block.
§Panics
Panics if
- a given
blockis already inserted. - a given
afterblock is NOTE inserted yet.
Sourcepub fn remove_block(&mut self, block: BasicBlockId)
pub fn remove_block(&mut self, block: BasicBlockId)
Remove a given block from a function. All instructions in a block are
also removed.
§Panics
Panics if
- a given
blockis NOT inserted. - a
blockis the last one block in a function.
Sourcepub fn append_inst(&mut self, inst: InstId, block: BasicBlockId)
pub fn append_inst(&mut self, inst: InstId, block: BasicBlockId)
Appends inst to the end of a block
§Panics
Panics if
- a given
blockis NOT inserted. - a given
instis already inserted.
Sourcepub fn prepend_inst(&mut self, inst: InstId, block: BasicBlockId)
pub fn prepend_inst(&mut self, inst: InstId, block: BasicBlockId)
Prepends inst to the beginning of a block
§Panics
Panics if
- a given
blockis NOT inserted. - a given
instis already inserted.
Sourcepub fn insert_inst_before_inst(&mut self, inst: InstId, before: InstId)
pub fn insert_inst_before_inst(&mut self, inst: InstId, before: InstId)
Insert inst before before inst.
§Panics
Panics if
- a given
beforeis NOT inserted. - a given
instis already inserted.
Sourcepub fn insert_inst_after(&mut self, inst: InstId, after: InstId)
pub fn insert_inst_after(&mut self, inst: InstId, after: InstId)
Insert inst after after inst.
§Panics
Panics if
- a given
afteris NOT inserted. - a given
instis already inserted.
Sourcepub fn remove_inst(&mut self, inst: InstId)
pub fn remove_inst(&mut self, inst: InstId)
Trait Implementations§
impl Eq for BodyOrder
impl StructuralPartialEq for BodyOrder
Auto Trait Implementations§
impl Freeze for BodyOrder
impl RefUnwindSafe for BodyOrder
impl Send for BodyOrder
impl Sync for BodyOrder
impl Unpin for BodyOrder
impl UnwindSafe for BodyOrder
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.