I observed that HARD_REGNO_CALL_PART_CLOBBERED gets called with
hard registers that HARD_REGNO_MODE_OK would reject.

Is it save to set HARD_REGNO_CALL_PART_CLOBBERED to FALSE for
hard registers for which HARD_REGNO_MODE_OK is FALSE?

Background is PR53593 where I see a code size increase of +10%
for avr.

HARD_REGNO_CALL_PART_CLOBBERED gets called with REGNO=29, MODE=HI
This register is not a valid hard register because HI regs must
start with even register numbers.

If it /was/ valid, then HARD_REGNO_CALL_PART_CLOBBERED should
return TRUE for HI:29. That is what the hook macro currently does.

However, if the hook macro is defined like so,
then the performance regression goes away:

#define HARD_REGNO_CALL_PART_CLOBBERED(REGNO, MODE) \
  (HARD_REGNO_MODE_OK (REGNO, MODE)
   && (more conditions))


Questions:

1:
Is it save to define the macro like that?
I.e. return FALSE for a register that is invalid
but would be call-part-clobbered if it was valid?

2:
What's the point of calling the macro with invalid hard register?
I can understand this to keep the call sites simple, but I don't
understand why changing the properties for an invalid hard register
affects code generation that much.

Thanks, Johann

Reply via email to