diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2021-09-30 07:14:16 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2021-09-30 07:14:16 -0700 |
commit | cc37c787f80e57e43176af3b0abf952721917c19 (patch) | |
tree | 2d74aa6f8931ee67a70d77647f0c2b781fcff3a7 /parser.c | |
parent | 5336fe15fa87107493cf4ca8ddcb4b05d5900318 (diff) | |
download | txr-cc37c787f80e57e43176af3b0abf952721917c19.tar.gz txr-cc37c787f80e57e43176af3b0abf952721917c19.tar.bz2 txr-cc37c787f80e57e43176af3b0abf952721917c19.zip |
compiler: eliminate basic-block next-block method.
The next-block method performs a linear search through the basic
block list, which is physically ordered, to find the physically
next block. This is actually not needed in several places that use the
method; they want the logically next block, which is nil if the last
instruction of the current doesn't potentially fall through to the next
block. In the one place where we need the physical next block, in the
elim-next-jump method, the caller can dynamically provide this, since it
walks the list.
* stdlib/optimize.tl (basic-block next-block): Method removed.
(basic-block link-graph): We revise the logic here a little bit. All of
the cases now consistently use the mechanism of setting link-next to
nil to indicate that they don't fall through to the next block.
The special case handling of the close instruction is clearer.
(basic-block (thread-jumps-block, peephole-block)): Several cases here
referred to the physically next block via the next-block method. This
can be replaced by just using the next pointer, which will be the same.
(basic-blocks elim-next-jump): This method now takes the next block as
an argument, since there is no next-block method it can call to get
the physcally next block. The argument is guaranteed non-null, so we
don't need the .? null-safe slot access syntax.
(basic-blocks elim-dead-code): Iterate over the next blocks
simultaneously, and pass the next block into elim-next-jump.
We no longer iterate over the last block, which has no physical next
block.
Diffstat (limited to 'parser.c')
0 files changed, 0 insertions, 0 deletions