pub struct MirFunction {
pub name: String,
pub blocks: Vec<BasicBlock>,
pub num_locals: u16,
pub param_slots: Vec<SlotId>,
pub param_reference_kinds: Vec<Option<BorrowKind>>,
pub local_types: Vec<LocalTypeInfo>,
pub span: Span,
}Expand description
The MIR representation of a single function.
Fields§
§name: String§blocks: Vec<BasicBlock>The basic blocks forming the CFG.
num_locals: u16Number of local variable slots.
param_slots: Vec<SlotId>Which locals are function parameters.
param_reference_kinds: Vec<Option<BorrowKind>>Per-parameter reference kind, aligned with param_slots.
local_types: Vec<LocalTypeInfo>Type information for locals (for Copy/Clone inference).
span: SpanSource span of the function.
Implementations§
Source§impl MirFunction
impl MirFunction
Sourcepub fn entry_block(&self) -> BasicBlockId
pub fn entry_block(&self) -> BasicBlockId
Get the entry block (always block 0).
Sourcepub fn iter_blocks(&self) -> impl Iterator<Item = &BasicBlock>
pub fn iter_blocks(&self) -> impl Iterator<Item = &BasicBlock>
Iterate over all blocks.
Sourcepub fn block(&self, id: BasicBlockId) -> &BasicBlock
pub fn block(&self, id: BasicBlockId) -> &BasicBlock
Get a block by ID.
Sourcepub fn all_points(&self) -> Vec<(Point, BasicBlockId, usize)>
pub fn all_points(&self) -> Vec<(Point, BasicBlockId, usize)>
Linearize all statements into a flat list of points. Returns (point, block_id, statement_index) triples.
Trait Implementations§
Source§impl Clone for MirFunction
impl Clone for MirFunction
Source§fn clone(&self) -> MirFunction
fn clone(&self) -> MirFunction
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for MirFunction
impl RefUnwindSafe for MirFunction
impl Send for MirFunction
impl Sync for MirFunction
impl Unpin for MirFunction
impl UnsafeUnpin for MirFunction
impl UnwindSafe for MirFunction
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more