pub struct PassBuilder { /* private fields */ }
Expand description

Main struct for registering callbacks.

Implementations§

source§

impl PassBuilder

source

pub fn add_module_pipeline_parsing_callback<T>(&mut self, cb: T)
where T: Fn(&str, &mut ModulePassManager) -> PipelineParsing + 'static,

Register a new pipeline parsing callback.

These callbacks can be used to parse a single pass name, and populate the given ModulePassManager accordingly.

source

pub fn add_function_pipeline_parsing_callback<T>(&mut self, cb: T)
where T: Fn(&str, &mut FunctionPassManager) -> PipelineParsing + 'static,

Register a new pipeline parsing callback.

These callbacks can be used to parse a single pass name, and populate the given FunctionPassManager accordingly.

source

pub fn add_module_analysis_registration_callback<T>(&mut self, cb: T)
where T: Fn(&mut ModuleAnalysisManager) + 'static,

Register a new callback for analysis registration.

These callbacks can be used to register custom analyses with the given ModuleAnalysisManager.

source

pub fn add_function_analysis_registration_callback<T>(&mut self, cb: T)
where T: Fn(&mut FunctionAnalysisManager) + 'static,

Register a new callback for analysis registration.

These callbacks can be used to register custom analyses with the given FunctionAnalysisManager.

source

pub fn add_peephole_ep_callback<T>(&mut self, cb: T)
where T: Fn(&mut FunctionPassManager, OptimizationLevel) + 'static,

Register a new callback to be triggered at the peephole extension point.

§From the LLVM documentation

This extension point allows adding passes that perform peephole optimizations similar to the instruction combiner.

These passes will be inserted after each instance of the instruction combiner pass.

source

pub fn add_scalar_optimizer_late_ep_callback<T>(&mut self, cb: T)
where T: Fn(&mut FunctionPassManager, OptimizationLevel) + 'static,

Register a new callback to be triggered at the optimizer late extension point.

§From the LLVM documentation

This extension point allows adding optimization passes after most of the main optimizations, but before the last cleanup-ish optimizations.

source

pub fn add_vectorizer_start_ep_callback<T>(&mut self, cb: T)
where T: Fn(&mut FunctionPassManager, OptimizationLevel) + 'static,

Register a new callback to be triggered at the vectorizer start extension point.

§From the LLVM documentation

This extension point allows adding optimization passes before the vectorizer and other highly target specific optimization passes are executed.

source

pub fn add_pipeline_start_ep_callback<T>(&mut self, cb: T)
where T: Fn(&mut ModulePassManager, OptimizationLevel) + 'static,

Available on crate features llvm12-0 or llvm13-0 or llvm14-0 or llvm15-0 or llvm16-0 or llvm17-0 only.

Register a new callback to be triggered at the pipeline start extension point.

§From the LLVM documentation

This extension point allows adding optimization once at the start of the pipeline. This does not apply to ‘backend’ compiles (LTO and ThinLTO link-time pipelines).

source

pub fn add_pipeline_early_simplification_ep_callback<T>(&mut self, cb: T)
where T: Fn(&mut ModulePassManager, OptimizationLevel) + 'static,

Available on crate features llvm12-0 or llvm13-0 or llvm14-0 or llvm15-0 or llvm16-0 or llvm17-0 only.

Register a new callback to be triggered at the pipeline early simplification extension point.

§From the LLVM documentation

This extension point allows adding optimization right after passes that do basic simplification of the input IR.

source

pub fn add_optimizer_last_ep_callback<T>(&mut self, cb: T)
where T: Fn(&mut ModulePassManager, OptimizationLevel) + 'static,

Available on crate features llvm11-0 or llvm12-0 or llvm13-0 or llvm14-0 or llvm15-0 or llvm16-0 or llvm17-0 only.

Register a new callback to be triggered at the optimizer last extension point.

§From the LLVM documentation

This extension point allows adding passes that run after everything else.

source

pub fn add_full_lto_early_ep_callback<T>(&mut self, cb: T)
where T: Fn(&mut ModulePassManager, OptimizationLevel) + 'static,

Available on crate features llvm15-0 or llvm16-0 or llvm17-0 only.

Register a new callback to be triggered at the full LTO early extension point.

§From the LLVM documentation

This extension point allow adding passes that run at Link Time, before Full Link Time Optimization.

source

pub fn add_full_lto_last_ep_callback<T>(&mut self, cb: T)
where T: Fn(&mut ModulePassManager, OptimizationLevel) + 'static,

Available on crate features llvm15-0 or llvm16-0 or llvm17-0 only.

Register a new callback to be triggered at the full LTO last extension point.

§From the LLVM documentation

This extensions point allow adding passes that run at Link Time, after Full Link Time Optimization.

source

pub fn add_optimizer_early_ep_callback<T>(&mut self, cb: T)
where T: Fn(&mut ModulePassManager, OptimizationLevel) + 'static,

Available on crate features llvm15-0 or llvm16-0 or llvm17-0 only.

Register a new callback to be triggered at the optimizer early extension point.

§From the LLVM documentation

This extension point allows adding passes just before the main module-level optimization passes.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.