summaryrefslogtreecommitdiffstats
path: root/stdlib/compiler.tl
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2025-06-17 23:49:04 -0700
committerKaz Kylheku <kaz@kylheku.com>2025-06-17 23:49:04 -0700
commitb6479c689570ae3df42a45da6d96fc679a5925f3 (patch)
tree59b4a34cdfc80222626aba8ef5911c53d2ffb458 /stdlib/compiler.tl
parent3dcd2869946e25041957e312fc3598a4f4639cf3 (diff)
downloadtxr-b6479c689570ae3df42a45da6d96fc679a5925f3.tar.gz
txr-b6479c689570ae3df42a45da6d96fc679a5925f3.tar.bz2
txr-b6479c689570ae3df42a45da6d96fc679a5925f3.zip
compiler: eliminate wasteful treg nulling.
* stdlib/optimize.tl (live-info): New slot, clobbered. (basic-block): New slot, cycle. Struct also inherits clobbered slot from live-info. (basic-block print): Print clobbered and cycle. (basic-blocks local-liveness): Calculate clobbered for each instruction and from that for the basic block. (basic-blocks identify-cycle-members): New method. Discovers which basic blocks are part of any cycle, and identifies them by setting the new cycle slot to t. (basic-blocks do-peephole-block): New local functions here for determining whether a register has been clobbered before the first instruction, either in the same basic block or any ancestors. Only works when the block is not part of a cycle. We add a peephole pattern matching move instructions that set tregs to (t 0)/nil. When we are not in a cycle block, and the treg has not previously been clobbered, we know it is clean: it still has the initial nil value set by the VM and we can remove the instruction. * stdlib/compiler.tl (compiler optimize): Call the identify-cycle-members method before peephole.
Diffstat (limited to 'stdlib/compiler.tl')
-rw-r--r--stdlib/compiler.tl1
1 files changed, 1 insertions, 0 deletions
diff --git a/stdlib/compiler.tl b/stdlib/compiler.tl
index fe4db13e..c3043d38 100644
--- a/stdlib/compiler.tl
+++ b/stdlib/compiler.tl
@@ -1840,6 +1840,7 @@
(while* (and (>= olev 6)
(neql nblocks (set nblocks bb.(num-blocks))))
bb.(calc-liveness)
+ bb.(identify-cycle-members)
bb.(peephole)
bb.(link-graph)
bb.(thread-jumps)