Skip to main content

BlockBuilder

Struct BlockBuilder 

Source
pub struct BlockBuilder<'a> {
    pub block_id: BlockId,
    /* private fields */
}

Fields§

§block_id: BlockId

Implementations§

Source§

impl<'a> BlockBuilder<'a>

Source

pub fn new( block_id: BlockId, function_name: String, context: &'a mut IRContext, registry: &'a mut IRRegistry, ) -> Self

Source

pub fn set_source_location(&mut self, location: SourceLocation)

Source

pub fn clear_source_location(&mut self)

Source

pub fn block_id(&self) -> BlockId

Source

pub fn add(&mut self, left: Value, right: Value, ty: Type) -> Value

Source

pub fn sub(&mut self, left: Value, right: Value, ty: Type) -> Value

Source

pub fn mul(&mut self, left: Value, right: Value, ty: Type) -> Value

Source

pub fn div(&mut self, left: Value, right: Value, ty: Type) -> Value

Source

pub fn mod_(&mut self, left: Value, right: Value, ty: Type) -> Value

Source

pub fn pow(&mut self, base: Value, exp: Value) -> Value

Source

pub fn checked_add(&mut self, left: Value, right: Value, ty: Type) -> Value

Source

pub fn checked_sub(&mut self, left: Value, right: Value, ty: Type) -> Value

Source

pub fn checked_mul(&mut self, left: Value, right: Value, ty: Type) -> Value

Source

pub fn and(&mut self, left: Value, right: Value) -> Value

Source

pub fn or(&mut self, left: Value, right: Value) -> Value

Source

pub fn xor(&mut self, left: Value, right: Value) -> Value

Source

pub fn not(&mut self, operand: Value) -> Value

Source

pub fn shl(&mut self, value: Value, shift: Value) -> Value

Source

pub fn shr(&mut self, value: Value, shift: Value) -> Value

Source

pub fn sar(&mut self, value: Value, shift: Value) -> Value

Source

pub fn eq(&mut self, left: Value, right: Value) -> Value

Source

pub fn ne(&mut self, left: Value, right: Value) -> Value

Source

pub fn lt(&mut self, left: Value, right: Value) -> Value

Source

pub fn gt(&mut self, left: Value, right: Value) -> Value

Source

pub fn le(&mut self, left: Value, right: Value) -> Value

Source

pub fn ge(&mut self, left: Value, right: Value) -> Value

Source

pub fn select( &mut self, condition: Value, then_val: Value, else_val: Value, ) -> Value

Source

pub fn allocate(&mut self, ty: Type, size: Size) -> Value

Source

pub fn storage_load(&mut self, slot: BigUint) -> Value

Source

pub fn storage_store(&mut self, slot: BigUint, value: Value)

Source

pub fn mapping_load(&mut self, mapping: Value, key: Value) -> Value

Source

pub fn mapping_store(&mut self, mapping: Value, key: Value, value: Value)

Source

pub fn array_load(&mut self, array: Value, index: Value) -> Value

Source

pub fn array_store(&mut self, array: Value, index: Value, value: Value)

Source

pub fn array_length(&mut self, array: Value) -> Value

Source

pub fn array_push(&mut self, array: Value, value: Value)

Source

pub fn array_pop(&mut self, array: Value) -> Value

Source

pub fn msg_sender(&mut self) -> Value

Source

pub fn msg_value(&mut self) -> Value

Source

pub fn block_number(&mut self) -> Value

Source

pub fn block_timestamp(&mut self) -> Value

Source

pub fn call_internal(&mut self, name: &str, args: Vec<Value>) -> Value

Source

pub fn call_external( &mut self, target: Value, selector: Value, args: Vec<Value>, value: Option<Value>, ) -> Value

Source

pub fn keccak256(&mut self, data: Value, len: Value) -> Value

Source

pub fn sha256(&mut self, data: Value, len: Value) -> Value

Source

