OSDN Git Service

* tree-def (WITH_SIZE_EXPR): New.
[pf3gnuchains/gcc-fork.git] / gcc / calls.c
index e128162..c48fd82 100644 (file)
@@ -163,8 +163,6 @@ rtx
 prepare_call_address (rtx funexp, rtx static_chain_value,
                      rtx *call_fusage, int reg_parm_seen, int sibcallp)
 {
-  funexp = protect_from_queue (funexp, 0);
-
   /* Make a valid memory address and copy constants through pseudo-regs,
      but not for a constant address if -fno-function-cse.  */
   if (GET_CODE (funexp) != SYMBOL_REF)
@@ -481,7 +479,7 @@ special_function_p (tree fndecl, int flags)
          hacky imitation of DECL_ASSEMBLER_NAME.  It's (also) wrong
          because you can declare fork() inside a function if you
          wish.  */
-      && (DECL_CONTEXT (fndecl) == NULL_TREE 
+      && (DECL_CONTEXT (fndecl) == NULL_TREE
          || TREE_CODE (DECL_CONTEXT (fndecl)) == TRANSLATION_UNIT_DECL)
       && TREE_PUBLIC (fndecl))
     {
@@ -663,10 +661,6 @@ precompute_register_parameters (int num_actuals, struct arg_data *args, int *reg
                                         VOIDmode, 0);
            preserve_temp_slots (args[i].value);
            pop_temp_slots ();
-
-           /* ANSI doesn't require a sequence point here,
-              but PCC has one, so this will avoid some problems.  */
-           emit_queue ();
          }
 
        /* If the value is a non-legitimate constant, force it into a
@@ -893,7 +887,7 @@ store_unaligned_arguments_into_pseudos (struct arg_data *args, int num_actuals)
    and may be modified by this routine.
 
    OLD_PENDING_ADJ, MUST_PREALLOCATE and FLAGS are pointers to integer
-   flags which may may be modified by this routine. 
+   flags which may may be modified by this routine.
 
    MAY_TAILCALL is cleared if we encounter an invisible pass-by-reference
    that requires allocation of stack space.
@@ -974,11 +968,8 @@ initialize_argument_information (int num_actuals ATTRIBUTE_UNUSED,
         with those made by function.c.  */
 
       /* See if this argument should be passed by invisible reference.  */
-      if (CONTAINS_PLACEHOLDER_P (TYPE_SIZE (type))
-         || TREE_ADDRESSABLE (type)
-         || FUNCTION_ARG_PASS_BY_REFERENCE (*args_so_far, TYPE_MODE (type),
-                                            type, argpos < n_named_args)
-         )
+      if (pass_by_reference (args_so_far, TYPE_MODE (type),
+                            type, argpos < n_named_args))
        {
          /* If we're compiling a thunk, pass through invisible
              references instead of making a copy.  */
@@ -1250,7 +1241,7 @@ precompute_arguments (int flags, int num_actuals, struct arg_data *args)
      get extraneous instructions emitted as part of the libcall sequence.  */
   if ((flags & ECF_LIBCALL_BLOCK) == 0)
     return;
-    
+
   for (i = 0; i < num_actuals; i++)
     {
       enum machine_mode mode;
@@ -1259,15 +1250,8 @@ precompute_arguments (int flags, int num_actuals, struct arg_data *args)
       if (TREE_ADDRESSABLE (TREE_TYPE (args[i].tree_value)))
        abort ();
 
-      args[i].value
-       = expand_expr (args[i].tree_value, NULL_RTX, VOIDmode, 0);
-
-      /* ANSI doesn't require a sequence point here,
-        but PCC has one, so this will avoid some problems.  */
-      emit_queue ();
-
       args[i].initial_value = args[i].value
-       = protect_from_queue (args[i].value, 0);
+       = expand_expr (args[i].tree_value, NULL_RTX, VOIDmode, 0);
 
       mode = TYPE_MODE (TREE_TYPE (args[i].tree_value));
       if (mode != args[i].mode)
@@ -1442,7 +1426,6 @@ rtx_for_function_call (tree fndecl, tree addr)
       push_temp_slots ();
       funexp = expand_expr (addr, NULL_RTX, VOIDmode, 0);
       pop_temp_slots ();       /* FUNEXP can't be BLKmode.  */
-      emit_queue ();
     }
   return funexp;
 }
@@ -2134,7 +2117,7 @@ expand_call (tree exp, rtx target, int ignore)
                  || (ACCUMULATE_OUTGOING_ARGS
                      && stack_arg_under_construction
                      && structure_value_addr == virtual_outgoing_args_rtx)
-                 ? copy_addr_to_reg (convert_memory_address 
+                 ? copy_addr_to_reg (convert_memory_address
                                      (Pmode, structure_value_addr))
                  : structure_value_addr);
 
@@ -2240,7 +2223,7 @@ expand_call (tree exp, rtx target, int ignore)
          || (!ACCUMULATE_OUTGOING_ARGS && args_size.constant)))
     structure_value_addr = copy_to_reg (structure_value_addr);
 
