From 062c49fd19fc73fa89a7b276682c74d4dae6d826 Mon Sep 17 00:00:00 2001 From: krebbel Date: Thu, 6 Dec 2007 09:59:06 +0000 Subject: 2007-12-06 Andreas Krebbel * 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/config/s390/s390.c | 17 +++++++++++++++++ gcc/config/s390/s390.md | 11 +++++++++++ 2 files changed, 28 insertions(+) (limited to 'gcc/config/s390') 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")]) -- cgit v1.2.1