Commit fb5eebb9 by Richard Henderson Committed by Richard Henderson

calls.c (emit_call_1): New arg rounded_stack_size; update callers.

        * calls.c (emit_call_1): New arg rounded_stack_size; update callers.
        Update pending_stack_adjust based on this value.
        (compute_argument_block_size): Include pending_stack_adjust in
        PREFERRED_STACK_BOUNDARY alignment.
        * function.c (assign_parms): Don't round to PREFERRED_STACK_BOUNDARY.

From-SVN: r26623
parent ed856f4c
Sun Apr 25 12:30:50 1999 Richard Henderson <rth@cygnus.com>
* calls.c (emit_call_1): New arg rounded_stack_size; update callers.
Update pending_stack_adjust based on this value.
(compute_argument_block_size): Include pending_stack_adjust in
PREFERRED_STACK_BOUNDARY alignment.
* function.c (assign_parms): Don't round to PREFERRED_STACK_BOUNDARY.
Sun Apr 25 14:38:10 EDT 1999 John Wehle (john@feith.com) Sun Apr 25 14:38:10 EDT 1999 John Wehle (john@feith.com)
* stupid.c (stupid_mark_refs): Generate a REG_UNUSED note * stupid.c (stupid_mark_refs): Generate a REG_UNUSED note
......
...@@ -127,8 +127,8 @@ int stack_arg_under_construction; ...@@ -127,8 +127,8 @@ int stack_arg_under_construction;
static int calls_function PROTO ((tree, int)); static int calls_function PROTO ((tree, int));
static int calls_function_1 PROTO ((tree, int)); static int calls_function_1 PROTO ((tree, int));
static void emit_call_1 PROTO ((rtx, tree, tree, HOST_WIDE_INT, static void emit_call_1 PROTO ((rtx, tree, tree, HOST_WIDE_INT,
HOST_WIDE_INT, rtx, rtx, HOST_WIDE_INT, HOST_WIDE_INT, rtx,
int, rtx, int)); rtx, int, rtx, int));
static void special_function_p PROTO ((char *, tree, int *, int *, static void special_function_p PROTO ((char *, tree, int *, int *,
int *, int *)); int *, int *));
static void precompute_register_parameters PROTO ((int, struct arg_data *, static void precompute_register_parameters PROTO ((int, struct arg_data *,
...@@ -374,13 +374,14 @@ prepare_call_address (funexp, fndecl, call_fusage, reg_parm_seen) ...@@ -374,13 +374,14 @@ prepare_call_address (funexp, fndecl, call_fusage, reg_parm_seen)
IS_CONST is true if this is a `const' call. */ IS_CONST is true if this is a `const' call. */
static void static void
emit_call_1 (funexp, fndecl, funtype, stack_size, struct_value_size, emit_call_1 (funexp, fndecl, funtype, stack_size, rounded_stack_size,
next_arg_reg, valreg, old_inhibit_defer_pop, call_fusage, struct_value_size, next_arg_reg, valreg, old_inhibit_defer_pop,
is_const) call_fusage, is_const)
rtx funexp; rtx funexp;
tree fndecl ATTRIBUTE_UNUSED; tree fndecl ATTRIBUTE_UNUSED;
tree funtype ATTRIBUTE_UNUSED; tree funtype ATTRIBUTE_UNUSED;
HOST_WIDE_INT stack_size; HOST_WIDE_INT stack_size;
HOST_WIDE_INT rounded_stack_size;
HOST_WIDE_INT struct_value_size; HOST_WIDE_INT struct_value_size;
rtx next_arg_reg; rtx next_arg_reg;
rtx valreg; rtx valreg;
...@@ -393,6 +394,7 @@ emit_call_1 (funexp, fndecl, funtype, stack_size, struct_value_size, ...@@ -393,6 +394,7 @@ emit_call_1 (funexp, fndecl, funtype, stack_size, struct_value_size,
rtx call_insn; rtx call_insn;
#ifndef ACCUMULATE_OUTGOING_ARGS #ifndef ACCUMULATE_OUTGOING_ARGS
int already_popped = 0; int already_popped = 0;
HOST_WIDE_INT n_popped = RETURN_POPS_ARGS (fndecl, funtype, stack_size);
#endif #endif
/* Ensure address is valid. SYMBOL_REF is already valid, so no need, /* Ensure address is valid. SYMBOL_REF is already valid, so no need,
...@@ -403,11 +405,9 @@ emit_call_1 (funexp, fndecl, funtype, stack_size, struct_value_size, ...@@ -403,11 +405,9 @@ emit_call_1 (funexp, fndecl, funtype, stack_size, struct_value_size,
#ifndef ACCUMULATE_OUTGOING_ARGS #ifndef ACCUMULATE_OUTGOING_ARGS
#if defined (HAVE_call_pop) && defined (HAVE_call_value_pop) #if defined (HAVE_call_pop) && defined (HAVE_call_value_pop)
if (HAVE_call_pop && HAVE_call_value_pop if (HAVE_call_pop && HAVE_call_value_pop && n_popped > 0)
&& (RETURN_POPS_ARGS (fndecl, funtype, stack_size) > 0
|| stack_size == 0))
{ {
rtx n_pop = GEN_INT (RETURN_POPS_ARGS (fndecl, funtype, stack_size)); rtx n_pop = GEN_INT (n_popped);
rtx pat; rtx pat;
/* If this subroutine pops its own args, record that in the call insn /* If this subroutine pops its own args, record that in the call insn
...@@ -485,23 +485,23 @@ emit_call_1 (funexp, fndecl, funtype, stack_size, struct_value_size, ...@@ -485,23 +485,23 @@ emit_call_1 (funexp, fndecl, funtype, stack_size, struct_value_size,
If returning from the subroutine does pop the args, indicate that the If returning from the subroutine does pop the args, indicate that the
stack pointer will be changed. */ stack pointer will be changed. */
if (stack_size != 0 && RETURN_POPS_ARGS (fndecl, funtype, stack_size) > 0) if (n_popped > 0)
{ {
if (!already_popped) if (!already_popped)
CALL_INSN_FUNCTION_USAGE (call_insn) CALL_INSN_FUNCTION_USAGE (call_insn)
= gen_rtx_EXPR_LIST (VOIDmode, = gen_rtx_EXPR_LIST (VOIDmode,
gen_rtx_CLOBBER (VOIDmode, stack_pointer_rtx), gen_rtx_CLOBBER (VOIDmode, stack_pointer_rtx),
CALL_INSN_FUNCTION_USAGE (call_insn)); CALL_INSN_FUNCTION_USAGE (call_insn));
stack_size -= RETURN_POPS_ARGS (fndecl, funtype, stack_size); stack_size -= n_popped;
stack_size_rtx = GEN_INT (stack_size); rounded_stack_size -= n_popped;
} }
if (stack_size != 0) if (rounded_stack_size != 0)
{ {
if (flag_defer_pop && inhibit_defer_pop == 0 && !is_const) if (flag_defer_pop && inhibit_defer_pop == 0 && !is_const)
pending_stack_adjust += stack_size; pending_stack_adjust += rounded_stack_size;
else else
adjust_stack (stack_size_rtx); adjust_stack (GEN_INT (rounded_stack_size));
} }
#endif #endif
} }
...@@ -1168,8 +1168,11 @@ compute_argument_block_size (reg_parm_stack_space, args_size) ...@@ -1168,8 +1168,11 @@ compute_argument_block_size (reg_parm_stack_space, args_size)
else else
{ {
#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); + pending_stack_adjust
+ STACK_BYTES - 1)
/ STACK_BYTES * STACK_BYTES)
- pending_stack_adjust);
#endif #endif
args_size->constant = MAX (args_size->constant, args_size->constant = MAX (args_size->constant,
...@@ -2272,7 +2275,8 @@ expand_call (exp, target, ignore) ...@@ -2272,7 +2275,8 @@ expand_call (exp, target, ignore)
/* All arguments and registers used for the call must be set up by now! */ /* All arguments and registers used for the call must be set up by now! */
/* Generate the actual call instruction. */ /* Generate the actual call instruction. */
emit_call_1 (funexp, fndecl, funtype, args_size.constant, struct_value_size, emit_call_1 (funexp, fndecl, funtype, unadjusted_args_size,
args_size.constant, struct_value_size,
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); valreg, old_inhibit_defer_pop, call_fusage, is_const);
...@@ -2957,7 +2961,7 @@ emit_library_call VPROTO((rtx orgfun, int no_queue, enum machine_mode outmode, ...@@ -2957,7 +2961,7 @@ emit_library_call VPROTO((rtx orgfun, int no_queue, enum machine_mode outmode,
get_identifier (XSTR (orgfun, 0)), get_identifier (XSTR (orgfun, 0)),
build_function_type (outmode == VOIDmode ? void_type_node build_function_type (outmode == VOIDmode ? void_type_node
: type_for_mode (outmode, 0), NULL_TREE), : type_for_mode (outmode, 0), NULL_TREE),
args_size.constant, 0, original_args_size.constant, args_size.constant, 0,
FUNCTION_ARG (args_so_far, VOIDmode, void_type_node, 1), FUNCTION_ARG (args_so_far, VOIDmode, void_type_node, 1),
outmode != VOIDmode ? hard_libcall_value (outmode) : NULL_RTX, outmode != VOIDmode ? hard_libcall_value (outmode) : NULL_RTX,
old_inhibit_defer_pop + 1, call_fusage, no_queue); old_inhibit_defer_pop + 1, call_fusage, no_queue);
...@@ -3530,7 +3534,8 @@ emit_library_call_value VPROTO((rtx orgfun, rtx value, int no_queue, ...@@ -3530,7 +3534,8 @@ emit_library_call_value VPROTO((rtx orgfun, rtx value, int no_queue,
emit_call_1 (fun, emit_call_1 (fun,
get_identifier (XSTR (orgfun, 0)), get_identifier (XSTR (orgfun, 0)),
build_function_type (type_for_mode (outmode, 0), NULL_TREE), build_function_type (type_for_mode (outmode, 0), NULL_TREE),
args_size.constant, struct_value_size, original_args_size.constant, args_size.constant,
struct_value_size,
FUNCTION_ARG (args_so_far, VOIDmode, void_type_node, 1), FUNCTION_ARG (args_so_far, VOIDmode, void_type_node, 1),
mem_value == 0 ? hard_libcall_value (outmode) : NULL_RTX, mem_value == 0 ? hard_libcall_value (outmode) : NULL_RTX,
old_inhibit_defer_pop + 1, call_fusage, is_const); old_inhibit_defer_pop + 1, call_fusage, is_const);
......
...@@ -58,10 +58,6 @@ Boston, MA 02111-1307, USA. */ ...@@ -58,10 +58,6 @@ Boston, MA 02111-1307, USA. */
#include "toplev.h" #include "toplev.h"
#include "hash.h" #include "hash.h"
#if !defined PREFERRED_STACK_BOUNDARY && defined STACK_BOUNDARY
#define PREFERRED_STACK_BOUNDARY STACK_BOUNDARY
#endif
#ifndef TRAMPOLINE_ALIGNMENT #ifndef TRAMPOLINE_ALIGNMENT
#define TRAMPOLINE_ALIGNMENT FUNCTION_BOUNDARY #define TRAMPOLINE_ALIGNMENT FUNCTION_BOUNDARY
#endif #endif
...@@ -5063,14 +5059,6 @@ assign_parms (fndecl, second_time) ...@@ -5063,14 +5059,6 @@ assign_parms (fndecl, second_time)
#endif #endif
#endif #endif
#ifdef PREFERRED_STACK_BOUNDARY
#define STACK_BYTES (PREFERRED_STACK_BOUNDARY / BITS_PER_UNIT)
current_function_args_size
= ((current_function_args_size + STACK_BYTES - 1)
/ STACK_BYTES) * STACK_BYTES;
#endif
#ifdef ARGS_GROW_DOWNWARD #ifdef ARGS_GROW_DOWNWARD
current_function_arg_offset_rtx current_function_arg_offset_rtx
= (stack_args_size.var == 0 ? GEN_INT (-stack_args_size.constant) = (stack_args_size.var == 0 ? GEN_INT (-stack_args_size.constant)
......
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