Struct PassContext

Source
pub struct PassContext {
    pass_ids: PrimaryMap<PassId, &'static str>,
    pass_timings: Vec<PassTiming>,
    provenance: ProvenanceTables,
}
Expand description

Shared context passed through compiler passes.

Fields§

§pass_ids: PrimaryMap<PassId, &'static str>§pass_timings: Vec<PassTiming>§provenance: ProvenanceTables

Implementations§

Source§

impl PassContext

Source

pub fn new() -> Self

Construct an empty pass context.

Source

pub fn run_timed<T, E, F>( &mut self, pass_name: &'static str, run: F, ) -> Result<T, E>
where F: FnOnce(&mut PassContext, PassId) -> Result<T, E>,

Run one pass, measure its wall-clock duration, and store timing stats.

Source

pub fn run_pass<P>( &mut self, pass: &mut P, input: P::In, ) -> Result<P::Out, P::Error>
where P: Pass,

Run one typed pass, measure duration, and store timing stats.

Source

pub fn run_pass_with_id<P>( &mut self, pass: &mut P, input: P::In, ) -> Result<(PassId, P::Out), P::Error>
where P: Pass,

Run one typed pass and return its pass id with output.

Source

pub fn run_timed_value<T, F>(&mut self, pass_name: &'static str, run: F) -> T
where F: FnOnce(&mut PassContext, PassId) -> T,

Run one infallible pass, measure duration, and store timing stats.

Source

pub fn pass_timings(&self) -> &[PassTiming]

Return recorded pass timings in execution order.

Source

pub fn extend_pass_timings<I>(&mut self, timings: I)
where I: IntoIterator<Item = PassTiming>,

Append externally collected pass timing samples.

Source

pub fn provenance(&self) -> &ProvenanceTables

Return shared provenance tables.

Source

pub fn provenance_mut(&mut self) -> &mut ProvenanceTables

Return mutable shared provenance tables.

Trait Implementations§

Source§

impl Debug for PassContext

Source§

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

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

impl Default for PassContext

Source§

fn default() -> PassContext

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.