diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2022-06-09 07:47:47 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2022-06-09 07:47:47 -0700 |
commit | 8187f1a3a27671d4d5b705901fa3fe30ed03cc5f (patch) | |
tree | 0ff9220fd939d35065560f0df0684ff3475fdd5e /stdlib | |
parent | faeae21c4621849e3c7e7393e504e36b54928555 (diff) | |
download | txr-8187f1a3a27671d4d5b705901fa3fe30ed03cc5f.tar.gz txr-8187f1a3a27671d4d5b705901fa3fe30ed03cc5f.tar.bz2 txr-8187f1a3a27671d4d5b705901fa3fe30ed03cc5f.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.
Diffstat (limited to 'stdlib')
-rw-r--r-- | stdlib/optimize.tl | 9 |
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) |