Skip to main content

InstructionVisitor

Trait InstructionVisitor 

Source
pub trait InstructionVisitor: Debug {
    // Required method
    fn visit_instruction(
        &mut self,
        instruction: Instruction,
        global_state: &GlobalState,
        analyses: &GlobalAnalyses,
        changes: &AtomicCounter,
    ) -> Vec<Instruction>;

    // Provided method
    fn visit_scope(
        &mut self,
        scope: &Scope,
        analyses: &GlobalAnalyses,
        changes: &AtomicCounter,
    ) { ... }
}
Expand description

Visitor that operates on an instruction level. Useful for passes that only need to recursively traverse the scopes and don’t care about control flow.

The changes counter should be incremented on any change, unless the pass is a unique one-time pass. It’s used to determine when to end a fixed-point optimization loop.

Required Methods§

Source

fn visit_instruction( &mut self, instruction: Instruction, global_state: &GlobalState, analyses: &GlobalAnalyses, changes: &AtomicCounter, ) -> Vec<Instruction>

Provided Methods§

Source

fn visit_scope( &mut self, scope: &Scope, analyses: &GlobalAnalyses, changes: &AtomicCounter, )

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§