aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Stallman <rms@gnu.org>1993-09-15 13:39:18 +0000
committerRichard Stallman <rms@gnu.org>1993-09-15 13:39:18 +0000
commitd181c15421baa6da37674bbd77a721b5593efe3c (patch)
treed738c543d9d0a1a4e932fef50ff0cb2699e6d8bf /gcc
parent9a7f678c7d874029fda58205abae428417a519e8 (diff)
downloadgcc-d181c15421baa6da37674bbd77a721b5593efe3c.zip
gcc-d181c15421baa6da37674bbd77a721b5593efe3c.tar.gz
gcc-d181c15421baa6da37674bbd77a721b5593efe3c.tar.bz2
(aggregate_value_p): Allow type node as argument.
From-SVN: r5328
Diffstat (limited to 'gcc')
-rw-r--r--gcc/function.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/gcc/function.c b/gcc/function.c
index f58b472..e4b631e 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -2768,8 +2768,10 @@ get_first_block_beg ()
return NULL_RTX;
}
-/* Return 1 if EXP returns an aggregate value, for which an address
- must be passed to the function or returned by the function. */
+/* Return 1 if EXP is an aggregate type (or a value with aggregate type).
+ This means a type for which function calls must pass an address to the
+ function or get an address back from the function.
+ EXP may be a type node or an expression (whose type is tested). */
int
aggregate_value_p (exp)
@@ -2777,19 +2779,25 @@ aggregate_value_p (exp)
{
int i, regno, nregs;
rtx reg;
- if (RETURN_IN_MEMORY (TREE_TYPE (exp)))
+ tree type;
+ if (TREE_CODE_CLASS (TREE_CODE (exp)) == 't')
+ type = exp;
+ else
+ type = TREE_TYPE (exp);
+
+ if (RETURN_IN_MEMORY (type))
return 1;
if (flag_pcc_struct_return
- && (TREE_CODE (TREE_TYPE (exp)) == RECORD_TYPE
- || TREE_CODE (TREE_TYPE (exp)) == UNION_TYPE
- || TREE_CODE (TREE_TYPE (exp)) == QUAL_UNION_TYPE
- || TREE_CODE (TREE_TYPE (exp)) == ARRAY_TYPE))
+ && (TREE_CODE (type) == RECORD_TYPE
+ || TREE_CODE (type) == UNION_TYPE
+ || TREE_CODE (type) == QUAL_UNION_TYPE
+ || TREE_CODE (type) == ARRAY_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);
+ reg = hard_function_value (type, 0);
regno = REGNO (reg);
- nregs = HARD_REGNO_NREGS (regno, TYPE_MODE (TREE_TYPE (exp)));
+ nregs = HARD_REGNO_NREGS (regno, TYPE_MODE (type));
for (i = 0; i < nregs; i++)
if (! call_used_regs[regno + i])
return 1;