public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH PR/34013]: Save red-zone while stack probing for x86_64
@ 2007-12-13  9:33 Kai Tietz
  2007-12-14  9:00 ` Kai Tietz
  0 siblings, 1 reply; 2+ messages in thread
From: Kai Tietz @ 2007-12-13  9:33 UTC (permalink / raw)
  To: GCC Patches

Hi,

I tested this and confirm the problem. I did a regression test of this 
patch for x86_64-linux and x86_64-mingw32 and it was successful.

ChangeLog

2007-12-13  Arthur Norman <acn1@cam.ac.uk>

        * gcc/config/i386/i386.c: (ix86_expand_prologue): Save red-zone 
while stack probing.


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

--- i386.c.orig          2007-10-27 23:32:02.331569000 +0100
+++ i386.c               2007-11-09 22:27:25.695830000 +0000
@@ -6283,8 +6283,12 @@
     allocate += frame.nregs * UNITS_PER_WORD;
 
   /* When using red zone we may start register saving before allocating
-     the stack frame saving one cycle of the prologue.  */
-  if (TARGET_RED_ZONE && frame.save_regs_using_mov)
+     the stack frame saving one cycle of the prologue. However I will
+     avoid doing this if I am going to have to probe the stack since
+     at least on x86_64 the stack probe can turn into a call that 
clobbers
+     a red zone location */
+  if (TARGET_RED_ZONE && frame.save_regs_using_mov &&
+      (! TARGET_STACK_PROBE || allocate < CHECK_STACK_LIMIT))
     ix86_emit_save_regs_using_mov (frame_pointer_needed ? 
hard_frame_pointer_rtx
                                                                    : 
stack_pointer_rtx,
 -frame.nregs * UNITS_PER_WORD);
@@ -6340,7 +6344,8 @@
                 }
     }
 
-  if (frame.save_regs_using_mov && !TARGET_RED_ZONE)
+  if (frame.save_regs_using_mov && (!TARGET_RED_ZONE ||
+         !(! TARGET_STACK_PROBE || allocate < CHECK_STACK_LIMIT)))
     {
       if (!frame_pointer_needed || !frame.to_allocate)
         ix86_emit_save_regs_using_mov (stack_pointer_rtx, 
frame.to_allocate);

Cheers,
 i.A. Kai Tietz

|  (\_/)  This is Bunny. Copy and paste Bunny
| (='.'=) into your signature to help him gain
| (")_(") world domination.

------------------------------------------------------------------------------------------
  OneVision Software Entwicklungs GmbH & Co. KG
  Dr.-Leo-Ritter-Straße 9 - 93049 Regensburg
  Tel: +49.(0)941.78004.0 - Fax: +49.(0)941.78004.489 - www.OneVision.com
  Commerzbank Regensburg - BLZ 750 400 62 - Konto 6011050
  Handelsregister: HRA 6744, Amtsgericht Regensburg
  Komplementärin: OneVision Software Entwicklungs Verwaltungs GmbH
  Dr.-Leo-Ritter-Straße 9 – 93049 Regensburg
  Handelsregister: HRB 8932, Amtsgericht Regensburg - Geschäftsführer: 
Ulrike Döhler, Manuela Kluger

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH PR/34013]: Save red-zone while stack probing for x86_64
  2007-12-13  9:33 [PATCH PR/34013]: Save red-zone while stack probing for x86_64 Kai Tietz
@ 2007-12-14  9:00 ` Kai Tietz
  0 siblings, 0 replies; 2+ messages in thread
From: Kai Tietz @ 2007-12-14  9:00 UTC (permalink / raw)
  To: GCC Patches

Hi,

> I tested this and confirm the problem. I did a regression test of this 
> patch for x86_64-linux and x86_64-mingw32 and it was successful.

Is this OK for apply ?

> ChangeLog
> 
> 2007-12-13  Arthur Norman <acn1@cam.ac.uk>
> 
>         * gcc/config/i386/i386.c: (ix86_expand_prologue): Save red-zone 
> while stack probing.
> 
> 
> See bugzilla: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34013
> 
> --- i386.c.orig          2007-10-27 23:32:02.331569000 +0100
> +++ i386.c               2007-11-09 22:27:25.695830000 +0000
> @@ -6283,8 +6283,12 @@
>      allocate += frame.nregs * UNITS_PER_WORD;
> 
>    /* When using red zone we may start register saving before allocating
> -     the stack frame saving one cycle of the prologue.  */
> -  if (TARGET_RED_ZONE && frame.save_regs_using_mov)
> +     the stack frame saving one cycle of the prologue. However I will
> +     avoid doing this if I am going to have to probe the stack since
> +     at least on x86_64 the stack probe can turn into a call that 
> clobbers
> +     a red zone location */
> +  if (TARGET_RED_ZONE && frame.save_regs_using_mov &&
> +      (! TARGET_STACK_PROBE || allocate < CHECK_STACK_LIMIT))
>      ix86_emit_save_regs_using_mov (frame_pointer_needed ? 
> hard_frame_pointer_rtx
>                                                                     : 
> stack_pointer_rtx,
>  -frame.nregs * UNITS_PER_WORD);
> @@ -6340,7 +6344,8 @@
>                  }
>      }
> 
> -  if (frame.save_regs_using_mov && !TARGET_RED_ZONE)
> +  if (frame.save_regs_using_mov && (!TARGET_RED_ZONE ||
> +         !(! TARGET_STACK_PROBE || allocate < CHECK_STACK_LIMIT)))
>      {
>        if (!frame_pointer_needed || !frame.to_allocate)
>          ix86_emit_save_regs_using_mov (stack_pointer_rtx, 
> frame.to_allocate);

Cheers,
 i.A. Kai Tietz

|  (\_/)  This is Bunny. Copy and paste Bunny
| (='.'=) into your signature to help him gain
| (")_(") world domination.

------------------------------------------------------------------------------------------
  OneVision Software Entwicklungs GmbH & Co. KG
  Dr.-Leo-Ritter-Straße 9 - 93049 Regensburg
  Tel: +49.(0)941.78004.0 - Fax: +49.(0)941.78004.489 - www.OneVision.com
  Commerzbank Regensburg - BLZ 750 400 62 - Konto 6011050
  Handelsregister: HRA 6744, Amtsgericht Regensburg
  Komplementärin: OneVision Software Entwicklungs Verwaltungs GmbH
  Dr.-Leo-Ritter-Straße 9 – 93049 Regensburg
  Handelsregister: HRB 8932, Amtsgericht Regensburg - Geschäftsführer: 
Ulrike Döhler, Manuela Kluger


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-12-14  8:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-12-13  9:33 [PATCH PR/34013]: Save red-zone while stack probing for x86_64 Kai Tietz
2007-12-14  9:00 ` Kai Tietz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).