Struct cretonne_codegen::ir::layout::Layout [−][src]
pub struct Layout { /* fields omitted */ }
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
impl Layout
[src]
impl Layout
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]
pub fn is_ebb_inserted(&self, ebb: Ebb) -> bool
Is ebb
currently part of the layout?
pub fn append_ebb(&mut self, ebb: Ebb)
[src]
pub fn append_ebb(&mut self, ebb: Ebb)
Insert ebb
as the last EBB in the layout.
pub fn insert_ebb(&mut self, ebb: Ebb, before: Ebb)
[src]
pub fn insert_ebb(&mut self, ebb: Ebb, before: Ebb)
Insert ebb
in the layout before the existing EBB before
.
pub fn insert_ebb_after(&mut self, ebb: Ebb, after: Ebb)
[src]
pub fn insert_ebb_after(&mut self, ebb: Ebb, after: Ebb)
Insert ebb
in the layout after the existing EBB after
.
pub fn remove_ebb(&mut self, ebb: Ebb)
[src]
pub fn remove_ebb(&mut self, ebb: Ebb)
Remove ebb
from the layout.
ⓘImportant traits for Ebbs<'f>pub fn ebbs(&self) -> Ebbs
[src]
pub fn ebbs(&self) -> Ebbs
Return an iterator over all EBBs in layout order.
pub fn entry_block(&self) -> Option<Ebb>
[src]
pub fn entry_block(&self) -> Option<Ebb>
Get the function's entry block. This is simply the first EBB in the layout order.
pub fn last_ebb(&self) -> Option<Ebb>
[src]
pub fn last_ebb(&self) -> Option<Ebb>
Get the last EBB in the layout.
pub fn prev_ebb(&self, ebb: Ebb) -> Option<Ebb>
[src]
pub fn prev_ebb(&self, ebb: Ebb) -> Option<Ebb>
Get the block preceding ebb
in the layout order.
pub fn next_ebb(&self, ebb: Ebb) -> Option<Ebb>
[src]
pub fn next_ebb(&self, ebb: Ebb) -> Option<Ebb>
Get the block following ebb
in the layout order.
impl Layout
[src]
impl Layout
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]
pub fn inst_ebb(&self, inst: Inst) -> Option<Ebb>
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]
pub fn pp_ebb<PP>(&self, pp: PP) -> Ebb where
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]
pub fn append_inst(&mut self, inst: Inst, ebb: Ebb)
Append inst
to the end of ebb
.
pub fn first_inst(&self, ebb: Ebb) -> Option<Inst>
[src]
pub fn first_inst(&self, ebb: Ebb) -> Option<Inst>
Fetch an ebb's first instruction.
pub fn last_inst(&self, ebb: Ebb) -> Option<Inst>
[src]
pub fn last_inst(&self, ebb: Ebb) -> Option<Inst>
Fetch an ebb's last instruction.
pub fn next_inst(&self, inst: Inst) -> Option<Inst>
[src]
pub fn next_inst(&self, inst: Inst) -> Option<Inst>
Fetch the instruction following inst
.
pub fn prev_inst(&self, inst: Inst) -> Option<Inst>
[src]
pub fn prev_inst(&self, inst: Inst) -> Option<Inst>
Fetch the instruction preceding inst
.
pub fn insert_inst(&mut self, inst: Inst, before: Inst)
[src]
pub fn insert_inst(&mut self, inst: Inst, before: Inst)
Insert inst
before the instruction before
in the same EBB.
pub fn remove_inst(&mut self, inst: Inst)
[src]
pub fn remove_inst(&mut self, inst: Inst)
Remove inst
from the layout.
ⓘImportant traits for Insts<'f>pub fn ebb_insts(&self, ebb: Ebb) -> Insts
[src]
pub fn ebb_insts(&self, ebb: Ebb) -> Insts
Iterate over the instructions in ebb
in layout order.
pub fn split_ebb(&mut self, new_ebb: Ebb, before: Inst)
[src]
pub fn split_ebb(&mut self, new_ebb: Ebb, before: Inst)
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 Clone for Layout
[src]
impl Clone for Layout
fn clone(&self) -> Layout
[src]
fn clone(&self) -> Layout
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl ProgramOrder for Layout
[src]
impl ProgramOrder for Layout
fn cmp<A, B>(&self, a: A, b: B) -> Ordering where
A: Into<ExpandedProgramPoint>,
B: Into<ExpandedProgramPoint>,
[src]
fn cmp<A, B>(&self, a: A, b: B) -> Ordering where
A: Into<ExpandedProgramPoint>,
B: Into<ExpandedProgramPoint>,
Compare the program points a
and b
relative to this program order. Read more
fn is_ebb_gap(&self, inst: Inst, ebb: Ebb) -> bool
[src]
fn is_ebb_gap(&self, inst: Inst, ebb: Ebb) -> bool
Is the range from inst
to ebb
just the gap between consecutive EBBs? Read more
impl<'f> IntoIterator for &'f Layout
[src]
impl<'f> IntoIterator for &'f Layout
Use a layout reference in a for loop.