Skip to main content

apply_fusions

Function apply_fusions 

Source
pub fn apply_fusions(
    nodes: &mut Vec<Option<Box<dyn PolydatNode>>>,
    wiring: &mut Vec<Vec<WireSource>>,
    name_to_idx: &mut HashMap<String, usize>,
    rules: &[FusionRule],
    output_nodes: &[usize],
) -> usize
Expand description

Apply all fusion rules to the node graph, returning the number of fusions applied.

Operates on mutable vectors of nodes and wiring. Nodes consumed by fusion are replaced with None (removed during later DCE/topo sort).

The pass runs to a fixed point: it repeats until no more rules match. Apply all fusion rules to the node graph, returning the number of fusions applied.

output_nodes lists node indices that are directly referenced by named outputs — these must not be consumed as interior nodes.