[−][src]Trait llhd::ir::prelude::UnitBuilder
A temporary object used to populate a Function
, Process
or Entity
.
Associated Types
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
.
Provided methods
fn ins(&mut self) -> InstBuilder<&mut Self>
Add a new instruction using an InstBuilder
.
fn named_block(&mut self, name: impl Into<String>) -> Block
Create a new named BB.
Panics if the unit is an Entity
. This is a convenience wrapper around
block()
followed by unit_mut().cfg_mut().set_name(..)
.
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 try_cfg(&self) -> Option<&ControlFlowGraph>
Get the CFG of the unit being built.
fn try_cfg_mut(&mut self) -> Option<&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.