OSDN Git Service

2007-12-06 Andreas Krebbel <krebbel1@de.ibm.com>
authorkrebbel <krebbel@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 6 Dec 2007 09:59:06 +0000 (09:59 +0000)
committerkrebbel <krebbel@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 6 Dec 2007 09:59:06 +0000 (09:59 +0000)
* config/s390/s390.c (s390_emit_stack_tie): New function.
(s390_emit_prologue): Emit a stack tie when writing to the
f8-f15 stack slots.
* config/s390/s390.md ("stack_tie"): New insn definition.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@130646 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/s390/s390.c
gcc/config/s390/s390.md

index 4607b80..92d0b3b 100644 (file)
@@ -1,3 +1,10 @@
+2007-12-06  Andreas Krebbel  <krebbel1@de.ibm.com>
+
+       * config/s390/s390.c (s390_emit_stack_tie): New function.
+       (s390_emit_prologue): Emit a stack tie when writing to the
+       f8-f15 stack slots.
+       * config/s390/s390.md ("stack_tie"): New insn definition.
+
 2007-12-06  Ben Elliston  <bje@au.ibm.com>
 
        * SERVICE: Remove.
index 35e2fa6..c1c4668 100644 (file)
@@ -7162,6 +7162,18 @@ s390_load_got (void)
   return insns;
 }
 
+/* This ties together stack memory (MEM with an alias set of frame_alias_set)
+   and the change to the stack pointer.  */
+
+static void
+s390_emit_stack_tie (void)
+{
+  rtx mem = gen_frame_mem (BLKmode,
+                          gen_rtx_REG (Pmode, STACK_POINTER_REGNUM));
+
+  emit_insn (gen_stack_tie (mem));
+}
+
 /* Expand the prologue into a bunch of separate insns.  */
 
 void
@@ -7390,6 +7402,11 @@ s390_emit_prologue (void)
 
   if (cfun_save_high_fprs_p && next_fpr)
     {
+      /* If the stack might be accessed through a different register
+        we have to make sure that the stack pointer decrement is not
+        moved below the use of the stack slots.  */
+      s390_emit_stack_tie ();
+
       insn = emit_insn (gen_add2_insn (temp_reg, 
                                       GEN_INT (cfun_frame_layout.f8_offset)));
 
index fbabfdd..670ae13 100644 (file)
@@ -61,6 +61,7 @@
    (UNSPEC_CCU_TO_INT          2)
    (UNSPEC_CCZ_TO_INT          3)
    (UNSPEC_ICM                 10)
+   (UNSPEC_TIE                  11)
 
    ; GOT/PLT and lt-relative accesses
    (UNSPEC_LTREL_OFFSET                100)
   ""
   "clc\t%O0(%G0,%R0),%S1"
   [(set_attr "op_type" "SS")])
+
+; This is used in s390_emit_prologue in order to prevent insns
+; adjusting the stack pointer to be moved over insns writing stack
+; slots using a copy of the stack pointer in a different register.
+(define_insn "stack_tie"
+  [(set (match_operand:BLK 0 "memory_operand" "+m")
+        (unspec:BLK [(match_dup 0)] UNSPEC_TIE))]
+  ""
+  ""
+  [(set_attr "length" "0")])