Struct BodyBuilder

Source
pub struct BodyBuilder {
    pub body: FunctionBody,
    /* private fields */
}

Fields§

§body: FunctionBody

Implementations§

Source§

impl BodyBuilder

Source

pub fn new(fid: FunctionId, source: SourceInfo) -> Self

Source

pub fn build(self) -> FunctionBody

Source

pub fn func_id(&self) -> FunctionId

Source

pub fn make_block(&mut self) -> BasicBlockId

Source

pub fn make_value(&mut self, value: impl Into<Value>) -> ValueId

Source

pub fn map_result(&mut self, inst: InstId, result: AssignableValue)

Source

pub fn inst_result(&mut self, inst: InstId) -> Option<&AssignableValue>

Source

pub fn move_to_block(&mut self, block: BasicBlockId)

Source

pub fn move_to_block_top(&mut self, block: BasicBlockId)

Source

pub fn make_unit(&mut self, unit_ty: TypeId) -> ValueId

Source

pub fn make_imm(&mut self, imm: BigInt, ty: TypeId) -> ValueId

Source

pub fn make_imm_from_bool(&mut self, imm: bool, ty: TypeId) -> ValueId

Source

pub fn make_constant(&mut self, constant: ConstantId, ty: TypeId) -> ValueId

Source

pub fn declare(&mut self, local: Local) -> ValueId

Source

pub fn store_func_arg(&mut self, local: Local) -> ValueId

Source

pub fn not(&mut self, value: ValueId, source: SourceInfo) -> InstId

Source

pub fn neg(&mut self, value: ValueId, source: SourceInfo) -> InstId

Source

pub fn inv(&mut self, value: ValueId, source: SourceInfo) -> InstId

Source

pub fn add(&mut self, lhs: ValueId, rhs: ValueId, source: SourceInfo) -> InstId

Source

pub fn sub(&mut self, lhs: ValueId, rhs: ValueId, source: SourceInfo) -> InstId

Source

pub fn mul(&mut self, lhs: ValueId, rhs: ValueId, source: SourceInfo) -> InstId

Source

pub fn div(&mut self, lhs: ValueId, rhs: ValueId, source: SourceInfo) -> InstId

Source

pub fn modulo( &mut self, lhs: ValueId, rhs: ValueId, source: SourceInfo, ) -> InstId

Source

pub fn pow(&mut self, lhs: ValueId, rhs: ValueId, source: SourceInfo) -> InstId

Source

pub fn shl(&mut self, lhs: ValueId, rhs: ValueId, source: SourceInfo) -> InstId

Source

pub fn shr(&mut self, lhs: ValueId, rhs: ValueId, source: SourceInfo) -> InstId

Source

pub fn bit_or( &mut self, lhs: ValueId, rhs: ValueId, source: SourceInfo, ) -> InstId

Source

pub fn bit_xor( &mut self, lhs: ValueId, rhs: ValueId, source: SourceInfo, ) -> InstId

Source

pub fn bit_and( &mut self, lhs: ValueId, rhs: ValueId, source: SourceInfo, ) -> InstId

Source

pub fn logical_and( &mut self, lhs: ValueId, rhs: ValueId, source: SourceInfo, ) -> InstId

Source

pub fn logical_or( &mut self, lhs: ValueId, rhs: ValueId, source: SourceInfo, ) -> InstId

Source

pub fn eq(&mut self, lhs: ValueId, rhs: ValueId, source: SourceInfo) -> InstId

Source

pub fn ne(&mut self, lhs: ValueId, rhs: ValueId, source: SourceInfo) -> InstId

Source

pub fn ge(&mut self, lhs: ValueId, rhs: ValueId, source: SourceInfo) -> InstId

Source

pub fn gt(&mut self, lhs: ValueId, rhs: ValueId, source: SourceInfo) -> InstId

Source

pub fn le(&mut self, lhs: ValueId, rhs: ValueId, source: SourceInfo) -> InstId

Source

pub fn lt(&mut self, lhs: ValueId, rhs: ValueId, source: SourceInfo) -> InstId

Source

pub fn primitive_cast( &mut self, value: ValueId, result_ty: TypeId, source: SourceInfo, ) -> InstId

Source

pub fn untag_cast( &mut self, value: ValueId, result_ty: TypeId, source: SourceInfo, ) -> InstId

Source

pub fn aggregate_construct( &mut self, ty: TypeId, args: Vec<ValueId>, source: SourceInfo, ) -> InstId

Source

pub fn bind(&mut self, src: ValueId, source: SourceInfo) -> InstId

Source

pub fn mem_copy(&mut self, src: ValueId, source: SourceInfo) -> InstId

Source

pub fn load(&mut self, src: ValueId, source: SourceInfo) -> InstId

Source

pub fn aggregate_access( &mut self, value: ValueId, indices: Vec<ValueId>, source: SourceInfo, ) -> InstId

Source

pub fn map_access( &mut self, value: ValueId, key: ValueId, source: SourceInfo, ) -> InstId

Source

pub fn call( &mut self, func: FunctionId, args: Vec<ValueId>, call_type: CallType, source: SourceInfo, ) -> InstId

Source

pub fn keccak256(&mut self, arg: ValueId, source: SourceInfo) -> InstId

Source

pub fn abi_encode(&mut self, arg: ValueId, source: SourceInfo) -> InstId

Source

pub fn create( &mut self, value: ValueId, contract: ContractId, source: SourceInfo, ) -> InstId

Source

pub fn create2( &mut self, value: ValueId, salt: ValueId, contract: ContractId, source: SourceInfo, ) -> InstId

Source

pub fn yul_intrinsic( &mut self, op: YulIntrinsicOp, args: Vec<ValueId>, source: SourceInfo, ) -> InstId

Source

pub fn jump(&mut self, dest: BasicBlockId, source: SourceInfo) -> InstId

Source

pub fn branch( &mut self, cond: ValueId, then: BasicBlockId, else_: BasicBlockId, source: SourceInfo, ) -> InstId

Source

pub fn switch( &mut self, disc: ValueId, table: SwitchTable, default: Option<BasicBlockId>, source: SourceInfo, ) -> InstId

Source

pub fn revert(&mut self, arg: Option<ValueId>, source: SourceInfo) -> InstId

Source

pub fn emit(&mut self, arg: ValueId, source: SourceInfo) -> InstId

Source

pub fn ret(&mut self, arg: ValueId, source: SourceInfo) -> InstId

Source

pub fn nop(&mut self, source: SourceInfo) -> InstId

Source

pub fn value_ty(&mut self, value: ValueId) -> TypeId

Source

pub fn value_data(&mut self, value: ValueId) -> &Value

Source

pub fn is_block_terminated(&mut self, block: BasicBlockId) -> bool

Returns true if current block is terminated.

Source

pub fn is_current_block_terminated(&mut self) -> bool

Source

pub fn current_block(&mut self) -> BasicBlockId

Source

pub fn remove_inst(&mut self, inst: InstId)

Source

pub fn inst_data(&self, inst: InstId) -> &Inst

Trait Implementations§

Source§

impl Debug for BodyBuilder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.