diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2023-04-07 05:14:00 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2023-04-07 05:14:00 -0700 |
commit | 2cf17e97d6b433405700653e7e2c885ad5dd75de (patch) | |
tree | 8a80b3cee917cd546b9e3e351ebf7cfdbd71027d /stdlib/compiler.tl | |
parent | 03d79d37bfbaccddbf7c83d25770a35fda95dad7 (diff) | |
download | txr-2cf17e97d6b433405700653e7e2c885ad5dd75de.tar.gz txr-2cf17e97d6b433405700653e7e2c885ad5dd75de.tar.bz2 txr-2cf17e97d6b433405700653e7e2c885ad5dd75de.zip |
compiler: optimization improvements
* stdlib/optimize.tl (basic-blocks peephole-block): Drop the
code argument, and operate on bl.insns, which is stored
back. Perform the renames in the rename list after the
peephole pass.
(basic-blocks rename): New method.
(basic-blocks do-peephole-block): Implementation of
peephole-block, under a new name. The local function called
rename is removed; calls to it go to the new rename method.
(basic-blocks peephole): Simplify code around calls to
peephole-block; we no longer have to pass bl.insns to it,
capture the return value and store it back into bl.insns.
* stdlib/compiler.tl (*opt-level*): Initial
value changes from 6 to 7.
(compiler optimize): At optimization level 6,
we now do another jump threading pass, and
peephole, like at levels 4 and 5. The peephole
optimizations at level 5 make it possible
to coalesce some basic blocks in some cases,
and that opens up the possibility for more
reductions. The previously level 6 optimizations
are moved to level 7.
* txr.1: Updated documentation of optimization levels,
and default value of *opt-level*.
* stdlib/doc-syms.tl: Updated.
Diffstat (limited to 'stdlib/compiler.tl')
-rw-r--r-- | stdlib/compiler.tl | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/stdlib/compiler.tl b/stdlib/compiler.tl index 5e5fff6b..2a8f97cd 100644 --- a/stdlib/compiler.tl +++ b/stdlib/compiler.tl @@ -378,8 +378,9 @@ ;; 3 - lambda/combinator lifting ;; 4 - control-flow: jump-threading, dead code ;; 5 - data-flow: dead registers, useless regisers -;; 6 - more expensive size or speed optimizations -(defvar usr:*opt-level* 6) +;; 6 - iterate on 4-5 optimizations. +;; 7 - more expensive size or speed optimizations +(defvar usr:*opt-level* 7) (defun dedup (obj) (cond @@ -1724,9 +1725,15 @@ (when (>= olev 5) bb.(calc-liveness) bb.(peephole) - bb.(elim-dead-code)) + (when (>= olev 6) + bb.(link-graph) + bb.(thread-jumps)) + bb.(elim-dead-code) + (when (>= olev 6) + bb.(calc-liveness) + bb.(peephole))) (cond - ((>= olev 6) + ((>= olev 7) bb.(merge-jump-thunks) bb.(compact-tregs) bb.(late-peephole bb.(get-insns))) |