InstBuilder

Trait InstBuilder 

Source
pub trait InstBuilder {
Show 55 methods // Required methods fn create_value(&mut self, value: ValueInfo) -> Value; fn create_inst(&mut self, inst: InstructionInfo); fn create_block(&mut self, block: InstBlock) -> Block; fn use_block(&mut self, block: Block) -> &mut InstBlock; fn require_import(&mut self, name: String); // Provided methods fn iconst_int(&mut self, value: u64) -> Value { ... } fn iconst_float(&mut self, value: f64) -> Value { ... } fn iconst_double(&mut self, value: f64) -> Value { ... } fn iconst_bool(&mut self, value: bool) -> Value { ... } fn iconst_str(&mut self, value: String) -> Value { ... } fn iconst_named(&mut self, name: String) -> Value { ... } fn iconst_named_props( &mut self, name: String, props: Vec<NamedProperty>, ) -> Value { ... } fn iconst_named_property(&self, name: String) -> NamedProperty { ... } fn iconst_named_static(&self, name: String) -> NamedProperty { ... } fn iconst_named_pointer(&self, name: String) -> NamedProperty { ... } fn iconst_named_index(&self, name: Value) -> NamedProperty { ... } fn ctype_bool(&mut self) -> AbiType { ... } fn ctype_uint8(&mut self) -> AbiType { ... } fn ctype_uint16(&mut self) -> AbiType { ... } fn ctype_uint32(&mut self) -> AbiType { ... } fn ctype_uint64(&mut self) -> AbiType { ... } fn ctype_usize(&mut self) -> AbiType { ... } fn ctype_int8(&mut self) -> AbiType { ... } fn ctype_int16(&mut self) -> AbiType { ... } fn ctype_int32(&mut self) -> AbiType { ... } fn ctype_int64(&mut self) -> AbiType { ... } fn ctype_isize(&mut self) -> AbiType { ... } fn ctype_char(&mut self) -> AbiType { ... } fn iadd(&mut self, l: Value, r: Value) -> Value { ... } fn isub(&mut self, l: Value, r: Value) -> Value { ... } fn imul(&mut self, l: Value, r: Value) -> Value { ... } fn idiv(&mut self, l: Value, r: Value) -> Value { ... } fn imod(&mut self, l: Value, r: Value) -> Value { ... } fn ibit_and(&mut self, l: Value, r: Value) -> Value { ... } fn ibit_or(&mut self, l: Value, r: Value) -> Value { ... } fn ibit_xor(&mut self, l: Value, r: Value) -> Value { ... } fn ibit_not(&mut self, l: Value) -> Value { ... } fn ibit_left(&mut self, l: Value, r: Value) -> Value { ... } fn ibit_right(&mut self, l: Value, r: Value) -> Value { ... } fn itest_eq(&mut self, l: Value, r: Value) -> Value { ... } fn itest_neq(&mut self, l: Value, r: Value) -> Value { ... } fn itest_gt(&mut self, l: Value, r: Value) -> Value { ... } fn itest_gt_eq(&mut self, l: Value, r: Value) -> Value { ... } fn itest_lt(&mut self, l: Value, r: Value) -> Value { ... } fn itest_lt_eq(&mut self, l: Value, r: Value) -> Value { ... } fn inot(&mut self, l: Value) -> Value { ... } fn ior(&mut self, l: Value, r: Value) -> Value { ... } fn iand(&mut self, l: Value, r: Value) -> Value { ... } fn jmp(&mut self, block: Block) { ... } fn iuse(&mut self, named: Named) -> Value { ... } fn set(&mut self, k: Value, v: Value) { ... } fn call(&mut self, k: Value, args: Vec<Value>) { ... } fn icall(&mut self, k: Value, args: Vec<Value>) -> Value { ... } fn return_(&mut self, v: Value) { ... } fn return_none(&mut self) { ... }
}
Expand description

A trait for building instructions.

Required Methods§

Source

fn create_value(&mut self, value: ValueInfo) -> Value

Defines a value in the InstBuilder’s values table, then returning the value.

Source

fn create_inst(&mut self, inst: InstructionInfo)

Pushes an instruction to the InstBuilder’s instruction list.

Source

fn create_block(&mut self, block: InstBlock) -> Block

Creates a block and registers it in the InstBuilder’s block table, returning a reference to said block.

Source

fn use_block(&mut self, block: Block) -> &mut InstBlock

Returns a pointer to the given block.

Source

fn require_import(&mut self, name: String)

Adds a required import.

Provided Methods§

Source

fn iconst_int(&mut self, value: u64) -> Value

Creates an unsigned 64-bit integer constant.

Source

fn iconst_float(&mut self, value: f64) -> Value

Creates an unsigned 64-bit float constant.

Source

fn iconst_double(&mut self, value: f64) -> Value

Creates an unsigned 64-bit double constant.

Source

fn iconst_bool(&mut self, value: bool) -> Value

Creates a boolean constant.

Source

fn iconst_str(&mut self, value: String) -> Value

Creates a string constant.

Source

fn iconst_named(&mut self, name: String) -> Value

Creates a named reference constant.

Source

fn iconst_named_props( &mut self, name: String, props: Vec<NamedProperty>, ) -> Value

Creates a named reference constant including the provided properties.

Source

fn iconst_named_property(&self, name: String) -> NamedProperty

Returns a new basic NamedProperty.

Source

fn iconst_named_static(&self, name: String) -> NamedProperty

Returns a new static NamedProperty.

Source

fn iconst_named_pointer(&self, name: String) -> NamedProperty

