From: Richard Henderson Date: Fri, 9 Jul 2004 00:19:25 +0000 (-0700) Subject: m32r-protos.h (m32r_va_arg): Remove. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4e15608a31c94a41fa22d9d840246be7e8e27c71;p=gcc.git m32r-protos.h (m32r_va_arg): Remove. * config/m32r/m32r-protos.h (m32r_va_arg): Remove. * config/m32r/m32r.c (TARGET_GIMPLIFY_VA_ARG_EXPR): New. (m32r_gimplify_va_arg_expr): Rewrite from m32r_va_arg. * config/m32r/m32r.h (EXPAND_BUILTIN_VA_ARG): Remove. From-SVN: r84335 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 330f1756a95..fdf2971a84b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,10 @@ 2004-07-08 Richard Henderson + * config/m32r/m32r-protos.h (m32r_va_arg): Remove. + * config/m32r/m32r.c (TARGET_GIMPLIFY_VA_ARG_EXPR): New. + (m32r_gimplify_va_arg_expr): Rewrite from m32r_va_arg. + * config/m32r/m32r.h (EXPAND_BUILTIN_VA_ARG): Remove. + * config/iq2000/iq2000-protos.h (iq2000_va_arg): Remove. * config/iq2000/iq2000.c (TARGET_GIMPLIFY_VA_ARG_EXPR): New. (iq2000_gimplify_va_arg_expr): Rewrite from iq2000_va_arg. diff --git a/gcc/config/m32r/m32r-protos.h b/gcc/config/m32r/m32r-protos.h index 17ab18d6c36..89a4cbe28f9 100644 --- a/gcc/config/m32r/m32r-protos.h +++ b/gcc/config/m32r/m32r-protos.h @@ -95,7 +95,6 @@ extern int reg_or_zero_operand (rtx, Mmode); #endif /* HAVE_MACHINE_MODES */ #ifdef TREE_CODE -extern struct rtx_def * m32r_va_arg (tree, tree); extern int m32r_pass_by_reference (tree); #endif /* TREE_CODE */ #endif /* RTX_CODE */ diff --git a/gcc/config/m32r/m32r.c b/gcc/config/m32r/m32r.c index 4105b4e04f5..871369a9e98 100644 --- a/gcc/config/m32r/m32r.c +++ b/gcc/config/m32r/m32r.c @@ -99,6 +99,7 @@ static void m32r_setup_incoming_varargs (CUMULATIVE_ARGS *, enum machine_mode, tree, int *, int); static void init_idents (void); static bool m32r_rtx_costs (rtx, int, int, int *); +static tree m32r_gimplify_va_arg_expr (tree, tree, tree *, tree *); /* Initialize the GCC target structure. */ #undef TARGET_ATTRIBUTE_TABLE @@ -142,6 +143,8 @@ static bool m32r_rtx_costs (rtx, int, int, int *); #undef TARGET_SETUP_INCOMING_VARARGS #define TARGET_SETUP_INCOMING_VARARGS m32r_setup_incoming_varargs +#undef TARGET_GIMPLIFY_VA_ARG_EXPR +#define TARGET_GIMPLIFY_VA_ARG_EXPR m32r_gimplify_va_arg_expr struct gcc_target targetm = TARGET_INITIALIZER; @@ -1394,61 +1397,13 @@ m32r_setup_incoming_varargs (CUMULATIVE_ARGS *cum, enum machine_mode mode, /* Implement `va_arg'. */ -rtx -m32r_va_arg (tree valist, tree type) +static tree +m32r_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p, tree *post_p) { - HOST_WIDE_INT size, rsize; - tree t; - rtx addr_rtx; - - size = int_size_in_bytes (type); - rsize = (size + UNITS_PER_WORD - 1) & -UNITS_PER_WORD; - if (m32r_pass_by_reference (type)) - { - tree type_ptr, type_ptr_ptr; - - /* Pass by reference. */ - type_ptr = build_pointer_type (type); - type_ptr_ptr = build_pointer_type (type_ptr); - - t = build (POSTINCREMENT_EXPR, va_list_type_node, valist, - build_int_2 (UNITS_PER_WORD, 0)); - TREE_SIDE_EFFECTS (t) = 1; - t = build1 (NOP_EXPR, type_ptr_ptr, t); - TREE_SIDE_EFFECTS (t) = 1; - t = build1 (INDIRECT_REF, type_ptr, t); - - addr_rtx = expand_expr (t, NULL_RTX, Pmode, EXPAND_NORMAL); - } + return ind_gimplify_va_arg_expr (valist, type, pre_p, post_p); else - { - /* Pass by value. */ - if (size < UNITS_PER_WORD) - { - /* Care for bigendian correction on the aligned address. */ - t = build (PLUS_EXPR, ptr_type_node, valist, - build_int_2 (rsize - size, 0)); - addr_rtx = expand_expr (t, NULL_RTX, Pmode, EXPAND_NORMAL); - addr_rtx = copy_to_reg (addr_rtx); - - /* Increment AP. */ - t = build (PLUS_EXPR, va_list_type_node, valist, - build_int_2 (rsize, 0)); - t = build (MODIFY_EXPR, va_list_type_node, valist, t); - TREE_SIDE_EFFECTS (t) = 1; - expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL); - } - else - { - t = build (POSTINCREMENT_EXPR, va_list_type_node, valist, - build_int_2 (rsize, 0)); - TREE_SIDE_EFFECTS (t) = 1; - addr_rtx = expand_expr (t, NULL_RTX, Pmode, EXPAND_NORMAL); - } - } - - return addr_rtx; + return std_gimplify_va_arg_expr (valist, type, pre_p, post_p); } /* Return true if INSN is real instruction bearing insn. */ diff --git a/gcc/config/m32r/m32r.h b/gcc/config/m32r/m32r.h index 0f119447a20..4a2e01f51da 100644 --- a/gcc/config/m32r/m32r.h +++ b/gcc/config/m32r/m32r.h @@ -1141,10 +1141,6 @@ extern enum reg_class m32r_regno_reg_class[FIRST_PSEUDO_REGISTER]; (((TYPE) ? TYPE_ALIGN (TYPE) : GET_MODE_BITSIZE (MODE)) <= PARM_BOUNDARY \ ? PARM_BOUNDARY : 2 * PARM_BOUNDARY) #endif - -/* Implement `va_arg'. */ -#define EXPAND_BUILTIN_VA_ARG(valist, type) \ - m32r_va_arg (valist, type) /* Function results. */