summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2022-06-09 07:47:47 -0700
committerKaz Kylheku <kaz@kylheku.com>2022-06-09 07:47:47 -0700
commit95e631002415ea431c35697077711fd28b31e98e (patch)
tree0ff9220fd939d35065560f0df0684ff3475fdd5e
parent29a81bdfbfaae1bdf93cb6d1a0bd2220cf5c9785 (diff)
downloadtxr-95e631002415ea431c35697077711fd28b31e98e.tar.gz
txr-95e631002415ea431c35697077711fd28b31e98e.tar.bz2
txr-95e631002415ea431c35697077711fd28b31e98e.zip
optimizer: remove root slot from basic-block.
The root slot is just supposed to be (car bl.list): the first basic block. Unfortunately, it's not maintained when bl.list is edited, which could cause bugs. This change makes no difference in the stdlib compiled files, other than of course the changes in optimize.tlo from this code change itself; so that is evidence suggesting this change is least not making anything worse. * stdlib/optimize.tl (basic-blocks): Remove root slot. (basic-blocks (link-graph, calc-liveness, elim-dead-code): Refer to (car bl.list) instead of bl.root.
-rw-r--r--stdlib/optimize.tl9
1 files changed, 3 insertions, 6 deletions
diff --git a/stdlib/optimize.tl b/stdlib/optimize.tl
index 5a59a531..00bf1cc4 100644
--- a/stdlib/optimize.tl
+++ b/stdlib/optimize.tl
@@ -53,7 +53,6 @@
insns
lt-dregs
symvec
- root
(hash (hash))
(li-hash (hash :eq-based))
list
@@ -120,7 +119,6 @@
,list))
(defmeth basic-blocks link-graph (bb)
- (set bb.root (car bb.list))
(each* ((bl bb.list)
(nxbl (append (cdr bl) '(nil))))
(let* ((code bl.insns)
@@ -275,7 +273,7 @@
(set-mask bl.used live-in))
(set changed t))))))
(set changed nil)
- (visit bb.root))))))
+ (visit (car bb.list)))))))
(defmeth basic-blocks thread-jumps-block (bb code)
(let* ((tail (last code))
@@ -549,9 +547,8 @@
(when bl.next
(visit bl.next))
[mapcar visit bl.links])))
- (for ((bl bb.root)) (bl) ((set bl bl.next))
- (visit bl))
- (visit bb.root))
+ (for ((bl (car bb.list))) (bl) ((set bl bl.next))
+ (visit bl)))
(upd bb.list (keep-if visited))
(let (flg)
(each ((bl bb.list)