weirflow 0.1.0

GPU-first dataflow analysis primitives for Vyre and Santh compiler pipelines.
Documentation
use crate::ifds_gpu;
use vyre::ir::Program;
use vyre_primitives::graph::csr_forward_traverse::csr_forward_traverse;
use vyre_primitives::graph::program_graph::ProgramGraphShape;
use vyre_primitives::predicate::edge_kind;

/// PHASE6_DATAFLOW HIGH: the previous `0xFFFF_FFFF` allow-mask let
/// taint flow along DOMINANCE / RETURN / every-other-edge-kind
/// indiscriminately. The IFDS reach contract is "data + call edges,
/// no dominance"  -  restricted to `ASSIGNMENT | CALL_ARG | RETURN |
/// PHI | ALIAS | MEM_STORE | MEM_LOAD | MUT_REF`.
pub(crate) const IFDS_REACH_MASK: u32 = edge_kind::ASSIGNMENT
    | edge_kind::CALL_ARG
    | edge_kind::RETURN
    | edge_kind::PHI
    | edge_kind::ALIAS
    | edge_kind::MEM_STORE
    | edge_kind::MEM_LOAD
    | edge_kind::MUT_REF;

/// Build one IFDS forward-reachability step over an exploded
/// super-graph laid out as a ProgramGraph.
///
/// The analysis driver is responsible for (a) materialising the
/// super-graph  -  call/return summary edges baked in by DF-9, (b)
/// seeding the frontier with source facts, (c) masking out
/// sanitizer-labelled facts after each step, (d) iterating to
/// fixpoint, (e) intersecting the final reach with the sink set.
#[must_use]
pub fn ifds_reach_step(shape: ProgramGraphShape, frontier_in: &str, frontier_out: &str) -> Program {
    csr_forward_traverse(shape, frontier_in, frontier_out, IFDS_REACH_MASK)
}

/// PHASE6_DATAFLOW CRITICAL: bridge from the high-level IFDS surface
/// to the GPU-native exploded-supergraph step. Pre-fix this module
/// did not import [`super::ifds_gpu`] at all  -  the G3 implementation
/// was orphaned. This entry point composes the exploded-supergraph
/// shape with the GPU step kernel so callers that already hold an
/// [`ifds_gpu::IfdsShape`] do not have to manually project to
/// `ProgramGraphShape`.
pub fn ifds_reach_step_exploded(
    shape: ifds_gpu::IfdsShape,
    frontier_in: &str,
    frontier_out: &str,
) -> Result<Program, String> {
    ifds_gpu::ifds_gpu_step(shape, frontier_in, frontier_out)
}