summaryrefslogtreecommitdiff
path: root/gcc/config/s390
diff options
context:
space:
mode:
authorkrebbel <krebbel@138bc75d-0d04-0410-961f-82ee72b054a4>2007-12-06 09:59:06 +0000
committerkrebbel <krebbel@138bc75d-0d04-0410-961f-82ee72b054a4>2007-12-06 09:59:06 +0000
commit062c49fd19fc73fa89a7b276682c74d4dae6d826 (patch)
tree7155ceccabc37e24f862e71bd78b3d184028ef8b /gcc/config/s390
parentce600e15270e7aea58a1724e3413b7d1cd3c1941 (diff)
downloadgcc-062c49fd19fc73fa89a7b276682c74d4dae6d826.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@130646 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/s390')
-rw-r--r--gcc/config/s390/s390.c17
-rw-r--r--gcc/config/s390/s390.md11
2 files changed, 28 insertions, 0 deletions
diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index 35e2fa67601..c1c46683081 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -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)));
diff --git a/gcc/config/s390/s390.md b/gcc/config/s390/s390.md
index fbabfdd2def..670ae13b36b 100644
--- a/gcc/config/s390/s390.md
+++ b/gcc/config/s390/s390.md
@@ -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)
@@ -7971,3 +7972,13 @@
""
"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")])