aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/sparc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@gcc.gnu.org>2015-12-07 23:18:29 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2015-12-07 23:18:29 +0000
commit9250444b59bb08bd5939c4af410eb153153baef9 (patch)
tree5d9f8cdcf5e2b3092a1f3216fffbffdc3ab45619 /gcc/config/sparc
parent7c010e27a9e9d975ff265264ae515f7dc9feebd6 (diff)
downloadgcc-9250444b59bb08bd5939c4af410eb153153baef9.zip
gcc-9250444b59bb08bd5939c4af410eb153153baef9.tar.gz
gcc-9250444b59bb08bd5939c4af410eb153153baef9.tar.bz2
re PR target/63668 (-mstd-struct-return fails for non-leaf functions)
PR target/63668 * doc/invoke.texi (SPARC options): Document -mstd-struct-return. * config/sparc/sparc.c (sparc_struct_value_rtx): Minor tweaks. * config/sparc/sparc.h (CALL_REALLY_USED_REGISTERS): Define. * config/sparc/sparc.opt (mstd-struct-return): Accept negative form. From-SVN: r231387
Diffstat (limited to 'gcc/config/sparc')
-rw-r--r--gcc/config/sparc/sparc.c15
-rw-r--r--gcc/config/sparc/sparc.h25
-rw-r--r--gcc/config/sparc/sparc.opt2
3 files changed, 33 insertions, 9 deletions
diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
index ae96a9b..55ddacf 100644
--- a/gcc/config/sparc/sparc.c
+++ b/gcc/config/sparc/sparc.c
@@ -7199,17 +7199,16 @@ sparc_struct_value_rtx (tree fndecl, int incoming)
&& TYPE_SIZE_UNIT (TREE_TYPE (fndecl))
&& TREE_CODE (TYPE_SIZE_UNIT (TREE_TYPE (fndecl))) == INTEGER_CST)
{
- /* We must check and adjust the return address, as it is
- optional as to whether the return object is really
- provided. */
- rtx ret_reg = gen_rtx_REG (Pmode, 31);
+ /* We must check and adjust the return address, as it is optional
+ as to whether the return object is really provided. */
+ rtx ret_reg = gen_rtx_REG (Pmode, RETURN_ADDR_REGNUM);
rtx scratch = gen_reg_rtx (SImode);
rtx_code_label *endlab = gen_label_rtx ();
- /* Calculate the return object size */
+ /* Calculate the return object size. */
tree size = TYPE_SIZE_UNIT (TREE_TYPE (fndecl));
rtx size_rtx = GEN_INT (TREE_INT_CST_LOW (size) & 0xfff);
- /* Construct a temporary return value */
+ /* Construct a temporary return value. */
rtx temp_val
= assign_stack_local (Pmode, TREE_INT_CST_LOW (size), 0);
@@ -7221,13 +7220,13 @@ sparc_struct_value_rtx (tree fndecl, int incoming)
emit_move_insn (scratch, gen_rtx_MEM (SImode,
plus_constant (Pmode,
ret_reg, 8)));
- /* Assume the size is valid and pre-adjust */
+ /* Assume the size is valid and pre-adjust. */
emit_insn (gen_add3_insn (ret_reg, ret_reg, GEN_INT (4)));
emit_cmp_and_jump_insns (scratch, size_rtx, EQ, const0_rtx, SImode,
0, endlab);
emit_insn (gen_sub3_insn (ret_reg, ret_reg, GEN_INT (4)));
/* Write the address of the memory pointed to by temp_val into
- the memory pointed to by mem */
+ the memory pointed to by mem. */
emit_move_insn (mem, XEXP (temp_val, 0));
emit_label (endlab);
}
diff --git a/gcc/config/sparc/sparc.h b/gcc/config/sparc/sparc.h
index d2782a4..d599418 100644
--- a/gcc/config/sparc/sparc.h
+++ b/gcc/config/sparc/sparc.h
@@ -696,6 +696,31 @@ extern enum cmodel sparc_cmodel;
\
1, 1, 1, 1, 1, 1, 1}
+/* 1 for registers not available across function calls.
+ Unlike the above, this need not include the FIXED_REGISTERS, but any
+ registers that can be used without being saved.
+ The latter must include the registers where values are returned
+ and the register where structure-value addresses are passed.
+ Aside from that, you can include as many other registers as you like. */
+
+#define CALL_REALLY_USED_REGISTERS \
+ {1, 1, 1, 1, 1, 1, 1, 1, \
+ 1, 1, 1, 1, 1, 1, 1, 1, \
+ 0, 0, 0, 0, 0, 0, 0, 0, \
+ 0, 0, 0, 0, 0, 0, 0, 0, \
+ \
+ 1, 1, 1, 1, 1, 1, 1, 1, \
+ 1, 1, 1, 1, 1, 1, 1, 1, \
+ 1, 1, 1, 1, 1, 1, 1, 1, \
+ 1, 1, 1, 1, 1, 1, 1, 1, \
+ \
+ 1, 1, 1, 1, 1, 1, 1, 1, \
+ 1, 1, 1, 1, 1, 1, 1, 1, \
+ 1, 1, 1, 1, 1, 1, 1, 1, \
+ 1, 1, 1, 1, 1, 1, 1, 1, \
+ \
+ 1, 1, 1, 1, 1, 1, 1}
+
/* Return number of consecutive hard regs needed starting at reg REGNO
to hold something of mode MODE.
This is ordinarily the length in words of a value of mode MODE
diff --git a/gcc/config/sparc/sparc.opt b/gcc/config/sparc/sparc.opt
index 16583c3..a50ba05 100644
--- a/gcc/config/sparc/sparc.opt
+++ b/gcc/config/sparc/sparc.opt
@@ -203,7 +203,7 @@ Target RejectNegative Joined Var(sparc_debug_string)
Enable debug output.
mstd-struct-return
-Target Report RejectNegative Var(sparc_std_struct_return)
+Target Report Var(sparc_std_struct_return)
Enable strict 32-bit psABI struct return checking.
mfix-at697f