InstructionSelector

Trait InstructionSelector 

Source
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§

Source

type Instruction: Instr

InstructionSelector::Instruction is the type to use for instructions.

Required Methods§

Source

fn select_pre_function_instructions( &mut self, gen: &mut VCodeGenerator<Self::Instruction, Self>, )

Selects the instructions that occur before the function starts executing.

Source

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.

Source

fn select_term( &mut self, gen: &mut VCodeGenerator<Self::Instruction, Self>, op: Terminator, )

Selects an instruction to use for a given Terminator.

Source

fn post_function_generation( &mut self, func: &mut Function<Self::Instruction>, gen: &mut VCodeGenerator<Self::Instruction, Self>, )

Performs post generation transforms on the Function.

Source

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.

Implementors§