pub struct FunctionTargetPipeline { /* private fields */ }
Expand description
A processing pipeline for function targets.
Implementations§
source§impl FunctionTargetPipeline
impl FunctionTargetPipeline
sourcepub fn add_processor(&mut self, processor: Box<dyn FunctionTargetProcessor>)
pub fn add_processor(&mut self, processor: Box<dyn FunctionTargetProcessor>)
Adds a processor to this pipeline. Processor will be called in the order they have been added.
sourcepub fn last_processor(&self) -> &dyn FunctionTargetProcessor
pub fn last_processor(&self) -> &dyn FunctionTargetProcessor
Gets the last processor in the pipeline, for testing.
sourcepub fn sort_targets_in_topological_order<'env>(
env: &'env GlobalEnv,
targets: &FunctionTargetsHolder
) -> Vec<FunctionEnv<'env>> ⓘ
pub fn sort_targets_in_topological_order<'env>( env: &'env GlobalEnv, targets: &FunctionTargetsHolder ) -> Vec<FunctionEnv<'env>> ⓘ
Sort functions in topological order. This is important for the function target processors. In programs without recursion or mutual recursion, processing functions in topological order means that when a processor sees a caller function, it is guaranteed that all the callees have already been analyzed.
sourcepub fn run_with_hook<H1, H2>(
&self,
env: &GlobalEnv,
targets: &mut FunctionTargetsHolder,
hook_before_pipeline: H1,
hook_after_each_processor: H2
)where
H1: Fn(&FunctionTargetsHolder),
H2: Fn(usize, &dyn FunctionTargetProcessor, &FunctionTargetsHolder),
pub fn run_with_hook<H1, H2>( &self, env: &GlobalEnv, targets: &mut FunctionTargetsHolder, hook_before_pipeline: H1, hook_after_each_processor: H2 )where H1: Fn(&FunctionTargetsHolder), H2: Fn(usize, &dyn FunctionTargetProcessor, &FunctionTargetsHolder),
Runs the pipeline on all functions in the targets holder. Processors are run on each individual function in breadth-first fashion; i.e. a processor can expect that processors preceding it in the pipeline have been executed for all functions before it is called.
sourcepub fn run(&self, env: &GlobalEnv, targets: &mut FunctionTargetsHolder)
pub fn run(&self, env: &GlobalEnv, targets: &mut FunctionTargetsHolder)
Run the pipeline on all functions in the targets holder, with no hooks in effect
sourcepub fn run_with_dump(
&self,
env: &GlobalEnv,
targets: &mut FunctionTargetsHolder,
dump_base_name: &str,
dump_cfg: bool
)
pub fn run_with_dump( &self, env: &GlobalEnv, targets: &mut FunctionTargetsHolder, dump_base_name: &str, dump_cfg: bool )
Runs the pipeline on all functions in the targets holder, dump the bytecode before the
pipeline as well as after each processor pass. If dump_cfg
is set, dump the per-function
control-flow graph (in dot format) too.