Skip to main content

PassCtx

Struct PassCtx 

Source
pub struct PassCtx<'ctx, 'str> { /* private fields */ }
Expand description

The bodies-free module view a block-local pass reads through: {shared, interfaces}.

A pass structurally cannot reach another function’s body through it, which is what makes holding one the proof that the shared state is frozen while a worker holds a disjoint &mut body. Copy, since it holds only shared references.

Implementations§

Source§

impl<'ctx, 'str> PassCtx<'ctx, 'str>

Source

pub fn new(ctx: &'ctx Context<'str>) -> Self

Build a view over ctx’s shared state and interfaces. The bodies are not captured; prefer split, which proves that with a simultaneous &mut bodies borrow.

Source

pub fn from_parts( shared: &'ctx Shared<'str>, interfaces: &'ctx Registry<FunctionId, FunctionInterface<'str>>, ) -> Self

Assemble a view from already-borrowed parts. This is the seam richer views (such as the analysis pipeline’s) use to hand their own {shared, interfaces} to the passes here.

Source

pub fn shr(&self) -> &'ctx Shared<'str>

The module’s shared IR state (interners, spaces, registers, name and address maps, memory image, truths).

Source

pub fn interface(&self, f: FunctionId) -> &'ctx FunctionInterface<'str>

The published interface of function f.

Source

pub fn interfaces(&self) -> &'ctx Registry<FunctionId, FunctionInterface<'str>>

The whole interface registry.

Source

pub fn body_view<'body>( self, body: &'body FunctionBody<'str>, ) -> BodyView<'body, 'str>
where 'ctx: 'body,

Build the static read view for a pass’s borrowed body.

Source

pub fn host<'body>( self, body: &'body mut FunctionBody<'str>, ) -> BodyMut<'body, 'str>
where 'ctx: 'body,

Build the mutation host for a pass’s exclusively borrowed body.

Trait Implementations§

Source§

impl<'ctx, 'str> Clone for PassCtx<'ctx, 'str>

Source§

fn clone(&self) -> PassCtx<'ctx, 'str>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'ctx, 'str> Copy for PassCtx<'ctx, 'str>

Auto Trait Implementations§

§

impl<'ctx, 'str> Freeze for PassCtx<'ctx, 'str>

§

impl<'ctx, 'str> RefUnwindSafe for PassCtx<'ctx, 'str>

§

impl<'ctx, 'str> Send for PassCtx<'ctx, 'str>

§

impl<'ctx, 'str> Sync for PassCtx<'ctx, 'str>

§

impl<'ctx, 'str> Unpin for PassCtx<'ctx, 'str>

§

impl<'ctx, 'str> UnsafeUnpin for PassCtx<'ctx, 'str>

§

impl<'ctx, 'str> UnwindSafe for PassCtx<'ctx, 'str>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.