Problem in gen_reload(), seeking an explanation

Franz Sirl Franz.Sirl-kernel@lauterbach.com
Wed Jun 16 10:04:00 GMT 1999


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:

move GENERAL_REGS,CTR_REGS
add GENERAL_REGS,GENERAL_REGS

And that works on PPC. Looking at the code in gen_reload() I saw that it 
makes a difference for gen_reload() if it is presented a

REG_CLASS(GENERAL_REGS) = REG_CLASS(CTR_REGS) + REG_CLASS(GENERAL_REGS)

or a

REG_CLASS(GENERAL_REGS) = REG_CLASS(GENERAL_REGS) + REG_CLASS(CTR_REGS)

The latter one is handled just fine in gen_reload().

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 :-(.

So my questions are:
- is gen_reload() supposed to handle such an add with 3 regs/2 regclasses?
- should swapping the regclasses change the behaviour at all?
- if gen_reload() is not able to handle this, what is the rule for that? 
Like: "Never enter here with different regclasses"?

I would really appreciate some information on that issue.

Thanks,
Franz.



More information about the Gcc mailing list