This is the mail archive of the gcc-patches@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]

Re: [3.1 PATCH] Serious regression on s390



Richard Henderson wrote:

>This is incorrect.  A global register _must_ be a fixed
>in order to be useful.  Otherwise the register allocator
>can clobber it on its own.

Ah, you're right; I hadn't noticed that global regs are also
added to the fixed_regs array.  Thanks for pointing this out.

Nevertheless, if you are using one of the 'really' fixed
registers  --those used by the ABI (stack pointer, literal pool
base register, GOT pointer if PIC)--  as global register variable,
the epilog still needs to restore them as the caller *relies*
on them being restored ...

[ B.t.w. is it allowed in the first place to use one of those
as global register?  I'm not sure whether this is clear from
the documentation ...  If it is, what is supposed to be the
effect if you modify one such variable? ]

What do you think of the following variant?

ChangeLog:

      * config/s390/s390.c (s390_emit_epilogue): Always restore registers
      needed by the compiler, even if they are used as global regs.


Index: gcc/config/s390/s390.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/s390/s390.c,v
retrieving revision 1.27.2.6
diff -c -p -r1.27.2.6 s390.c
*** gcc/config/s390/s390.c    17 Apr 2002 15:59:45 -0000    1.27.2.6
--- gcc/config/s390/s390.c    25 Apr 2002 17:39:38 -0000
*************** s390_emit_epilogue ()
*** 3255,3260 ****
--- 3255,3268 ----
         i <= frame.last_save_gpr;
         i++)
      {
+       /* These registers are special and need to be
+          restored in any case.  */
+       if (i == STACK_POINTER_REGNUM
+               || i == RETURN_REGNUM
+               || i == BASE_REGISTER
+               || (flag_pic && i == PIC_OFFSET_TABLE_REGNUM))
+         continue;
+
        if (global_regs[i])
          {
            addr = plus_constant (frame_pointer,


Mit freundlichen Gruessen / Best Regards

Ulrich Weigand

--
  Dr. Ulrich Weigand
  Linux for S/390 Design & Development
  IBM Deutschland Entwicklung GmbH, Schoenaicher Str. 220, 71032 Boeblingen
  Phone: +49-7031/16-3727   ---   Email: Ulrich.Weigand@de.ibm.com


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