From a900345fb54ed9f1cca996c238c50c385de959dd Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Fri, 9 Jul 2004 03:10:51 -0700 Subject: [PATCH] v850-protos.h (v850_va_arg): Remove. * config/v850/v850-protos.h (v850_va_arg): Remove. * config/v850/v850.c (TARGET_GIMPLIFY_VA_ARG_EXPR): New. (v850_gimplify_va_arg_expr): Rewrite from v850_va_arg. * config/v850/v850.h (EXPAND_BUILTIN_VA_ARG): Remove. (FUNCTION_ARG_PASS_BY_REFERENCE): Handle variable size types. (FUNCTION_ARG_CALLEE_COPIES): Use FUNCTION_ARG_PASS_BY_REFERENCE. From-SVN: r84359 --- gcc/ChangeLog | 9 +++++++ gcc/config/v850/v850-protos.h | 1 - gcc/config/v850/v850.c | 46 ++++++++--------------------------- gcc/config/v850/v850.h | 8 ++---- 4 files changed, 21 insertions(+), 43 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c8c4ac3a78d..166277bc92d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2004-07-09 Richard Henderson + + * config/v850/v850-protos.h (v850_va_arg): Remove. + * config/v850/v850.c (TARGET_GIMPLIFY_VA_ARG_EXPR): New. + (v850_gimplify_va_arg_expr): Rewrite from v850_va_arg. + * config/v850/v850.h (EXPAND_BUILTIN_VA_ARG): Remove. + (FUNCTION_ARG_PASS_BY_REFERENCE): Handle variable size types. + (FUNCTION_ARG_CALLEE_COPIES): Use FUNCTION_ARG_PASS_BY_REFERENCE. + 2004-07-09 Richard Earnshaw PR target/12133 diff --git a/gcc/config/v850/v850-protos.h b/gcc/config/v850/v850-protos.h index 5355f88181a..d20f50b50d1 100644 --- a/gcc/config/v850/v850-protos.h +++ b/gcc/config/v850/v850-protos.h @@ -70,7 +70,6 @@ extern int pattern_is_ok_for_epilogue (rtx, Mmode); extern int register_is_ok_for_epilogue (rtx, Mmode); #ifdef TREE_CODE extern rtx function_arg (CUMULATIVE_ARGS *, Mmode, tree, int); -extern rtx v850_va_arg (tree, tree); #endif #endif #endif /* TREE_CODE */ diff --git a/gcc/config/v850/v850.c b/gcc/config/v850/v850.c index 063a3fe5c77..5a8c89ff49f 100644 --- a/gcc/config/v850/v850.c +++ b/gcc/config/v850/v850.c @@ -67,6 +67,7 @@ static void v850_encode_section_info (tree, rtx, int); static bool v850_return_in_memory (tree, tree); static void v850_setup_incoming_varargs (CUMULATIVE_ARGS *, enum machine_mode, tree, int *, int); +static tree v850_gimplify_va_arg_expr (tree, tree, tree *, tree *); /* Information about the various small memory areas. */ struct small_memory_info small_memory[ (int)SMALL_MEMORY_max ] = @@ -132,6 +133,9 @@ static int v850_interrupt_p = FALSE; #undef TARGET_SETUP_INCOMING_VARARGS #define TARGET_SETUP_INCOMING_VARARGS v850_setup_incoming_varargs +#undef TARGET_GIMPLIFY_VA_ARG_EXPR +#define TARGET_GIMPLIFY_VA_ARG_EXPR v850_gimplify_va_arg_expr + struct gcc_target targetm = TARGET_INITIALIZER; /* Sometimes certain combinations of command options do not make @@ -3306,43 +3310,13 @@ construct_prepare_instruction (rtx op) /* Implement `va_arg'. */ -rtx -v850_va_arg (tree valist, tree type) +static tree +v850_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p, tree *post_p) { - HOST_WIDE_INT size, rsize; - tree addr, incr; - rtx addr_rtx; - int indirect; - - /* Round up sizeof(type) to a word. */ - size = int_size_in_bytes (type); - rsize = (size + UNITS_PER_WORD - 1) & -UNITS_PER_WORD; - indirect = 0; - - if (size > 8) - { - size = rsize = UNITS_PER_WORD; - indirect = 1; - } - - addr = save_expr (valist); - incr = fold (build (PLUS_EXPR, ptr_type_node, addr, - build_int_2 (rsize, 0))); - - incr = build (MODIFY_EXPR, ptr_type_node, valist, incr); - TREE_SIDE_EFFECTS (incr) = 1; - expand_expr (incr, const0_rtx, VOIDmode, EXPAND_NORMAL); - - addr_rtx = expand_expr (addr, NULL, Pmode, EXPAND_NORMAL); - - if (indirect) - { - addr_rtx = force_reg (Pmode, addr_rtx); - addr_rtx = gen_rtx_MEM (Pmode, addr_rtx); - set_mem_alias_set (addr_rtx, get_varargs_alias_set ()); - } - - return addr_rtx; + if (FUNCTION_ARG_PASS_BY_REFERENCE (dummy, TYPE_MODE (type), type, 0)) + return ind_gimplify_va_arg_expr (valist, type, pre_p, post_p); + else + return std_gimplify_va_arg_expr (valist, type, pre_p, post_p); } /* Return an RTX indicating where the return address to the diff --git a/gcc/config/v850/v850.h b/gcc/config/v850/v850.h index 6f3282184d7..9a34a50a5af 100644 --- a/gcc/config/v850/v850.h +++ b/gcc/config/v850/v850.h @@ -773,15 +773,11 @@ struct cum_arg { int nbytes; int anonymous_args; }; space allocated by the caller. */ #define OUTGOING_REG_PARM_STACK_SPACE -/* Implement `va_arg'. */ -#define EXPAND_BUILTIN_VA_ARG(valist, type) \ - v850_va_arg (valist, type) - #define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED) \ - ((TYPE) && int_size_in_bytes (TYPE) > 8) + ((TYPE) && (unsigned HOST_WIDE_INT) int_size_in_bytes (TYPE) > 8) #define FUNCTION_ARG_CALLEE_COPIES(CUM, MODE, TYPE, NAMED) \ - ((TYPE) && int_size_in_bytes (TYPE) > 8) + FUNCTION_ARG_PASS_BY_REFERENCE (CUM, MODE, TYPE, NAMED) /* 1 if N is a possible register number for function argument passing. */ -- 2.30.2