public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* IRA is not looking into the predicates ?
@ 2009-10-30 13:20 Mohamed Shafi
  2009-10-30 18:18 ` Ian Lance Taylor
  2009-10-30 18:31 ` Jeff Law
  0 siblings, 2 replies; 6+ messages in thread
From: Mohamed Shafi @ 2009-10-30 13:20 UTC (permalink / raw)
  To: GCC

Hi,

I am doing a port for a 32bit target in GCC 4.4.0. The target does not
have support for symbolic address in QImode for load operations. In
order to do this what i have done is in define_expand for moveqi
reject symbolic address it they come in source operands and i have
also written a predicate for *moveqi_internal to reject such cases.
But i get the following ICE:

 insn does not satisfy its constraints:
(insn 24 5 6 2 ice4.c:4 (set (reg:QI 17 r1)
        (mem/c/i:QI (symbol_ref:SI ("s") [flags 0x2] <var_decl
0xb7bfd000 s>) [0 s+0 S1 A32])) 0 {*movqi_internal} (nil))


From ice4.c.172r.ira

(insn 24 5 6 2 ice4.c:4 (set (reg:QI 17 r1)
        (mem/c/i:QI (symbol_ref:SI ("s") [flags 0x2] <var_decl
0xb7bfd000 s>) [0 s+0 S1 A32])) 0 {*movqi_internal} (nil))

(insn 6 24 7 2 ice4.c:4 (set (reg:QI 16 r0 [62])
        (plus:QI (reg:QI 17 r1)
            (const_int -100 [0xffffff9c]))) 16 {addqi3} (nil))

From ice4.c.168r.asmcons

(insn 5 2 6 2 ice4.c:4 (set (reg:SI 61 [ s ])
        (mem/c/i:SI (symbol_ref:SI ("s") [flags 0x2] <var_decl
0xb7bfd000 s>) [0 s+0 S4 A32])) 2 {*movsi_internal} (nil))

(insn 6 5 7 2 ice4.c:4 (set (reg:QI 62)
        (plus:QI (subreg:QI (reg:SI 61 [ s ]) 0)
            (const_int -100 [0xffffff9c]))) 16 {addqi3}
(expr_list:REG_DEAD (reg:SI 61 [ s ])
        (nil)))

How can i prevent this ICE ?

Regards,
Shafi

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: IRA is not looking into the predicates ?
  2009-10-30 13:20 IRA is not looking into the predicates ? Mohamed Shafi
@ 2009-10-30 18:18 ` Ian Lance Taylor
  2009-11-04 13:43   ` Mohamed Shafi
  2009-10-30 18:31 ` Jeff Law
  1 sibling, 1 reply; 6+ messages in thread
From: Ian Lance Taylor @ 2009-10-30 18:18 UTC (permalink / raw)
  To: Mohamed Shafi; +Cc: GCC

Mohamed Shafi <shafitvm@gmail.com> writes:

>From ice4.c.168r.asmcons
>
> (insn 5 2 6 2 ice4.c:4 (set (reg:SI 61 [ s ])
>         (mem/c/i:SI (symbol_ref:SI ("s") [flags 0x2] <var_decl
> 0xb7bfd000 s>) [0 s+0 S4 A32])) 2 {*movsi_internal} (nil))
>
> (insn 6 5 7 2 ice4.c:4 (set (reg:QI 62)
>         (plus:QI (subreg:QI (reg:SI 61 [ s ]) 0)
>             (const_int -100 [0xffffff9c]))) 16 {addqi3}
> (expr_list:REG_DEAD (reg:SI 61 [ s ])
>         (nil)))
>
> How can i prevent this ICE ?

If asmcons is the first place that this appears, then I think it must
be coming from some asm statement.  So the first step would be to look
at the asm statement and see if it can be rewritten using a different
constraint.

Ian

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: IRA is not looking into the predicates ?
  2009-10-30 13:20 IRA is not looking into the predicates ? Mohamed Shafi
  2009-10-30 18:18 ` Ian Lance Taylor
@ 2009-10-30 18:31 ` Jeff Law
  2009-11-04 13:42   ` Mohamed Shafi
  1 sibling, 1 reply; 6+ messages in thread
From: Jeff Law @ 2009-10-30 18:31 UTC (permalink / raw)
  To: Mohamed Shafi; +Cc: GCC

On 10/30/09 07:13, Mohamed Shafi wrote:
> Hi,
>
> I am doing a port for a 32bit target in GCC 4.4.0. The target does not
> have support for symbolic address in QImode for load operations.
You'll need to make sure to reject such addresses for QImode in 
GO_IF_LEGITIMATE_ADDRESS.


>   In
> order to do this what i have done is in define_expand for moveqi
> reject symbolic address it they come in source operands and i have
> also written a predicate for *moveqi_internal to reject such cases.
>    
OK.  Nothing wrong with these steps.  Though you really need to make 
sure GO_IF_LEGITIMATE_ADDRESS is defined correctly.

