This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: A question about fold_rtx when it attempts to fold PC


> fold_rtx somehow attempts to fold PC like so:
> 
>     case PC:
>       /* If the next insn is a CODE_LABEL followed by a jump table,
> 	 PC's value is a LABEL_REF pointing to that label.  That
> 	 lets us fold switch statements on the VAX.  */
>       {
> 	rtx next;
> 	if (insn && tablejump_p (insn, &next, NULL))
> 	  return gen_rtx_LABEL_REF (Pmode, next);
>       }
>       break;
> 
> Now what is this suppose to do?
> 
> If INSN is a table jump insn, is PC folded to the label immediately
> before the label immediately before the dispatch table?  The dispatch
> table is something that a table jump insn references but does not
> jumps to.  It doesn't make sense to fold PC this way...

I can't answer that without more study whether it makes sense to fold
PC as above.

It's not true to say that a dispatch table is something that a table
jump insn references but does not jump to.  There are some implementations
of the dispatch table on the PA which contain code that's jumped to.

The comment needs rewriting.

> Steven Bosscher recently removed CASE_DROPS_THROUGH from VAX, which
> makes me wonder if this is a thing of past.

The above code wasn't conditioned on CASE_DROPS_THROUGH.  The PA and
VAX now have similar casesi implementations.  Of hand, I can't see
why the if would always be false unless there is a bug in tablejump_p.

Dave
-- 
J. David Anglin                                  dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6602)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]