pub struct DefSiteAnalysis<'db, 'a> { /* private fields */ }Expand description
Forward analysis that records where each variable first becomes available.
Implementations§
Source§impl DefSiteAnalysis<'_, '_>
impl DefSiteAnalysis<'_, '_>
Sourcepub fn analyze(lowered: &Lowered<'_>) -> DefSites
pub fn analyze(lowered: &Lowered<'_>) -> DefSites
Runs def-site analysis on a lowered function.
Returns a vector indexed by variable arena index, mapping each variable to the
DefLocation where it first becomes available:
BlockEntry(block): available at block entry (parameters, goto remappings, match arm bindings).Statement((block, i)): available after statementiinblock.None: the variable’s defining block is unreachable from the function entry.
Trait Implementations§
Source§impl<'db, 'a> DataflowAnalyzer<'db, 'a> for DefSiteAnalysis<'db, 'a>
impl<'db, 'a> DataflowAnalyzer<'db, 'a> for DefSiteAnalysis<'db, 'a>
Source§fn initial_info(
&mut self,
_block_id: BlockId,
_block_end: &'a BlockEnd<'db>,
) -> Self::Info
fn initial_info( &mut self, _block_id: BlockId, _block_end: &'a BlockEnd<'db>, ) -> Self::Info
Create the initial analysis state at a terminal block. Read more
Source§fn merge(
&mut self,
_lowered: &Lowered<'db>,
_statement_location: StatementLocation,
_info1: Self::Info,
_info2: Self::Info,
) -> Self::Info
fn merge( &mut self, _lowered: &Lowered<'db>, _statement_location: StatementLocation, _info1: Self::Info, _info2: Self::Info, ) -> Self::Info
Merge/join states from multiple control flow paths.
Called at join points (match merge for backward, block entry for forward). Read more
Source§fn transfer_stmt(
&mut self,
_info: &mut Self::Info,
statement_location: StatementLocation,
stmt: &'a Statement<'db>,
)
fn transfer_stmt( &mut self, _info: &mut Self::Info, statement_location: StatementLocation, stmt: &'a Statement<'db>, )
Transfer function for a single statement. Read more
Source§fn transfer_edge(
&mut self,
_info: &Self::Info,
edge: &Edge<'db, 'a>,
) -> Self::Info
fn transfer_edge( &mut self, _info: &Self::Info, edge: &Edge<'db, 'a>, ) -> Self::Info
Transfer state along a CFG edge.
Called when traversing between blocks via control flow edges. Read more
Source§fn transfer_block(
&mut self,
info: &mut Self::Info,
block_id: BlockId,
block: &'a Block<'db>,
)
fn transfer_block( &mut self, info: &mut Self::Info, block_id: BlockId, block: &'a Block<'db>, )
Transfer function for an entire block. Read more
Source§fn visit_block_start(
&mut self,
_info: &mut Self::Info,
_block_id: BlockId,
_block: &Block<'db>,
)
fn visit_block_start( &mut self, _info: &mut Self::Info, _block_id: BlockId, _block: &Block<'db>, )
Called when entering a block during traversal (before transfer_block).
Source§fn block_entry_location(
&self,
lowered: &Lowered<'db>,
block_id: BlockId,
) -> LocationId<'db>
fn block_entry_location( &self, lowered: &Lowered<'db>, block_id: BlockId, ) -> LocationId<'db>
Block entry location.
For Backward it is the merge location.
For Forward it is the block entry location, if there is a statement.
If not statement exists it will look at block end. This might recurse to next block if we
have a goto with no remappings.
Auto Trait Implementations§
impl<'db, 'a> Freeze for DefSiteAnalysis<'db, 'a>
impl<'db, 'a> RefUnwindSafe for DefSiteAnalysis<'db, 'a>
impl<'db, 'a> Send for DefSiteAnalysis<'db, 'a>
impl<'db, 'a> Sync for DefSiteAnalysis<'db, 'a>
impl<'db, 'a> Unpin for DefSiteAnalysis<'db, 'a>
impl<'db, 'a> UnsafeUnpin for DefSiteAnalysis<'db, 'a>
impl<'db, 'a> UnwindSafe for DefSiteAnalysis<'db, 'a>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<'db, T> DebugDbUpcast<'db, T> for Twhere
T: ?Sized,
impl<'db, T> DebugDbUpcast<'db, T> for Twhere
T: ?Sized,
fn debug_db_upcast(&'db self) -> &'db T
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