pub fn emit_event( &mut self, event_id: EventId, topics: Vec<Value>, data: Vec<Value>, )

Source

pub fn cast(&mut self, value: Value, to: Type) -> Value

Source

pub fn assert(&mut self, condition: Value, message: &str)

Source

pub fn require(&mut self, condition: Value, message: &str)

Source

pub fn assign(&mut self, result: Value, value: Value)

Source

pub fn phi(&mut self, values: Vec<(BlockId, Value)>) -> Value

Source

pub fn jump(&mut self, target: BlockId) -> Result<()>

Source

pub fn branch( &mut self, condition: Value, then_block: BlockId, else_block: BlockId, ) -> Result<()>

Source

pub fn return_value(&mut self, value: Value) -> Result<()>

Source

pub fn return_void(&mut self) -> Result<()>

Source

pub fn revert(&mut self, message: &str) -> Result<()>

Source

pub fn is_sealed(&self) -> bool

Source

pub fn seal_with_terminator(&mut self, terminator: Terminator) -> Result<()>

Source

pub fn new_temp(&mut self) -> Value

Source

pub fn constant_uint(&self, value: u64, bits: u16) -> Value

Source

pub fn constant_int(&self, value: i64, bits: u16) -> Value

Source

pub fn constant_bool(&self, value: bool) -> Value

Source

pub fn constant_address(&self, bytes: [u8; 20]) -> Value

Source§

impl<'a> BlockBuilder<'a>

Trait Implementations§

Source§

impl<'a> InstBuilder<'a> for BlockBuilder<'a>

Source§

fn add(&mut self, left: Value, right: Value, ty: Type) -> Value

Source§

fn sub(&mut self, left: Value, right: Value, ty: Type) -> Value

Source§

fn mul(&mut self, left: Value, right: Value, ty: Type) -> Value

Source§

fn div(&mut self, left: Value, right: Value, ty: Type) -> Value

Source§

fn mod_(&mut self, left: Value, right: Value, ty: Type) -> Value

Source§

fn pow(&mut self, base: Value, exp: Value) -> Value

Source§

fn and(&mut self, left: Value, right: Value) -> Value

Source§

fn or(&mut self, left: Value, right: Value) -> Value

Source§

fn xor(&mut self, left: Value, right: Value) -> Value

Source§

fn not(&mut self, operand: Value) -> Value

Source§

fn shl(&mut self, value: Value, shift: Value) -> Value

Source§

fn shr(&mut self, value: Value, shift: Value) -> Value

Source§

fn sar(&mut self, value: Value, shift: Value) -> Value

Source§

fn eq(&mut self, left: Value, right: Value) -> Value

Source§

fn ne(&mut self, left: Value, right: Value) -> Value

Source§

fn lt(&mut self, left: Value, right: Value) -> Value

Source§

fn gt(&mut self, left: Value, right: Value) -> Value

Source§

fn le(&mut self, left: Value, right: Value) -> Value

Source§

fn ge(&mut self, left: Value, right: Value) -> Value

Source§

fn jump(&mut self, target: BlockId, args: Vec<Value>)

Source§

fn branch( &mut self, condition: Value, then_block: BlockId, else_block: BlockId, then_args: Vec<Value>, else_args: Vec<Value>, )

Source§

fn return_value(&mut self, value: Option<Value>)

Source§

fn assign(&mut self, dest: Value, src: Value)

Source§

fn phi(&mut self, values: Vec<(BlockId, Value)>) -> Value

Source§

impl<'a> InstBuilderBase<'a> for BlockBuilder<'a>

Source§

fn new_temp(&mut self) -> Value

Source§

fn current_block(&self) -> BlockId

Source§

fn switch_to_block(&mut self, block: BlockId)

Source§

impl<'a> InstBuilderExt<'a> for BlockBuilder<'a>

Source§

fn storage_load(&mut self, slot: BigUint) -> Value

Source§

fn storage_store(&mut self, slot: BigUint, value: Value)

Source§

