pub trait InstBuilderBase<'f>: Sized {
// Required methods
fn data_flow_graph(&self) -> &DataFlowGraph;
fn data_flow_graph_mut(&mut self) -> &mut DataFlowGraph;
fn build(
self,
data: InstructionData,
ctrl_typevar: Type,
) -> (Inst, &'f mut DataFlowGraph);
fn build_aux_inst(
&mut self,
data: InstructionData,
ctrl_typevar: Type,
) -> Inst;
// Provided method
fn build_imm_const(
&mut self,
controlling_type: Type,
imm: Imm64,
base_opcode: Opcode,
) -> Value { ... }
}Expand description
Base trait for instruction builders.
The InstBuilderBase trait provides the basic functionality required by the methods of the
generated InstBuilder trait. These methods should not normally be used directly. Use the
methods in the InstBuilder trait instead.
Any data type that implements InstBuilderBase also gets all the methods of the InstBuilder
trait.
Required Methods§
Sourcefn data_flow_graph(&self) -> &DataFlowGraph
fn data_flow_graph(&self) -> &DataFlowGraph
Get an immutable reference to the data flow graph that will hold the constructed instructions.
Sourcefn data_flow_graph_mut(&mut self) -> &mut DataFlowGraph
fn data_flow_graph_mut(&mut self) -> &mut DataFlowGraph
Get a mutable reference to the data flow graph that will hold the constructed instructions.
Sourcefn build(
self,
data: InstructionData,
ctrl_typevar: Type,
) -> (Inst, &'f mut DataFlowGraph)
fn build( self, data: InstructionData, ctrl_typevar: Type, ) -> (Inst, &'f mut DataFlowGraph)
Insert an instruction and return a reference to it, consuming the builder.
The result types may depend on a controlling type variable. For non-polymorphic
instructions with multiple results, pass INVALID for the ctrl_typevar argument.
Sourcefn build_aux_inst(&mut self, data: InstructionData, ctrl_typevar: Type) -> Inst
fn build_aux_inst(&mut self, data: InstructionData, ctrl_typevar: Type) -> Inst
Build and insert an auxiliary instruction.
This auxiliary instruction must be inserted before the instruction this builder will ultimately build.
This method returns the new instruction, without consuming the builder.
Provided Methods§
Sourcefn build_imm_const(
&mut self,
controlling_type: Type,
imm: Imm64,
base_opcode: Opcode,
) -> Value
fn build_imm_const( &mut self, controlling_type: Type, imm: Imm64, base_opcode: Opcode, ) -> Value
Materialize an immediate integer constant as an iconst (and possibly an
extension), inserting it before the instruction this builder will build,
and return its result value.
The constant’s type is controlling_type, or, for vector controlling
types, its lane type. Because iconst only supports i8 through i64,
an i128 constant is built as an iconst.i64 that is then sign- or
zero-extended.
Whether the immediate is sign- or zero-extended matches the historical
semantics of the *_imm instruction for base_opcode:
- Sign-extended:
iadd,imul,sdiv,srem, andicmp - Zero-extended: Everything else
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".