RFA: Have ira-conflicts.c use base_reg_class()

Vladimir Makarov vmakarov@redhat.com
Wed Jan 14 00:22:00 GMT 2009


Nick Clifton wrote:
> Hi Bernd,
>
>>>   The bfin port is not currently building in the gcc mainline because
>>>   ira-conflicts.c needs a definition of BASE_REGS_CLASS.  The patch
>>>   below adds one, although I am not 100% sure that I have used the
>>>   right value.
>>
>> IMO ira-conflicts.c needs to be fixed to accept MODE_CODE_BASE_REG_CLASS
>> like everything else.
>>
>> Thanks for trying to fix this, but this patch is clearly wrong.
>
> Fair enough - in which case please could you review the attached 
> patch.  It changes ira-conflicts.c to use the base_reg_class() inline 
> function defined in addresses.h which will use 
> MODE_CODE_BASE_REG_CLASS if it is defined.  I had to guess at the 
> parameters to pass to base_reg_class() but I think their exact values 
> will not matter too much.
>
> Tested by rebuilding a lot of toolchains[1], including bfin-elf and by 
> preforming a regression test of the gcc testsuite for an 
> i686-pc-linux-gnu toolchain.  (There were no regressions).
>
> OK to apply ?
>
I am looking at the original code and see two BASE_REG_CLASS occurrences

  if (! CLASS_LIKELY_SPILLED_P (BASE_REG_CLASS))
    CLEAR_HARD_REG_SET (temp_hard_reg_set);
  else
    {
      COPY_HARD_REG_SET (temp_hard_reg_set,
             reg_class_contents[BASE_REG_CLASS]);
      AND_COMPL_HARD_REG_SET (temp_hard_reg_set, ira_no_alloc_regs);
      AND_HARD_REG_SET (temp_hard_reg_set, call_used_reg_set);
    }

Your patch contains only one change.  You should change the second 
occurrence too (in reg_class_contents).  Your patch also uses

base_reg_class (VOIDmode, REG, REG)

I'd use

base_reg_class (VOIDmode, ADDRESS, SCRATCH)

because the code, as I remember, is necessary to guarantee that reload finds a register for address to do spill.

With these two changes the patch is ok.


Thanks for the patch and checking the ports, Nick.





More information about the Gcc-patches mailing list