Returns a new pointer NamedProperty.

Source

fn iconst_named_index(&self, name: Value) -> NamedProperty

Returns a new index NamedProperty.

Source

fn ctype_bool(&mut self) -> AbiType

Creates a C target specific boolean type. Requires the stdbool.h standard library to be provided by your C compiler.

Source

fn ctype_uint8(&mut self) -> AbiType

Creates a C target specific 8 bit unsigned integer type. Requires the stdint.h standard library to be provided by your C compiler.

Source

fn ctype_uint16(&mut self) -> AbiType

Creates a C target specific 16 bit unsigned integer type. Requires the stdint.h standard library to be provided by your C compiler.

Source

fn ctype_uint32(&mut self) -> AbiType

Creates a C target specific 32 bit unsigned integer type. Requires the stdint.h standard library to be provided by your C compiler.

Source

fn ctype_uint64(&mut self) -> AbiType

Creates a C target specific 64 bit unsigned integer type. Requires the stdint.h standard library to be provided by your C compiler.

Source

fn ctype_usize(&mut self) -> AbiType

Creates a C target specific size that scales to the target’s architecture. For 32-bit processors, this is the same as a uint32 and for 64-bit architectures this is the same as a uint64.

Source

fn ctype_int8(&mut self) -> AbiType

Creates a C target specific 8 bit integer type. Requires the stdint.h standard library to be provided by your C compiler.

Source

fn ctype_int16(&mut self) -> AbiType

Creates a C target specific 16 bit integer type. Requires the stdint.h standard library to be provided by your C compiler.

Source

fn ctype_int32(&mut self) -> AbiType

Creates a C target specific 32 bit integer type. Requires the stdint.h standard library to be provided by your C compiler.

Source

fn ctype_int64(&mut self) -> AbiType

Creates a C target specific 64 bit integer type. Requires the stdint.h standard library to be provided by your C compiler.

Source

fn ctype_isize(&mut self) -> AbiType

Creates a C target specific size that scales to the target’s architecture. For 32-bit processors, this is the same as an int32 and for 64-bit architectures this is the same as an int64.

Source

fn ctype_char(&mut self) -> AbiType

A C-specific character type.

Source

fn iadd(&mut self, l: Value, r: Value) -> Value

Adds two values together and returns the sum of the expression.

Source

fn isub(&mut self, l: Value, r: Value) -> Value

Subtracts two values together and returns the sum of the expression.

Source

fn imul(&mut self, l: Value, r: Value) -> Value

Multiplies two values together and returns the sum of the expression.

Source

fn idiv(&mut self, l: Value, r: Value) -> Value

Divides two values together and returns the sum of the expression.

Source

fn imod(&mut self, l: Value, r: Value) -> Value

Divides two values together and returns the remainder of the expression. Equivalent to the % (modulus) operator.

Source

fn ibit_and(&mut self, l: Value, r: Value) -> Value

Returns the results of the Bitwise AND operation.

Source

fn ibit_or(&mut self, l: Value, r: Value) -> Value

Returns the results of the Bitwise OR operation.

Source

fn ibit_xor(&mut self, l: Value, r: Value) -> Value

Returns the results of the Bitwise XOR operation.

Source

fn ibit_not(&mut self, l: Value) -> Value

Returns the results of the Bitwise NOT operation.

Source

fn ibit_left(&mut self, l: Value, r: Value) -> Value

Returns the results of the Bitwise left shift operation.

Source

fn ibit_right(&mut self, l: Value, r: Value) -> Value

Returns the results of the Bitwise right shift operation.

Source

fn itest_eq(&mut self, l: Value, r: Value) -> Value

Tests if two values are equal to eachother. Returns a boolean value with the result of the operation.

Source

fn itest_neq(&mut self, l: Value, r: Value) -> Value

Tests if two values are not equal to eachother. Returns a boolean value with the result of the operation.

Source

fn itest_gt(&mut self, l: Value, r: Value) -> Value

Tests if the first value is greater than the second. Returns a boolean value with the result of the operation.

Source

fn itest_gt_eq(&mut self, l: Value, r: Value) -> Value

Tests if the first value is greater than or equal to the second. Returns a boolean value with the result of the operation.

Source

fn itest_lt(&mut self, l: Value, r: Value) -> Value

Tests if the first value is less than the second. Returns a boolean value with the result of the operation.

Source

fn itest_lt_eq(&mut self, l: Value, r: Value) -> Value

Tests if the first value is less than or equal to the second. Returns a boolean value with the result of the operation.

Source

fn inot(&mut self, l: Value) -> Value

Negates a boolean value.

Source

fn ior(&mut self, l: Value, r: Value) -> Value

Returns if either value is equal to true.

Source

fn iand(&mut self, l: Value, r: Value) -> Value

Returns if both values are equal to true.

Source

fn jmp(&mut self, block: Block)

Unconditionally jumps to a certain block.

Source

fn iuse(&mut self, named: Named) -> Value

Uses a named reference as a value.

Source

fn set(&mut self, k: Value, v: Value)

Sets a value, equivalent to the = assignment operator in most programming languages.

Source

fn call(&mut self, k: Value, args: Vec<Value>)

Makes a function call with the specified function name and arguments.

Source

fn icall(&mut self, k: Value, args: Vec<Value>) -> Value

Makes a function call and returns the value that the function call returns.

Source

fn return_(&mut self, v: Value)

Returns a value from the function that this InstBuilder resides in.

Source

fn return_none(&mut self)

Returns and exits the function, without returning a value. The function should have a return type of void.

Implementors§