This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Cleaning up expand optabs code
- From: Georg-Johann Lay <avr at gjlay dot de>
- To: Georg-Johann Lay <avr at gjlay dot de>, Richard Henderson <rth at redhat dot com>, gcc-patches at gcc dot gnu dot org, richard dot sandiford at linaro dot org
- Date: Fri, 01 Apr 2011 14:54:29 +0200
- Subject: Re: Cleaning up expand optabs code
- References: <g4k4fxzp0h.fsf@linaro.org> <4D825EF5.1010307@redhat.com> <87wrju28hn.fsf@firetop.home> <4D87A69B.90704@redhat.com> <g462rbxke1.fsf@linaro.org> <4D88E10A.8080005@redhat.com> <4D8B32A9.9050309@linux.vnet.ibm.com> <4D8C8D81.5080103@gjlay.de> <4D8CCE3D.7010100@redhat.com> <4D944E2A.9040907@gjlay.de> <g4bp0rmpeu.fsf@linaro.org>
Richard Sandiford schrieb:
> Georg-Johann Lay <avr@gjlay.de> writes:
>> Richard Henderson schrieb:
>>> On 03/25/2011 05:41 AM, Georg-Johann Lay wrote:
>>>>> On 03/22/2011 06:48 PM, Richard Henderson wrote:
>>>>>
>>>>>> Ok. Watch out for other target problems this week.
>>>> libgcc fails to build for avr (SVN 171446)
>>>>
>>>> ../../../../../gcc.gnu.org/trunk/libgcc/../gcc/libgcc2.c: In function
>>>> '__negdi2':
>>>> ../../../../../gcc.gnu.org/trunk/libgcc/../gcc/libgcc2.c:68:17:
>>>> internal compiler error: in maybe_gen_insn, at optabs.c:7123
>>> This is due to a miscommunication between the middle-end and the backend
>>> about how many arguments the setmemhi pattern takes.
>>>
>>> (define_expand "setmemhi"
>>> [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
>>> (match_operand 2 "const_int_operand" ""))
>>> (use (match_operand:HI 1 "const_int_operand" ""))
>>> (use (match_operand:HI 3 "const_int_operand" "n"))
>>> (clobber (match_scratch:HI 4 ""))
>>> (clobber (match_dup 5))])]
>>>
>>> The match_scratch is counted in .n_operands, which makes the count of
>>> operands not equal 4, so we assume 6 operands are necessary. We can
>>> fix this for the special case of avr by only assuming 6 operands when
>>> there are in fact 6 operands, but of course this could fail just as
>>> easily if there were two scratches.
>>>
>>> All of which suggests that optional arguments to a named optab is a
>>> mistake that ought to be rectified.
>>>
>>> I plan to commit the following after bootstrap and check.
>>>
>>>
>> Hi, there is still trouble with "setmemhi" on avr, again for the
>> negdi2 from libgcc:
>>
>> #1 0x0839ccd7 in maybe_legitimize_operand (icode=CODE_FOR_setmemhi,
>> opno=4, op=0xbfffd22c) at ../../../gcc.gnu.org/trunk/gcc/optabs.c:7024
>> (gdb) p *op
>> $11 = {type = EXPAND_OUTPUT, unsigned_p = 0, unused = 0, mode =
>> VOIDmode, value = 0xb7d63360}
>> (gdb) p op->value
>> $12 = (rtx) 0xb7d63360
>> (gdb) pr
>> (use:CC (nil))
>>
>>
>> i.e. there is garbage in op->value
>>
>> (gdb)
>> (gdb) frame 0
>> #0 fancy_abort (file=0x88099f0
>> "../../../gcc.gnu.org/trunk/gcc/optabs.c", line=7024,
>> function=0x880a280 "maybe_legitimize_operand") at
>> ../../../gcc.gnu.org/trunk/gcc/diagnostic.c:893
>> (gdb)
>
> Yeah, as things stand, we need to set nops to 4 if was originally 5.
>
> I'm testing a series of patches to make the number of generator
> arguments available in insn_data. I'll post them once they pass
> (hopefully later today).
>
> Richard
Thanks, I can build avr-gcc again.
Johann