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§
Sourcefn create_value(&mut self, value: ValueInfo) -> Value
fn create_value(&mut self, value: ValueInfo) -> Value
Defines a value in the InstBuilder’s values table, then returning the value.
Sourcefn create_inst(&mut self, inst: InstructionInfo)
fn create_inst(&mut self, inst: InstructionInfo)
Pushes an instruction to the InstBuilder’s instruction list.
Sourcefn create_block(&mut self, block: InstBlock) -> Block
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.
Sourcefn require_import(&mut self, name: String)
fn require_import(&mut self, name: String)
Adds a required import.
Provided Methods§
Sourcefn iconst_int(&mut self, value: u64) -> Value
fn iconst_int(&mut self, value: u64) -> Value
Creates an unsigned 64-bit integer constant.
Sourcefn iconst_float(&mut self, value: f64) -> Value
fn iconst_float(&mut self, value: f64) -> Value
Creates an unsigned 64-bit float constant.
Sourcefn iconst_double(&mut self, value: f64) -> Value
fn iconst_double(&mut self, value: f64) -> Value
Creates an unsigned 64-bit double constant.
Sourcefn iconst_bool(&mut self, value: bool) -> Value
fn iconst_bool(&mut self, value: bool) -> Value
Creates a boolean constant.
Sourcefn iconst_str(&mut self, value: String) -> Value
fn iconst_str(&mut self, value: String) -> Value
Creates a string constant.
Sourcefn iconst_named(&mut self, name: String) -> Value
fn iconst_named(&mut self, name: String) -> Value
Creates a named reference constant.
Sourcefn iconst_named_props(
&mut self,
name: String,
props: Vec<NamedProperty>,
) -> Value
fn iconst_named_props( &mut self, name: String, props: Vec<NamedProperty>, ) -> Value
Creates a named reference constant including the provided properties.
Sourcefn iconst_named_property(&self, name: String) -> NamedProperty
fn iconst_named_property(&self, name: String) -> NamedProperty
Returns a new basic NamedProperty.
Sourcefn iconst_named_static(&self, name: String) -> NamedProperty
fn iconst_named_static(&self, name: String) -> NamedProperty
Returns a new static NamedProperty.
Sourcefn iconst_named_pointer(&self, name: String) -> NamedProperty
fn iconst_named_pointer(&self, name: String) -> NamedProperty
Returns a new pointer NamedProperty.
Sourcefn iconst_named_index(&self, name: Value) -> NamedProperty
fn iconst_named_index(&self, name: Value) -> NamedProperty
Returns a new index NamedProperty.
Sourcefn ctype_bool(&mut self) -> AbiType
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.
Sourcefn ctype_uint8(&mut self) -> AbiType
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.
Sourcefn ctype_uint16(&mut self) -> AbiType
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.
Sourcefn ctype_uint32(&mut self) -> AbiType
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.
Sourcefn ctype_uint64(&mut self) -> AbiType
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.
Sourcefn ctype_usize(&mut self) -> AbiType
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
.
Sourcefn ctype_int8(&mut self) -> AbiType
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.
Sourcefn ctype_int16(&mut self) -> AbiType
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.
Sourcefn ctype_int32(&mut self) -> AbiType
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.
Sourcefn ctype_int64(&mut self) -> AbiType
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.
Sourcefn ctype_isize(&mut self) -> AbiType
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
.
Sourcefn ctype_char(&mut self) -> AbiType
fn ctype_char(&mut self) -> AbiType
A C-specific character type.
Sourcefn iadd(&mut self, l: Value, r: Value) -> Value
fn iadd(&mut self, l: Value, r: Value) -> Value
Adds two values together and returns the sum of the expression.
Sourcefn isub(&mut self, l: Value, r: Value) -> Value
fn isub(&mut self, l: Value, r: Value) -> Value
Subtracts two values together and returns the sum of the expression.
Sourcefn imul(&mut self, l: Value, r: Value) -> Value
fn imul(&mut self, l: Value, r: Value) -> Value
Multiplies two values together and returns the sum of the expression.
Sourcefn idiv(&mut self, l: Value, r: Value) -> Value
fn idiv(&mut self, l: Value, r: Value) -> Value
Divides two values together and returns the sum of the expression.
Sourcefn imod(&mut self, l: Value, r: Value) -> Value
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.
Sourcefn ibit_and(&mut self, l: Value, r: Value) -> Value
fn ibit_and(&mut self, l: Value, r: Value) -> Value
Returns the results of the Bitwise AND operation.
Sourcefn ibit_or(&mut self, l: Value, r: Value) -> Value
fn ibit_or(&mut self, l: Value, r: Value) -> Value
Returns the results of the Bitwise OR operation.
Sourcefn ibit_xor(&mut self, l: Value, r: Value) -> Value
fn ibit_xor(&mut self, l: Value, r: Value) -> Value
Returns the results of the Bitwise XOR operation.
Sourcefn ibit_left(&mut self, l: Value, r: Value) -> Value
fn ibit_left(&mut self, l: Value, r: Value) -> Value
Returns the results of the Bitwise left shift operation.
Sourcefn ibit_right(&mut self, l: Value, r: Value) -> Value
fn ibit_right(&mut self, l: Value, r: Value) -> Value
Returns the results of the Bitwise right shift operation.
Sourcefn itest_eq(&mut self, l: Value, r: Value) -> Value
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.
Sourcefn itest_neq(&mut self, l: Value, r: Value) -> Value
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.
Sourcefn itest_gt(&mut self, l: Value, r: Value) -> Value
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.
Sourcefn itest_gt_eq(&mut self, l: Value, r: Value) -> Value
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.
Sourcefn itest_lt(&mut self, l: Value, r: Value) -> Value
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.
Sourcefn itest_lt_eq(&mut self, l: Value, r: Value) -> Value
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.
Sourcefn set(&mut self, k: Value, v: Value)
fn set(&mut self, k: Value, v: Value)
Sets a value, equivalent to the =
assignment operator in most programming languages.
Sourcefn call(&mut self, k: Value, args: Vec<Value>)
fn call(&mut self, k: Value, args: Vec<Value>)
Makes a function call with the specified function name and arguments.
Sourcefn icall(&mut self, k: Value, args: Vec<Value>) -> Value
fn icall(&mut self, k: Value, args: Vec<Value>) -> Value
Makes a function call and returns the value that the function call returns.
Sourcefn return_(&mut self, v: Value)
fn return_(&mut self, v: Value)
Returns a value from the function that this InstBuilder resides in.
Sourcefn return_none(&mut self)
fn return_none(&mut self)
Returns and exits the function, without returning a value. The function should have a
return type of void
.