/** * DominatorGraph * * Computes the dominator tree for a control-flow graph using the * Cooper et al. "A Simple, Fast Dominance Algorithm" (2001). * * Chosen over Lengauer-Tarjan because typical intra-procedural CFGs have * fewer than 100 blocks — O(n²) worst-case is negligible and the algorithm * is straightforward to verify correct. * * Reference: * Cooper, K.D., Harvey, T.J., Kennedy, K. (2001). "A Simple, Fast Dominance * Algorithm". Software Practice & Experience, 4, 1–10. * * Design invariants: * - No Node.js-specific APIs. Browser + Node.js + Cloudflare Workers safe. * - Does not mutate the input CFG. * - Unreachable blocks are excluded from all dominator queries. */ import type { CFG } from '../types/index.js'; /** * Dominator tree for a CFG, computed with the Cooper et al. algorithm. * * Entry blocks have no immediate dominator (immediateDominator returns null). * Only blocks reachable from the entry are included. */ export declare class DominatorGraph { private readonly idom; private readonly rpoIndex; private readonly entryId; /** Cached reverse map: blockId → all blockIds it strictly dominates. */ private _dominated; constructor(cfg: CFG, entryId?: number); /** * Returns true if block `a` dominates block `b`. * A block dominates itself (reflexive). */ dominates(a: number, b: number): boolean; /** * Returns true if block `a` strictly dominates block `b` (a ≠ b and a dom b). */ strictlyDominates(a: number, b: number): boolean; /** * Returns the immediate dominator of `blockId`, or null for the entry block * (or any block not in the dominator tree). */ immediateDominator(blockId: number): number | null; /** * Returns all block IDs strictly dominated by `blockId`. * (Computed lazily and cached on first call.) */ dominated(blockId: number): number[]; } //# sourceMappingURL=dominator-graph.d.ts.map