From e1a0822ea333a0f513a8adde417d0d3798f9919b Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Fri, 5 Feb 2021 21:20:26 -0800 Subject: 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 ...). --- share/txr/stdlib/optimize.tl | 14 ++++++-------- 1 file 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 -- cgit v1.2.3