code wiki / (root) / dom.nx

dom.nx

buildroot/runtime/dom.nx

16683 B426 linesdepth 3pulls 3 transitivereach 2 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 · 2 importers

syscalls.nx dom.nx dom_test.nx smoke_dom_inspect.nx

imports: syscalls.nx

imported by: dom_test.nxsmoke_dom_inspect.nx

structs

23struct Block {

consts

none

functions

41func rpo_dfs(blocks: *Block, b: i64,
called by 2: rpo_dfsdom_compute calls 1: rpo_dfs
61func dom_intersect(blocks: *Block, b1: i64, b2: i64) -> i64 {
called by 1: dom_compute
86func dom_compute(blocks: *Block, n_blocks: i64, entry: i64) -> i64 {
called by 2: mainmain calls 2: rpo_dfsdom_intersect
188func df_compute(blocks: *Block, n_blocks: i64,
275func loop_detect(blocks: *Block, n_blocks: i64,