Commit 937868a2 by Richard Kenner

(alpha_builtin_savregs): Correctly compute ARGSIZE and NREGS.

From-SVN: r2867
parent aca49971
...@@ -1013,7 +1013,7 @@ print_operand (file, x, code) ...@@ -1013,7 +1013,7 @@ print_operand (file, x, code)
} }
/* Do what is necessary for `va_start'. The argument is ignored; /* Do what is necessary for `va_start'. The argument is ignored;
We look at the current function to determine if stdargs or varargs We look at the current function to determine if stdarg or varargs
is used and fill in an initial va_list. A pointer to this constructor is used and fill in an initial va_list. A pointer to this constructor
is returned. */ is returned. */
...@@ -1023,7 +1023,7 @@ alpha_builtin_saveregs (arglist) ...@@ -1023,7 +1023,7 @@ alpha_builtin_saveregs (arglist)
{ {
rtx block, addr, argsize; rtx block, addr, argsize;
tree fntype = TREE_TYPE (current_function_decl); tree fntype = TREE_TYPE (current_function_decl);
int stdargs = (TYPE_ARG_TYPES (fntype) != 0 int stdarg = (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));
int nregs = current_function_args_info; int nregs = current_function_args_info;
...@@ -1034,27 +1034,22 @@ alpha_builtin_saveregs (arglist) ...@@ -1034,27 +1034,22 @@ alpha_builtin_saveregs (arglist)
if (GET_CODE (current_function_arg_offset_rtx) != CONST_INT) if (GET_CODE (current_function_arg_offset_rtx) != CONST_INT)
{ {
argsize = plus_constant (current_function_arg_offset_rtx, argsize = plus_constant (current_function_arg_offset_rtx,
((6 - stdargs) * UNITS_PER_WORD (6 * UNITS_PER_WORD + UNITS_PER_WORD - 1));
+ UNITS_PER_WORD - 1));
argsize = expand_shift (RSHIFT_EXPR, Pmode, argsize, argsize = expand_shift (RSHIFT_EXPR, Pmode, argsize,
build_int_2 (3, 0), argsize, 0); build_int_2 (3, 0), argsize, 0);
} }
else else
{ {
/* If we are using memory, deduct the stdarg adjustment from it, /* Compute the number of args in memory and number of arguments already
otherwise from the number of registers. Then compute the current processed. Then adjust the number of registers if this is stdarg. */
argument number. */
int memargs = ((INTVAL (current_function_arg_offset_rtx) int memargs = ((INTVAL (current_function_arg_offset_rtx)
+ UNITS_PER_WORD - 1) + UNITS_PER_WORD - 1)
/ UNITS_PER_WORD); / UNITS_PER_WORD);
if (memargs)
memargs -= stdargs;
else
nregs -= stdargs;
argsize = GEN_INT (MIN (nregs, 6) + memargs); argsize = GEN_INT (MIN (nregs, 6) + memargs);
if (nregs <= 6)
nregs -= stdarg;
} }
/* Allocate the va_list constructor */ /* Allocate the va_list constructor */
......
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