-  /* Tail calls can make things harder to debug, and we're traditionally
+  /* Tail calls can make things harder to debug, and we've traditionally
      pushed these optimizations into -O2.  Don't try if we're already
      expanding a call, as that means we're an argument.  Don't try if
      there's cleanups, as we know there's code to follow the call.
@@ -2359,7 +2342,7 @@ expand_call (tree exp, rtx target, int ignore)
       int sibcall_failure = 0;
       /* We want to emit any pending stack adjustments before the tail
         recursion "call".  That way we know any adjustment after the tail
-        recursion call can be ignored if we indeed use the tail 
+        recursion call can be ignored if we indeed use the tail
         call expansion.  */
       int save_pending_stack_adjust = 0;
       int save_stack_pointer_delta = 0;
@@ -2368,10 +2351,6 @@ expand_call (tree exp, rtx target, int ignore)
 
       if (pass == 0)
        {
-         /* Emit any queued insns now; otherwise they would end up in
-             only one of the alternates.  */
-         emit_queue ();
-
          /* State variables we need to save and restore between
             iterations.  */
          save_pending_stack_adjust = pending_stack_adjust;
@@ -2776,7 +2755,7 @@ expand_call (tree exp, rtx target, int ignore)
         structure value.  */
       if (pass != 0 && structure_value_addr && ! structure_value_addr_parm)
        {
-         structure_value_addr 
+         structure_value_addr
            = convert_memory_address (Pmode, structure_value_addr);
          emit_move_insn (struct_value,
                          force_reg (Pmode,
@@ -2793,9 +2772,6 @@ expand_call (tree exp, rtx target, int ignore)
       load_register_parameters (args, num_actuals, &call_fusage, flags,
                                pass == 0, &sibcall_failure);
 
-      /* Perform postincrements before actually calling the function.  */
-      emit_queue ();
-
       /* Save a pointer to the last insn before the call, so that we can
         later safely search backwards to find the CALL_INSN.  */
       before_call = get_last_insn ();
@@ -2864,8 +2840,8 @@ expand_call (tree exp, rtx target, int ignore)
                  && (DECL_FUNCTION_CODE (fndecl) == BUILT_IN_SQRT
                      || DECL_FUNCTION_CODE (fndecl) == BUILT_IN_SQRTF
                      || DECL_FUNCTION_CODE (fndecl) == BUILT_IN_SQRTL))
-               note = gen_rtx_fmt_e (SQRT, 
-                                     GET_MODE (temp), 
+               note = gen_rtx_fmt_e (SQRT,
+                                     GET_MODE (temp),
                                      args[0].initial_value);
              else
                {
@@ -2876,7 +2852,7 @@ expand_call (tree exp, rtx target, int ignore)
                    note = gen_rtx_EXPR_LIST (VOIDmode,
                                              args[i].initial_value, note);
                  note = gen_rtx_EXPR_LIST (VOIDmode, funexp, note);
-                 
+
                  if (flags & ECF_PURE)
                    note = gen_rtx_EXPR_LIST (VOIDmode,
                        gen_rtx_USE (VOIDmode,
@@ -3069,6 +3045,7 @@ expand_call (tree exp, rtx target, int ignore)
          emit_stack_restore (SAVE_BLOCK, old_stack_level, NULL_RTX);
          stack_pointer_delta = old_stack_pointer_delta;
          pending_stack_adjust = old_pending_adj;
+         old_stack_allocated = stack_pointer_delta - pending_stack_adjust;
          stack_arg_under_construction = old_stack_arg_under_construction;
          highest_outgoing_arg_in_use = initial_highest_arg_in_use;
          stack_usage_map = initial_stack_usage_map;
@@ -3551,15 +3528,12 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value,
          || (GET_MODE (val) != mode && GET_MODE (val) != VOIDmode))
        abort ();
 
-      /* There's no need to call protect_from_queue, because
-        either emit_move_insn or emit_push_insn will do that.  */
-
       /* Make sure it is a reasonable operand for a move or push insn.  */
       if (!REG_P (val) && !MEM_P (val)
          && ! (CONSTANT_P (val) && LEGITIMATE_CONSTANT_P (val)))
        val = force_operand (val, NULL_RTX);
 
-      if (FUNCTION_ARG_PASS_BY_REFERENCE (args_so_far, mode, NULL_TREE, 1))
+      if (pass_by_reference (&args_so_far, mode, NULL_TREE, 1))
        {
          rtx slot;
          int must_copy = ! FUNCTION_ARG_CALLEE_COPIES (args_so_far, mode,
@@ -3967,7 +3941,7 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value,
          if (GET_CODE (valreg) == PARALLEL)
            {
              temp = gen_reg_rtx (outmode);
-             emit_group_store (temp, valreg, NULL_TREE, 
+             emit_group_store (temp, valreg, NULL_TREE,
                                GET_MODE_SIZE (outmode));
              valreg = temp;
            }
@@ -4059,7 +4033,6 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value,
    for a value of mode OUTMODE,
    with NARGS different arguments, passed as alternating rtx values
    and machine_modes to convert them to.
-   The rtx values should have been passed through protect_from_queue already.
 
    FN_TYPE should be LCT_NORMAL for `normal' calls, LCT_CONST for `const'
    calls, LCT_PURE for `pure' calls, LCT_CONST_MAKE_BLOCK for `const' calls
@@ -4345,7 +4318,7 @@ store_one_arg (struct arg_data *arg, rtx argblock, int flags,
            excess = (arg->locate.size.constant
                      - int_size_in_bytes (TREE_TYPE (pval))
                      + partial * GET_MODE_SIZE (GET_MODE (elt)));
-         } 
+         }
          else
            excess = (arg->locate.size.constant
                      - int_size_in_bytes (TREE_TYPE (pval))
@@ -4431,10 +4404,6 @@ store_one_arg (struct arg_data *arg, rtx argblock, int flags,
      be deferred during the rest of the arguments.  */
   NO_DEFER_POP;
 
-  /* ANSI doesn't require a sequence point here,
-     but PCC has one, so this will avoid some problems.  */
-  emit_queue ();
-
   /* Free any temporary slots made in processing this argument.  Show
      that we might have taken the address of something and pushed that
      as an operand.  */
@@ -4466,7 +4435,7 @@ must_pass_in_stack_var_size (enum machine_mode mode ATTRIBUTE_UNUSED,
   return false;
 }
 
-/* Another version of the TARGET_MUST_PASS_IN_STACK hook.  This one 
+/* Another version of the TARGET_MUST_PASS_IN_STACK hook.  This one
    takes trailing padding of a structure into account.  */
 /* ??? Should be able to merge these two by examining BLOCK_REG_PADDING.  */