[PATCH, middle-end]: members of global_regs[] are also members of fixed_regs[]

Uros Bizjak ubizjak@gmail.com
Sat Dec 8 08:54:00 GMT 2007


Hello!

It was brought to my attention that members of global_regs[] array are 
always* members of fixed_regs[] array, so there is no need to check both 
arrays with "fixed_regs[N] || global_regs[N]".

Attached patch is the result of code grep for the above logic and fixes 
a couple of places through the code.
The patch also includes a fix for thinko w.r.t. i386 string instructions 
and global regs. We should check fixed_regs[] here too, so we could 
handle stringop expansion for i.e. -ffixed-edi compile flags in addition 
to global regs definitions. Oh, and fixes off-by-one error when 
adjusting regparm value due to hard regs usage.

The patch was bootstrapped and regresion tested on x86_64 {,-m32}.  The 
patch needs approval of its (trivial) middle-end part.

2007-12-08  Uros Bizjak  <ubizjak@gmail.com>

        * cse.c (FIXED_REGNO_P): Do not check global_regs array, registers
        that are members of global_regs are also members of fixed_regs 
array.
        * regrename.c (regrename_optimize): Ditto.
        * config/i386/i386.c (ix86_function_regparm): Ditto.  Use 
REGPARM_MAX
        to check that no regparm hard register is taken by a fixed register
        variable.  Check up to and including DI_REG when adjusting regparm
        value due to fixed regs usage.
        (rep_prefix_usable): Check fixed_regs array, not global_regs 
array for
        available hard registers.
        (ix86_expand_strlen): Ditto.
        * config/i386/i386.md (strmov): Ditto.
        (cmpstrnsi): Ditto.

*) regclass.c, line 631 and 923.

Uros.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: global_reg.diff.txt
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20071208/3b169794/attachment.txt>


More information about the Gcc-patches mailing list