pub trait InstructionSelector: Default {
type Instruction: Instr;
// Required methods
fn select_pre_function_instructions(
&mut self,
gen: &mut VCodeGenerator<Self::Instruction, Self>,
);
fn select_instr(
&mut self,
gen: &mut VCodeGenerator<Self::Instruction, Self>,
result: Option<Value>,
op: Operation,
);
fn select_term(
&mut self,
gen: &mut VCodeGenerator<Self::Instruction, Self>,
op: Terminator,
);
fn post_function_generation(
&mut self,
func: &mut Function<Self::Instruction>,
gen: &mut VCodeGenerator<Self::Instruction, Self>,
);
fn post_generation(&mut self, vcode: &mut VCode<Self::Instruction>);
}Expand description
InstructionSelector is the other trait that has to be implemented for a backend. This trait
selects instructions to use based on the Operations and
Terminators in the provided IR.
Required Associated Types§
Sourcetype Instruction: Instr
type Instruction: Instr
InstructionSelector::Instruction is the type to use for instructions.
Required Methods§
Sourcefn select_pre_function_instructions(
&mut self,
gen: &mut VCodeGenerator<Self::Instruction, Self>,
)
fn select_pre_function_instructions( &mut self, gen: &mut VCodeGenerator<Self::Instruction, Self>, )
Selects the instructions that occur before the function starts executing.
Sourcefn select_instr(
&mut self,
gen: &mut VCodeGenerator<Self::Instruction, Self>,
result: Option<Value>,
op: Operation,
)
fn select_instr( &mut self, gen: &mut VCodeGenerator<Self::Instruction, Self>, result: Option<Value>, op: Operation, )
Selects an instruction to use for the given Operation.
Sourcefn select_term(
&mut self,
gen: &mut VCodeGenerator<Self::Instruction, Self>,
op: Terminator,
)
fn select_term( &mut self, gen: &mut VCodeGenerator<Self::Instruction, Self>, op: Terminator, )
Selects an instruction to use for a given Terminator.
Sourcefn post_function_generation(
&mut self,
func: &mut Function<Self::Instruction>,
gen: &mut VCodeGenerator<Self::Instruction, Self>,
)
fn post_function_generation( &mut self, func: &mut Function<Self::Instruction>, gen: &mut VCodeGenerator<Self::Instruction, Self>, )
Performs post generation transforms on the Function.
Sourcefn post_generation(&mut self, vcode: &mut VCode<Self::Instruction>)
fn post_generation(&mut self, vcode: &mut VCode<Self::Instruction>)
Performs post generation transforms on the VCode.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.