Trait yaxpeax_core::data::Disambiguator[][src]

pub trait Disambiguator<A: ValueLocations, LocSpec> {
    fn disambiguate(
        &self,
        instr: &A::Instruction,
        loc: (Option<A::Location>, Direction),
        spec: LocSpec
    ) -> Option<A::Location>; }
Expand description

Disambiguator is used with LocIterator to allow customizable refinement of locations in an instruction. While in most architectures, registers are unambiguous, memory locations are often much more complex. Disambiguation must be flexible because the actual scheme may vary program to program, compiler to compiler, and binary to binary, all for the same architecture.

As an example for x86_64 variance, a maximally pessimistic analysis may assume all memory accesses alias. This significantly complicates stack analysis, and for most programs it may be acceptable to assume that stack-relative accesses do not alias, for example, heap accesses or static data accesses. Because stack accesses in a single function often are all constant offsets from a known pointer, a disambiguation to move all stack accesses into a stack-only region we assume is not aliased by other memory means we can insert variables for stack memory with a naive analysis. This same claim holds for globals and program accesses, with arbitrary heap accesses still possibly requiring more intensive analysis.

Required methods

Implementors