[PATCH] Do not allow non-allocatable registers in scratch_operand

Segher Boessenkool segher@kernel.crashing.org
Fri Sep 19 12:21:00 GMT 2014

On Thu, Sep 18, 2014 at 11:54:46PM -0600, Jeff Law wrote:
> Shouldn't you be testing if the register is fixed rather than its class? 
>  Or maybe both?

register_operand (via general_operand) uses operand_reg_set for this; it is
initialised via the regclass NO_REGS too (and other things).

This would work for us (rs6000) too, or indeed fixed_regs[], or even wider
classes.  I have no idea if it would hurt other targets though, and I have
no desire to test all weirdo targets ;-)

If another regclass reg is assigned to a match_scratch (and then via a
splitter to a match_operand register), reload can fix it up.  It cannot
fix up things properly for regs of NO_REGS class.  This is what this patch
is for: a class NO_REGS reg cannot ever work as a match_scratch.

I could test for a wider class if you want, but I'll need some guidance
what to test for exactly then; existing code isn't exactly consistent.


More information about the Gcc-patches mailing list