[][src]Trait llhd::ir::prelude::UnitBuilder

pub trait UnitBuilder {
    type Unit: Unit;
    fn unit(&self) -> &Self::Unit;
fn unit_mut(&mut self) -> &mut Self::Unit;
fn build_inst(&mut self, data: InstData, ty: Type) -> Inst;
fn remove_inst(&mut self, inst: Inst);
fn block(&mut self) -> Block;
fn remove_block(&mut self, bb: Block);
fn insert_at_end(&mut self);
fn insert_at_beginning(&mut self);
fn append_to(&mut self, bb: Block);
fn prepend_to(&mut self, bb: Block);
fn insert_after(&mut self, inst: Inst);
fn insert_before(&mut self, inst: Inst); fn ins(&mut self) -> InstBuilder<&mut Self> { ... }
fn dfg(&self) -> &DataFlowGraph { ... }
fn dfg_mut(&mut self) -> &mut DataFlowGraph { ... }
fn cfg(&self) -> &ControlFlowGraph { ... }
fn cfg_mut(&mut self) -> &mut ControlFlowGraph { ... }
fn func_layout(&self) -> &FunctionLayout { ... }
fn func_layout_mut(&mut self) -> &mut FunctionLayout { ... }
fn inst_layout(&self) -> &InstLayout { ... }
fn inst_layout_mut(&mut self) -> &mut InstLayout { ... }
fn add_extern(&mut self, name: UnitName, sig: Signature) -> ExtUnit { ... }
fn prune_if_unused(&mut self, inst: Inst) -> bool { ... } }

A temporary object used to populate a Function, Process or Entity.

Associated Types

type Unit: Unit

The type returned by unit() and unit_mut().

Loading content...

Required methods

fn unit(&self) -> &Self::Unit

Return the unit being built.

fn unit_mut(&mut self) -> &mut Self::Unit

Return the mutable unit being built.

fn build_inst(&mut self, data: InstData, ty: Type) -> Inst

Add a new instruction.

fn remove_inst(&mut self, inst: Inst)

Remove an instruction.

fn block(&mut self) -> Block

Create a new BB.

Panics if the unit is an Entity.

fn remove_block(&mut self, bb: Block)

Remove a BB.

Panics if the unit is an Entity.

fn insert_at_end(&mut self)

Append all following instructions at the end of the unit.

Panics if the unit is a Function or Process.

fn insert_at_beginning(&mut self)

Prepend all following instructions at the beginning of the unit.

Panics if the unit is a Function or Process.

fn append_to(&mut self, bb: Block)

Append all following instructions to the end of bb.

Panics if the unit is an Entity.

fn prepend_to(&mut self, bb: Block)

Prepend all following instructions to the beginning of bb.

Panics if the unit is an Entity.

fn insert_after(&mut self, inst: Inst)

Insert all following instructions after inst.

fn insert_before(&mut self, inst: Inst)

Insert all following instructions before inst.

Loading content...

Provided methods

fn ins(&mut self) -> InstBuilder<&mut Self>

Add a new instruction using an InstBuilder.

fn dfg(&self) -> &DataFlowGraph

Get the DFG of the unit being built.

fn dfg_mut(&mut self) -> &mut DataFlowGraph

Get the mutable DFG of the unit being built.

fn cfg(&self) -> &ControlFlowGraph

Get the CFG of the unit being built.

fn cfg_mut(&mut self) -> &mut ControlFlowGraph

Get the mutable CFG of the unit being built.

fn func_layout(&self) -> &FunctionLayout

Get the function/process layout of the unit being built.

Panics if the unit is an Entity.

fn func_layout_mut(&mut self) -> &mut FunctionLayout

Get the function/process layout of the unit being built.

Panics if the unit is an Entity.

fn inst_layout(&self) -> &InstLayout

Get the entity layout of the unit being built.

Panics if the unit is a Function or Process.

fn inst_layout_mut(&mut self) -> &mut InstLayout

Get the entity layout of the unit being built.

Panics if the unit is a Function or Process.

fn add_extern(&mut self, name: UnitName, sig: Signature) -> ExtUnit

Import an external unit for use within this unit.

fn prune_if_unused(&mut self, inst: Inst) -> bool

Remove an instruction if its value is not being read.

Returns true if the instruction was removed.

Loading content...

Implementors

impl<'_> UnitBuilder for EntityBuilder<'_>[src]

type Unit = Entity

impl<'_> UnitBuilder for FunctionBuilder<'_>[src]

type Unit = Function

impl<'_> UnitBuilder for ProcessBuilder<'_>[src]

type Unit = Process

Loading content...