arc-protos.h (arc_va_arg): Remove.
* config/arc/arc-protos.h (arc_va_arg): Remove. * config/arc/arc.c (TARGET_GIMPLIFY_VA_ARG_EXPR): New. (arc_gimplify_va_arg_expr): Rewrite from arc_va_arg. * config/arc/arc.h (EXPAND_BUILTIN_VA_ARG): Remove. From-SVN: r84313
This commit is contained in:
parent
b714a4192e
commit
99680f9883
|
@ -1,5 +1,10 @@
|
||||||
2004-07-08 Richard Henderson <rth@redhat.com>
|
2004-07-08 Richard Henderson <rth@redhat.com>
|
||||||
|
|
||||||
|
* config/arc/arc-protos.h (arc_va_arg): Remove.
|
||||||
|
* config/arc/arc.c (TARGET_GIMPLIFY_VA_ARG_EXPR): New.
|
||||||
|
(arc_gimplify_va_arg_expr): Rewrite from arc_va_arg.
|
||||||
|
* config/arc/arc.h (EXPAND_BUILTIN_VA_ARG): Remove.
|
||||||
|
|
||||||
* config/c4x/c4x-protos.h (c4x_va_arg): Remove.
|
* config/c4x/c4x-protos.h (c4x_va_arg): Remove.
|
||||||
* config/c4x/c4x.c (TARGET_GIMPLIFY_VA_ARG_EXPR): New.
|
* config/c4x/c4x.c (TARGET_GIMPLIFY_VA_ARG_EXPR): New.
|
||||||
(c4x_gimplify_va_arg_expr): Rewrite from c4x_va_arg.
|
(c4x_gimplify_va_arg_expr): Rewrite from c4x_va_arg.
|
||||||
|
|
|
@ -18,11 +18,7 @@ along with GCC; see the file COPYING. If not, write to
|
||||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||||
Boston, MA 02111-1307, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#ifdef RTX_CODE
|
|
||||||
#ifdef TREE_CODE
|
|
||||||
extern void arc_va_start (tree, rtx);
|
extern void arc_va_start (tree, rtx);
|
||||||
extern rtx arc_va_arg (tree, tree);
|
|
||||||
#endif /* TREE_CODE */
|
|
||||||
|
|
||||||
extern enum machine_mode arc_select_cc_mode (enum rtx_code, rtx, rtx);
|
extern enum machine_mode arc_select_cc_mode (enum rtx_code, rtx, rtx);
|
||||||
|
|
||||||
|
@ -55,11 +51,8 @@ extern int const_sint32_operand (rtx, enum machine_mode);
|
||||||
extern int const_uint32_operand (rtx, enum machine_mode);
|
extern int const_uint32_operand (rtx, enum machine_mode);
|
||||||
extern int proper_comparison_operator (rtx, enum machine_mode);
|
extern int proper_comparison_operator (rtx, enum machine_mode);
|
||||||
extern int shift_operator (rtx, enum machine_mode);
|
extern int shift_operator (rtx, enum machine_mode);
|
||||||
#endif /* RTX_CODE */
|
|
||||||
|
|
||||||
#ifdef TREE_CODE
|
|
||||||
extern enum arc_function_type arc_compute_function_type (tree);
|
extern enum arc_function_type arc_compute_function_type (tree);
|
||||||
#endif /* TREE_CODE */
|
|
||||||
|
|
||||||
|
|
||||||
extern void arc_init (void);
|
extern void arc_init (void);
|
||||||
|
@ -71,4 +64,3 @@ extern void arc_finalize_pic (void);
|
||||||
extern void arc_ccfsm_at_label (const char *, int);
|
extern void arc_ccfsm_at_label (const char *, int);
|
||||||
extern int arc_ccfsm_branch_deleted_p (void);
|
extern int arc_ccfsm_branch_deleted_p (void);
|
||||||
extern void arc_ccfsm_record_branch_deleted (void);
|
extern void arc_ccfsm_record_branch_deleted (void);
|
||||||
|
|
||||||
|
|
|
@ -102,6 +102,7 @@ static bool arc_rtx_costs (rtx, int, int, int *);
|
||||||
static int arc_address_cost (rtx);
|
static int arc_address_cost (rtx);
|
||||||
static void arc_external_libcall (rtx);
|
static void arc_external_libcall (rtx);
|
||||||
static bool arc_return_in_memory (tree, tree);
|
static bool arc_return_in_memory (tree, tree);
|
||||||
|
static tree arc_gimplify_va_arg_expr (tree, tree, tree *, tree *);
|
||||||
|
|
||||||
/* Initialize the GCC target structure. */
|
/* Initialize the GCC target structure. */
|
||||||
#undef TARGET_ASM_ALIGNED_HI_OP
|
#undef TARGET_ASM_ALIGNED_HI_OP
|
||||||
|
@ -141,6 +142,8 @@ static bool arc_return_in_memory (tree, tree);
|
||||||
|
|
||||||
#undef TARGET_SETUP_INCOMING_VARARGS
|
#undef TARGET_SETUP_INCOMING_VARARGS
|
||||||
#define TARGET_SETUP_INCOMING_VARARGS arc_setup_incoming_varargs
|
#define TARGET_SETUP_INCOMING_VARARGS arc_setup_incoming_varargs
|
||||||
|
#undef TARGET_GIMPLIFY_VA_ARG_EXPR
|
||||||
|
#define TARGET_GIMPLIFY_VA_ARG_EXPR arc_gimplify_va_arg_expr
|
||||||
|
|
||||||
struct gcc_target targetm = TARGET_INITIALIZER;
|
struct gcc_target targetm = TARGET_INITIALIZER;
|
||||||
|
|
||||||
|
@ -2289,76 +2292,20 @@ arc_va_start (tree valist, rtx nextarg)
|
||||||
std_expand_builtin_va_start (valist, nextarg);
|
std_expand_builtin_va_start (valist, nextarg);
|
||||||
}
|
}
|
||||||
|
|
||||||
rtx
|
static tree
|
||||||
arc_va_arg (tree valist, tree type)
|
arc_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p, tree *post_p)
|
||||||
{
|
{
|
||||||
rtx addr_rtx;
|
|
||||||
tree addr, incr;
|
|
||||||
tree type_ptr = build_pointer_type (type);
|
|
||||||
|
|
||||||
/* All aggregates are passed by reference. All scalar types larger
|
/* All aggregates are passed by reference. All scalar types larger
|
||||||
than 8 bytes are passed by reference. */
|
than 8 bytes are passed by reference. */
|
||||||
|
|
||||||
if (AGGREGATE_TYPE_P (type) || int_size_in_bytes (type) > 8)
|
if (AGGREGATE_TYPE_P (type) || int_size_in_bytes (type) > 8)
|
||||||
{
|
{
|
||||||
tree type_ptr_ptr = build_pointer_type (type_ptr);
|
tree type_ptr = build_pointer_type (type);
|
||||||
|
tree addr = std_gimplify_va_arg_expr (valist, type_ptr, pre_p, post_p);
|
||||||
addr = build (INDIRECT_REF, type_ptr,
|
return build_fold_indirect_ref (addr);
|
||||||
build (NOP_EXPR, type_ptr_ptr, valist));
|
|
||||||
|
|
||||||
incr = build (PLUS_EXPR, TREE_TYPE (valist),
|
|
||||||
valist, build_int_2 (UNITS_PER_WORD, 0));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
HOST_WIDE_INT align, rounded_size;
|
|
||||||
|
|
||||||
/* Compute the rounded size of the type. */
|
|
||||||
align = PARM_BOUNDARY / BITS_PER_UNIT;
|
|
||||||
rounded_size = (((TREE_INT_CST_LOW (TYPE_SIZE (type)) / BITS_PER_UNIT
|
|
||||||
+ align - 1) / align) * align);
|
|
||||||
|
|
||||||
/* Align 8 byte operands. */
|
|
||||||
addr = valist;
|
|
||||||
if (TYPE_ALIGN (type) > BITS_PER_WORD)
|
|
||||||
{
|
|
||||||
/* AP = (TYPE *)(((int)AP + 7) & -8) */
|
|
||||||
|
|
||||||
addr = build (NOP_EXPR, integer_type_node, valist);
|
|
||||||
addr = fold (build (PLUS_EXPR, integer_type_node, addr,
|
|
||||||
build_int_2 (7, 0)));
|
|
||||||
addr = fold (build (BIT_AND_EXPR, integer_type_node, addr,
|
|
||||||
build_int_2 (-8, 0)));
|
|
||||||
addr = fold (build (NOP_EXPR, TREE_TYPE (valist), addr));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* The increment is always rounded_size past the aligned pointer. */
|
|
||||||
incr = fold (build (PLUS_EXPR, TREE_TYPE (addr), addr,
|
|
||||||
build_int_2 (rounded_size, 0)));
|
|
||||||
|
|
||||||
/* Adjust the pointer in big-endian mode. */
|
|
||||||
if (BYTES_BIG_ENDIAN)
|
|
||||||
{
|
|
||||||
HOST_WIDE_INT adj;
|
|
||||||
adj = TREE_INT_CST_LOW (TYPE_SIZE (type)) / BITS_PER_UNIT;
|
|
||||||
if (rounded_size > align)
|
|
||||||
adj = rounded_size;
|
|
||||||
|
|
||||||
addr = fold (build (PLUS_EXPR, TREE_TYPE (addr), addr,
|
|
||||||
build_int_2 (rounded_size - adj, 0)));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Evaluate the data address. */
|
return std_gimplify_va_arg_expr (valist, type, pre_p, post_p);
|
||||||
addr_rtx = expand_expr (addr, NULL_RTX, Pmode, EXPAND_NORMAL);
|
|
||||||
addr_rtx = copy_to_reg (addr_rtx);
|
|
||||||
|
|
||||||
/* Compute new value for AP. */
|
|
||||||
incr = build (MODIFY_EXPR, TREE_TYPE (valist), valist, incr);
|
|
||||||
TREE_SIDE_EFFECTS (incr) = 1;
|
|
||||||
expand_expr (incr, const0_rtx, VOIDmode, EXPAND_NORMAL);
|
|
||||||
|
|
||||||
return addr_rtx;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This is how to output a definition of an internal numbered label where
|
/* This is how to output a definition of an internal numbered label where
|
||||||
|
|
|
@ -1217,7 +1217,3 @@ enum arc_function_type {
|
||||||
/* Implement `va_start' for varargs and stdarg. */
|
/* Implement `va_start' for varargs and stdarg. */
|
||||||
#define EXPAND_BUILTIN_VA_START(valist, nextarg) \
|
#define EXPAND_BUILTIN_VA_START(valist, nextarg) \
|
||||||
arc_va_start (valist, nextarg)
|
arc_va_start (valist, nextarg)
|
||||||
|
|
||||||
/* Implement `va_arg'. */
|
|
||||||
#define EXPAND_BUILTIN_VA_ARG(valist, type) \
|
|
||||||
arc_va_arg (valist, type)
|
|
||||||
|
|
Loading…
Reference in New Issue