patch for mips flow problem, including test case

Ken Raeburn
Wed Oct 7 20:00:00 GMT 1998

> The addition of (use (label)) to tablejumps is an anachronism.  That was
> necessary in the early days, but it has been unnecessary ever since the
> REG_LABEL reg notes were added.

The USE method is the only way used by rtlanal.c:computed_jump_p,
which is used by flow, to distinguish tablejumps from generic computed

The notes on REG_LABEL in rtl.h emphasize its use in non-jump insns.
If it can be used in a jump insn to indicate the associated table,
that should be indicated there.  Might we want labels on tables of
addresses to be handled differently from labels that would be targets
of jumps or address-of-code-label operations?

Currently the MIPS tablejump insns don't get REG_LABEL notes; only
non-jump insns do.  Nothing associated with the jump insn itself
indicates the possible targets.

>	  There are a number of ports nowadays that
> don't bother to include the (use (label)) in tablejump patterns.  The MIPS
> is one.  PA is another (see the casesi0 pattern).  There may be others.

Okay, then the PA will probably fail the test case I added, if casesi0
gets used.

I don't much care which way we do this -- USE expressions or REG_LABEL
notes attached to the jump insn -- but we need (at least) one that we
can use consistently throughout.  If we're using two, until we
eliminate the need for one, I guess we should try to make them both
work. :-(

Using notes on the jump insn has the benefit that a real computed jump
that can be determined to have a small list of possible targets could
be annotated.  Not that we have any code to do that sort of analysis
at the moment, but the possible improvements in the flow graph may
make it worthwhile.

> The patch is OK.  It doesn't completely fix the problem I just described,
> but I don't see any harm to it, and it will fix the problem you reported,
> so we may as well put it in.

Thanks, I will, and I'll add the comments to that you

> Another incidentally, I see that there are still other tablejump patterns in
> the file that are missing the (use (label)).  This includes at least
> tablejump_mips161, tablejump_mips162, and casesi_internal.  Again, this isn't
> something that has to be fixed.  It just means your patch doesn't fix the
> entire problem.

The mips16* ones are just define_expands using DONE; they always emit
the tablejump_internal1 and _internal2 patterns respectively.  So the
pattern isn't important, but probably ought to be fixed up anyways.
Similarly for casesi, but casesi_internal does need fixing.

I'll submit another patch to deal with these soon.


More information about the Gcc-patches mailing list