MLIR DAG rewriter w/ SSA IR, dominance and CFG analysis passes
1type value = int
2
3type inst =
4 | Alloca of value
5 | Load of value * value
6 | Store of value * value
7 | Phi of value * (value * value) list
8 | Move of value * value
9 | BinOp of value * value * value
10 | Ret of value option
11 | Br of value
12 | CondBr of value * value * value
13
14type block = {
15 id : value;
16 insts : inst list;
17 mutable preds : value list;
18 mutable succs : value list;
19}
20
21type func = {
22 blocks : block list;
23 entry : value;
24}
25
26let mk_block id insts =
27 { id; insts; preds = []; succs = [] }