Skip to main content

weir/
points_to.rs

1//! DF-3  -  Andersen points-to, field-sensitive at struct granularity.
2//!
3//! Andersen's analysis on the SSA constraint graph reduces to forward
4//! transitive closure over subset edges. This façade keeps the public API
5//! stable while implementation duties live in focused submodules.
6
7#[cfg(any(test, feature = "cpu-parity"))]
8mod oracle;
9mod plan;
10mod program;
11#[cfg(test)]
12#[allow(deprecated)]
13mod tests;
14
15pub(crate) const OP_ID: &str = "weir::points_to";
16
17pub(crate) const POINTS_TO_EDGE_MASK: u32 = vyre_primitives::predicate::edge_kind::ASSIGNMENT
18    | vyre_primitives::predicate::edge_kind::ALIAS
19    | vyre_primitives::predicate::edge_kind::MEM_STORE
20    | vyre_primitives::predicate::edge_kind::MEM_LOAD
21    | vyre_primitives::predicate::edge_kind::MUT_REF
22    | vyre_primitives::predicate::edge_kind::PHI;
23
24crate::define_analysis_family! {
25    family: PointsToFamily,
26    kind: crate::fixed_point_graph::FixedPointAnalysisKind::PointsToSubset,
27    name: "points_to subset_closure_via",
28    program_builder: andersen_points_to,
29    graph_prep: plan::prepare_points_to_subset_graph,
30    graph_prep_scratch: plan::prepare_points_to_subset_graph_with_scratch,
31    input_buffer: "pts_in",
32    output_buffer: "pts_out",
33    closure_prefix: subset_closure,
34    resident_prefix: subset_closure_resident,
35    word_capacity: "points_to subset_closure",
36    frontier_output: "points-to frontier",
37    resident_capacity: "points_to subset_closure resident",
38    resident_output: "points-to frontier",
39    visibility: pub,
40}
41
42pub use plan::{
43    prepare_points_to_subset_graph, prepare_points_to_subset_graph_into,
44    prepare_points_to_subset_plan, prepare_points_to_subset_plan_into,
45};
46#[allow(deprecated)]
47pub use program::{andersen_points_to, andersen_points_to_with_shape, PointsTo};
48
49#[cfg(any(test, feature = "cpu-parity"))]
50#[allow(deprecated)]
51pub(crate) use oracle::cpu_subset_closure;
52
53#[cfg(test)]
54use vyre::ir::Program;
55#[cfg(test)]
56use vyre_primitives::graph::csr_forward_traverse::bitset_words;
57#[cfg(test)]
58use vyre_primitives::graph::program_graph::ProgramGraphShape;