From 51dcde6f95c8a107e0fb143210122eb49ee3c421 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Thu, 18 Apr 2002 13:28:39 -0700 Subject: [PATCH] ia64.c (ia64_function_arg_pass_by_reference): New. * config/ia64/ia64.c (ia64_function_arg_pass_by_reference): New. (ia64_va_arg): Expect variable sized types by reference. * config/ia64/ia64-protos.h: Update. * config/ia64/ia64.h (FUNCTION_ARG_PASS_BY_REFERENCE): Use ia64_function_arg_pass_by_reference. From-SVN: r52494 --- gcc/ChangeLog | 8 ++++++++ gcc/config/ia64/ia64-protos.h | 3 +++ gcc/config/ia64/ia64.c | 20 ++++++++++++++++++++ gcc/config/ia64/ia64.h | 3 ++- 4 files changed, 33 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 137640dd43c..7b71e96161c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2002-04-18 Richard Henderson + + * config/ia64/ia64.c (ia64_function_arg_pass_by_reference): New. + (ia64_va_arg): Expect variable sized types by reference. + * config/ia64/ia64-protos.h: Update. + * config/ia64/ia64.h (FUNCTION_ARG_PASS_BY_REFERENCE): Use + ia64_function_arg_pass_by_reference. + 2002-04-18 Richard Henderson * ifcvt.c: Include except.h. diff --git a/gcc/config/ia64/ia64-protos.h b/gcc/config/ia64/ia64-protos.h index 2bf67b24f0f..8b0d1852862 100644 --- a/gcc/config/ia64/ia64-protos.h +++ b/gcc/config/ia64/ia64-protos.h @@ -114,6 +114,9 @@ extern int ia64_function_arg_partial_nregs PARAMS((CUMULATIVE_ARGS *, extern void ia64_function_arg_advance PARAMS((CUMULATIVE_ARGS *, enum machine_mode, tree, int)); +extern int ia64_function_arg_pass_by_reference PARAMS((CUMULATIVE_ARGS *, + enum machine_mode, + tree, int)); extern int ia64_return_in_memory PARAMS((tree)); extern void ia64_asm_output_external PARAMS((FILE *, tree, const char *)); diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c index 74cbf813ca4..d628dea91af 100644 --- a/gcc/config/ia64/ia64.c +++ b/gcc/config/ia64/ia64.c @@ -3200,6 +3200,19 @@ ia64_function_arg_advance (cum, mode, type, named) cum->int_regs = cum->words; } } + +/* Variable sized types are passed by reference. */ +/* ??? At present this is a GCC extension to the IA-64 ABI. */ + +int +ia64_function_arg_pass_by_reference (cum, mode, type, named) + CUMULATIVE_ARGS *cum ATTRIBUTE_UNUSED; + enum machine_mode mode ATTRIBUTE_UNUSED; + tree type; + int named ATTRIBUTE_UNUSED; +{ + return TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST; +} /* Implement va_start. */ @@ -3231,6 +3244,13 @@ ia64_va_arg (valist, type) { tree t; + /* Variable sized types are passed by reference. */ + if (TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST) + { + rtx addr = std_expand_builtin_va_arg (valist, build_pointer_type (type)); + return gen_rtx_MEM (ptr_mode, force_reg (Pmode, addr)); + } + /* Arguments with alignment larger than 8 bytes start at the next even boundary. */ if (TYPE_ALIGN (type) > 8 * BITS_PER_UNIT) diff --git a/gcc/config/ia64/ia64.h b/gcc/config/ia64/ia64.h index 8b0d3d8ae35..fd880facde9 100644 --- a/gcc/config/ia64/ia64.h +++ b/gcc/config/ia64/ia64.h @@ -1268,7 +1268,8 @@ enum reg_class pointer is passed in whatever way is appropriate for passing a pointer to that type. */ -#define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED) 0 +#define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED) \ + ia64_function_arg_pass_by_reference (&CUM, MODE, TYPE, NAMED) /* A C type for declaring a variable that is used as the first argument of `FUNCTION_ARG' and other related values. For some target machines, the type -- 2.30.2