sway_ir::analysis::memory_utils

Function get_gep_referred_symbols

Source
pub fn get_gep_referred_symbols(
    context: &Context<'_>,
    val: Value,
) -> FxIndexSet<Symbol>
Expand description

Get Symbols, both Symbol::Locals and Symbol::Args, reachable from the val via chain of InstOp::GetElemPtr (GEP) instructions. A val can, via GEP instructions, refer indirectly to none, or one or more symbols.

If the val is not a pointer, an empty set is returned.

Note that this function does not return Symbols potentially reachable via referencing (&), dereferencing (*), and raw pointers (__addr_of) and is thus suitable for all IR analysis and manipulation that deals strictly with GEP access.

To acquire all Symbols reachable from the val, use get_referred_symbols instead.