code wiki / (root) / nx_dom.nx

nx_dom.nx

buildroot/runtime/nx_dom.nx

16511 B432 linesdepth 2pulls 2 transitivereach 1 importersview sourcekind librarytopic dom
docsdependenciesstructsconstsfunctions

about

dom.nx -- Cooper-Harvey-Kennedy dominance, in NishiLang. Ports the algorithm in dom.c to NishiLang. This is the first module of the self-hosted compiler: pure graph operations on a CFG, no dependency on ir.c's types. Future integration wraps this so the rest of the compiler can call it. Algorithm summary: 1. Reverse-postorder DFS from entry -> rpo[], rpo_num[]. 2. Iterative dominators until fixed point (CHK 2001). 3. Dominance frontier via Cytron's closed-form walk. 4. Dominator-tree children table for pre-order walks.

dependencies 1 imports · 1 importers

nx_syscalls.nx nx_dom.nx nx_smoke_dom_inspect.nx

imports: nx_syscalls.nx

imported by: nx_smoke_dom_inspect.nx

structs

29struct Block

consts

none

functions

47func rpo_dfs(blocks: *Block, b: i64,
called by 2: rpo_dfsdom_compute calls 1: rpo_dfs
67func dom_intersect(blocks: *Block, b1: i64, b2: i64) -> i64
called by 1: dom_compute
92func dom_compute(blocks: *Block, n_blocks: i64, entry: i64) -> i64
called by 1: main calls 3: sys_mmaprpo_dfsdom_intersect
194func df_compute(blocks: *Block, n_blocks: i64,
281func loop_detect(blocks: *Block, n_blocks: i64,
calls 1: sys_mmap