Skip to main content

PassManager

Struct PassManager 

Source
pub struct PassManager {
    pub max_iterations: u32,
    /* private fields */
}
Expand description

Manages a pipeline of optimization passes with dependency ordering.

Passes are executed in topological order based on their declared dependencies. Cycle detection uses Kahn’s algorithm.

Fields§

§max_iterations: u32

Maximum number of fixed-point iterations.

Implementations§

Source§

impl PassManager

Source

pub fn new() -> Self

Create a new pass manager.

Source

pub fn add_pass(&mut self, name: impl Into<String>)

Register a pass by name.

Source

pub fn add_dependency( &mut self, pass: impl Into<String>, depends_on: impl Into<String>, )

Add a dependency: pass depends on depends_on.

Source

pub fn record_run(&mut self, name: &str, changes: usize, duration_us: u64)

Record a run of the named pass.

Source

pub fn get_stats(&self, name: &str) -> Option<&PassStats>

Get statistics for a named pass.

Source

pub fn all_stats(&self) -> &HashMap<String, PassStats>

Get all statistics.

Source

pub fn num_passes(&self) -> usize

Number of registered passes.

Source

pub fn topological_order(&self) -> Option<Vec<String>>

Compute topological ordering of passes using Kahn’s algorithm.

Returns None if there is a cycle in the dependency graph.

Source

pub fn has_cycle(&self) -> bool

Check if the dependency graph has a cycle.

Source

pub fn total_changes(&self) -> usize

Total changes across all passes.

Source

pub fn total_runs(&self) -> u32

Total runs across all passes.

Trait Implementations§

Source§

impl Debug for PassManager

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for PassManager

Source§

fn default() -> PassManager

Returns the “default value” for a type. Read more

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.