OSDN Git Service

Daily bump.
[pf3gnuchains/gcc-fork.git] / gcc / calls.c
index e2c4fcb..f6bc970 100644 (file)
@@ -136,7 +136,7 @@ static int compute_argument_block_size (int, struct args_size *, tree, tree, int
 static void initialize_argument_information (int, struct arg_data *,
                                             struct args_size *, int,
                                             tree, tree,
-                                            tree, CUMULATIVE_ARGS *, int,
+                                            tree, tree, CUMULATIVE_ARGS *, int,
                                             rtx *, int *, int *, int *,
                                             bool *, bool);
 static void compute_argument_addresses (struct arg_data *, rtx, int);
@@ -938,7 +938,7 @@ initialize_argument_information (int num_actuals ATTRIBUTE_UNUSED,
                                 struct args_size *args_size,
                                 int n_named_args ATTRIBUTE_UNUSED,
                                 tree exp, tree struct_value_addr_value,
-                                tree fndecl,
+                                tree fndecl, tree fntype,
                                 CUMULATIVE_ARGS *args_so_far,
                                 int reg_parm_stack_space,
                                 rtx *old_stack_level, int *old_pending_adj,
@@ -1119,7 +1119,9 @@ initialize_argument_information (int num_actuals ATTRIBUTE_UNUSED,
       mode = TYPE_MODE (type);
       unsignedp = TYPE_UNSIGNED (type);
 
-      if (targetm.calls.promote_function_args (fndecl ? TREE_TYPE (fndecl) : 0))
+      if (targetm.calls.promote_function_args (fndecl
+                                              ? TREE_TYPE (fndecl)
+                                              : fntype))
        mode = promote_mode (type, mode, &unsignedp, 1);
 
       args[i].unsignedp = unsignedp;
@@ -2088,7 +2090,7 @@ expand_call (tree exp, rtx target, int ignore)
   /* Set up a place to return a structure.  */
 
   /* Cater to broken compilers.  */
-  if (aggregate_value_p (exp, fndecl))
+  if (aggregate_value_p (exp, (!fndecl ? fntype : fndecl)))
     {
       /* This call returns a big structure.  */
       flags &= ~(ECF_CONST | ECF_PURE | ECF_LOOPING_CONST_OR_PURE);
@@ -2245,7 +2247,7 @@ expand_call (tree exp, rtx target, int ignore)
      arguments into ARGS_SIZE, etc.  */
   initialize_argument_information (num_actuals, args, &args_size,
                                   n_named_args, exp,
-                                  structure_value_addr_value, fndecl,
+                                  structure_value_addr_value, fndecl, fntype,
                                   &args_so_far, reg_parm_stack_space,
                                   &old_stack_level, &old_pending_adj,
                                   &must_preallocate, &flags,
@@ -2296,6 +2298,12 @@ expand_call (tree exp, rtx target, int ignore)
         It does not seem worth the effort since few optimizable
         sibling calls will return a structure.  */
       || structure_value_addr != NULL_RTX
+#ifdef REG_PARM_STACK_SPACE
+      /* If outgoing reg parm stack space changes, we can not do sibcall.  */
+      || (OUTGOING_REG_PARM_STACK_SPACE (funtype)
+         != OUTGOING_REG_PARM_STACK_SPACE (TREE_TYPE (current_function_decl)))
+      || (reg_parm_stack_space != REG_PARM_STACK_SPACE (fndecl))
+#endif
       /* Check whether the target is able to optimize the call
         into a sibcall.  */
       || !targetm.function_ok_for_sibcall (fndecl, exp)