aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Stallman <rms@gnu.org>1992-10-09 16:59:56 +0000
committerRichard Stallman <rms@gnu.org>1992-10-09 16:59:56 +0000
commit9d790a4f7376d202702a505f3199d221df73bbcc (patch)
tree0855fe750c9ae5b4b934acf2e252c137cb1869e2 /gcc
parent6ed1d6c5eda4bcf3d996aec32b510dce8e957d1d (diff)
downloadgcc-9d790a4f7376d202702a505f3199d221df73bbcc.zip
gcc-9d790a4f7376d202702a505f3199d221df73bbcc.tar.gz
gcc-9d790a4f7376d202702a505f3199d221df73bbcc.tar.bz2
(aggregate_value_p): Return 1 if regs we would use are not all call-clobbered.
From-SVN: r2384
Diffstat (limited to 'gcc')
-rw-r--r--gcc/function.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/function.c b/gcc/function.c
index 8ee0754..2d01888 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -2543,6 +2543,8 @@ int
aggregate_value_p (exp)
tree exp;
{
+ int i, regno, nregs;
+ rtx reg;
if (TYPE_MODE (TREE_TYPE (exp)) == BLKmode)
return 1;
if (RETURN_IN_MEMORY (TREE_TYPE (exp)))
@@ -2551,6 +2553,14 @@ aggregate_value_p (exp)
&& (TREE_CODE (TREE_TYPE (exp)) == RECORD_TYPE
|| TREE_CODE (TREE_TYPE (exp)) == UNION_TYPE))
return 1;
+ /* Make sure we have suitable call-clobbered regs to return
+ the value in; if not, we must return it in memory. */
+ reg = hard_function_value (TREE_TYPE (exp), 0);
+ regno = REGNO (reg);
+ nregs = HARD_REGNO_NREGS (regno, TYPE_MODE (TREE_TYPE (exp)));
+ for (i = 0; i < nregs; i++)
+ if (! call_used_regs[regno + i])
+ return 1;
return 0;
}