IRA doesn't look at operand predicates or insn conditions.  It assumes 
that any insns are valid assuming any pseudo registers appearing in the 
insn get suitable hard registers.

Based on the dumps you provided it appears that reg61 does not get a 
hard register and reload is generating the problematical insn #24.  This 
is a good indication that your GO_IF_LEGITIMATE_ADDRESS is incorrectly 
implemented.


jeff

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: IRA is not looking into the predicates ?
  2009-10-30 18:31 ` Jeff Law
@ 2009-11-04 13:42   ` Mohamed Shafi
  2009-11-04 14:41     ` Jeff Law
  0 siblings, 1 reply; 6+ messages in thread
From: Mohamed Shafi @ 2009-11-04 13:42 UTC (permalink / raw)
  To: Jeff Law; +Cc: GCC

2009/10/30 Jeff Law <law@redhat.com>:
> On 10/30/09 07:13, Mohamed Shafi wrote:
>>
>> Hi,
>>
>> I am doing a port for a 32bit target in GCC 4.4.0. The target does not
>> have support for symbolic address in QImode for load operations.
>
> You'll need to make sure to reject such addresses for QImode in
> GO_IF_LEGITIMATE_ADDRESS.
>
>
>>  In
>> order to do this what i have done is in define_expand for moveqi
>> reject symbolic address it they come in source operands and i have
>> also written a predicate for *moveqi_internal to reject such cases.
>>
>
> OK.  Nothing wrong with these steps.  Though you really need to make sure
> GO_IF_LEGITIMATE_ADDRESS is defined correctly.
>
> IRA doesn't look at operand predicates or insn conditions.  It assumes that
> any insns are valid assuming any pseudo registers appearing in the insn get
> suitable hard registers.
>
> Based on the dumps you provided it appears that reg61 does not get a hard
> register and reload is generating the problematical insn #24.  This is a
> good indication that your GO_IF_LEGITIMATE_ADDRESS is incorrectly
> implemented.
>
   I the GO_IF_LEGITIMATE_ADDRESS address macro i am allowing this
address because the target supports symbolic address in QImode for
store operations. And in the macro GO_IF_LEGITIMATE_ADDRESS there is
no option to check if the address is used in load or store. Thats why
in define_expand for moveqi i reject symbolic address it they come in
source operands and a predicate for *moveqi_internal to reject such
cases. But still i am getting the ICE.  IIRC the control does not come
to TARGET_SECONDARY_RELOAD also. How can i overcome this?

Regards,
Shafi

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: IRA is not looking into the predicates ?
  2009-10-30 18:18 ` Ian Lance Taylor
@ 2009-11-04 13:43   ` Mohamed Shafi
  0 siblings, 0 replies; 6+ messages in thread
From: Mohamed Shafi @ 2009-11-04 13:43 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: GCC

2009/10/30 Ian Lance Taylor <iant@google.com>:
> Mohamed Shafi <shafitvm@gmail.com> writes:
>
>>From ice4.c.168r.asmcons
>>
>> (insn 5 2 6 2 ice4.c:4 (set (reg:SI 61 [ s ])
>>         (mem/c/i:SI (symbol_ref:SI ("s") [flags 0x2] <var_decl
>> 0xb7bfd000 s>) [0 s+0 S4 A32])) 2 {*movsi_internal} (nil))
>>
>> (insn 6 5 7 2 ice4.c:4 (set (reg:QI 62)
>>         (plus:QI (subreg:QI (reg:SI 61 [ s ]) 0)
>>             (const_int -100 [0xffffff9c]))) 16 {addqi3}
>> (expr_list:REG_DEAD (reg:SI 61 [ s ])
>>         (nil)))
>>
>> How can i prevent this ICE ?
>
> If asmcons is the first place that this appears, then I think it must
> be coming from some asm statement.  So the first step would be to look
> at the asm statement and see if it can be rewritten using a different
> constraint.
>
   No this appears from the rtl expand onwards.

Shafi

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: IRA is not looking into the predicates ?
  2009-11-04 13:42   ` Mohamed Shafi
@ 2009-11-04 14:41     ` Jeff Law
  0 siblings, 0 replies; 6+ messages in thread
From: Jeff Law @ 2009-11-04 14:41 UTC (permalink / raw)
  To: Mohamed Shafi; +Cc: GCC


>     I the GO_IF_LEGITIMATE_ADDRESS address macro i am allowing this
> address because the target supports symbolic address in QImode for
> store operations.
If your target can not use a symbolic address in a QImode load, then 
GO_IF_LEGITIMATE_ADDRESS must reject symbolic addresses in QImode.  It's 
that simple.

jeff


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-11-04 14:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-30 13:20 IRA is not looking into the predicates ? Mohamed Shafi
2009-10-30 18:18 ` Ian Lance Taylor
2009-11-04 13:43   ` Mohamed Shafi
2009-10-30 18:31 ` Jeff Law
2009-11-04 13:42   ` Mohamed Shafi
2009-11-04 14:41     ` Jeff Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).