diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2021-11-10 07:06:25 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2021-11-10 07:06:25 -0800 |
commit | 82aee83fa4e280007c4146053202e22c2754211b (patch) | |
tree | 21cc1ad38d03b702d21a78446e198e99920590c9 /configure | |
parent | fd2c685968667bc10c37164dd8b765779b4c208a (diff) | |
download | txr-82aee83fa4e280007c4146053202e22c2754211b.tar.gz txr-82aee83fa4e280007c4146053202e22c2754211b.tar.bz2 txr-82aee83fa4e280007c4146053202e22c2754211b.zip |
compiler: late-peephole match for a wasteful register move.
I've noticed a wasteful instruction pattern in the compiled
code for the sys:awk-code-move-check function:
7: 2C020007 movsr t2 t7
8: 3800000E if t7 14
9: 00000007
10: 20050002 gcall t2 1 t9 d1 t8 t6 t7
11: 00090001
12: 00080401
13: 00070006
14: 10000002 end t2
Here, the t2 register can be replaced with t7 in the gcall
and end instructions, and the movsr t2 t7 instruction can
be eliminated.
It looks like something that could somehow be targeted more generally
with a clever peephole pattern assisted by data-flow information,
but for now I'm sticking in a dumb late-peephole pattern which just
looks for this very specific pattern.
* stdlib/optimize.tl (basic-blocks late-peephole): Add new
pattern for eliminating the move, as described above.
There are several hits for this in the standard library in addition to
the awk module: in the path-test, each-prod and getopts files.
Diffstat (limited to 'configure')
0 files changed, 0 insertions, 0 deletions