pub struct UseDefInfo { /* private fields */ }Expand description
Use-def / def-use information for a single function.
Implementations§
Source§impl UseDefInfo
impl UseDefInfo
Sourcepub fn compute(func: &Function) -> Self
pub fn compute(func: &Function) -> Self
Walk all instructions in func and collect definition and use info.
Sourcepub fn def_block(&self, id: InstrId) -> Option<BlockId>
pub fn def_block(&self, id: InstrId) -> Option<BlockId>
The block in which id is defined, or None if not found.
Sourcepub fn uses_of(&self, vref: ValueRef) -> &[(BlockId, InstrId)]
pub fn uses_of(&self, vref: ValueRef) -> &[(BlockId, InstrId)]
All use sites of vref: (block, instruction) pairs.
For phi incoming values the block is the phi’s own block, not the
predecessor. Use phi_uses_of when correct
predecessor-block semantics are needed (liveness, mem2reg).
Returns an empty slice if the value has no uses.
Sourcepub fn phi_uses_of(&self, vref: ValueRef) -> &[(BlockId, InstrId)]
pub fn phi_uses_of(&self, vref: ValueRef) -> &[(BlockId, InstrId)]
Phi-specific use sites of vref with predecessor-block semantics.
For each phi [vref, %pred] instruction that uses vref, returns a
(pred, phi_instr_id) pair. This is the correct view for SSA liveness
analysis (the value must be live-out of pred) and for phi elimination
(copies are inserted at the end of pred).
Returns an empty slice if vref does not appear in any phi incoming list.