[][src]Struct llhd::ir::prelude::Unit

pub struct Unit<'a> { /* fields omitted */ }

An immutable function, process, or entity.

Implementations

impl<'a> Unit<'a>[src]

pub fn new(unit: UnitId, data: &'a UnitData) -> Self[src]

Create a new unit wrapper around raw unit data.

pub fn new_anonymous(data: &'a UnitData) -> Self[src]

Create a new unit wrapper around raw unit data that has not been added to a module yet.

pub fn id(self) -> UnitId[src]

Get the unit's id.

pub fn data(self) -> &'a UnitData[src]

Get the unit's data.

pub fn kind(&self) -> UnitKind[src]

Get the kind of this unit.

pub fn sig(self) -> &'a Signature[src]

Get the unit's signature.

pub fn name(self) -> &'a UnitName[src]

Get the unit's name.

pub fn dump(self) -> Self[src]

👎 Deprecated since 0.13.0:

simply drop the dump()

Dump the unit in human-readable form.

pub fn verify(self)[src]

Panic if the unit is not well-formed.

pub fn is_function(self) -> bool[src]

Check if this unit is a Function.

pub fn is_process(self) -> bool[src]

Check if this unit is a Process.

pub fn is_entity(self) -> bool[src]

Check if this unit is an Entity.

pub fn input_args(self) -> impl Iterator<Item = Value> + 'a[src]

Return an iterator over the unit's input arguments.

pub fn output_args(self) -> impl Iterator<Item = Value> + 'a[src]

Return an iterator over the unit's output arguments.

pub fn args(self) -> impl Iterator<Item = Value> + 'a[src]

Return an iterator over the unit's arguments.

pub fn input_arg(self, pos: usize) -> Value[src]

Get the input argument at position pos.

pub fn output_arg(self, pos: usize) -> Value[src]

Get the output argument at position pos.

pub fn extern_name(self, ext: ExtUnit) -> &'a UnitName[src]

Return the name of an external unit.

pub fn extern_sig(self, ext: ExtUnit) -> &'a Signature[src]

Return the signature of an external unit.

pub fn extern_units(
    self
) -> impl Iterator<Item = (ExtUnit, &'a ExtUnitData)> + 'a
[src]

Return an iterator over the external units used by this unit.

impl<'a> Unit<'a>[src]

pub fn trg(self) -> TemporalRegionGraph[src]

Compute the unit's temporal region graph.

pub fn predtbl(self) -> PredecessorTable[src]

Compute the unit's block predecessor table.

pub fn temporal_predtbl(self) -> PredecessorTable[src]

Compute the unit's temporal block predecessor table.

pub fn domtree(self) -> DominatorTree[src]

Compute the unit's dominator tree.

pub fn temporal_domtree(self) -> DominatorTree[src]

Compute the unit's temporal dominator tree.

pub fn domtree_with_predtbl(self, pt: &PredecessorTable) -> DominatorTree[src]

Compute the unit's dominator tree, if a predecessor table is already available.

impl<'a> Unit<'a>[src]

pub fn get_block_name(self, bb: Block) -> Option<&'a str>[src]

Return the name of a BB.

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

Return the anonymous name hint of a BB.

impl<'a> Unit<'a>[src]

pub fn is_placeholder(self, value: Value) -> bool[src]

Check if a value is a placeholder.

pub fn has_result(self, inst: Inst) -> bool[src]

Returns whether an instruction produces a result.

pub fn inst_result(self, inst: Inst) -> Value[src]

Returns the result of an instruction.

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

Returns the result of an instruction.

pub fn arg_value(self, arg: Arg) -> Value[src]

Returns the value of an argument.

pub fn value_type(self, value: Value) -> Type[src]

Returns the type of a value.

pub fn inst_type(self, inst: Inst) -> Type[src]

Returns the type of an instruction.

pub fn get_value_arg(self, value: Value) -> Option<Arg>[src]

Return the argument that produces value.

pub fn value_arg(self, value: Value) -> Arg[src]

Return the argument that produces value, or panic.

pub fn get_value_inst(self, value: Value) -> Option<Inst>[src]

Return the instruction that produces value.

pub fn value_inst(self, value: Value) -> Inst[src]

Return the instruction that produces value, or panic.

pub fn get_name(self, value: Value) -> Option<&'a str>[src]

Return the name of a value.

pub fn get_anonymous_hint(self, value: Value) -> Option<u32>[src]

Return the anonymous name hint of a value.

pub fn uses(self, value: Value) -> &'a HashSet<Inst>[src]

Iterate over all uses of a value.

pub fn has_uses(self, value: Value) -> bool[src]

Check if a value is used.

pub fn has_one_use(self, value: Value) -> bool[src]

Check if a value has exactly one use.

pub fn get_const(self, value: Value) -> Option<Value>[src]

Resolve a constant value.

Returns None if the value is not constant. Note that this does not perform constant folding. Rather, the value must resolve to an instruction which produces a constant value.

pub fn get_const_time(self, value: Value) -> Option<&'a TimeValue>[src]

Resolve a constant time value.

Returns None if the value is not constant. Note that this does not perform constant folding. Rather, the value must resolve to an instruction which produces a constant value.

pub fn get_const_int(self, value: Value) -> Option<&'a IntValue>[src]

Resolve a constant integer value.

Returns None if the value is not constant. Note that this does not perform constant folding. Rather, the value must resolve to an instruction which produces a constant value.

pub fn get_const_array(self, value: Value) -> Option<ArrayValue>[src]

Resolve a constant array value.

Returns None if the value is not constant. Note that this does not perform constant folding. Rather, the value must resolve to an instruction which produces a constant value.

pub fn get_const_struct(self, value: Value) -> Option<StructValue>[src]

Resolve a constant struct value.

Returns None if the value is not constant. Note that this does not perform constant folding. Rather, the value must resolve to an instruction which produces a constant value.

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

Get the location hint associated with an instruction.

Returns the byte offset of the instruction in the input file, or None if there is no hint for the instruction.

pub fn block_id_bound(self) -> usize[src]

Get the block ID bound.

This function is useful for creating dense vectors to associate data with blocks.

impl<'a> Unit<'a>[src]

Basic Block Layout

The following functions are used to query the basic block layout.

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

Return an iterator over all BBs in layout order.

pub fn is_block_inserted(self, bb: Block) -> bool[src]

Check if a block is inserted into the layout.

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<'a> Unit<'a>[src]

Instruction Layout

The following functions are used to query the instruction layout within a block.

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 insts(self, bb: Block) -> impl Iterator<Item = Inst> + 'a[src]

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

pub fn all_insts(self) -> impl Iterator<Item = Inst> + 'a[src]

Return an iterator over all instructions in layout order.

pub fn is_inst_inserted(self, inst: Inst) -> bool[src]

Check if an instruction is inserted into the layout.

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<'a> Borrow<Unit<'a>> for UnitBuilder<'a>[src]

impl<'a> Clone for Unit<'a>[src]

impl<'a> Copy for Unit<'a>[src]

impl Display for Unit<'_>[src]

impl Index<Block> for Unit<'_>[src]

type Output = BlockData

The returned type after indexing.

impl Index<ExtUnit> for Unit<'_>[src]

type Output = ExtUnitData

The returned type after indexing.

impl Index<Inst> for Unit<'_>[src]

type Output = InstData

The returned type after indexing.

impl Index<Value> for Unit<'_>[src]

type Output = ValueData

The returned type after indexing.

Auto Trait Implementations

impl<'a> RefUnwindSafe for Unit<'a>[src]

impl<'a> Send for Unit<'a>[src]

impl<'a> Sync for Unit<'a>[src]

impl<'a> Unpin for Unit<'a>[src]

impl<'a> UnwindSafe for Unit<'a>[src]

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> From<T> for T[src]

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

impl<T> Pointable for T

type Init = T

The type for initializers.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[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.