summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-02-05 21:20:26 -0800
committerKaz Kylheku <kaz@kylheku.com>2021-02-05 21:20:26 -0800
commit05f4a2d0d33c5e2cdc0569775cf8218824c7078e (patch)
tree605faf2c96c658c351e8f6e4907b6616a605692a
parentd02854155e915e28740605a7302faaaff1128622 (diff)
downloadtxr-05f4a2d0d33c5e2cdc0569775cf8218824c7078e.tar.gz
txr-05f4a2d0d33c5e2cdc0569775cf8218824c7078e.tar.bz2
txr-05f4a2d0d33c5e2cdc0569775cf8218824c7078e.zip
compiler: rewrite one peephole patern using @(with ...).
* share/txr/stdlib/optimize.tl (basic-blocks peephole): Rewrite the recently added jump hreading optimization as a single pattern, doing the matching into the other basic block through the hash table using @(with ...).
-rw-r--r--share/txr/stdlib/optimize.tl14
1 files changed, 6 insertions, 8 deletions
diff --git a/share/txr/stdlib/optimize.tl b/share/txr/stdlib/optimize.tl
index a8a329de..4b446baf 100644
--- a/share/txr/stdlib/optimize.tl
+++ b/share/txr/stdlib/optimize.tl
@@ -66,14 +66,12 @@
^((jmp ,jjlabel) ,*rest))
(@jelse insns))))
(((if @reg @jlabel0)
- (jmp @jlabel1) . @rest)
- (let ((jinsns [bb.hash jlabel1]))
- (if-match (@(op eq jlabel1)
- (if @(op eq reg) @nil)
- (jmp @jlabel3) . @nil)
- jinsns
- ^(,(car insns) (jmp ,jlabel3) ,*rest)
- insns)))
+ (jmp @(with @jlabel1
+ @(hash (@jlabel1 (@jlabel1
+ (if @reg @nil)
+ (jmp @jlabel3) . @nil)))
+ bb.hash)) . @rest)
+ ^(,(car insns) (jmp ,jlabel3) ,*rest))
(((if @reg @jlabel) . @rest)
(let ((jinsns [bb.hash jlabel]))
(match-case jinsns