[][src]Struct llhd::ir::FunctionLayout

pub struct FunctionLayout { /* fields omitted */ }

Determines the order of instructions and BBs in a Function or Process.

Methods

impl FunctionLayout[src]

pub fn new() -> Self[src]

Create a new function layout.

impl FunctionLayout[src]

Basic block arrangement.

The following functions are used for laying out the basic blocks within a Function or Process.

pub fn append_block(&mut self, bb: Block)[src]

Append a BB to the end of the function.

pub fn prepend_block(&mut self, bb: Block)[src]

Prepend a BB to the beginning of a function.

This effectively makes bb the new entry block.

pub fn insert_block_after(&mut self, bb: Block, after: Block)[src]

Insert a BB after another BB.

pub fn insert_block_before(&mut self, bb: Block, before: Block)[src]

Insert a BB before another BB.

pub fn remove_block(&mut self, bb: Block)[src]

Remove a BB from the function.

pub fn swap_blocks(&mut self, bb0: Block, bb1: Block)[src]

Swap the position of two BBs.

pub fn blocks<'a>(&'a self) -> impl Iterator<Item = Block> + 'a[src]

Return an iterator over all BBs in layout order.

pub fn first_block(&self) -> Option<Block>[src]

Get the first BB in the layout. This is the entry block.

pub fn last_block(&self) -> Option<Block>[src]

Get the last BB in the layout.

pub fn prev_block(&self, bb: Block) -> Option<Block>[src]

Get the BB preceding bb in the layout.

pub fn next_block(&self, bb: Block) -> Option<Block>[src]

Get the BB following bb in the layout.

pub fn entry(&self) -> Block[src]

Get the entry block in the layout.

The fallible alternative is first_block(bb).

impl FunctionLayout[src]

Instruction arrangement.

The following functions are used for laying out the instructions within a Function or Process.

pub fn inst_block(&self, inst: Inst) -> Option<Block>[src]

Get the BB which contains inst, or None if inst is not inserted.

pub fn append_inst(&mut self, inst: Inst, bb: Block)[src]

Append an instruction to the end of a BB.

pub fn prepend_inst(&mut self, inst: Inst, bb: Block)[src]

Prepend an instruction to the beginning of a BB.

pub fn insert_inst_after(&mut self, inst: Inst, after: Inst)[src]

Insert an instruction after another instruction.

pub fn insert_inst_before(&mut self, inst: Inst, before: Inst)[src]

Insert an instruction before another instruction.

pub fn remove_inst(&mut self, inst: Inst)[src]

Remove an instruction from the function.

pub fn insts<'a>(&'a self, bb: Block) -> impl Iterator<Item = Inst> + 'a[src]

Return an iterator over all instructions in a block in layout order.

pub fn first_inst(&self, bb: Block) -> Option<Inst>[src]

Get the first instruction in the layout.

pub fn last_inst(&self, bb: Block) -> Option<Inst>[src]

Get the last instruction in the layout.

pub fn prev_inst(&self, inst: Inst) -> Option<Inst>[src]

Get the instruction preceding inst in the layout.

pub fn next_inst(&self, inst: Inst) -> Option<Inst>[src]

Get the instruction following inst in the layout.

pub fn terminator(&self, bb: Block) -> Inst[src]

Get the terminator instruction in the layout.

The fallible alternative is last_inst(bb).

Trait Implementations

impl Default for FunctionLayout[src]

impl<'de> Deserialize<'de> for FunctionLayout[src]

impl Layout for FunctionLayout[src]

impl Serialize for FunctionLayout[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.