| 1 | // Copyright (c) 2026 Alexander Medvednikov. All rights reserved. |
| 2 | // Use of this source code is governed by an MIT license |
| 3 | // that can be found in the LICENSE file. |
| 4 | |
| 5 | module ssa |
| 6 | |
| 7 | pub type BlockID = int |
| 8 | |
| 9 | pub fn (id BlockID) str() string { |
| 10 | return int(id).str() |
| 11 | } |
| 12 | |
| 13 | pub struct BasicBlock { |
| 14 | pub: |
| 15 | id BlockID |
| 16 | val_id ValueID |
| 17 | name string |
| 18 | parent int // Function ID |
| 19 | pub mut: |
| 20 | instrs []ValueID |
| 21 | |
| 22 | // Control Flow Graph |
| 23 | preds []BlockID |
| 24 | succs []BlockID |
| 25 | |
| 26 | // Dominators |
| 27 | idom BlockID |
| 28 | dom_tree []BlockID |
| 29 | } |
| 30 | |