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>
impl<'ctx, 'str> PassCtx<'ctx, 'str>
Sourcepub fn new(ctx: &'ctx Context<'str>) -> Self
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.
Sourcepub fn from_parts(
shared: &'ctx Shared<'str>,
interfaces: &'ctx Registry<FunctionId, FunctionInterface<'str>>,
) -> Self
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.
Sourcepub fn shr(&self) -> &'ctx Shared<'str>
pub fn shr(&self) -> &'ctx Shared<'str>
The module’s shared IR state (interners, spaces, registers, name and address maps, memory image, truths).
Sourcepub fn interface(&self, f: FunctionId) -> &'ctx FunctionInterface<'str>
pub fn interface(&self, f: FunctionId) -> &'ctx FunctionInterface<'str>
The published interface of function f.
Sourcepub fn interfaces(&self) -> &'ctx Registry<FunctionId, FunctionInterface<'str>>
pub fn interfaces(&self) -> &'ctx Registry<FunctionId, FunctionInterface<'str>>
The whole interface registry.
Sourcepub fn body_view<'body>(
self,
body: &'body FunctionBody<'str>,
) -> BodyView<'body, 'str>where
'ctx: 'body,
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.
Sourcepub fn host<'body>(
self,
body: &'body mut FunctionBody<'str>,
) -> BodyMut<'body, 'str>where
'ctx: 'body,
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.