Fri, 11 Aug 2000 17:27:14 -0400 (EDT)
I've been working on getting better translations of transfer statements,
hopefully in order to allow some branches to fall through as opposed to
being explicit jumps. But, I was starting with some simple goto
eliminations -- first eliminate all blocks which are nothing but jump by
replacing jumps to that block with jumps to the final target. That was
pretty easy. Then I wanted to combine block A with block B when the only
transfer to block B is jump from block A. This is having some problems.
Question 1: from the Chunk.t datatype, I get two lists of labels:
gcReturns and entries. I understand that gcReturns are the set of labels
that got inserted for limitChecks and prims that enter the runtime. And
entries are the function entry points. I had thought that those where the
only ways of "entering" the Chunk. But handlers are handled differently?
i.e., is it possible to transfer between chunks because of a handle? I
think that might explain why I'm getting unresolved symbols. I wanted to
be aggressive and simply count all the jumps to each label and then toss
out anything that has 0 jumps to it. Obviously, things like gcReturns
have no explicit jumps, so they are marked as Must (be kept). I guess
handlers are the same way -- some of them are never explicitly jumped to,
yet they must be kept.
I suspect this issue arose in the c-backend as well. (I think) it
explains why I didn't understand why all the targets of Switches and
SwitchIPs were forced to be output.
Question 2: Any reason not to build up a list of handler labels and pass
them along with the Chunks in order to do this precise analysis? Or are
there other cases where it would break?