diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2021-02-26 19:28:18 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2021-02-26 19:28:18 -0800 |
commit | 3f0c43974617e91aa3b5ac80f5e3348c8812f293 (patch) | |
tree | d5139ec364764e0b0a7f52a5696013c3fb0b960b /parser.l | |
parent | 6c19f277b8234121b2ed4be9246d4e6a7d4b8a9e (diff) | |
download | txr-3f0c43974617e91aa3b5ac80f5e3348c8812f293.tar.gz txr-3f0c43974617e91aa3b5ac80f5e3348c8812f293.tar.bz2 txr-3f0c43974617e91aa3b5ac80f5e3348c8812f293.zip |
compiler: new optimization.
Using liveness information, if we are very careful about the
circumstances, we can can eliminate instructions of the form
mov tN src
and replace every subsequent occurrence of tN in the basic
block by src. For instance, simple case: if a function
ends with
mov t13 d5
end t13
that can be rewriten as
end d5
The most important condition is that t13 is not live on exit
from that basic block. There are other conditions. For now,
one of the conditions is that src cannot be a v register.
* share/txr/stdlib/optimize.tl (struct live-info): New slot,
def. This indicates which t register is being clobbered, if
any, by the instruction to which this info is attached.
(basic-blocks local-liveness): Adjust the propagation of the
defined info. If an instruction both consumes a register and
overwrites it, we track that as both a use and a definition.
We set up the def fields of live-info. We do that by mutation,
so we must be careful to copy the structure. The def field
pertains to just one instruction, but the same info can be
attached to multiple instructions.
(subst-preserve): New function.
(basic-blocks peephole-block): New optimization added.
Now takes a basic-block argument, bl.
(basic-blocks peephole): Pass bl to peephole-block.
Diffstat (limited to 'parser.l')
0 files changed, 0 insertions, 0 deletions