v / vlib / v2 / ssa / block.v
29 lines · 23 sloc · 506 bytes · 09cc0c5133d075ee6dcff29286dce7eb7d4421da
Raw
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
5module ssa
6
7pub type BlockID = int
8
9pub fn (id BlockID) str() string {
10 return int(id).str()
11}
12
13pub struct BasicBlock {
14pub:
15 id BlockID
16 val_id ValueID
17 name string
18 parent int // Function ID
19pub 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