From 3bd1acdfbfb8e6e2dd2b4fb99746396c6df2587b Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Wed, 29 Sep 2021 23:15:45 -0700 Subject: 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. --- stdlib/optimize.tl | 6 +++--- 1 file 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) -- cgit v1.2.3