[][src]Struct llhd::ir::InstBuilder

pub struct InstBuilder<'a, 'b> { /* fields omitted */ }

A temporary object used to construct a single instruction.

Implementations

impl<'a, 'b> InstBuilder<'a, 'b>[src]

pub fn new(builder: &'b mut UnitBuilder<'a>) -> Self[src]

Create a new instruction builder that inserts into builder.

pub fn name(self, name: impl Into<String>) -> Self[src]

Assign a name to the instruction being built.

impl<'a, 'b> InstBuilder<'a, 'b>[src]

pub fn const_zero(&mut self, ty: &Type) -> Value[src]

Construct the zero value for a type.

This is a convenience function that creates the appropriate instruction sequence to generate the given zero value. Note that arrays and structs emit multiple instructions.

pub fn const_int(&mut self, value: impl Into<IntValue>) -> Value[src]

Construct the given value for int type.

This is a convenience function that creates the appropriate instruction sequence to generate the given value for int type.

pub fn const_time(&mut self, value: impl Into<TimeValue>) -> Value[src]

Construct the given value for time type.

This is a convenience function that creates the appropriate instruction sequence to generate the given value for int type.

pub fn alias(&mut self, x: Value) -> Value[src]

Creates alias instruction to assign a new name to a value.

pub fn array_uniform(&mut self, imm: usize, x: Value) -> Value[src]

Creates array instruction to generate array of a given size with all elements of given value.

pub fn array(&mut self, args: Vec<Value>) -> Value[src]

Creates array instruction to generate array from a vector of similar type of Values.

pub fn strukt(&mut self, args: Vec<Value>) -> Value[src]

Creates struct instruction to generate struct from a vector of different types of Values.

pub fn not(&mut self, x: Value) -> Value[src]

Creates not instruction to generate inverse of a given Value.

pub fn neg(&mut self, x: Value) -> Value[src]

Creates neg instruction to compute two's compliment of the given Value.

pub fn add(&mut self, x: Value, y: Value) -> Value[src]

Creates add instruction to sum two given Value's.

pub fn sub(&mut self, x: Value, y: Value) -> Value[src]

Creates sub instruction to substract the two given Value's.

pub fn and(&mut self, x: Value, y: Value) -> Value[src]

Creates and instruction to compute bitwise AND of the given two Value's.

pub fn or(&mut self, x: Value, y: Value) -> Value[src]

Creates or instruction to compute bitwise OR of the given two Value's.

pub fn xor(&mut self, x: Value, y: Value) -> Value[src]

Creates xor instruction to compute bitwise XOR of the given two Value's.

pub fn smul(&mut self, x: Value, y: Value) -> Value[src]

Creates smul instruction to compute signed binary multiplication.

pub fn sdiv(&mut self, x: Value, y: Value) -> Value[src]

Creates sdiv instruction to compute signed binary division

pub fn smod(&mut self, x: Value, y: Value) -> Value[src]

Creates smod instruction to compute signed binary modulus of a given Value when divided by the other

pub fn srem(&mut self, x: Value, y: Value) -> Value[src]

Creates srem instruction to compute signed binary reminder of the given Value when divided by the other

pub fn umul(&mut self, x: Value, y: Value) -> Value[src]

Creates smul instruction to compute unsigned binary multiplication

pub fn udiv(&mut self, x: Value, y: Value) -> Value[src]

Creates sdiv instruction to compute unsigned binary division of a given Value with the other

pub fn umod(&mut self, x: Value, y: Value) -> Value[src]

Creates umod instruction to compute unsigned binary modulus of a given Value when divided by the other

pub fn urem(&mut self, x: Value, y: Value) -> Value[src]

Creates urem instruction to compute unsigned binary reminder of the given Value when divided by the other

pub fn eq(&mut self, x: Value, y: Value) -> Value[src]

Creates eq instruction to check for equality of the given Value's

pub fn neq(&mut self, x: Value, y: Value) -> Value[src]

Creates neq instruction to check for unequality of the given Value's

pub fn slt(&mut self, x: Value, y: Value) -> Value[src]

Creates slt instruction to check if a given Value, as signed, is less than the other

pub fn sgt(&mut self, x: Value, y: Value) -> Value[src]

Creates sgt instruction to check if a given Value, as signed, is greater than the other

pub fn sle(&mut self, x: Value, y: Value) -> Value[src]

Creates sle instruction to check if a given Value, as signed, is less than or equal to the other

pub fn sge(&mut self, x: Value, y: Value) -> Value[src]

Creates sge instruction to check if a given Value, as signed, is greater than or equal to the other

pub fn ult(&mut self, x: Value, y: Value) -> Value[src]

Creates ult instruction to check if a given Value, as unsigned, is less than the other

pub fn ugt(&mut self, x: Value, y: Value) -> Value[src]

Creates ugt instruction to check if a given Value, as unsigned, is greater than the other

pub fn ule(&mut self, x: Value, y: Value) -> Value[src]

Creates ule instruction to check if a given Value, as unsigned, is less than or equal to the other

pub fn uge(&mut self, x: Value, y: Value) -> Value[src]

