This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug rtl-optimization/34312] [4.3 regression] spill failure with -O2 -fPIC -march=pentium-m on i386



------- Comment #9 from ubizjak at gmail dot com  2007-12-05 13:54 -------
(In reply to comment #8)
> > Instead, -fPIC should unconditionally decrease the available regparm by 1.
> Yes, this seems to be the best solution in the short term.

I'm testing following patch:

Index: i386.c
===================================================================
--- i386.c      (revision 130622)
+++ i386.c      (working copy)
@@ -3200,7 +3200,7 @@ ix86_function_regparm (const_tree type, 
          /* Make sure no regparm register is taken by a
             global register variable.  */
          for (local_regparm = 0; local_regparm < 3; local_regparm++)
-           if (global_regs[local_regparm])
+           if (global_regs[local_regparm] || fixed_regs[local_regparm])
              break;

          /* We can't use regparm(3) for nested functions as these use
@@ -3226,7 +3226,7 @@ ix86_function_regparm (const_tree type, 
             so the more global reg vars there are, the smaller regparm
             optimization use, unless requested by the user explicitly.  */
          for (regno = 0; regno < 6; regno++)
-           if (global_regs[regno])
+           if (global_regs[regno] || fixed_regs[regno])
              globals++;
          local_regparm
            = globals < local_regparm ? local_regparm - globals : 0;

The rationale is that fixed reg, as well as global reg should decrease the
number of registers available for argument passing. When %ebx is used as -fpic
reg for 32bit targets, this does exactly what Comment #6 suggests.

This patch of course doesn't lower the importance of the fix for PR 19398. ;)


-- 

ubizjak at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |ubizjak at gmail dot com
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2007-12-03 11:28:04         |2007-12-05 13:54:47
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34312


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]