v850.h (EXPAND_BUILTIN_VA_ARG): New.

* v850.h (EXPAND_BUILTIN_VA_ARG): New.
        * v850.c (v850_va_arg): New.

From-SVN: r29146
This commit is contained in:
Richard Henderson 1999-09-06 15:05:26 -07:00 committed by Richard Henderson
parent 63de6c74a5
commit bc092c4a3c
3 changed files with 52 additions and 0 deletions

View File

@ -1,3 +1,8 @@
Mon Sep 6 15:04:55 1999 Richard Henderson <rth@cygnus.com>
* v850.h (EXPAND_BUILTIN_VA_ARG): New.
* v850.c (v850_va_arg): New.
Tue Sep 7 09:36:01 1999 Michael Hayes <m.hayes@elec.canterbury.ac.nz>
* haifa-sched.c: Tidy comments.

View File

@ -3150,3 +3150,45 @@ v850_set_default_decl_attr (decl)
}
}
}
/* Implement `va_arg'. */
rtx
v850_va_arg (valist, type)
tree valist, type;
{
HOST_WIDE_INT size, rsize, align;
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, valist,
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);
MEM_ALIAS_SET (addr_rtx) = get_varargs_alias_set ();
}
return addr_rtx;
}

View File

@ -735,6 +735,10 @@ extern int current_function_anonymous_args;
#define SETUP_INCOMING_VARARGS(CUM, MODE, TYPE, PAS, SECOND) \
current_function_anonymous_args = (!TARGET_GHS ? 1 : 0);
/* 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)
@ -1663,3 +1667,4 @@ extern int v850_handle_pragma PROTO ((int (*)(void), void (*)(int)
extern void v850_encode_data_area ();
extern void v850_set_default_decl_attr ();
extern v850_data_area v850_get_data_area ();
extern struct rtx_def *v850_va_arg ();