diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2021-09-29 23:15:45 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2021-09-29 23:15:45 -0700 |
commit | 3bd1acdfbfb8e6e2dd2b4fb99746396c6df2587b (patch) | |
tree | 9fe6af52bee4ecea8a1e3976c241c40014e869c5 | |
parent | 16e6b383cff55a7c417fa8bff33c9cca1d04d3df (diff) | |
download | txr-3bd1acdfbfb8e6e2dd2b4fb99746396c6df2587b.tar.gz txr-3bd1acdfbfb8e6e2dd2b4fb99746396c6df2587b.tar.bz2 txr-3bd1acdfbfb8e6e2dd2b4fb99746396c6df2587b.zip |
compiler: improvement in next-block linking.
* stdlib/optimize.tl (basic-blocks link-graph): Do not search
the entire list for a block's successor. Iterate over the cdr
of the list in parallel, so that the next block is directly
available at each iteration.
-rw-r--r-- | stdlib/optimize.tl | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/stdlib/optimize.tl b/stdlib/optimize.tl index 5f81bc10..628a5317 100644 --- a/stdlib/optimize.tl +++ b/stdlib/optimize.tl @@ -123,12 +123,12 @@ (defmeth basic-blocks link-graph (bb) (set bb.root (car bb.list)) - (each ((bl bb.list)) + (each* ((bl bb.list) + (nxbl (append (cdr bl) '(nil)))) (let* ((code bl.insns) (tail (last code)) (linsn (car tail)) - (link-next t) - (nxbl (cadr (memq bl bb.list)))) + (link-next t)) (set bl.next nxbl) (match-case linsn ((jmp @jlabel) |