diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2021-02-24 21:55:10 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2021-02-24 21:55:10 -0800 |
commit | 6c19f277b8234121b2ed4be9246d4e6a7d4b8a9e (patch) | |
tree | 78fa0d646e6c0184710510d1806ff1fafeea183d /strudel.c | |
parent | 286ecfa6be0d484b2cd13366fd6aac53a54eae4a (diff) | |
download | txr-6c19f277b8234121b2ed4be9246d4e6a7d4b8a9e.tar.gz txr-6c19f277b8234121b2ed4be9246d4e6a7d4b8a9e.tar.bz2 txr-6c19f277b8234121b2ed4be9246d4e6a7d4b8a9e.zip |
compiler: data flow analysis for t registers.
The optimizer now calculates t liveness information for the t
registers. In every basic block, it now knows which t regs
are live on exit, and which are used in the block, at every
instruction.
One small optimization is based on this so far: the removal
of a move instruction targeting a dead register. This appears
stable.
* share/txr/stdlib/compiler.tl (compiler comp-unwind-protect):
The protected code of a uwprot must terminate with a regular
end instruction, rather than the jend pseudo-instruction.
This is because the clean-up block is executed after the
protected block and references values generated in it: t
registers are live between he pfrag and the cfrag. Without
this, the compile-file-conditionally function was wrongly
optimized, causing it to return false due to the setting of
the success flag (that having been moved into a t register)
having being optimized away.
(compiler optimize): Add the call the basic-blocks method
to calculate liveness.
* share/txr/stdlib/optimize.tl (struct live-info, struct
basic-block): New structure types. The basic-block
structure type now representes basic blocks instead of raw
lists.
(struct basic-blocks): New slots, root, li-hash.
(basic-blocks jump-ops): We add few instructions that
reference labels, just to be safe.
(basic-blocks :postinit): Refactor division into basic blocks
so that it generates basic-block objects instead of just lists
of instructions. Also, the new method link-graph is called
which analyzes the tail instructions of all the blocks to
determine connectivity and sets the next and links fields
of the objects to build a graph.
(basic-blocks (get-insns, cut-blocks)): Refactor for struct
represenation of basic blocks.
(basic-blocks (link-graph, local-liveness, calc-liveness): New
methods.
(basic-blocks thread-jumps-block): Refactor for struct
representation of basic blocks.
(basic-blocks peephole-blocks): Likewise, and new pattern for
removing moves into dead t-registers, assisted by liveness
information.
(basic-blocks (peephole, thread-jumps)): Refactor for
basic-blocks representation.
Diffstat (limited to 'strudel.c')
0 files changed, 0 insertions, 0 deletions