Creates uge instruction to check if a given Value, as unsigned, is greater than or equal the other

pub fn shl(&mut self, x: Value, y: Value, z: Value) -> Value[src]

Creates shl instruction to shift a given Value to the left by the given amount from a hidden Value

pub fn shr(&mut self, x: Value, y: Value, z: Value) -> Value[src]

Creates shr instruction to shift a given Value to the right by the given amount from a hidden Value

pub fn mux(&mut self, x: Value, y: Value) -> Value[src]

Creates mux instruction to choose a Value from a given array of Values based on a given selector Value

pub fn reg(&mut self, x: Value, data: Vec<RegTrigger>) -> Inst[src]

Creates reg instruction to provide a storage element which drives it output onto a signal

pub fn ins_field(&mut self, x: Value, y: Value, imm: usize) -> Value[src]

Creates insf instruction to insert a field or element or bit in a given array or struct or integer, respectively, at an index

pub fn ins_slice(
    &mut self,
    x: Value,
    y: Value,
    imm0: usize,
    imm1: usize
) -> Value
[src]

Creates inss instruction to insert a slice of array element or integer bits in a given array or integer, respectively, in a range of indexes

pub fn ext_field(&mut self, x: Value, imm: usize) -> Value[src]

Creates extf instruction to extract a field or element or bit from a given array or struct or integer, respectively, at an index

pub fn ext_slice(&mut self, x: Value, imm0: usize, imm1: usize) -> Value[src]

Creates exts instruction to extract a slice of array element or integer bits from a given array or integer, respectively, in a range of indexes

pub fn con(&mut self, x: Value, y: Value) -> Inst[src]

Creates con instruction to connect two signals

pub fn del(&mut self, target: Value, source: Value, delay: Value) -> Inst[src]

Creates del instruction to delay a signal source by a delay

pub fn call(&mut self, unit: ExtUnit, args: Vec<Value>) -> Inst[src]

Creates call instruction to transfer control to a function and yield its return value

pub fn inst(
    &mut self,
    unit: ExtUnit,
    inputs: Vec<Value>,
    outputs: Vec<Value>
) -> Inst
[src]

Creates inst instruction to instantiates a proces or entity within the current one

pub fn sig(&mut self, x: Value) -> Value[src]

Creates sig instruction to allocate a signal

pub fn prb(&mut self, x: Value) -> Value[src]

Creates prb instruction to probe the current value of a signal

pub fn drv(&mut self, signal: Value, value: Value, delay: Value) -> Inst[src]

Creates drv instruction to shedule signal value to change after a delay

pub fn drv_cond(
    &mut self,
    signal: Value,
    value: Value,
    delay: Value,
    cond: Value
) -> Inst
[src]

Creates drv_cond instruction to shedule signal value to change after a delay if given condition is satisfied

pub fn var(&mut self, x: Value) -> Value[src]

Creates var instruction to allocate memory on stack with the initial value and returns a pointer to that location

pub fn ld(&mut self, x: Value) -> Value[src]

Creates ld instruction to load a value from a memory location pointer

pub fn st(&mut self, x: Value, y: Value) -> Inst[src]

Creates st instruction to store a value to a memory location pointer

pub fn halt(&mut self) -> Inst[src]

Creates halt instruction to terminate an execution of a process

pub fn ret(&mut self) -> Inst[src]

Creates ret instruction to return from a void function

pub fn ret_value(&mut self, x: Value) -> Inst[src]

Creates ret instruction to return from a void function and returns a value

pub fn phi(&mut self, args: Vec<Value>, bbs: Vec<Block>) -> Value[src]

Creates phi instruction to implement phi node in SSA graph representing the function or process

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

Creates br instruction to transfer control to another basic block

pub fn br_cond(&mut self, x: Value, bb0: Block, bb1: Block) -> Inst[src]

Creates br instruction to transfer control to another basic block, between two blocks, based on the given condition

pub fn wait(&mut self, bb: Block, args: Vec<Value>) -> Inst[src]

Creates wait instruction to suspend execution of a process until any of the observed signals change

pub fn wait_time(&mut self, bb: Block, time: Value, args: Vec<Value>) -> Inst[src]

Creates wait instruction to suspend execution of a process until any of the observed signals change or a fixed time interval has passed

impl<'a, 'b> InstBuilder<'a, 'b>[src]

Fundamental convenience forwards to the wrapped builder.

pub fn suffix<'c>(self, value: Value, suffix: impl Into<Cow<'c, str>>) -> Self[src]

Assign another value's name plus a suffix to the instruction being built.

If value has a name, the instruction's name will be <value>.<suffix>. Otherwise it will just be <suffix>.

Auto Trait Implementations

impl<'a, 'b> RefUnwindSafe for InstBuilder<'a, 'b>

impl<'a, 'b> Send for InstBuilder<'a, 'b>

impl<'a, 'b> Sync for InstBuilder<'a, 'b>

impl<'a, 'b> Unpin for InstBuilder<'a, 'b> where
    'a: 'b, 

impl<'a, 'b> !UnwindSafe for InstBuilder<'a, 'b>

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, 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.