[−][src]Struct cranelift_codegen::ir::layout::Layout
The Layout
struct determines the layout of EBBs and instructions in a function. It does not
contain definitions of instructions or EBBs, but depends on Inst
and Ebb
entity references
being defined elsewhere.
This data structure determines:
- The order of EBBs in the function.
- Which EBB contains a given instruction.
- The order of instructions with an EBB.
While data dependencies are not recorded, instruction ordering does affect control dependencies, so part of the semantics of the program are determined by the layout.
Methods
impl Layout
[src]
impl Layout
[src]
Methods for laying out EBBs.
An unknown EBB starts out as not inserted in the EBB layout. The layout is a linear order of inserted EBBs. Once an EBB has been inserted in the layout, instructions can be added. An EBB can only be removed from the layout when it is empty.
Since every EBB must end with a terminator instruction which cannot fall through, the layout of EBBs do not affect the semantics of the program.
pub fn is_ebb_inserted(&self, ebb: Ebb) -> bool
[src]
Is ebb
currently part of the layout?
pub fn append_ebb(&mut self, ebb: Ebb)
[src]
Insert ebb
as the last EBB in the layout.
pub fn insert_ebb(&mut self, ebb: Ebb, before: Ebb)
[src]
Insert ebb
in the layout before the existing EBB before
.
pub fn insert_ebb_after(&mut self, ebb: Ebb, after: Ebb)
[src]
Insert ebb
in the layout after the existing EBB after
.
pub fn remove_ebb(&mut self, ebb: Ebb)
[src]
Remove ebb
from the layout.
ⓘImportant traits for Ebbs<'f>pub fn ebbs(&self) -> Ebbs
[src]
Return an iterator over all EBBs in layout order.
pub fn entry_block(&self) -> Option<Ebb>
[src]
Get the function's entry block. This is simply the first EBB in the layout order.
pub fn last_ebb(&self) -> Option<Ebb>
[src]
Get the last EBB in the layout.
pub fn prev_ebb(&self, ebb: Ebb) -> Option<Ebb>
[src]
Get the block preceding ebb
in the layout order.
pub fn next_ebb(&self, ebb: Ebb) -> Option<Ebb>
[src]
Get the block following ebb
in the layout order.
impl Layout
[src]
Methods for arranging instructions.
An instruction starts out as not inserted in the layout. An instruction can be inserted into an EBB at a given position.
pub fn inst_ebb(&self, inst: Inst) -> Option<Ebb>
[src]
Get the EBB containing inst
, or None
if inst
is not inserted in the layout.
pub fn pp_ebb<PP>(&self, pp: PP) -> Ebb where
PP: Into<ExpandedProgramPoint>,
[src]
PP: Into<ExpandedProgramPoint>,
Get the EBB containing the program point pp
. Panic if pp
is not in the layout.
pub fn append_inst(&mut self, inst: Inst, ebb: Ebb)
[src]
Append inst
to the end of ebb
.
pub fn first_inst(&self, ebb: Ebb) -> Option<Inst>
[src]
Fetch an ebb's first instruction.
pub fn last_inst(&self, ebb: Ebb) -> Option<Inst>
[src]
Fetch an ebb's last instruction.
pub fn next_inst(&self, inst: Inst) -> Option<Inst>
[src]
Fetch the instruction following inst
.
pub fn prev_inst(&self, inst: Inst) -> Option<Inst>
[src]
Fetch the instruction preceding inst
.
pub fn insert_inst(&mut self, inst: Inst, before: Inst)
[src]
Insert inst
before the instruction before
in the same EBB.
pub fn remove_inst(&mut self, inst: Inst)
[src]
Remove inst
from the layout.
ⓘImportant traits for Insts<'f>pub fn ebb_insts(&self, ebb: Ebb) -> Insts
[src]
Iterate over the instructions in ebb
in layout order.
pub fn split_ebb(&mut self, new_ebb: Ebb, before: Inst)
[src]
Split the EBB containing before
in two.
Insert new_ebb
after the old EBB and move before
and the following instructions to
new_ebb
:
old_ebb:
i1
i2
i3 << before
i4
becomes:
old_ebb:
i1
i2
new_ebb:
i3 << before
i4
Trait Implementations
impl ProgramOrder for Layout
[src]
fn cmp<A, B>(&self, a: A, b: B) -> Ordering where
A: Into<ExpandedProgramPoint>,
B: Into<ExpandedProgramPoint>,
[src]
A: Into<ExpandedProgramPoint>,
B: Into<ExpandedProgramPoint>,
fn is_ebb_gap(&self, inst: Inst, ebb: Ebb) -> bool
[src]
impl<'f> IntoIterator for &'f Layout
[src]
Use a layout reference in a for loop.
type Item = Ebb
The type of the elements being iterated over.
type IntoIter = Ebbs<'f>
Which kind of iterator are we turning this into?
ⓘImportant traits for Ebbs<'f>fn into_iter(self) -> Ebbs<'f>
[src]
impl Clone for Layout
[src]
Auto Trait Implementations
impl Unpin for Layout
impl Send for Layout
impl Sync for Layout
impl UnwindSafe for Layout
impl RefUnwindSafe for Layout
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,