Andy H <[EMAIL PROTECTED]> writes:
> I am am tracking down ICE bug in reload during global register allocation.
>
> I have managed to find root of problem but I am not sure how it should 
> work correctly. I would appreciate anyones advise on this.
>
> ICE is from assert  in push_reload  to ensure that pseudos  have been 
> replaced with hard register or constants. (reload.c  line 940 or so)
> It fails because pseudo equivalent of constant is not (yet)  replaced 
> for IN.
>
> The sequence of event that causes this to occur is something like this.
>
> 1) Psuedo p68 is marked as equivalent to constant
> reg_equiv_constant[68]=(symbol_ref:HI ("chk_fail_buf") [flags 0x40] 
> <var_decl 0x7fe00000 chk_fail_buf>)
>
> 2) p68+2 is also needed
> (plus:HI (reg/f:HI 68)
>     (const_int 2 [0x2]))
>
> 3) find_reloads_address  is given p68+2 by find_reloads()
>
> 4)  p68+2 is  STRICTLY checked as memory address - and target rejects it 
> as it has no outer constant and contains psuedo.
>   if (strict_memory_address_p (mode, ad))
>
> 5) find_reloads_address then uses LEGITIMIZE_RELOAD_ADDRESS to fix problem
>
> 6) LEGITIMIZE_RELOAD_ADDRESS calls push_reload  to reload p68 using  
> BASE_POINTER
>
> 7)ICE
> [...]
> Perhaps LEGITIMIZE_RELOAD should fix problem - though that seems odd.

TBH, it sounds like the opposite: LEGITIMIZE_RELOAD_ADDRESS should
not be handling this address at all.  If L_R_A does nothing with it,
the normal reload handling will first try:

  (const:HI (plus:HI (symbol_ref:HI ("chk_fail_buf") (const_int 2))))

If that's legitimate, that's the address you'll get.  If it isn't,
the normal reload handling will reload the symbol_ref into a
base register of class:

  MODE_CODE_BASE_REG_CLASS (mem_mode, PLUS, CONST_INT)

And it sounds from your message like that's exactly what you want.

Richard

Reply via email to