fn storage_load_dynamic(&mut self, slot: Value) -> Value

Source§

fn storage_store_dynamic(&mut self, slot: Value, value: Value)

Source§

fn mapping_load(&mut self, mapping: Value, key: Value) -> Value

Source§

fn mapping_store(&mut self, mapping: Value, key: Value, value: Value)

Source§

fn array_load(&mut self, array: Value, index: Value) -> Value

Source§

fn array_store(&mut self, array: Value, index: Value, value: Value)

Source§

fn array_length(&mut self, array: Value) -> Value

Source§

fn array_push(&mut self, array: Value, value: Value)

Source§

fn array_pop(&mut self, array: Value) -> Value

Source§

fn msg_sender(&mut self) -> Value

Source§

fn msg_value(&mut self) -> Value

Source§

fn msg_data(&mut self) -> Value

Source§

fn block_number(&mut self) -> Value

Source§

fn block_timestamp(&mut self) -> Value

Source§

fn block_difficulty(&mut self) -> Value

Source§

fn block_gaslimit(&mut self) -> Value

Source§

fn block_coinbase(&mut self) -> Value

Source§

fn tx_origin(&mut self) -> Value

Source§

fn tx_gasprice(&mut self) -> Value

Source§

fn gas_left(&mut self) -> Value

Source§

fn msg_sig(&mut self) -> Value

Source§

fn block_chainid(&mut self) -> Value

Source§

fn block_basefee(&mut self) -> Value

Source§

fn call_internal(&mut self, name: &str, args: Vec<Value>) -> Value

Source§

fn call_external( &mut self, target: Value, selector: Value, args: Vec<Value>, value: Option<Value>, ) -> Value

Source§

fn delegate_call( &mut self, target: Value, selector: Value, args: Vec<Value>, ) -> Value

Source§

fn static_call( &mut self, target: Value, selector: Value, args: Vec<Value>, ) -> Value

Source§

fn emit_event(&mut self, event: EventId, topics: Vec<Value>, data: Vec<Value>)

Source§

fn keccak256(&mut self, data: Value, len: Value) -> Value

Source§

fn sha256(&mut self, data: Value, len: Value) -> Value

Source§

fn ripemd160(&mut self, data: Value, len: Value) -> Value

Source§

fn ecrecover(&mut self, hash: Value, v: Value, r: Value, s: Value) -> Value

Source§

fn checked_add(&mut self, left: Value, right: Value, ty: Type) -> Value

Source§

fn checked_sub(&mut self, left: Value, right: Value, ty: Type) -> Value

Source§

fn checked_mul(&mut self, left: Value, right: Value, ty: Type) -> Value

Source§

fn checked_div(&mut self, left: Value, right: Value, ty: Type) -> Value

Source§

fn require(&mut self, condition: Value, message: &str)

Source§

fn assert(&mut self, condition: Value, message: &str)

Source§

fn revert(&mut self, message: &str)

Source§

fn memory_alloc(&mut self, size: Value) -> Value

Source§

fn memory_copy(&mut self, dest: Value, src: Value, size: Value)

Source§

fn memory_size(&mut self) -> Value

Source§

fn cast(&mut self, value: Value, to: Type) -> Value

Source§

fn zext(&mut self, value: Value, to: Type) -> Value

Source§

fn sext(&mut self, value: Value, to: Type) -> Value

Source§

fn trunc(&mut self, value: Value, to: Type) -> Value

Auto Trait Implementations§

§

impl<'a> !UnwindSafe for BlockBuilder<'a>

§

impl<'a> Freeze for BlockBuilder<'a>

§

impl<'a> RefUnwindSafe for BlockBuilder<'a>

§

impl<'a> Send for BlockBuilder<'a>

§

impl<'a> Sync for BlockBuilder<'a>

§

impl<'a> Unpin for BlockBuilder<'a>

§

impl<'a> UnsafeUnpin for BlockBuilder<'a>

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> Same for T

Source§

type Output = T

Should always be Self
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.