Skip to main content

relationship_tree

Function relationship_tree 

Source
pub fn relationship_tree(
    fired: &[Opt],
    preempted: &[(Opt, Opt)],
    dependencies: &[(Opt, Opt)],
) -> Vec<OptNode>
Expand description

The complete optimization chain for one program, derived deterministically from a single all-optimizations-on evaluation plus the static registry graph — no differential toggling in the hot path. fired is the set that fired; preempted is the (winner, loser) BLOCKER pairs that occurred; dependencies is the (dependent, dep) per-program DEPENDENCY pairs (one optimization only fired because another was on) — all three come from the baked per-program graph (compile::optimization_graph).

The in-play set is fired ∪ {losers} ∪ {dependency endpoints} ∪ closure over the parent relation, where a node’s parents are its static requires PLUS its per-program dependencies: every opt that fired, every opt skipped because a higher-precedence one claimed it, and the parents they hang under (so the tree never orphans a child). Each node is placed by a depth-first walk along that combined parent relation, parents before children. Closures over the fixed 40-row registry — O(n²), and the same for identical input.