Commit 26a258fe by Per Bothner

(expand_call, emit_library_call, emit_library_call_value):

Allways adjust current_function_outgoing_args_size, even #ifndef
ACCUMULATE_OUTGOING_ARGS.  (Useful for stack overflow checking.)

From-SVN: r8290
parent c199879d
......@@ -1353,19 +1353,25 @@ expand_call (exp, target, ignore)
}
argblock = push_block (ARGS_SIZE_RTX (args_size), 0, 0);
}
else if (must_preallocate)
else
{
/* Note that we must go through the motions of allocating an argument
block even if the size is zero because we may be storing args
in the area reserved for register arguments, which may be part of
the stack frame. */
int needed = args_size.constant;
#ifdef ACCUMULATE_OUTGOING_ARGS
/* Store the maximum argument space used. It will be pushed by the
prologue.
prologue (if ACCUMULATE_OUTGOING_ARGS, or stack overflow checking). */
if (needed > current_function_outgoing_args_size)
current_function_outgoing_args_size = needed;
Since the stack pointer will never be pushed, it is possible for
if (must_preallocate)
{
#ifdef ACCUMULATE_OUTGOING_ARGS
/* Since the stack pointer will never be pushed, it is possible for
the evaluation of a parm to clobber something we have already
written to the stack. Since most function calls on RISC machines
do not use the stack, this is uncommon, but must work correctly.
......@@ -1378,9 +1384,6 @@ expand_call (exp, target, ignore)
Another approach might be to try to reorder the argument
evaluations to avoid this conflicting stack usage. */
if (needed > current_function_outgoing_args_size)
current_function_outgoing_args_size = needed;
#if defined(REG_PARM_STACK_SPACE) && ! defined(OUTGOING_REG_PARM_STACK_SPACE)
/* Since we will be writing into the entire argument area, the
map must be allocated for its entire size, not just the part that
......@@ -1392,7 +1395,8 @@ expand_call (exp, target, ignore)
highest_outgoing_arg_in_use = MAX (initial_highest_arg_in_use,
needed + 1);
#else
highest_outgoing_arg_in_use = MAX (initial_highest_arg_in_use, needed);
highest_outgoing_arg_in_use = MAX (initial_highest_arg_in_use,
needed);
#endif
stack_usage_map = (char *) alloca (highest_outgoing_arg_in_use);
......@@ -1407,7 +1411,8 @@ expand_call (exp, target, ignore)
/* The address of the outgoing argument list must not be copied to a
register here, because argblock would be left pointing to the
wrong place after the call to allocate_dynamic_stack_space below. */
wrong place after the call to allocate_dynamic_stack_space below.
*/
argblock = virtual_outgoing_args_rtx;
......@@ -1443,7 +1448,7 @@ expand_call (exp, target, ignore)
argblock = copy_to_reg (argblock);
#endif /* not ACCUMULATE_OUTGOING_ARGS */
}
}
#ifdef ACCUMULATE_OUTGOING_ARGS
/* The save/restore code in store_one_arg handles all cases except one:
......@@ -2276,9 +2281,10 @@ emit_library_call VPROTO((rtx orgfun, int no_queue, enum machine_mode outmode,
#endif
#endif
#ifdef ACCUMULATE_OUTGOING_ARGS
if (args_size.constant > current_function_outgoing_args_size)
current_function_outgoing_args_size = args_size.constant;
#ifdef ACCUMULATE_OUTGOING_ARGS
args_size.constant = 0;
#endif
......@@ -2623,9 +2629,10 @@ emit_library_call_value VPROTO((rtx orgfun, rtx value, int no_queue,
#endif
#endif
#ifdef ACCUMULATE_OUTGOING_ARGS
if (args_size.constant > current_function_outgoing_args_size)
current_function_outgoing_args_size = args_size.constant;
#ifdef ACCUMULATE_OUTGOING_ARGS
args_size.constant = 0;
#endif
......
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