Commit fc2acc87 by Richard Henderson Committed by Richard Henderson

mn10300.c (mn10300_builtin_saveregs): Use get_varargs_alias_set and tag the spill mems.

        * mn10300.c (mn10300_builtin_saveregs): Use get_varargs_alias_set
        and tag the spill mems.
        (mn10300_va_start): New.
        (mn10300_va_arg): New.
        * mn10300.h (EXPAND_BUILTIN_VA_START): New.
        (EXPAND_BUILTIN_VA_ARG): New.

From-SVN: r28316
parent 8bb793f3
Wed Jul 28 11:22:21 1999 Richard Henderson <rth@cygnus.com>
* mn10300.c (mn10300_builtin_saveregs): Use get_varargs_alias_set
and tag the spill mems.
(mn10300_va_start): New.
(mn10300_va_arg): New.
* mn10300.h (EXPAND_BUILTIN_VA_START): New.
(EXPAND_BUILTIN_VA_ARG): New.
Wed Jul 28 11:20:19 1999 Richard Henderson <rth@cygnus.com> Wed Jul 28 11:20:19 1999 Richard Henderson <rth@cygnus.com>
* mn10200.c (mn10200_va_arg): New. * mn10200.c (mn10200_va_arg): New.
......
...@@ -629,29 +629,82 @@ initial_offset (from, to) ...@@ -629,29 +629,82 @@ initial_offset (from, to)
rtx rtx
mn10300_builtin_saveregs () mn10300_builtin_saveregs ()
{ {
rtx offset; rtx offset, mem;
tree fntype = TREE_TYPE (current_function_decl); tree fntype = TREE_TYPE (current_function_decl);
int argadj = ((!(TYPE_ARG_TYPES (fntype) != 0 int argadj = ((!(TYPE_ARG_TYPES (fntype) != 0
&& (TREE_VALUE (tree_last (TYPE_ARG_TYPES (fntype))) && (TREE_VALUE (tree_last (TYPE_ARG_TYPES (fntype)))
!= void_type_node))) != void_type_node)))
? UNITS_PER_WORD : 0); ? UNITS_PER_WORD : 0);
int set = get_varargs_alias_set ();
if (argadj) if (argadj)
offset = plus_constant (current_function_arg_offset_rtx, argadj); offset = plus_constant (current_function_arg_offset_rtx, argadj);
else else
offset = current_function_arg_offset_rtx; offset = current_function_arg_offset_rtx;
emit_move_insn (gen_rtx (MEM, SImode, current_function_internal_arg_pointer), mem = gen_rtx_MEM (SImode, current_function_internal_arg_pointer);
gen_rtx (REG, SImode, 0)); MEM_ALIAS_SET (mem) = set;
emit_move_insn (gen_rtx (MEM, SImode, emit_move_insn (mem, gen_rtx_REG (SImode, 0));
plus_constant
(current_function_internal_arg_pointer, 4)), mem = gen_rtx_MEM (SImode,
gen_rtx (REG, SImode, 1)); plus_constant (current_function_internal_arg_pointer, 4));
MEM_ALIAS_SET (mem) = set;
emit_move_insn (mem, gen_rtx_REG (SImode, 1));
return copy_to_reg (expand_binop (Pmode, add_optab, return copy_to_reg (expand_binop (Pmode, add_optab,
current_function_internal_arg_pointer, current_function_internal_arg_pointer,
offset, 0, 0, OPTAB_LIB_WIDEN)); offset, 0, 0, OPTAB_LIB_WIDEN));
} }
void
mn10300_va_start (stdarg_p, valist, nextarg)
int stdarg_p;
tree valist;
rtx nextarg;
{
if (stdarg_p)
nextarg = expand_builtin_saveregs ();
std_expand_builtin_va_start (stdarg_p, valist, nextarg);
}
rtx
mn10300_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);
}
/* Return an RTX to represent where a value with mode MODE will be returned /* Return an RTX to represent where a value with mode MODE will be returned
from a function. If the result is 0, the argument is pushed. */ from a function. If the result is 0, the argument is pushed. */
......
...@@ -473,7 +473,6 @@ extern struct rtx_def *function_arg (); ...@@ -473,7 +473,6 @@ extern struct rtx_def *function_arg ();
#define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \ #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \
function_arg_partial_nregs (&CUM, MODE, TYPE, NAMED) function_arg_partial_nregs (&CUM, MODE, TYPE, NAMED)
#define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED) \ #define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED) \
((TYPE) && int_size_in_bytes (TYPE) > 8) ((TYPE) && int_size_in_bytes (TYPE) > 8)
...@@ -572,6 +571,16 @@ extern struct rtx_def *function_arg (); ...@@ -572,6 +571,16 @@ extern struct rtx_def *function_arg ();
extern struct rtx_def *mn10300_builtin_saveregs (); extern struct rtx_def *mn10300_builtin_saveregs ();
#define EXPAND_BUILTIN_SAVEREGS() mn10300_builtin_saveregs () #define EXPAND_BUILTIN_SAVEREGS() mn10300_builtin_saveregs ()
/* Implement `va_start' for varargs and stdarg. */
extern void mn10300_va_start();
#define EXPAND_BUILTIN_VA_START(stdarg, valist, nextarg) \
mn10300_va_start (stdarg, valist, nextarg)
/* Implement `va_arg'. */
extern struct rtx_def *mn10300_va_arg();
#define EXPAND_BUILTIN_VA_ARG(valist, type) \
mn10300_va_arg (valist, type)
/* Addressing modes, and classification of registers for them. */ /* Addressing modes, and classification of registers for them. */
......
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