This is the mail archive of the gcc-bugs@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]

Re: gcc-2.95pre: Internal compiler error in `gen_add2_insn'


At 11:55 27.05.99 , Jeffrey A Law wrote:

>   In message <4.2.0.54.19990526185527.050797f0@mail.lauterbach.com>you write:
>   > Lets assume out=r10, op0=r1 and op1=ctr, then gen_reload() tries to 
> run the
>   >
>   > following simplified sequence:
>   >
>   > /* try reloading r1 into r10, that will succeed */
>   > gen_reload (out, op0);
>   > /* try to add ctr to r10, that will abort if constraints don't match */
>   > insn = emit_insn (gen_add2_insn (out, op1));
>Huh?  You skipped the 3-operand add sequences earlier.
>
>I strongly suspect that your problem is that you shouldn't have gotten to the
>gen_add2_insn calls to start with in this example.  If you get to that case
>with CTR as one of the registers, then something has already gone wrong
>earlier in gen_reload.

Jeff, I think we are talking different languages here. As I don't 
understand all the issues behind reload, it's quite difficult for me to 
find the right arguments or explanations. What I'm trying to say that 
gen_reload() is able to handle this situation quite happily with my patch 
and looking at the code I think my patch is reasonable to the best of my 
knowledge. Maybe it would help if you could explain to me why I can't 
replace the gen_add2_insn() with gen_rtx_SET(gen_rtx_PLUS())?

Currently I see the following structure in gen_reload():

/* try 3 operand first */
insn = gen_rtx_SET (r10, plus(r1,ctr))
if (recog_memoized (insn) >= 0)
         if (constrain_operands (1))
                 return insn // OK, Success
/* else */
/* now try r10 = r1, r10 = r10 + ctr */
gen_reload (r10, r1)
insn = gen_add2_insn (r10, ctr)
if (recog_memoized (insn) >= 0)
         if (constrain_operands (1))
                 return insn // OK, Success
/* else */
/* now try r10 = ctr, r10 = r10 + r1 */
gen_reload (r10, ctr)
insn = gen_add2_insn (r10, r1)

What I don't understand is why it is OK to use gen_rtx_SET() on the 
3-operand check, but not on the first 2-operand check? Why does it make a 
difference if I enter gen_reload() with in=plus(ctr,r1) compared to 
in=plus(r1,ctr)? The comments in gen_reload() suggest that it tries hard to 
avoid such situations. You were talking about scratch registers, isn't that 
exactly happening here? If the 3-operand add doesn't succeed, try to use 
the output register as a scratch register. And that will be tried with both 
r10=r1,r10=r10+ctr and r10=ctr,r10=r10+r1.
With my limited knowledge I would say it's just fine to enter here with 
GENERAL_REGS=GENERAL_REGS+CTR_REGS classes, cause reload could assume it 
can use the output register as a scratch register even in presence of 
SECONDARY_RELOAD_CLASS. It just should make no difference if I enter 
gen_reload() with GENERAL_REGS=GENERAL_REGS+CTR_REGS or 
GENERAL_REGS=CTR_REGS+GENERAL_REGS.

Puzzled, but learning,

Franz.


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