This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Problem in gen_reload(), seeking an explanation
- To: Franz Sirl <Franz dot Sirl-kernel at lauterbach dot com>
- Subject: Re: Problem in gen_reload(), seeking an explanation
- From: Jeffrey A Law <law at cygnus dot com>
- Date: Mon, 21 Jun 1999 05:24:33 -0600
- cc: egcs at egcs dot cygnus dot com
- Reply-To: law at cygnus dot com
In message <4.2.0.56.19990616181739.039cabd0@mail.lauterbach.com>you write:
> Hi,
>
> on PPC gcc-2.95pre I have a testcase that aborts in gen_add2_insn() called
> by gen_reload(). The problem is a insn with 3 different real registers like
>
> this
>
> REG_CLASS(GENERAL_REGS) = REG_CLASS(CTR_REGS) + REG_CLASS(GENERAL_REGS)
>
> There's no instruction on PPC that can handle these regclasses a single
> instruction add, so gen_reload() tries to use a move/add sequence. And here
>
> starts the problem, cause it first tries
>
> move GENERAL_REGS,GENERAL_REGS
> add GENERAL_REGS,CTR_REGS
>
> with the add generated by gen_add2_insn(). Unfortunately gen_add2_insn()
> aborts here, cause there is no "add GENERAL_REGS,CTR_REGS" on PPC.
> But there is code in gen_reload() lateron that would try the following:
What I have maintained all along is that this should have been handled before
we called gen_add2_insn.
If you look earlier in gen_reload we have support for rearranging the operands
of an add instruction to avoid this kind of problem. You need to determine
why that code is not shuffling the operands so that the add looks like
GPRx = GPRx + CTR
> I submitted a patch to replace the gen_add2_insn() with a general gen_rtx
> expression to avoid the abort, but Jeff doesn't like it :-(.
I don't like it because it's the wrong solution. You're fixing the symptom
(gen_add2_insn aborting), not the problem (we never should have called
gen_add2_insn with bogus operands).
> So my questions are:
> - is gen_reload() supposed to handle such an add with 3 regs/2 regclasses?
Yes. If it does not, then that would be the real bug IMHO. If you don't
have a 3 operand add, then you have to generate a move; add sequence. It
may be the case that we do not perform the necessary operand shuffling when
we create the move;add sequence.
jeff