Hi, Richard,

To answer the question, which registers should be included in “ALL”. 
I studied X86 hard register set in more details. And also consulted with 
H.J.Lu, And found:

In the current x86 implementation, mask registers, MM0-MM7 registers, and 
ST0-ST7 registers are not zeroed.

The reasons actually are:
1. Mask registers are marked as “FIXED_REGS” by middle end,  (in the following 
place, reginfo.c, init_reg_sets_1)

      /* If a register is too limited to be treated as a register operand,
         then it should never be allocated to a pseudo.  */
      if (!TEST_HARD_REG_BIT (operand_reg_set, i))
        fixed_regs[i] = 1;

2. MM0-MM7 registers and ST0-ST7 registers are aliased with each other, (i.e, 
the same set of registers have two different
Names), so, zero individual mm or st register will be very impractical. 
However, we can zero them together with emms. 

So, my conclusion is, 

1. For “ALL”, we should include all call_used_regs that are not fixed_regs. 
2. For X86 implementation, I added more comments, and also add clearing all mm 
and st registers with emms.

In general, “ALL” should include all call_used_regs that are not fixed_regs. 

thanks.

Qing

> 
> If we have common, written-down ground rules for deciding which kinds
> of register should be included and which shouldn't, it will be easier
> to apply those rules to a given target.  And it will be easier to decide
> on the right behaviour for the default implementation of the hook.
> 
> It feels like the pushback against defining a default implementation
> of the hook is also a pushback against being specific about how targets
> are supposed to select which kinds of register need to be zeroed.
> 
> Thanks,
> Richard

Reply via email to