aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Starovoytov <alexey.starovoytov@sun.com>2006-04-14 07:01:38 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2006-04-14 07:01:38 +0000
commit68ba34f361d5287404bde9283b9df315f4a2c147 (patch)
tree43f4e85b1d6157f26fa20af215d3f50757377754
parent39b1ec97f0445bcc6e960de32e7b82011f0161ca (diff)
downloadgcc-68ba34f361d5287404bde9283b9df315f4a2c147.zip
gcc-68ba34f361d5287404bde9283b9df315f4a2c147.tar.gz
gcc-68ba34f361d5287404bde9283b9df315f4a2c147.tar.bz2
sparc.c (emit_and_preserve): Allocate space for the register save area.
* config/sparc/sparc.c (emit_and_preserve): Allocate space for the register save area. Co-Authored-By: Eric Botcazou <ebotcazou@libertysurf.fr> From-SVN: r112950
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/config/sparc/sparc.c20
2 files changed, 20 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index f8fdd81..d063df8 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2006-04-14 Alexey Starovoytov <alexey.starovoytov@sun.com>
+ Eric Botcazou <ebotcazou@libertysurf.fr>
+
+ * config/sparc/sparc.c (emit_and_preserve): Allocate space for the
+ register save area.
+
2005-04-13 Uros Bizjak <uros@kss-loka.si>
PR middle-end/27134
diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
index 578f916..692e46e 100644
--- a/gcc/config/sparc/sparc.c
+++ b/gcc/config/sparc/sparc.c
@@ -8487,16 +8487,24 @@ sparc_rtx_costs (rtx x, int code, int outer_code, int *total)
}
}
-/* Emit the sequence of insns SEQ while preserving the registers. */
+/* Emit the sequence of insns SEQ while preserving the registers REG and REG2.
+ This is achieved by means of a manual dynamic stack space allocation in
+ the current frame. We make the assumption that SEQ doesn't contain any
+ function calls, with the possible exception of calls to the PIC helper. */
static void
emit_and_preserve (rtx seq, rtx reg, rtx reg2)
{
- /* STACK_BOUNDARY guarantees that this is a 2-word slot. */
- rtx slot = gen_rtx_MEM (word_mode,
- plus_constant (stack_pointer_rtx, SPARC_STACK_BIAS));
+ /* We must preserve the lowest 16 words for the register save area. */
+ HOST_WIDE_INT offset = 16*UNITS_PER_WORD;
+ /* We really need only 2 words of fresh stack space. */
+ HOST_WIDE_INT size = SPARC_STACK_ALIGN (offset + 2*UNITS_PER_WORD);
- emit_insn (gen_stack_pointer_dec (GEN_INT (STACK_BOUNDARY/BITS_PER_UNIT)));
+ rtx slot
+ = gen_rtx_MEM (word_mode, plus_constant (stack_pointer_rtx,
+ SPARC_STACK_BIAS + offset));
+
+ emit_insn (gen_stack_pointer_dec (GEN_INT (size)));
emit_insn (gen_rtx_SET (VOIDmode, slot, reg));
if (reg2)
emit_insn (gen_rtx_SET (VOIDmode,
@@ -8508,7 +8516,7 @@ emit_and_preserve (rtx seq, rtx reg, rtx reg2)
reg2,
adjust_address (slot, word_mode, UNITS_PER_WORD)));
emit_insn (gen_rtx_SET (VOIDmode, reg, slot));
- emit_insn (gen_stack_pointer_inc (GEN_INT (STACK_BOUNDARY/BITS_PER_UNIT)));
+ emit_insn (gen_stack_pointer_inc (GEN_INT (size)));
}
/* Output the assembler code for a thunk function. THUNK_DECL is the