Commit 062fff1b by Richard Henderson Committed by Richard Henderson

cris-protos.h (cris_expand_builtin_va_arg): Remove.

        * config/cris/cris-protos.h (cris_expand_builtin_va_arg): Remove.
        * config/cris/cris.c (TARGET_GIMPLIFY_VA_ARG_EXPR): New.
        (cris_gimplify_va_arg_expr): Rewrite from cris_expand_builtin_va_arg.
        * config/cris/cris.h (EXPAND_BUILTIN_VA_ARG): Remove.

From-SVN: r84321
parent 2d8f9759
...@@ -6,6 +6,13 @@ ...@@ -6,6 +6,13 @@
2004-07-08 Richard Henderson <rth@redhat.com> 2004-07-08 Richard Henderson <rth@redhat.com>
* config/cris/cris-protos.h (cris_expand_builtin_va_arg): Remove.
* config/cris/cris.c (TARGET_GIMPLIFY_VA_ARG_EXPR): New.
(cris_gimplify_va_arg_expr): Rewrite from cris_expand_builtin_va_arg.
* config/cris/cris.h (EXPAND_BUILTIN_VA_ARG): Remove.
2004-07-08 Richard Henderson <rth@redhat.com>
* builtins.c (ind_gimplify_va_arg_expr): New. * builtins.c (ind_gimplify_va_arg_expr): New.
* tree.h (ind_gimplify_va_arg_expr): Declare. * tree.h (ind_gimplify_va_arg_expr): Declare.
* config/arc/arc.c (arc_gimplify_va_arg_expr): Use it. * config/arc/arc.c (arc_gimplify_va_arg_expr): Use it.
......
...@@ -45,10 +45,6 @@ extern int cris_symbol (rtx); ...@@ -45,10 +45,6 @@ extern int cris_symbol (rtx);
extern void cris_output_addr_const (FILE *, rtx); extern void cris_output_addr_const (FILE *, rtx);
extern int cris_cfun_uses_pic_table (void); extern int cris_cfun_uses_pic_table (void);
extern void cris_target_asm_named_section (const char *, unsigned int); extern void cris_target_asm_named_section (const char *, unsigned int);
# ifdef TREE_CODE
extern rtx cris_expand_builtin_va_arg (tree, tree);
# endif
#endif /* RTX_CODE */ #endif /* RTX_CODE */
extern void cris_pragma_expand_mul (struct cpp_reader *); extern void cris_pragma_expand_mul (struct cpp_reader *);
......
...@@ -116,6 +116,8 @@ static void cris_init_libfuncs (void); ...@@ -116,6 +116,8 @@ static void cris_init_libfuncs (void);
static bool cris_rtx_costs (rtx, int, int, int *); static bool cris_rtx_costs (rtx, int, int, int *);
static int cris_address_cost (rtx); static int cris_address_cost (rtx);
static tree cris_gimplify_va_arg_expr (tree, tree, tree *, tree *);
/* The function cris_target_asm_function_epilogue puts the last insn to /* The function cris_target_asm_function_epilogue puts the last insn to
output here. It always fits; there won't be a symbol operand. Used in output here. It always fits; there won't be a symbol operand. Used in
delay_slots_for_epilogue and function_epilogue. */ delay_slots_for_epilogue and function_epilogue. */
...@@ -189,6 +191,8 @@ int cris_cpu_version = CRIS_DEFAULT_CPU_VERSION; ...@@ -189,6 +191,8 @@ int cris_cpu_version = CRIS_DEFAULT_CPU_VERSION;
#undef TARGET_SETUP_INCOMING_VARARGS #undef TARGET_SETUP_INCOMING_VARARGS
#define TARGET_SETUP_INCOMING_VARARGS cris_setup_incoming_varargs #define TARGET_SETUP_INCOMING_VARARGS cris_setup_incoming_varargs
#undef TARGET_GIMPLIFY_VA_ARG_EXPR
#define TARGET_GIMPLIFY_VA_ARG_EXPR cris_gimplify_va_arg_expr
struct gcc_target targetm = TARGET_INITIALIZER; struct gcc_target targetm = TARGET_INITIALIZER;
...@@ -2785,84 +2789,16 @@ cris_init_libfuncs (void) ...@@ -2785,84 +2789,16 @@ cris_init_libfuncs (void)
set_optab_libfunc (umod_optab, SImode, "__Umod"); set_optab_libfunc (umod_optab, SImode, "__Umod");
} }
/* The EXPAND_BUILTIN_VA_ARG worker. This is modified from the /* The va_arg gimplifier. All we need to do here special is notice
"standard" implementation of va_arg: read the value from the current when we we've got a pass-by-reference. */
address and increment by the size of one or two registers. The
important difference for CRIS is that if the type is
pass-by-reference, then perform an indirection. */
rtx static tree
cris_expand_builtin_va_arg (tree valist, tree type) cris_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p, tree *post_p)
{ {
tree addr_tree, t; if (FUNCTION_ARG_PASS_BY_REFERENCE (dummy, TYPE_MODE (type), type, dummy))
rtx addr; return ind_gimplify_va_arg_expr (valist, type, pre_p, post_p);
tree passed_size = size_zero_node;
tree type_size = NULL;
tree size3 = size_int (3);
tree size4 = size_int (4);
tree size8 = size_int (8);
tree rounded_size;
/* Get AP. */
addr_tree = valist;
if (type == error_mark_node
|| (type_size = TYPE_SIZE_UNIT (TYPE_MAIN_VARIANT (type))) == NULL
|| TREE_OVERFLOW (type_size))
/* Presumably an error; the size isn't computable. A message has
supposedly been emitted elsewhere. */
rounded_size = size_zero_node;
else else
rounded_size return std_gimplify_va_arg_expr (valist, type, pre_p, post_p);
= fold (build (MULT_EXPR, sizetype,
fold (build (TRUNC_DIV_EXPR, sizetype,
fold (build (PLUS_EXPR, sizetype,
type_size, size3)),
size4)),
size4));
if (!integer_zerop (rounded_size))
{
/* Check if the type is passed by value or by reference. Values up
to 8 bytes are passed by-value, padded to register-size (4
bytes). Larger values and varying-size types are passed
by reference. */
passed_size
= (!really_constant_p (type_size)
? size4
: fold (build (COND_EXPR, sizetype,
fold (build (GT_EXPR, sizetype,
rounded_size,
size8)),
size4,
rounded_size)));
addr_tree
= (!really_constant_p (type_size)
? build1 (INDIRECT_REF, build_pointer_type (type), addr_tree)
: fold (build (COND_EXPR, TREE_TYPE (addr_tree),
fold (build (GT_EXPR, sizetype,
rounded_size,
size8)),
build1 (INDIRECT_REF, build_pointer_type (type),
addr_tree),
addr_tree)));
}
addr = expand_expr (addr_tree, NULL_RTX, Pmode, EXPAND_NORMAL);
addr = copy_to_reg (addr);
if (!integer_zerop (rounded_size))
{
/* Compute new value for AP. */
t = build (MODIFY_EXPR, TREE_TYPE (valist), valist,
build (PLUS_EXPR, TREE_TYPE (valist), valist,
passed_size));
TREE_SIDE_EFFECTS (t) = 1;
expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
}
return addr;
} }
/* The INIT_EXPANDERS worker sets the per-function-data initializer and /* The INIT_EXPANDERS worker sets the per-function-data initializer and
......
...@@ -1051,14 +1051,6 @@ struct cum_args {int regs;}; ...@@ -1051,14 +1051,6 @@ struct cum_args {int regs;};
documentation. */ documentation. */
/* Node: Varargs */
/* FIXME: This and other EXPAND_BUILTIN_VA_... target macros are not
documented, although used by several targets. */
#define EXPAND_BUILTIN_VA_ARG(VALIST, TYPE) \
cris_expand_builtin_va_arg (VALIST, TYPE)
/* Node: Trampolines */ /* Node: Trampolines */
/* This looks too complicated, and it is. I assigned r7 to be the /* This looks too complicated, and it is. I assigned r7 to be the
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment