diff options
author | Richard Henderson <rth@cygnus.com> | 1999-07-28 11:21:02 -0700 |
---|---|---|
committer | Richard Henderson <rth@gcc.gnu.org> | 1999-07-28 11:21:02 -0700 |
commit | 8bb793f37f0c9b0c9003a0d8509a0da8198807e0 (patch) | |
tree | b8cf4c79ee7c5d387387db61ef1a5fec91bc0642 /gcc | |
parent | d0be05dbc4b53f224ea31c5f3eb4c1e1b73bc978 (diff) | |
download | gcc-8bb793f37f0c9b0c9003a0d8509a0da8198807e0.zip gcc-8bb793f37f0c9b0c9003a0d8509a0da8198807e0.tar.gz gcc-8bb793f37f0c9b0c9003a0d8509a0da8198807e0.tar.bz2 |
mn10200.c (mn10200_va_arg): New.
* mn10200.c (mn10200_va_arg): New.
* mn10200.h (EXPAND_BUILTIN_VA_ARG): New.
From-SVN: r28315
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/config/mn10200/mn10200.c | 37 | ||||
-rw-r--r-- | gcc/config/mn10200/mn10200.h | 4 |
3 files changed, 46 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index eb5c409..37c69fc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +Wed Jul 28 11:20:19 1999 Richard Henderson <rth@cygnus.com> + + * mn10200.c (mn10200_va_arg): New. + * mn10200.h (EXPAND_BUILTIN_VA_ARG): New. + Wed Jul 28 11:19:06 1999 Richard Henderson <rth@cygnus.com> * builtins.c (std_expand_builtin_va_arg): Use int_size_in_bytes diff --git a/gcc/config/mn10200/mn10200.c b/gcc/config/mn10200/mn10200.c index 5435f77..6e91b8e 100644 --- a/gcc/config/mn10200/mn10200.c +++ b/gcc/config/mn10200/mn10200.c @@ -1436,6 +1436,43 @@ function_arg_partial_nregs (cum, mode, type, named) return (nregs * UNITS_PER_WORD - cum->nbytes) / UNITS_PER_WORD; } +rtx +mn10200_va_arg (valist, type) + tree valist, type; +{ + 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; + } + else + { + t = build1 (NOP_EXPR, ptr, t); + TREE_SIDE_EFFECTS (t) = 1; + } + + /* Calculate! */ + return expand_expr (t, NULL_RTX, Pmode, EXPAND_NORMAL); +} + char * output_tst (operand, insn) rtx operand, insn; diff --git a/gcc/config/mn10200/mn10200.h b/gcc/config/mn10200/mn10200.h index fcf1058..c044c16 100644 --- a/gcc/config/mn10200/mn10200.h +++ b/gcc/config/mn10200/mn10200.h @@ -508,6 +508,10 @@ extern struct rtx_def *function_arg(); #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \ function_arg (&CUM, MODE, TYPE, NAMED) +/* Implement `va_arg'. */ +extern struct rtx_def *mn10200_va_arg(); +#define EXPAND_BUILTIN_VA_ARG(valist, type) \ + mn10200_va_arg (valist, type) /* For "large" items, we pass them by invisible reference, and the callee is responsible for copying the data item if it might be |