[RFC] Problem with EH regs in global register allocation

Michael Matz matz@suse.de
Fri Dec 14 09:41:00 GMT 2007


Hi,

On Thu, 13 Dec 2007, Andreas Krebbel wrote:

> /* If we haven't succeeded yet,
>      see if some hard reg that conflicts with us
>      was utilized poorly by local-alloc.
>      If so, kick out the regs that were put there by local-alloc
>      so we can use it instead.  */
>   if (best_reg < 0 && !retrying
>       /* Let's not bother with multi-reg allocnos.  */
>       && allocno[num].size == 1
>       && REG_BASIC_BLOCK (allocno[num].reg) == REG_BLOCK_GLOBAL)
>     {
> 	...
> 
> finds out that r9 would be the best choice for r46 and reassigns r9 to 
> r46

Blaeh.  There's a similar problem with stack regs on x86.  At that time we 
solved it by adding a new field to struct allocno.  I would do that here 
too.  Make it a bitfield, and add a new bit for no_eh_regs to not enlarge 
the structure too much.

You can then use this in find_reg to either initialize used1 before it's 
copied to used2 (the hardreg set of unusable registers), or explicitely 
test it only in reuse-local-regs loop.


Ciao,
Michael.



More information about the Gcc-patches mailing list