diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2023-04-06 22:38:59 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2023-04-06 22:38:59 -0700 |
commit | 03d79d37bfbaccddbf7c83d25770a35fda95dad7 (patch) | |
tree | 051a6eb05802c2973ea669a70f663a3161320845 /stdlib | |
parent | bfce69c0af7c48add464ab1233bb48d0e4d6059f (diff) | |
download | txr-03d79d37bfbaccddbf7c83d25770a35fda95dad7.tar.gz txr-03d79d37bfbaccddbf7c83d25770a35fda95dad7.tar.bz2 txr-03d79d37bfbaccddbf7c83d25770a35fda95dad7.zip |
compiler: small local refactoring in optimizer.
* stdlib/optimize.tl (basic-blocks peephole-block): Move local
rename function into main labels block, so other optimizations
will be able to use it. Remove an unused argument, and change
the recursion to a mapcar, since that's what it's doing.
Diffstat (limited to 'stdlib')
-rw-r--r-- | stdlib/optimize.tl | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/stdlib/optimize.tl b/stdlib/optimize.tl index 99b59210..8ab9e7ca 100644 --- a/stdlib/optimize.tl +++ b/stdlib/optimize.tl @@ -357,7 +357,9 @@ (and li (not (bit li.used n))))) (only-locally-used-treg (insn n) (let ((li [bb.li-hash insn])) - (and li (bit li.used n) (not (bit bl.live n)))))) + (and li (bit li.used n) (not (bit bl.live n))))) + (rename (insns dst src) + (mapcar (op subst-preserve dst src bb [bb.li-hash @1] @1) insns))) (rewrite-case insns code ;; dead t-reg (@(require ((@(or mov getlx getv getf getfb) (t @n) . @nil) . @nil) @@ -387,13 +389,7 @@ (not (find src rest : [chain bb.li-hash .def]))) (pushnew bl bb.rescan) (set bb.recalc t) - (labels ((rename (insns n dst src) - (tree-case insns - ((fi . t) - (cons (subst-preserve dst src bb [bb.li-hash fi] fi) - (rename (cdr insns) n dst src))) - (else else)))) - (rename (cdr insns) n dst src))) + (rename rest dst src)) ;; wasteful moves (((mov @reg0 @nil) (mov @reg0 @nil) . @nil) (cdr insns)) |