diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2023-04-07 19:21:56 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2023-04-07 19:21:56 -0700 |
commit | 73c90f20025cf3780f52ef23fac0fab4ff21c9a1 (patch) | |
tree | c0b46d0bf276f69333cac6b97ad55f58d0f5a4b2 /stdlib | |
parent | 2cf17e97d6b433405700653e7e2c885ad5dd75de (diff) | |
download | txr-73c90f20025cf3780f52ef23fac0fab4ff21c9a1.tar.gz txr-73c90f20025cf3780f52ef23fac0fab4ff21c9a1.tar.bz2 txr-73c90f20025cf3780f52ef23fac0fab4ff21c9a1.zip |
compiler: iterate on level 4-5 optimizations.
* stdlib/optimize.tl (basic-blocks num-blocks): New
method.
* stdlib/compiler.tl (compiler optimize): At optimization
level 6, instead of performing one extra pass of
jump threading, dead-code elimintation and peephole
optimizations, keep iterating on these until the number
of basic blocks stays the same.
* txr.1: Documented.
Diffstat (limited to 'stdlib')
-rw-r--r-- | stdlib/compiler.tl | 17 | ||||
-rw-r--r-- | stdlib/optimize.tl | 3 |
2 files changed, 11 insertions, 9 deletions
diff --git a/stdlib/compiler.tl b/stdlib/compiler.tl index 2a8f97cd..bf6496bb 100644 --- a/stdlib/compiler.tl +++ b/stdlib/compiler.tl @@ -1723,15 +1723,14 @@ bb.(thread-jumps) bb.(elim-dead-code)) (when (>= olev 5) - bb.(calc-liveness) - bb.(peephole) - (when (>= olev 6) - bb.(link-graph) - bb.(thread-jumps)) - bb.(elim-dead-code) - (when (>= olev 6) - bb.(calc-liveness) - bb.(peephole))) + (let ((nblocks nil)) + (while* (and (>= olev 6) + (neql nblocks (set nblocks bb.(num-blocks)))) + bb.(calc-liveness) + bb.(peephole) + bb.(link-graph) + bb.(thread-jumps) + bb.(elim-dead-code)))) (cond ((>= olev 7) bb.(merge-jump-thunks) diff --git a/stdlib/optimize.tl b/stdlib/optimize.tl index ff256db7..8bf8b8c9 100644 --- a/stdlib/optimize.tl +++ b/stdlib/optimize.tl @@ -85,6 +85,9 @@ (mapdo (do set [bb.hash @1.label] @1) bb.list)) bb.(link-graph)) + (:method num-blocks (bb) + (len bb.list)) + (:method get-insns (bb) [mappend .insns bb.list]) |