]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
calls.c (emit_call_1): New arg rounded_stack_size; update callers.
authorRichard Henderson <rth@cygnus.com>
Sun, 25 Apr 1999 12:31:52 +0000 (05:31 -0700)
committerRichard Henderson <rth@gcc.gnu.org>
Sun, 25 Apr 1999 12:31:52 +0000 (05:31 -0700)
        * 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

gcc/ChangeLog
gcc/calls.c
gcc/function.c

index e153d1d8243bdf35e10899940a3acfcadee5ae43..d0af7b2ffcac7b4505741f0c2618960e5980e297 100644 (file)
@@ -1,3 +1,11 @@
+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)
 
        * stupid.c (stupid_mark_refs): Generate a REG_UNUSED note
index af96b9b60fbf9a5c1100f092f90718b48a56a4f2..808ff56a74d9622295f90a87e36b39ebfbaa1f34 100644 (file)
@@ -127,8 +127,8 @@ int stack_arg_under_construction;
 static int calls_function      PROTO ((tree, int));
 static int calls_function_1    PROTO ((tree, int));
 static void emit_call_1                PROTO ((rtx, tree, tree, HOST_WIDE_INT,
-                                       HOST_WIDE_INT, rtx, rtx,
-                                       int, rtx, int));
+                                       HOST_WIDE_INT, HOST_WIDE_INT, rtx,
+                                       rtx, int, rtx, int));
 static void special_function_p PROTO ((char *, tree, int *, int *,
                                        int *, int *));
 static void precompute_register_parameters     PROTO ((int, struct arg_data *,
@@ -374,13 +374,14 @@ prepare_call_address (funexp, fndecl, call_fusage, reg_parm_seen)
    IS_CONST is true if this is a `const' call.  */
 
 static void
-emit_call_1 (funexp, fndecl, funtype, stack_size, struct_value_size, 
-             next_arg_reg, valreg, old_inhibit_defer_pop, call_fusage,
-            is_const)
+emit_call_1 (funexp, fndecl, funtype, stack_size, rounded_stack_size,
+            struct_value_size, next_arg_reg, valreg, old_inhibit_defer_pop,
+            call_fusage, is_const)
      rtx funexp;
      tree fndecl ATTRIBUTE_UNUSED;
      tree funtype ATTRIBUTE_UNUSED;
      HOST_WIDE_INT stack_size;
+     HOST_WIDE_INT rounded_stack_size;
      HOST_WIDE_INT struct_value_size;
      rtx next_arg_reg;
      rtx valreg;
@@ -393,6 +394,7 @@ emit_call_1 (funexp, fndecl, funtype, stack_size, struct_value_size,
   rtx call_insn;
 #ifndef ACCUMULATE_OUTGOING_ARGS
   int already_popped = 0;
+  HOST_WIDE_INT n_popped = RETURN_POPS_ARGS (fndecl, funtype, stack_size);
 #endif
 
   /* 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,
 
 #ifndef ACCUMULATE_OUTGOING_ARGS
 #if defined (HAVE_call_pop) && defined (HAVE_call_value_pop)
-  if (HAVE_call_pop && HAVE_call_value_pop
-      && (RETURN_POPS_ARGS (fndecl, funtype, stack_size) > 0 
-          || stack_size == 0))
+  if (HAVE_call_pop && HAVE_call_value_pop && n_popped > 0)
     {
-      rtx n_pop = GEN_INT (RETURN_POPS_ARGS (fndecl, funtype, stack_size));
+      rtx n_pop = GEN_INT (n_popped);
       rtx pat;
 
       /* 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,
      If returning from the subroutine does pop the args, indicate that the
      stack pointer will be changed.  */
 
-  if (stack_size != 0 && RETURN_POPS_ARGS (fndecl, funtype, stack_size) > 0)
+  if (n_popped > 0)
     {
       if (!already_popped)
        CALL_INSN_FUNCTION_USAGE (call_insn)
          = gen_rtx_EXPR_LIST (VOIDmode,
                               gen_rtx_CLOBBER (VOIDmode, stack_pointer_rtx),
                               CALL_INSN_FUNCTION_USAGE (call_insn));
-      stack_size -= RETURN_POPS_ARGS (fndecl, funtype, stack_size);
-      stack_size_rtx = GEN_INT (stack_size);
+      stack_size -= n_popped;
+      rounded_stack_size -= n_popped;
     }
 
-  if (stack_size != 0)
+  if (rounded_stack_size != 0)
     {
       if (flag_defer_pop && inhibit_defer_pop == 0 && !is_const)
-       pending_stack_adjust += stack_size;
+       pending_stack_adjust += rounded_stack_size;
       else
-       adjust_stack (stack_size_rtx);
+       adjust_stack (GEN_INT (rounded_stack_size));
     }
 #endif
 }
@@ -1168,8 +1168,11 @@ compute_argument_block_size (reg_parm_stack_space, args_size)
   else
     {
 #ifdef PREFERRED_STACK_BOUNDARY
-      args_size->constant = (((args_size->constant + (STACK_BYTES - 1))
-                             / STACK_BYTES) * STACK_BYTES);
+      args_size->constant = (((args_size->constant
+                              + pending_stack_adjust
+                              + STACK_BYTES - 1)
+                             / STACK_BYTES * STACK_BYTES)
+                            - pending_stack_adjust);
 #endif
 
       args_size->constant = MAX (args_size->constant,
@@ -2272,7 +2275,8 @@ expand_call (exp, target, ignore)
   /* All arguments and registers used for the call must be set up by now!  */
 
   /* 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),
               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,
                get_identifier (XSTR (orgfun, 0)), 
               build_function_type (outmode == VOIDmode ? void_type_node
                                    : 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),
               outmode != VOIDmode ? hard_libcall_value (outmode) : NULL_RTX,
               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,
   emit_call_1 (fun, 
                get_identifier (XSTR (orgfun, 0)),
               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),
               mem_value == 0 ? hard_libcall_value (outmode) : NULL_RTX,
               old_inhibit_defer_pop + 1, call_fusage, is_const);
index 30357865d73a2e0b95bcad7bca2c3299c967049e..7590caf2d04588c123087a568db7a04248e48def 100644 (file)
@@ -58,10 +58,6 @@ Boston, MA 02111-1307, USA.  */
 #include "toplev.h"
 #include "hash.h"
 
-#if !defined PREFERRED_STACK_BOUNDARY && defined STACK_BOUNDARY
-#define PREFERRED_STACK_BOUNDARY STACK_BOUNDARY
-#endif
-
 #ifndef TRAMPOLINE_ALIGNMENT
 #define TRAMPOLINE_ALIGNMENT FUNCTION_BOUNDARY
 #endif
@@ -5063,14 +5059,6 @@ assign_parms (fndecl, second_time)
 #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
   current_function_arg_offset_rtx
     = (stack_args_size.var == 0 ? GEN_INT (-stack_args_size.constant)