pub trait FunctionTargetProcessor {
// Required method
fn name(&self) -> String;
// Provided methods
fn process(
&self,
_targets: &mut FunctionTargetsHolder,
_fun_env: &FunctionEnv<'_>,
_data: FunctionData
) -> FunctionData { ... }
fn process_and_maybe_remove(
&self,
targets: &mut FunctionTargetsHolder,
func_env: &FunctionEnv<'_>,
data: FunctionData
) -> Option<FunctionData> { ... }
fn initialize(&self, _env: &GlobalEnv, _targets: &mut FunctionTargetsHolder) { ... }
fn finalize(&self, _env: &GlobalEnv, _targets: &mut FunctionTargetsHolder) { ... }
fn is_single_run(&self) -> bool { ... }
fn run(&self, _env: &GlobalEnv, _targets: &mut FunctionTargetsHolder) { ... }
fn dump_result(
&self,
_f: &mut Formatter<'_>,
_env: &GlobalEnv,
_targets: &FunctionTargetsHolder
) -> Result { ... }
}
Expand description
A trait describing a function target processor.
Required Methods§
Provided Methods§
sourcefn process(
&self,
_targets: &mut FunctionTargetsHolder,
_fun_env: &FunctionEnv<'_>,
_data: FunctionData
) -> FunctionData
fn process( &self, _targets: &mut FunctionTargetsHolder, _fun_env: &FunctionEnv<'_>, _data: FunctionData ) -> FunctionData
Processes a function variant. Takes as parameter a target holder which can be mutated, the env of the function being processed, and the target data. During the time the processor is called, the target data is removed from the holder, and added back once transformation has finished. This allows the processor to take ownership on the target data.
sourcefn process_and_maybe_remove(
&self,
targets: &mut FunctionTargetsHolder,
func_env: &FunctionEnv<'_>,
data: FunctionData
) -> Option<FunctionData>
fn process_and_maybe_remove( &self, targets: &mut FunctionTargetsHolder, func_env: &FunctionEnv<'_>, data: FunctionData ) -> Option<FunctionData>
Same as process
but can return None to indicate that the function variant is
removed. By default, this maps to Some(self.process(..))
. One needs to implement
either this function or process
.
sourcefn initialize(&self, _env: &GlobalEnv, _targets: &mut FunctionTargetsHolder)
fn initialize(&self, _env: &GlobalEnv, _targets: &mut FunctionTargetsHolder)
A function which is called once before any process
call is issued.
sourcefn finalize(&self, _env: &GlobalEnv, _targets: &mut FunctionTargetsHolder)
fn finalize(&self, _env: &GlobalEnv, _targets: &mut FunctionTargetsHolder)
A function which is called once after the last process
call.
sourcefn is_single_run(&self) -> bool
fn is_single_run(&self) -> bool
A function which can be implemented to indicate that instead of a sequence of initialize,
process, and finalize, this processor has a single run
function for the analysis of the
whole set of functions.
sourcefn run(&self, _env: &GlobalEnv, _targets: &mut FunctionTargetsHolder)
fn run(&self, _env: &GlobalEnv, _targets: &mut FunctionTargetsHolder)
To be implemented if is_single_run()
is true.
sourcefn dump_result(
&self,
_f: &mut Formatter<'_>,
_env: &GlobalEnv,
_targets: &FunctionTargetsHolder
) -> Result
fn dump_result( &self, _f: &mut Formatter<'_>, _env: &GlobalEnv, _targets: &FunctionTargetsHolder ) -> Result
A function which creates a dump of the processors results, for debugging.
Implementors§
impl FunctionTargetProcessor for BorrowAnalysisProcessor
impl FunctionTargetProcessor for CleanAndOptimizeProcessor
impl FunctionTargetProcessor for DataInvariantInstrumentationProcessor
impl FunctionTargetProcessor for DebugInstrumenter
impl FunctionTargetProcessor for EliminateImmRefsProcessor
impl FunctionTargetProcessor for GlobalInvariantAnalysisProcessor
impl FunctionTargetProcessor for GlobalInvariantInstrumentationProcessor
impl FunctionTargetProcessor for GlobalInvariantInstrumentationProcessorV2
impl FunctionTargetProcessor for InconsistencyCheckInstrumenter
impl FunctionTargetProcessor for LiveVarAnalysisProcessor
impl FunctionTargetProcessor for LoopAnalysisProcessor
impl FunctionTargetProcessor for MemoryInstrumentationProcessor
impl FunctionTargetProcessor for MonoAnalysisProcessor
This processor computes monomorphization information for backends.