upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/tools/cfg_structure.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/cfg_structure.py')
-rw-r--r--tools/cfg_structure.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/cfg_structure.py b/tools/cfg_structure.py
index 68522ec8b..9b7b41212 100644
--- a/tools/cfg_structure.py
+++ b/tools/cfg_structure.py
@@ -80,7 +80,7 @@ def _dominators(rpo, preds):
80 return idom, pos 80 return idom, pos
81 81
82 82
83def structure(succ): 83def structure(succ, out_pcs=None):
84 rpo, back, preds = _order(succ) 84 rpo, back, preds = _order(succ)
85 idom, pos = _dominators(rpo, preds) 85 idom, pos = _dominators(rpo, preds)
86 86
@@ -158,7 +158,8 @@ def structure(succ):
158 out_list.append(("loop", x, lbody)) 158 out_list.append(("loop", x, lbody))
159 else: 159 else:
160 out_list.append(("block", x)) 160 out_list.append(("block", x))
161 if kind == "b" and len(below) == 1 and list(succ[x]) == [below[0][1]]: 161 if (kind == "b" and len(below) == 1 and list(succ[x]) == [below[0][1]]
162 and (out_pcs is None or set(out_pcs[x]) == {below[0][1]})):
162 stack.append(("emit", out_list, parent_list, below[0], depth)) 163 stack.append(("emit", out_list, parent_list, below[0], depth))
163 else: 164 else:
164 hoist = (parent_list is not None and below 165 hoist = (parent_list is not None and below