Register allocation trouble

Georg-Johann Lay avr@gjlay.de
Mon Jul 24 14:42:00 GMT 2017


On 24.07.2017 13:38, Andrew Stubbs wrote:
> Thanks to all those who replied. :-)
> 
> Here's what I've done to fix the problem:
> 
> 1. Set the base rclass to A only.
> 
> 2. Configured secondary reloads to B via A.
> 
> 3. Disabled the Rb constraint. [*]
> 
> That's enough to create correct code, but it's pretty horrible, so I 
> also added new patterns of the form Nathan suggested so that the base 
> register can be allocated directly, as an optimization. These occur 
> before the main mov insn in the search order, and catch only valid MEMs 
> that won't get meddled with, so I believe that the "one mov per mode" 
> rule can be safely ignored. The main mov pattern can still do the 
> loads/stores, via the secondary reloads, so I believe that to be safe too.

Dunno if that works in all situation.  For example, when the register
allocator is facing high register pressure and decides to spill the
target register, it uses the constraints of the matched insn.

Johann

> Thanks again
> 
> Andrew
> 
> [*] I've not removed it because actually it's still active for some 
> address spaces, but that's a detail I glossed over previously.
> 



More information about the Gcc mailing list