aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorDoug Evans <dje@gnu.org>1993-04-19 19:25:29 +0000
committerDoug Evans <dje@gnu.org>1993-04-19 19:25:29 +0000
commit137a2a7b835fc5341f5dbaf4f502d35721450a40 (patch)
tree8f7f5625e87a162468a11ee32efd281bbbc95031 /gcc
parent5e0de251204954b4a332a2ed7417623ed826de3e (diff)
downloadgcc-137a2a7b835fc5341f5dbaf4f502d35721450a40.zip
gcc-137a2a7b835fc5341f5dbaf4f502d35721450a40.tar.gz
gcc-137a2a7b835fc5341f5dbaf4f502d35721450a40.tar.bz2
(assign_parms): Use new FUNCTION_ARG_CALLEE_COPIES macro.
From-SVN: r4184
Diffstat (limited to 'gcc')
-rw-r--r--gcc/function.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/gcc/function.c b/gcc/function.c
index 06f3649..21111db 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -3178,6 +3178,53 @@ assign_parms (fndecl, second_time)
emit_move_insn (parmreg, DECL_RTL (parm));
DECL_RTL (parm) = parmreg;
}
+#ifdef FUNCTION_ARG_CALLEE_COPIES
+ /* If we are passed an arg by reference and it is our responsibility
+ to make a copy, do it now.
+ PASSED_TYPE and PASSED mode now refer to the pointer, not the
+ original argument, so we must recreate them in the call to
+ FUNCTION_ARG_CALLEE_COPIES. */
+ /* ??? Later add code to handle the case that if the argument isn't
+ modified, don't do the copy. */
+
+ else if (passed_pointer
+ && FUNCTION_ARG_CALLEE_COPIES (args_so_far,
+ TYPE_MODE (DECL_ARG_TYPE (parm)),
+ DECL_ARG_TYPE (parm),
+ ! last_named))
+ {
+ rtx copy;
+ tree type = DECL_ARG_TYPE (parm);
+
+ /* This sequence may involve a library call perhaps clobbering
+ registers that haven't been copied to pseudos yet. */
+
+ push_to_sequence (conversion_insns);
+
+ if (TYPE_SIZE (type) == 0
+ || TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST)
+ {
+ /* This is a variable sized object. */
+ /* ??? Can we use expr_size here? */
+ rtx size_rtx = expand_expr (size_in_bytes (type), NULL_RTX,
+ TYPE_MODE(sizetype), 0);
+
+ copy = gen_rtx (MEM, BLKmode,
+ allocate_dynamic_stack_space (size_rtx, NULL_RTX,
+ TYPE_ALIGN (type)));
+ }
+ else
+ {
+ int size = int_size_in_bytes (type);
+ copy = assign_stack_temp (BLKmode, size, 1);
+ }
+
+ store_expr (parm, copy, 0);
+ emit_move_insn (parmreg, XEXP (copy, 0));
+ conversion_insns = get_insns ();
+ end_sequence ();
+ }
+#endif /* FUNCTION_ARG_CALLEE_COPIES */
/* In any case, record the parm's desired stack location
in case we later discover it must live in the stack. */