This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Register allocation trouble


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.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]