comparison gcc/calls.c @ 67:f6334be47118

update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
author nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
date Tue, 22 Mar 2011 17:18:12 +0900
parents b7f97abdc517
children 1b10fe6932e1 04ced10e8804
comparison
equal deleted inserted replaced
65:65488c3d617d 67:f6334be47118
30 #include "expr.h" 30 #include "expr.h"
31 #include "optabs.h" 31 #include "optabs.h"
32 #include "libfuncs.h" 32 #include "libfuncs.h"
33 #include "function.h" 33 #include "function.h"
34 #include "regs.h" 34 #include "regs.h"
35 #include "toplev.h" 35 #include "diagnostic-core.h"
36 #include "output.h" 36 #include "output.h"
37 #include "tm_p.h" 37 #include "tm_p.h"
38 #include "timevar.h" 38 #include "timevar.h"
39 #include "sbitmap.h" 39 #include "sbitmap.h"
40 #include "langhooks.h" 40 #include "langhooks.h"
87 /* Location on the stack at which parameter should be stored. The store 87 /* Location on the stack at which parameter should be stored. The store
88 has already been done if STACK == VALUE. */ 88 has already been done if STACK == VALUE. */
89 rtx stack; 89 rtx stack;
90 /* Location on the stack of the start of this argument slot. This can 90 /* Location on the stack of the start of this argument slot. This can
91 differ from STACK if this arg pads downward. This location is known 91 differ from STACK if this arg pads downward. This location is known
92 to be aligned to FUNCTION_ARG_BOUNDARY. */ 92 to be aligned to TARGET_FUNCTION_ARG_BOUNDARY. */
93 rtx stack_slot; 93 rtx stack_slot;
94 /* Place that this stack area has been saved, if needed. */ 94 /* Place that this stack area has been saved, if needed. */
95 rtx save_area; 95 rtx save_area;
96 /* If an argument's alignment does not permit direct copying into registers, 96 /* If an argument's alignment does not permit direct copying into registers,
97 copy in smaller-sized pieces into pseudos. These are stored in a 97 copy in smaller-sized pieces into pseudos. These are stored in a
206 /* Generate instructions to call function FUNEXP, 206 /* Generate instructions to call function FUNEXP,
207 and optionally pop the results. 207 and optionally pop the results.
208 The CALL_INSN is the first insn generated. 208 The CALL_INSN is the first insn generated.
209 209
210 FNDECL is the declaration node of the function. This is given to the 210 FNDECL is the declaration node of the function. This is given to the
211 macro RETURN_POPS_ARGS to determine whether this function pops its own args. 211 hook TARGET_RETURN_POPS_ARGS to determine whether this function pops
212 212 its own args.
213 FUNTYPE is the data type of the function. This is given to the macro 213
214 RETURN_POPS_ARGS to determine whether this function pops its own args. 214 FUNTYPE is the data type of the function. This is given to the hook
215 We used to allow an identifier for library functions, but that doesn't 215 TARGET_RETURN_POPS_ARGS to determine whether this function pops its
216 work when the return type is an aggregate type and the calling convention 216 own args. We used to allow an identifier for library functions, but
217 says that the pointer to this aggregate is to be popped by the callee. 217 that doesn't work when the return type is an aggregate type and the
218 calling convention says that the pointer to this aggregate is to be
219 popped by the callee.
218 220
219 STACK_SIZE is the number of bytes of arguments on the stack, 221 STACK_SIZE is the number of bytes of arguments on the stack,
220 ROUNDED_STACK_SIZE is that number rounded up to 222 ROUNDED_STACK_SIZE is that number rounded up to
221 PREFERRED_STACK_BOUNDARY; zero if the size is variable. This is 223 PREFERRED_STACK_BOUNDARY; zero if the size is variable. This is
222 both to put into the call insn and to generate explicit popping 224 both to put into the call insn and to generate explicit popping
224 226
225 STRUCT_VALUE_SIZE is the number of bytes wanted in a structure value. 227 STRUCT_VALUE_SIZE is the number of bytes wanted in a structure value.
226 It is zero if this call doesn't want a structure value. 228 It is zero if this call doesn't want a structure value.
227 229
228 NEXT_ARG_REG is the rtx that results from executing 230 NEXT_ARG_REG is the rtx that results from executing
229 FUNCTION_ARG (args_so_far, VOIDmode, void_type_node, 1) 231 targetm.calls.function_arg (&args_so_far, VOIDmode, void_type_node, true)
230 just after all the args have had their registers assigned. 232 just after all the args have had their registers assigned.
231 This could be whatever you like, but normally it is the first 233 This could be whatever you like, but normally it is the first
232 arg-register beyond those used for args in this call, 234 arg-register beyond those used for args in this call,
233 or 0 if all the arg-registers are used in this call. 235 or 0 if all the arg-registers are used in this call.
234 It is passed on to `gen_call' so you can put this info in the call insn. 236 It is passed on to `gen_call' so you can put this info in the call insn.
254 CUMULATIVE_ARGS *args_so_far ATTRIBUTE_UNUSED) 256 CUMULATIVE_ARGS *args_so_far ATTRIBUTE_UNUSED)
255 { 257 {
256 rtx rounded_stack_size_rtx = GEN_INT (rounded_stack_size); 258 rtx rounded_stack_size_rtx = GEN_INT (rounded_stack_size);
257 rtx call_insn; 259 rtx call_insn;
258 int already_popped = 0; 260 int already_popped = 0;
259 HOST_WIDE_INT n_popped = RETURN_POPS_ARGS (fndecl, funtype, stack_size); 261 HOST_WIDE_INT n_popped
262 = targetm.calls.return_pops_args (fndecl, funtype, stack_size);
260 263
261 #ifdef CALL_POPS_ARGS 264 #ifdef CALL_POPS_ARGS
262 n_popped += CALL_POPS_ARGS (* args_so_far); 265 n_popped += CALL_POPS_ARGS (* args_so_far);
263 #endif 266 #endif
264 267
596 /* The function exp may have the `returns_twice' attribute. */ 599 /* The function exp may have the `returns_twice' attribute. */
597 if (DECL_IS_RETURNS_TWICE (exp)) 600 if (DECL_IS_RETURNS_TWICE (exp))
598 flags |= ECF_RETURNS_TWICE; 601 flags |= ECF_RETURNS_TWICE;
599 602
600 /* Process the pure and const attributes. */ 603 /* Process the pure and const attributes. */
601 if (TREE_READONLY (exp) && ! TREE_THIS_VOLATILE (exp)) 604 if (TREE_READONLY (exp))
602 flags |= ECF_CONST; 605 flags |= ECF_CONST;
603 if (DECL_PURE_P (exp)) 606 if (DECL_PURE_P (exp))
604 flags |= ECF_PURE; 607 flags |= ECF_PURE;
605 if (DECL_LOOPING_CONST_OR_PURE_P (exp)) 608 if (DECL_LOOPING_CONST_OR_PURE_P (exp))
606 flags |= ECF_LOOPING_CONST_OR_PURE; 609 flags |= ECF_LOOPING_CONST_OR_PURE;
607 610
608 if (DECL_IS_NOVOPS (exp)) 611 if (DECL_IS_NOVOPS (exp))
609 flags |= ECF_NOVOPS; 612 flags |= ECF_NOVOPS;
613 if (lookup_attribute ("leaf", DECL_ATTRIBUTES (exp)))
614 flags |= ECF_LEAF;
610 615
611 if (TREE_NOTHROW (exp)) 616 if (TREE_NOTHROW (exp))
612 flags |= ECF_NOTHROW; 617 flags |= ECF_NOTHROW;
613 618
614 flags = special_function_p (exp, flags); 619 flags = special_function_p (exp, flags);
615 } 620 }
616 else if (TYPE_P (exp) && TYPE_READONLY (exp) && ! TREE_THIS_VOLATILE (exp)) 621 else if (TYPE_P (exp) && TYPE_READONLY (exp))
617 flags |= ECF_CONST; 622 flags |= ECF_CONST;
618 623
619 if (TREE_THIS_VOLATILE (exp)) 624 if (TREE_THIS_VOLATILE (exp))
620 flags |= ECF_NORETURN; 625 {
626 flags |= ECF_NORETURN;
627 if (flags & (ECF_CONST|ECF_PURE))
628 flags |= ECF_LOOPING_CONST_OR_PURE;
629 }
621 630
622 return flags; 631 return flags;
623 } 632 }
624 633
625 /* Detect flags from a CALL_EXPR. */ 634 /* Detect flags from a CALL_EXPR. */
875 rtx reg = gen_reg_rtx (word_mode); 884 rtx reg = gen_reg_rtx (word_mode);
876 rtx word = operand_subword_force (args[i].value, j, BLKmode); 885 rtx word = operand_subword_force (args[i].value, j, BLKmode);
877 int bitsize = MIN (bytes * BITS_PER_UNIT, BITS_PER_WORD); 886 int bitsize = MIN (bytes * BITS_PER_UNIT, BITS_PER_WORD);
878 887
879 args[i].aligned_regs[j] = reg; 888 args[i].aligned_regs[j] = reg;
880 word = extract_bit_field (word, bitsize, 0, 1, NULL_RTX, 889 word = extract_bit_field (word, bitsize, 0, 1, false, NULL_RTX,
881 word_mode, word_mode); 890 word_mode, word_mode);
882 891
883 /* There is no need to restrict this code to loading items 892 /* There is no need to restrict this code to loading items
884 in TYPE_ALIGN sized hunks. The bitfield instructions can 893 in TYPE_ALIGN sized hunks. The bitfield instructions can
885 load up entire word sized registers efficiently. 894 load up entire word sized registers efficiently.
1081 for it. */ 1090 for it. */
1082 rtx size_rtx = expr_size (args[i].tree_value); 1091 rtx size_rtx = expr_size (args[i].tree_value);
1083 1092
1084 if (*old_stack_level == 0) 1093 if (*old_stack_level == 0)
1085 { 1094 {
1086 emit_stack_save (SAVE_BLOCK, old_stack_level, NULL_RTX); 1095 emit_stack_save (SAVE_BLOCK, old_stack_level);
1087 *old_pending_adj = pending_stack_adjust; 1096 *old_pending_adj = pending_stack_adjust;
1088 pending_stack_adjust = 0; 1097 pending_stack_adjust = 0;
1089 } 1098 }
1090 1099
1091 copy = gen_rtx_MEM (BLKmode, 1100 /* We can pass TRUE as the 4th argument because we just
1092 allocate_dynamic_stack_space 1101 saved the stack pointer and will restore it right after
1093 (size_rtx, NULL_RTX, TYPE_ALIGN (type))); 1102 the call. */
1103 copy = allocate_dynamic_stack_space (size_rtx,
1104 TYPE_ALIGN (type),
1105 TYPE_ALIGN (type),
1106 true);
1107 copy = gen_rtx_MEM (BLKmode, copy);
1094 set_mem_attributes (copy, type, 1); 1108 set_mem_attributes (copy, type, 1);
1095 } 1109 }
1096 else 1110 else
1097 copy = assign_temp (type, 0, 1, 0); 1111 copy = assign_temp (type, 0, 1, 0);
1098 1112
1122 fndecl ? TREE_TYPE (fndecl) : fntype, 0); 1136 fndecl ? TREE_TYPE (fndecl) : fntype, 0);
1123 1137
1124 args[i].unsignedp = unsignedp; 1138 args[i].unsignedp = unsignedp;
1125 args[i].mode = mode; 1139 args[i].mode = mode;
1126 1140
1127 args[i].reg = FUNCTION_ARG (*args_so_far, mode, type, 1141 args[i].reg = targetm.calls.function_arg (args_so_far, mode, type,
1128 argpos < n_named_args); 1142 argpos < n_named_args);
1129 #ifdef FUNCTION_INCOMING_ARG 1143
1130 /* If this is a sibling call and the machine has register windows, the 1144 /* If this is a sibling call and the machine has register windows, the
1131 register window has to be unwinded before calling the routine, so 1145 register window has to be unwinded before calling the routine, so
1132 arguments have to go into the incoming registers. */ 1146 arguments have to go into the incoming registers. */
1133 args[i].tail_call_reg = FUNCTION_INCOMING_ARG (*args_so_far, mode, type, 1147 if (targetm.calls.function_incoming_arg != targetm.calls.function_arg)
1134 argpos < n_named_args); 1148 args[i].tail_call_reg
1135 #else 1149 = targetm.calls.function_incoming_arg (args_so_far, mode, type,
1136 args[i].tail_call_reg = args[i].reg; 1150 argpos < n_named_args);
1137 #endif 1151 else
1152 args[i].tail_call_reg = args[i].reg;
1138 1153
1139 if (args[i].reg) 1154 if (args[i].reg)
1140 args[i].partial 1155 args[i].partial
1141 = targetm.calls.arg_partial_bytes (args_so_far, mode, type, 1156 = targetm.calls.arg_partial_bytes (args_so_far, mode, type,
1142 argpos < n_named_args); 1157 argpos < n_named_args);
1187 ADD_PARM_SIZE (*args_size, args[i].locate.size.var); 1202 ADD_PARM_SIZE (*args_size, args[i].locate.size.var);
1188 1203
1189 /* Increment ARGS_SO_FAR, which has info about which arg-registers 1204 /* Increment ARGS_SO_FAR, which has info about which arg-registers
1190 have been used, etc. */ 1205 have been used, etc. */
1191 1206
1192 FUNCTION_ARG_ADVANCE (*args_so_far, TYPE_MODE (type), type, 1207 targetm.calls.function_arg_advance (args_so_far, TYPE_MODE (type),
1193 argpos < n_named_args); 1208 type, argpos < n_named_args);
1194 } 1209 }
1195 } 1210 }
1196 1211
1197 /* Update ARGS_SIZE to contain the total size for the argument block. 1212 /* Update ARGS_SIZE to contain the total size for the argument block.
1198 Return the original constant component of the argument block's size. 1213 Return the original constant component of the argument block's size.
1666 1681
1667 else if (partial == 0 || args[i].pass_on_stack) 1682 else if (partial == 0 || args[i].pass_on_stack)
1668 { 1683 {
1669 rtx mem = validize_mem (args[i].value); 1684 rtx mem = validize_mem (args[i].value);
1670 1685
1671 /* Check for overlap with already clobbered argument area. */ 1686 /* Check for overlap with already clobbered argument area,
1687 providing that this has non-zero size. */
1672 if (is_sibcall 1688 if (is_sibcall
1673 && mem_overlaps_already_clobbered_arg_p (XEXP (args[i].value, 0), 1689 && (size == 0
1674 size)) 1690 || mem_overlaps_already_clobbered_arg_p
1691 (XEXP (args[i].value, 0), size)))
1675 *sibcall_failure = 1; 1692 *sibcall_failure = 1;
1676 1693
1677 /* Handle a BLKmode that needs shifting. */ 1694 /* Handle a BLKmode that needs shifting. */
1678 if (nregs == 1 && size < UNITS_PER_WORD 1695 if (nregs == 1 && size < UNITS_PER_WORD
1679 #ifdef BLOCK_REG_PADDING 1696 #ifdef BLOCK_REG_PADDING
1884 { 1901 {
1885 rtx new_rtx; 1902 rtx new_rtx;
1886 1903
1887 if (REG_P (x) 1904 if (REG_P (x)
1888 && HARD_REGISTER_P (x) 1905 && HARD_REGISTER_P (x)
1889 && CLASS_LIKELY_SPILLED_P (REGNO_REG_CLASS (REGNO (x)))) 1906 && targetm.class_likely_spilled_p (REGNO_REG_CLASS (REGNO (x))))
1890 { 1907 {
1891 /* Make sure that we generate a REG rather than a CONCAT. 1908 /* Make sure that we generate a REG rather than a CONCAT.
1892 Moves into CONCATs can need nontrivial instructions, 1909 Moves into CONCATs can need nontrivial instructions,
1893 and the whole point of this function is to avoid 1910 and the whole point of this function is to avoid
1894 using the hard register directly in such a situation. */ 1911 using the hard register directly in such a situation. */
2321 stack allocated by our caller. */ 2338 stack allocated by our caller. */
2322 || args_size.constant > (crtl->args.size 2339 || args_size.constant > (crtl->args.size
2323 - crtl->args.pretend_args_size) 2340 - crtl->args.pretend_args_size)
2324 /* If the callee pops its own arguments, then it must pop exactly 2341 /* If the callee pops its own arguments, then it must pop exactly
2325 the same number of arguments as the current function. */ 2342 the same number of arguments as the current function. */
2326 || (RETURN_POPS_ARGS (fndecl, funtype, args_size.constant) 2343 || (targetm.calls.return_pops_args (fndecl, funtype, args_size.constant)
2327 != RETURN_POPS_ARGS (current_function_decl, 2344 != targetm.calls.return_pops_args (current_function_decl,
2328 TREE_TYPE (current_function_decl), 2345 TREE_TYPE (current_function_decl),
2329 crtl->args.size)) 2346 crtl->args.size))
2330 || !lang_hooks.decls.ok_for_sibcall (fndecl)) 2347 || !lang_hooks.decls.ok_for_sibcall (fndecl))
2331 try_tail_call = 0; 2348 try_tail_call = 0;
2332 2349
2333 /* Check if caller and callee disagree in promotion of function 2350 /* Check if caller and callee disagree in promotion of function
2334 return value. */ 2351 return value. */
2469 make space for all args right now. */ 2486 make space for all args right now. */
2470 else if (adjusted_args_size.var != 0) 2487 else if (adjusted_args_size.var != 0)
2471 { 2488 {
2472 if (old_stack_level == 0) 2489 if (old_stack_level == 0)
2473 { 2490 {
2474 emit_stack_save (SAVE_BLOCK, &old_stack_level, NULL_RTX); 2491 emit_stack_save (SAVE_BLOCK, &old_stack_level);
2475 old_stack_pointer_delta = stack_pointer_delta; 2492 old_stack_pointer_delta = stack_pointer_delta;
2476 old_pending_adj = pending_stack_adjust; 2493 old_pending_adj = pending_stack_adjust;
2477 pending_stack_adjust = 0; 2494 pending_stack_adjust = 0;
2478 /* stack_arg_under_construction says whether a stack arg is 2495 /* stack_arg_under_construction says whether a stack arg is
2479 being constructed at the old stack level. Pushing the stack 2496 being constructed at the old stack level. Pushing the stack
2480 gets a clean outgoing argument block. */ 2497 gets a clean outgoing argument block. */
2481 old_stack_arg_under_construction = stack_arg_under_construction; 2498 old_stack_arg_under_construction = stack_arg_under_construction;
2482 stack_arg_under_construction = 0; 2499 stack_arg_under_construction = 0;
2483 } 2500 }
2484 argblock = push_block (ARGS_SIZE_RTX (adjusted_args_size), 0, 0); 2501 argblock = push_block (ARGS_SIZE_RTX (adjusted_args_size), 0, 0);
2502 if (flag_stack_usage)
2503 current_function_has_unbounded_dynamic_stack_size = 1;
2485 } 2504 }
2486 else 2505 else
2487 { 2506 {
2488 /* Note that we must go through the motions of allocating an argument 2507 /* Note that we must go through the motions of allocating an argument
2489 block even if the size is zero because we may be storing args 2508 block even if the size is zero because we may be storing args
2622 + (OUTGOING_REG_PARM_STACK_SPACE ((!fndecl ? fntype 2641 + (OUTGOING_REG_PARM_STACK_SPACE ((!fndecl ? fntype
2623 : TREE_TYPE (fndecl))) ? 0 2642 : TREE_TYPE (fndecl))) ? 0
2624 : reg_parm_stack_space)); 2643 : reg_parm_stack_space));
2625 if (old_stack_level == 0) 2644 if (old_stack_level == 0)
2626 { 2645 {
2627 emit_stack_save (SAVE_BLOCK, &old_stack_level, 2646 emit_stack_save (SAVE_BLOCK, &old_stack_level);
2628 NULL_RTX);
2629 old_stack_pointer_delta = stack_pointer_delta; 2647 old_stack_pointer_delta = stack_pointer_delta;
2630 old_pending_adj = pending_stack_adjust; 2648 old_pending_adj = pending_stack_adjust;
2631 pending_stack_adjust = 0; 2649 pending_stack_adjust = 0;
2632 /* stack_arg_under_construction says whether a stack 2650 /* stack_arg_under_construction says whether a stack
2633 arg is being constructed at the old stack level. 2651 arg is being constructed at the old stack level.
2641 free (stack_usage_map_buf); 2659 free (stack_usage_map_buf);
2642 stack_usage_map_buf = XCNEWVEC (char, highest_outgoing_arg_in_use); 2660 stack_usage_map_buf = XCNEWVEC (char, highest_outgoing_arg_in_use);
2643 stack_usage_map = stack_usage_map_buf; 2661 stack_usage_map = stack_usage_map_buf;
2644 highest_outgoing_arg_in_use = 0; 2662 highest_outgoing_arg_in_use = 0;
2645 } 2663 }
2646 allocate_dynamic_stack_space (push_size, NULL_RTX, 2664 /* We can pass TRUE as the 4th argument because we just
2647 BITS_PER_UNIT); 2665 saved the stack pointer and will restore it right after
2666 the call. */
2667 allocate_dynamic_stack_space (push_size, 0,
2668 BIGGEST_ALIGNMENT, true);
2648 } 2669 }
2649 2670
2650 /* If argument evaluation might modify the stack pointer, 2671 /* If argument evaluation might modify the stack pointer,
2651 copy the address of the argument list to a register. */ 2672 copy the address of the argument list to a register. */
2652 for (i = 0; i < num_actuals; i++) 2673 for (i = 0; i < num_actuals; i++)
2682 } 2703 }
2683 /* Now that the stack is properly aligned, pops can't safely 2704 /* Now that the stack is properly aligned, pops can't safely
2684 be deferred during the evaluation of the arguments. */ 2705 be deferred during the evaluation of the arguments. */
2685 NO_DEFER_POP; 2706 NO_DEFER_POP;
2686 2707
2708 /* Record the maximum pushed stack space size. We need to delay
2709 doing it this far to take into account the optimization done
2710 by combine_pending_stack_adjustment_and_call. */
2711 if (flag_stack_usage
2712 && !ACCUMULATE_OUTGOING_ARGS
2713 && pass
2714 && adjusted_args_size.var == 0)
2715 {
2716 int pushed = adjusted_args_size.constant + pending_stack_adjust;
2717 if (pushed > current_function_pushed_stack_size)
2718 current_function_pushed_stack_size = pushed;
2719 }
2720
2687 funexp = rtx_for_function_call (fndecl, addr); 2721 funexp = rtx_for_function_call (fndecl, addr);
2688 2722
2689 /* Figure out the register where the value, if any, will come back. */ 2723 /* Figure out the register where the value, if any, will come back. */
2690 valreg = 0; 2724 valreg = 0;
2691 if (TYPE_MODE (rettype) != VOIDmode 2725 if (TYPE_MODE (rettype) != VOIDmode
2823 later safely search backwards to find the CALL_INSN. */ 2857 later safely search backwards to find the CALL_INSN. */
2824 before_call = get_last_insn (); 2858 before_call = get_last_insn ();
2825 2859
2826 /* Set up next argument register. For sibling calls on machines 2860 /* Set up next argument register. For sibling calls on machines
2827 with register windows this should be the incoming register. */ 2861 with register windows this should be the incoming register. */
2828 #ifdef FUNCTION_INCOMING_ARG
2829 if (pass == 0) 2862 if (pass == 0)
2830 next_arg_reg = FUNCTION_INCOMING_ARG (args_so_far, VOIDmode, 2863 next_arg_reg = targetm.calls.function_incoming_arg (&args_so_far,
2831 void_type_node, 1); 2864 VOIDmode,
2865 void_type_node,
2866 true);
2832 else 2867 else
2833 #endif 2868 next_arg_reg = targetm.calls.function_arg (&args_so_far,
2834 next_arg_reg = FUNCTION_ARG (args_so_far, VOIDmode, 2869 VOIDmode, void_type_node,
2835 void_type_node, 1); 2870 true);
2836 2871
2837 /* All arguments and registers used for the call must be set up by 2872 /* All arguments and registers used for the call must be set up by
2838 now! */ 2873 now! */
2839 2874
2840 /* Stack must be properly aligned now. */ 2875 /* Stack must be properly aligned now. */
3063 /* If size of args is variable or this was a constructor call for a stack 3098 /* If size of args is variable or this was a constructor call for a stack
3064 argument, restore saved stack-pointer value. */ 3099 argument, restore saved stack-pointer value. */
3065 3100
3066 if (old_stack_level) 3101 if (old_stack_level)
3067 { 3102 {
3068 emit_stack_restore (SAVE_BLOCK, old_stack_level, NULL_RTX); 3103 emit_stack_restore (SAVE_BLOCK, old_stack_level);
3069 stack_pointer_delta = old_stack_pointer_delta; 3104 stack_pointer_delta = old_stack_pointer_delta;
3070 pending_stack_adjust = old_pending_adj; 3105 pending_stack_adjust = old_pending_adj;
3071 old_stack_allocated = stack_pointer_delta - pending_stack_adjust; 3106 old_stack_allocated = stack_pointer_delta - pending_stack_adjust;
3072 stack_arg_under_construction = old_stack_arg_under_construction; 3107 stack_arg_under_construction = old_stack_arg_under_construction;
3073 highest_outgoing_arg_in_use = initial_highest_arg_in_use; 3108 highest_outgoing_arg_in_use = initial_highest_arg_in_use;
3417 3452
3418 argvec[count].value = addr; 3453 argvec[count].value = addr;
3419 argvec[count].mode = Pmode; 3454 argvec[count].mode = Pmode;
3420 argvec[count].partial = 0; 3455 argvec[count].partial = 0;
3421 3456
3422 argvec[count].reg = FUNCTION_ARG (args_so_far, Pmode, NULL_TREE, 1); 3457 argvec[count].reg = targetm.calls.function_arg (&args_so_far,
3458 Pmode, NULL_TREE, true);
3423 gcc_assert (targetm.calls.arg_partial_bytes (&args_so_far, Pmode, 3459 gcc_assert (targetm.calls.arg_partial_bytes (&args_so_far, Pmode,
3424 NULL_TREE, 1) == 0); 3460 NULL_TREE, 1) == 0);
3425 3461
3426 locate_and_pad_parm (Pmode, NULL_TREE, 3462 locate_and_pad_parm (Pmode, NULL_TREE,
3427 #ifdef STACK_PARMS_IN_REG_PARM_AREA 3463 #ifdef STACK_PARMS_IN_REG_PARM_AREA
3433 3469
3434 if (argvec[count].reg == 0 || argvec[count].partial != 0 3470 if (argvec[count].reg == 0 || argvec[count].partial != 0
3435 || reg_parm_stack_space > 0) 3471 || reg_parm_stack_space > 0)
3436 args_size.constant += argvec[count].locate.size.constant; 3472 args_size.constant += argvec[count].locate.size.constant;
3437 3473
3438 FUNCTION_ARG_ADVANCE (args_so_far, Pmode, (tree) 0, 1); 3474 targetm.calls.function_arg_advance (&args_so_far, Pmode, (tree) 0, true);
3439 3475
3440 count++; 3476 count++;
3441 } 3477 }
3442 3478
3443 for (; count < nargs; count++) 3479 for (; count < nargs; count++)
3492 } 3528 }
3493 3529
3494 argvec[count].value = val; 3530 argvec[count].value = val;
3495 argvec[count].mode = mode; 3531 argvec[count].mode = mode;
3496 3532
3497 argvec[count].reg = FUNCTION_ARG (args_so_far, mode, NULL_TREE, 1); 3533 argvec[count].reg = targetm.calls.function_arg (&args_so_far, mode,
3534 NULL_TREE, true);
3498 3535
3499 argvec[count].partial 3536 argvec[count].partial
3500 = targetm.calls.arg_partial_bytes (&args_so_far, mode, NULL_TREE, 1); 3537 = targetm.calls.arg_partial_bytes (&args_so_far, mode, NULL_TREE, 1);
3501 3538
3502 locate_and_pad_parm (mode, NULL_TREE, 3539 locate_and_pad_parm (mode, NULL_TREE,
3512 3549
3513 if (argvec[count].reg == 0 || argvec[count].partial != 0 3550 if (argvec[count].reg == 0 || argvec[count].partial != 0
3514 || reg_parm_stack_space > 0) 3551 || reg_parm_stack_space > 0)
3515 args_size.constant += argvec[count].locate.size.constant; 3552 args_size.constant += argvec[count].locate.size.constant;
3516 3553
3517 FUNCTION_ARG_ADVANCE (args_so_far, mode, (tree) 0, 1); 3554 targetm.calls.function_arg_advance (&args_so_far, mode, (tree) 0, true);
3518 } 3555 }
3519 3556
3520 /* If this machine requires an external definition for library 3557 /* If this machine requires an external definition for library
3521 functions, write one out. */ 3558 functions, write one out. */
3522 assemble_external_libcall (fun); 3559 assemble_external_libcall (fun);
3535 if (! OUTGOING_REG_PARM_STACK_SPACE ((!fndecl ? fntype : TREE_TYPE (fndecl)))) 3572 if (! OUTGOING_REG_PARM_STACK_SPACE ((!fndecl ? fntype : TREE_TYPE (fndecl))))
3536 args_size.constant -= reg_parm_stack_space; 3573 args_size.constant -= reg_parm_stack_space;
3537 3574
3538 if (args_size.constant > crtl->outgoing_args_size) 3575 if (args_size.constant > crtl->outgoing_args_size)
3539 crtl->outgoing_args_size = args_size.constant; 3576 crtl->outgoing_args_size = args_size.constant;
3577
3578 if (flag_stack_usage && !ACCUMULATE_OUTGOING_ARGS)
3579 {
3580 int pushed = args_size.constant + pending_stack_adjust;
3581 if (pushed > current_function_pushed_stack_size)
3582 current_function_pushed_stack_size = pushed;
3583 }
3540 3584
3541 if (ACCUMULATE_OUTGOING_ARGS) 3585 if (ACCUMULATE_OUTGOING_ARGS)
3542 { 3586 {
3543 /* Since the stack pointer will never be pushed, it is possible for 3587 /* Since the stack pointer will never be pushed, it is possible for
3544 the evaluation of a parm to clobber something we have already 3588 the evaluation of a parm to clobber something we have already
3821 emit_call_1 (fun, NULL, 3865 emit_call_1 (fun, NULL,
3822 get_identifier (XSTR (orgfun, 0)), 3866 get_identifier (XSTR (orgfun, 0)),
3823 build_function_type (tfom, NULL_TREE), 3867 build_function_type (tfom, NULL_TREE),
3824 original_args_size.constant, args_size.constant, 3868 original_args_size.constant, args_size.constant,
3825 struct_value_size, 3869 struct_value_size,
3826 FUNCTION_ARG (args_so_far, VOIDmode, void_type_node, 1), 3870 targetm.calls.function_arg (&args_so_far,
3871 VOIDmode, void_type_node, true),
3827 valreg, 3872 valreg,
3828 old_inhibit_defer_pop + 1, call_fusage, flags, & args_so_far); 3873 old_inhibit_defer_pop + 1, call_fusage, flags, & args_so_far);
3829 3874
3830 /* For calls to `setjmp', etc., inform function.c:setjmp_warnings 3875 /* For calls to `setjmp', etc., inform function.c:setjmp_warnings
3831 that it should complain if nonvolatile values are live. For 3876 that it should complain if nonvolatile values are live. For