From 634cbdb330b7c0aa7c40a2fc5f95eb816e4fe66d Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Fri, 9 Jul 2004 02:50:10 -0700 Subject: [PATCH] mn10300-protos.h (mn10300_va_arg): Remove. * config/mn10300/mn10300-protos.h (mn10300_va_arg): Remove. * config/mn10300/mn10300.c (TARGET_GIMPLIFY_VA_ARG_EXPR): New. (mn10300_gimplify_va_arg_expr): Rewrite from mn10300_va_arg. * config/mn10300/mn10300.h (EXPAND_BUILTIN_VA_ARG): Remove. From-SVN: r84353 --- gcc/ChangeLog | 7 +++++ gcc/config/mn10300/mn10300-protos.h | 1 - gcc/config/mn10300/mn10300.c | 41 ++++++----------------------- gcc/config/mn10300/mn10300.h | 7 ----- 4 files changed, 15 insertions(+), 41 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e16a2a87e4d..0d86377c70f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2004-07-09 Richard Henderson + + * config/mn10300/mn10300-protos.h (mn10300_va_arg): Remove. + * config/mn10300/mn10300.c (TARGET_GIMPLIFY_VA_ARG_EXPR): New. + (mn10300_gimplify_va_arg_expr): Rewrite from mn10300_va_arg. + * config/mn10300/mn10300.h (EXPAND_BUILTIN_VA_ARG): Remove. + 2004-07-09 Eric Botcazou * config/sparc/sparc.md (return): Rewrite length formula. diff --git a/gcc/config/mn10300/mn10300-protos.h b/gcc/config/mn10300/mn10300-protos.h index e5a1a636da3..3767115a416 100644 --- a/gcc/config/mn10300/mn10300-protos.h +++ b/gcc/config/mn10300/mn10300-protos.h @@ -52,7 +52,6 @@ extern struct rtx_def *function_arg (CUMULATIVE_ARGS *, enum machine_mode, tree, int); extern int function_arg_partial_nregs (CUMULATIVE_ARGS *, enum machine_mode, tree, int); -extern struct rtx_def *mn10300_va_arg (tree, tree); #endif /* TREE_CODE */ extern void expand_prologue (void); diff --git a/gcc/config/mn10300/mn10300.c b/gcc/config/mn10300/mn10300.c index da235e39a29..22fc6794b85 100644 --- a/gcc/config/mn10300/mn10300.c +++ b/gcc/config/mn10300/mn10300.c @@ -71,7 +71,7 @@ static bool mn10300_rtx_costs (rtx, int, int, int *); static void mn10300_file_start (void); static bool mn10300_return_in_memory (tree, tree); static rtx mn10300_builtin_saveregs (void); - +static tree mn10300_gimplify_va_arg_expr (tree, tree, tree *, tree *); /* Initialize the GCC target structure. */ #undef TARGET_ASM_ALIGNED_HI_OP @@ -98,6 +98,8 @@ static rtx mn10300_builtin_saveregs (void); #undef TARGET_EXPAND_BUILTIN_SAVEREGS #define TARGET_EXPAND_BUILTIN_SAVEREGS mn10300_builtin_saveregs +#undef TARGET_GIMPLIFY_VA_ARG_EXPR +#define TARGET_GIMPLIFY_VA_ARG_EXPR mn10300_gimplify_va_arg_expr static void mn10300_encode_section_info (tree, rtx, int); struct gcc_target targetm = TARGET_INITIALIZER; @@ -1457,40 +1459,13 @@ mn10300_va_start (tree valist, rtx nextarg) std_expand_builtin_va_start (valist, nextarg); } -rtx -mn10300_va_arg (tree valist, tree type) +static tree +mn10300_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p, tree *post_p) { - HOST_WIDE_INT align, rsize; - tree t, ptr, pptr; - - /* Compute the rounded size of the type. */ - align = PARM_BOUNDARY / BITS_PER_UNIT; - rsize = (((int_size_in_bytes (type) + align - 1) / align) * align); - - t = build (POSTINCREMENT_EXPR, TREE_TYPE (valist), valist, - build_int_2 ((rsize > 8 ? 4 : rsize), 0)); - TREE_SIDE_EFFECTS (t) = 1; - - ptr = build_pointer_type (type); - - /* "Large" types are passed by reference. */ - if (rsize > 8) - { - pptr = build_pointer_type (ptr); - t = build1 (NOP_EXPR, pptr, t); - TREE_SIDE_EFFECTS (t) = 1; - - t = build1 (INDIRECT_REF, ptr, t); - TREE_SIDE_EFFECTS (t) = 1; - } + if (FUNCTION_ARG_PASS_BY_REFERENCE (dummy, TYPE_MODE (type), type, dummy)) + return ind_gimplify_va_arg_expr (valist, type, pre_p, post_p); else - { - t = build1 (NOP_EXPR, ptr, t); - TREE_SIDE_EFFECTS (t) = 1; - } - - /* Calculate! */ - return expand_expr (t, NULL_RTX, Pmode, EXPAND_NORMAL); + return std_gimplify_va_arg_expr (valist, type, pre_p, post_p); } /* Return an RTX to represent where a value with mode MODE will be returned diff --git a/gcc/config/mn10300/mn10300.h b/gcc/config/mn10300/mn10300.h index d980b445cfe..e831e28035a 100644 --- a/gcc/config/mn10300/mn10300.h +++ b/gcc/config/mn10300/mn10300.h @@ -697,13 +697,6 @@ struct cum_arg {int nbytes; }; /* Implement `va_start' for varargs and stdarg. */ #define EXPAND_BUILTIN_VA_START(valist, nextarg) \ mn10300_va_start (valist, nextarg) - -/* Implement `va_arg'. */ -#define EXPAND_BUILTIN_VA_ARG(valist, type) \ - mn10300_va_arg (valist, type) - -/* Addressing modes, and classification of registers for them. */ - /* 1 if X is an rtx for a constant that is a valid address. */ -- 2.30.2