dfs implements the depth-first search part of the LT algorithm.
(v *node, i int32, preorder []*node)
| 82 | |
| 83 | // dfs implements the depth-first search part of the LT algorithm. |
| 84 | func (lt *ltState) dfs(v *node, i int32, preorder []*node) int32 { |
| 85 | preorder[i] = v |
| 86 | v.dom.pre = i // For now: DFS preorder of spanning tree of CFG |
| 87 | i++ |
| 88 | lt.sdom[v.dom.index] = v |
| 89 | lt.link(nil, v) |
| 90 | for _, w := range v.imports { |
| 91 | if lt.sdom[w.dom.index] == nil { |
| 92 | lt.parent[w.dom.index] = v |
| 93 | i = lt.dfs(w, i, preorder) |
| 94 | } |
| 95 | } |
| 96 | return i |
| 97 | } |
| 98 | |
| 99 | // eval implements the EVAL part of the LT algorithm. |
| 100 | func (lt *ltState) eval(v *node) *node { |