Commit 774e6b37 by Jan Hubicka Committed by Jan Hubicka

calls.c (expand_call): Do sanity checking on arg_space_so_far.

	* calls.c (expand_call): Do sanity checking on arg_space_so_far.
	Update arg_space_so_far on stack adjustments.
	(emit_library_call, emit_library_call_value): Likewise; take into
	account arg_space_so_far and pending_stack_adjust when calculcating
	the boundary.

From-SVN: r32586
parent 295ae817
Thu Mar 16 16:01:30 MET 2000 Jan Hubicka <jh@suse.cz>
* calls.c (expand_call): Do sanity checking on arg_space_so_far.
Update arg_space_so_far on stack adjustments.
(emit_library_call, emit_library_call_value): Likewise; take into
account arg_space_so_far and pending_stack_adjust when calculcating
the boundary.
Thu Mar 16 09:02:19 2000 Jason Eckhardt <jle@cygnus.com> Thu Mar 16 09:02:19 2000 Jason Eckhardt <jle@cygnus.com>
* flow.c: Move all basic block reordering code into its own file. * flow.c: Move all basic block reordering code into its own file.
......
...@@ -1707,6 +1707,7 @@ expand_call (exp, target, ignore) ...@@ -1707,6 +1707,7 @@ expand_call (exp, target, ignore)
rtx old_stack_level = 0; rtx old_stack_level = 0;
int old_pending_adj = 0; int old_pending_adj = 0;
int old_inhibit_defer_pop = inhibit_defer_pop; int old_inhibit_defer_pop = inhibit_defer_pop;
int old_arg_space_so_far = arg_space_so_far;
rtx call_fusage = 0; rtx call_fusage = 0;
register tree p; register tree p;
register int i; register int i;
...@@ -2380,7 +2381,10 @@ expand_call (exp, target, ignore) ...@@ -2380,7 +2381,10 @@ expand_call (exp, target, ignore)
/* If we pushed args in forward order, perform stack alignment /* If we pushed args in forward order, perform stack alignment
after pushing the last arg. */ after pushing the last arg. */
if (argblock == 0) if (argblock == 0)
anti_adjust_stack (GEN_INT (args_size.constant - unadjusted_args_size)); {
anti_adjust_stack (GEN_INT (args_size.constant - unadjusted_args_size));
arg_space_so_far += args_size.constant - unadjusted_args_size;
}
#endif #endif
#endif #endif
...@@ -2432,6 +2436,10 @@ expand_call (exp, target, ignore) ...@@ -2432,6 +2436,10 @@ expand_call (exp, target, ignore)
FUNCTION_ARG (args_so_far, VOIDmode, void_type_node, 1), FUNCTION_ARG (args_so_far, VOIDmode, void_type_node, 1),
valreg, old_inhibit_defer_pop, call_fusage, is_const, nothrow); valreg, old_inhibit_defer_pop, call_fusage, is_const, nothrow);
/* Stack pointer ought to be restored to the value before call. */
if (old_arg_space_so_far != arg_space_so_far)
abort();
/* If call is cse'able, make appropriate pair of reg-notes around it. /* If call is cse'able, make appropriate pair of reg-notes around it.
Test valreg so we don't crash; may safely ignore `const' Test valreg so we don't crash; may safely ignore `const'
if return type is void. Disable for PARALLEL return values, because if return type is void. Disable for PARALLEL return values, because
...@@ -2740,6 +2748,7 @@ emit_library_call VPARAMS((rtx orgfun, int no_queue, enum machine_mode outmode, ...@@ -2740,6 +2748,7 @@ emit_library_call VPARAMS((rtx orgfun, int no_queue, enum machine_mode outmode,
struct args_size offset; struct args_size size; rtx save_area; }; struct args_size offset; struct args_size size; rtx save_area; };
struct arg *argvec; struct arg *argvec;
int old_inhibit_defer_pop = inhibit_defer_pop; int old_inhibit_defer_pop = inhibit_defer_pop;
int old_arg_space_so_far = arg_space_so_far;
rtx call_fusage = 0; rtx call_fusage = 0;
int reg_parm_stack_space = 0; int reg_parm_stack_space = 0;
int nothrow; int nothrow;
...@@ -2883,8 +2892,14 @@ emit_library_call VPARAMS((rtx orgfun, int no_queue, enum machine_mode outmode, ...@@ -2883,8 +2892,14 @@ emit_library_call VPARAMS((rtx orgfun, int no_queue, enum machine_mode outmode,
original_args_size = args_size; original_args_size = args_size;
#ifdef PREFERRED_STACK_BOUNDARY #ifdef PREFERRED_STACK_BOUNDARY
args_size.constant = (((args_size.constant + (STACK_BYTES - 1)) args_size.constant = (((args_size.constant
/ STACK_BYTES) * STACK_BYTES); + arg_space_so_far
+ pending_stack_adjust
+ STACK_BYTES - 1)
/ STACK_BYTES
* STACK_BYTES)
- arg_space_so_far
- pending_stack_adjust);
#endif #endif
args_size.constant = MAX (args_size.constant, args_size.constant = MAX (args_size.constant,
...@@ -2954,8 +2969,11 @@ emit_library_call VPARAMS((rtx orgfun, int no_queue, enum machine_mode outmode, ...@@ -2954,8 +2969,11 @@ emit_library_call VPARAMS((rtx orgfun, int no_queue, enum machine_mode outmode,
/* If we push args individually in reverse order, perform stack alignment /* If we push args individually in reverse order, perform stack alignment
before the first push (the last arg). */ before the first push (the last arg). */
if (argblock == 0) if (argblock == 0)
anti_adjust_stack (GEN_INT (args_size.constant {
- original_args_size.constant)); anti_adjust_stack (GEN_INT (args_size.constant
- original_args_size.constant));
arg_space_so_far += args_size.constant - original_args_size.constant;
}
#endif #endif
#endif #endif
...@@ -3086,6 +3104,7 @@ emit_library_call VPARAMS((rtx orgfun, int no_queue, enum machine_mode outmode, ...@@ -3086,6 +3104,7 @@ emit_library_call VPARAMS((rtx orgfun, int no_queue, enum machine_mode outmode,
emit_push_insn (val, mode, NULL_TREE, NULL_RTX, 0, partial, reg, 0, emit_push_insn (val, mode, NULL_TREE, NULL_RTX, 0, partial, reg, 0,
argblock, GEN_INT (argvec[argnum].offset.constant), argblock, GEN_INT (argvec[argnum].offset.constant),
reg_parm_stack_space, ARGS_SIZE_RTX (alignment_pad)); reg_parm_stack_space, ARGS_SIZE_RTX (alignment_pad));
arg_space_so_far += argvec[argnum].size.constant;
#ifdef ACCUMULATE_OUTGOING_ARGS #ifdef ACCUMULATE_OUTGOING_ARGS
/* Now mark the segment we just used. */ /* Now mark the segment we just used. */
...@@ -3102,8 +3121,11 @@ emit_library_call VPARAMS((rtx orgfun, int no_queue, enum machine_mode outmode, ...@@ -3102,8 +3121,11 @@ emit_library_call VPARAMS((rtx orgfun, int no_queue, enum machine_mode outmode,
/* If we pushed args in forward order, perform stack alignment /* If we pushed args in forward order, perform stack alignment
after pushing the last arg. */ after pushing the last arg. */
if (argblock == 0) if (argblock == 0)
anti_adjust_stack (GEN_INT (args_size.constant {
- original_args_size.constant)); anti_adjust_stack (GEN_INT (args_size.constant
- original_args_size.constant));
arg_space_so_far += args_size.constant - original_args_size.constant;
}
#endif #endif
#endif #endif
...@@ -3174,6 +3196,10 @@ emit_library_call VPARAMS((rtx orgfun, int no_queue, enum machine_mode outmode, ...@@ -3174,6 +3196,10 @@ emit_library_call VPARAMS((rtx orgfun, int no_queue, enum machine_mode outmode,
pop_temp_slots (); pop_temp_slots ();
/* Stack pointer ought to be restored to the value before call. */
if (old_arg_space_so_far != arg_space_so_far)
abort();
/* Now restore inhibit_defer_pop to its actual original value. */ /* Now restore inhibit_defer_pop to its actual original value. */
OK_DEFER_POP; OK_DEFER_POP;
...@@ -3259,6 +3285,7 @@ emit_library_call_value VPARAMS((rtx orgfun, rtx value, int no_queue, ...@@ -3259,6 +3285,7 @@ emit_library_call_value VPARAMS((rtx orgfun, rtx value, int no_queue,
struct args_size offset; struct args_size size; rtx save_area; }; struct args_size offset; struct args_size size; rtx save_area; };
struct arg *argvec; struct arg *argvec;
int old_inhibit_defer_pop = inhibit_defer_pop; int old_inhibit_defer_pop = inhibit_defer_pop;
int old_arg_space_so_far = arg_space_so_far;
rtx call_fusage = 0; rtx call_fusage = 0;
rtx mem_value = 0; rtx mem_value = 0;
int pcc_struct_value = 0; int pcc_struct_value = 0;
...@@ -3474,8 +3501,14 @@ emit_library_call_value VPARAMS((rtx orgfun, rtx value, int no_queue, ...@@ -3474,8 +3501,14 @@ emit_library_call_value VPARAMS((rtx orgfun, rtx value, int no_queue,
original_args_size = args_size; original_args_size = args_size;
#ifdef PREFERRED_STACK_BOUNDARY #ifdef PREFERRED_STACK_BOUNDARY
args_size.constant = (((args_size.constant + (STACK_BYTES - 1)) args_size.constant = (((args_size.constant
/ STACK_BYTES) * STACK_BYTES); + arg_space_so_far
+ pending_stack_adjust
+ STACK_BYTES - 1)
/ STACK_BYTES
* STACK_BYTES)
- arg_space_so_far
- pending_stack_adjust);
#endif #endif
args_size.constant = MAX (args_size.constant, args_size.constant = MAX (args_size.constant,
...@@ -3545,8 +3578,11 @@ emit_library_call_value VPARAMS((rtx orgfun, rtx value, int no_queue, ...@@ -3545,8 +3578,11 @@ emit_library_call_value VPARAMS((rtx orgfun, rtx value, int no_queue,
/* If we push args individually in reverse order, perform stack alignment /* If we push args individually in reverse order, perform stack alignment
before the first push (the last arg). */ before the first push (the last arg). */
if (argblock == 0) if (argblock == 0)
anti_adjust_stack (GEN_INT (args_size.constant {
- original_args_size.constant)); anti_adjust_stack (GEN_INT (args_size.constant
- original_args_size.constant));
arg_space_so_far += args_size.constant - original_args_size.constant;
}
#endif #endif
#endif #endif
...@@ -3677,6 +3713,7 @@ emit_library_call_value VPARAMS((rtx orgfun, rtx value, int no_queue, ...@@ -3677,6 +3713,7 @@ emit_library_call_value VPARAMS((rtx orgfun, rtx value, int no_queue,
emit_push_insn (val, mode, NULL_TREE, NULL_RTX, 0, partial, reg, 0, emit_push_insn (val, mode, NULL_TREE, NULL_RTX, 0, partial, reg, 0,
argblock, GEN_INT (argvec[argnum].offset.constant), argblock, GEN_INT (argvec[argnum].offset.constant),
reg_parm_stack_space, ARGS_SIZE_RTX (alignment_pad)); reg_parm_stack_space, ARGS_SIZE_RTX (alignment_pad));
arg_space_so_far += argvec[argnum].size.constant;
#ifdef ACCUMULATE_OUTGOING_ARGS #ifdef ACCUMULATE_OUTGOING_ARGS
/* Now mark the segment we just used. */ /* Now mark the segment we just used. */
...@@ -3693,8 +3730,11 @@ emit_library_call_value VPARAMS((rtx orgfun, rtx value, int no_queue, ...@@ -3693,8 +3730,11 @@ emit_library_call_value VPARAMS((rtx orgfun, rtx value, int no_queue,
/* If we pushed args in forward order, perform stack alignment /* If we pushed args in forward order, perform stack alignment
after pushing the last arg. */ after pushing the last arg. */
if (argblock == 0) if (argblock == 0)
anti_adjust_stack (GEN_INT (args_size.constant {
- original_args_size.constant)); anti_adjust_stack (GEN_INT (args_size.constant
- original_args_size.constant));
arg_space_so_far += args_size.constant - unadjusted_args_size;
}
#endif #endif
#endif #endif
...@@ -3778,6 +3818,10 @@ emit_library_call_value VPARAMS((rtx orgfun, rtx value, int no_queue, ...@@ -3778,6 +3818,10 @@ emit_library_call_value VPARAMS((rtx orgfun, rtx value, int no_queue,
pop_temp_slots (); pop_temp_slots ();
/* Stack pointer ought to be restored to the value before call. */
if (old_arg_space_so_far != arg_space_so_far)
abort();
/* Copy the value to the right place. */ /* Copy the value to the right place. */
if (outmode != VOIDmode) if (outmode != VOIDmode)
{ {
......
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