diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2021-03-02 07:36:13 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2021-03-02 07:36:13 -0800 |
commit | ed4ddd978ac564b83d09cfe96f97c993442cc195 (patch) | |
tree | e49ce64a11fbf9e6c9919954d6ea077ae7801065 /share | |
parent | d714b3549720df0e4322fb3bf7e46208fcd89cce (diff) | |
download | txr-ed4ddd978ac564b83d09cfe96f97c993442cc195.tar.gz txr-ed4ddd978ac564b83d09cfe96f97c993442cc195.tar.bz2 txr-ed4ddd978ac564b83d09cfe96f97c993442cc195.zip |
compiler: new peephole cases: if over d reg.
During peephole optimization, new cases can arise where a dreg
is tested.
* share/txr/stdlib/optimize.tl (basic-blocks peephole-block):
Test for (if dreg ...) and (ifq dreg nil), eliminating the
instruction or rewriting to jmp. Could be worth it to do
another thread and dead code elimination.
Diffstat (limited to 'share')
-rw-r--r-- | share/txr/stdlib/optimize.tl | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/share/txr/stdlib/optimize.tl b/share/txr/stdlib/optimize.tl index 813264df..411af8d9 100644 --- a/share/txr/stdlib/optimize.tl +++ b/share/txr/stdlib/optimize.tl @@ -385,6 +385,12 @@ ^((if (t ,reg) ,xbl.label))) (t insns)))) (@jelse insns)))) + (@(require ((if @(as reg (d @dn)) @jlabel) . @nil) + (not (memqual reg bb.lt-dregs))) + nil) + (@(require ((ifq @(as reg (d @dn)) (t 0) @jlabel) . @nil) + (not (memqual reg bb.lt-dregs))) + ^((jmp ,jlabel))) (@else insns))) (defmeth basic-blocks peephole (bb) |