Skip to main content

PassBuilder

Struct PassBuilder 

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

Handle to LLVM’s PassBuilder, received by plugin registrar functions.

Provides methods to register callbacks for pipeline parsing, analysis registration, and various extension points.

Implementations§

Source§

impl PassBuilder

Source

pub unsafe fn from_raw(pass_builder: *mut c_void) -> Self

Construct from a raw PassBuilder pointer.

§Safety

pass_builder must be a valid pointer to LLVM’s PassBuilder.

Source

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

Register a callback for parsing module pipeline elements.

When LLVM encounters an unknown pass name in a module pipeline, it calls registered callbacks. If the callback recognizes the name, it should add the pass to the given PluginModulePassManager and return PipelineParsing::Parsed.

Source

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

Register a callback for parsing function pipeline elements.

Source

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

Register a callback for module analysis registration.

Source

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

Register a callback for function analysis registration.

Source

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

Register a peephole extension point callback (function-level).

Source

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

Register a scalar-optimizer-late extension point callback (function-level).

Source

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

Register a vectorizer-start extension point callback (function-level).

Source

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

Register an optimizer-last extension point callback (module-level).

Available on LLVM 11+. On older versions, this is a no-op.

Source

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

Register a pipeline-start extension point callback (module-level).

Available on LLVM 12+. On older versions, this is a no-op.

Source

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

Register a pipeline-early-simplification extension point callback (module-level).

Available on LLVM 12+. On older versions, this is a no-op.

Source

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

Register an optimizer-early extension point callback (module-level).

Available on LLVM 15+. On older versions, this is a no-op.

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>,

Source§

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>,

Source§

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.