comparison gcc/calls.c @ 69:1b10fe6932e1

merge 69
author Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
date Sun, 21 Aug 2011 07:53:12 +0900
parents b362627d71ba f6334be47118
children b81903832de2
comparison
equal deleted inserted replaced
66:b362627d71ba 69:1b10fe6932e1
1 /* Convert function calls to rtl insns, for GNU C compiler. 1 /* Convert function calls to rtl insns, for GNU C compiler.
2 Copyright (C) 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2 Copyright (C) 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
3 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 3 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
4 Free Software Foundation, Inc. 4 Free Software Foundation, Inc.
5 5
6 This file is part of GCC. 6 This file is part of GCC.
7 7
8 GCC is free software; you can redistribute it and/or modify it under 8 GCC is free software; you can redistribute it and/or modify it under
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
176 /* Make a valid memory address and copy constants through pseudo-regs, 176 /* Make a valid memory address and copy constants through pseudo-regs,
177 but not for a constant address if -fno-function-cse. */ 177 but not for a constant address if -fno-function-cse. */
178 if (GET_CODE (funexp) != SYMBOL_REF) 178 if (GET_CODE (funexp) != SYMBOL_REF)
179 /* If we are using registers for parameters, force the 179 /* If we are using registers for parameters, force the
180 function address into a register now. */ 180 function address into a register now. */
181 funexp = ((SMALL_REGISTER_CLASSES && reg_parm_seen) 181 funexp = ((reg_parm_seen
182 ? force_not_mem (memory_address (FUNCTION_MODE, funexp)) 182 && targetm.small_register_classes_for_mode_p (FUNCTION_MODE))
183 : memory_address (FUNCTION_MODE, funexp)); 183 ? force_not_mem (memory_address (FUNCTION_MODE, funexp))
184 : memory_address (FUNCTION_MODE, funexp));
184 else if (! sibcallp) 185 else if (! sibcallp)
185 { 186 {
186 #ifndef NO_FUNCTION_CSE 187 #ifndef NO_FUNCTION_CSE
187 if (optimize && ! flag_no_function_cse) 188 if (optimize && ! flag_no_function_cse)
188 funexp = force_reg (Pmode, funexp); 189 funexp = force_reg (Pmode, funexp);
208 /* Generate instructions to call function FUNEXP, 209 /* Generate instructions to call function FUNEXP,
209 and optionally pop the results. 210 and optionally pop the results.
210 The CALL_INSN is the first insn generated. 211 The CALL_INSN is the first insn generated.
211 212
212 FNDECL is the declaration node of the function. This is given to the 213 FNDECL is the declaration node of the function. This is given to the
213 macro RETURN_POPS_ARGS to determine whether this function pops its own args. 214 hook TARGET_RETURN_POPS_ARGS to determine whether this function pops
214 215 its own args.
215 FUNTYPE is the data type of the function. This is given to the macro 216
216 RETURN_POPS_ARGS to determine whether this function pops its own args. 217 FUNTYPE is the data type of the function. This is given to the hook
217 We used to allow an identifier for library functions, but that doesn't 218 TARGET_RETURN_POPS_ARGS to determine whether this function pops its
218 work when the return type is an aggregate type and the calling convention 219 own args. We used to allow an identifier for library functions, but
219 says that the pointer to this aggregate is to be popped by the callee. 220 that doesn't work when the return type is an aggregate type and the
221 calling convention says that the pointer to this aggregate is to be
222 popped by the callee.
220 223
221 STACK_SIZE is the number of bytes of arguments on the stack, 224 STACK_SIZE is the number of bytes of arguments on the stack,
222 ROUNDED_STACK_SIZE is that number rounded up to 225 ROUNDED_STACK_SIZE is that number rounded up to
223 PREFERRED_STACK_BOUNDARY; zero if the size is variable. This is 226 PREFERRED_STACK_BOUNDARY; zero if the size is variable. This is
224 both to put into the call insn and to generate explicit popping 227 both to put into the call insn and to generate explicit popping
226 229
227 STRUCT_VALUE_SIZE is the number of bytes wanted in a structure value. 230 STRUCT_VALUE_SIZE is the number of bytes wanted in a structure value.
228 It is zero if this call doesn't want a structure value. 231 It is zero if this call doesn't want a structure value.
229 232
230 NEXT_ARG_REG is the rtx that results from executing 233 NEXT_ARG_REG is the rtx that results from executing
231 FUNCTION_ARG (args_so_far, VOIDmode, void_type_node, 1) 234 targetm.calls.function_arg (&args_so_far, VOIDmode, void_type_node, true)
232 just after all the args have had their registers assigned. 235 just after all the args have had their registers assigned.
233 This could be whatever you like, but normally it is the first 236 This could be whatever you like, but normally it is the first
234 arg-register beyond those used for args in this call, 237 arg-register beyond those used for args in this call,
235 or 0 if all the arg-registers are used in this call. 238 or 0 if all the arg-registers are used in this call.
236 It is passed on to `gen_call' so you can put this info in the call insn. 239 It is passed on to `gen_call' so you can put this info in the call insn.
256 CUMULATIVE_ARGS *args_so_far ATTRIBUTE_UNUSED) 259 CUMULATIVE_ARGS *args_so_far ATTRIBUTE_UNUSED)
257 { 260 {
258 rtx rounded_stack_size_rtx = GEN_INT (rounded_stack_size); 261 rtx rounded_stack_size_rtx = GEN_INT (rounded_stack_size);
259 rtx call_insn; 262 rtx call_insn;
260 int already_popped = 0; 263 int already_popped = 0;
261 HOST_WIDE_INT n_popped = RETURN_POPS_ARGS (fndecl, funtype, stack_size); 264 HOST_WIDE_INT n_popped
265 = targetm.calls.return_pops_args (fndecl, funtype, stack_size);
262 266
263 #ifdef CALL_POPS_ARGS 267 #ifdef CALL_POPS_ARGS
264 n_popped += CALL_POPS_ARGS (* args_so_far); 268 n_popped += CALL_POPS_ARGS (* args_so_far);
265 #endif 269 #endif
266 270
598 /* The function exp may have the `returns_twice' attribute. */ 602 /* The function exp may have the `returns_twice' attribute. */
599 if (DECL_IS_RETURNS_TWICE (exp)) 603 if (DECL_IS_RETURNS_TWICE (exp))
600 flags |= ECF_RETURNS_TWICE; 604 flags |= ECF_RETURNS_TWICE;
601 605
602 /* Process the pure and const attributes. */ 606 /* Process the pure and const attributes. */
603 if (TREE_READONLY (exp) && ! TREE_THIS_VOLATILE (exp)) 607 if (TREE_READONLY (exp))
604 flags |= ECF_CONST; 608 flags |= ECF_CONST;
605 if (DECL_PURE_P (exp)) 609 if (DECL_PURE_P (exp))
606 flags |= ECF_PURE; 610 flags |= ECF_PURE;
607 if (DECL_LOOPING_CONST_OR_PURE_P (exp)) 611 if (DECL_LOOPING_CONST_OR_PURE_P (exp))
608 flags |= ECF_LOOPING_CONST_OR_PURE; 612 flags |= ECF_LOOPING_CONST_OR_PURE;
609 613
610 if (DECL_IS_NOVOPS (exp)) 614 if (DECL_IS_NOVOPS (exp))
611 flags |= ECF_NOVOPS; 615 flags |= ECF_NOVOPS;
616 if (lookup_attribute ("leaf", DECL_ATTRIBUTES (exp)))
617 flags |= ECF_LEAF;
612 618
613 if (TREE_NOTHROW (exp)) 619 if (TREE_NOTHROW (exp))
614 flags |= ECF_NOTHROW; 620 flags |= ECF_NOTHROW;
615 621
616 flags = special_function_p (exp, flags); 622 flags = special_function_p (exp, flags);
617 } 623 }
618 else if (TYPE_P (exp) && TYPE_READONLY (exp) && ! TREE_THIS_VOLATILE (exp)) 624 else if (TYPE_P (exp) && TYPE_READONLY (exp))
619 flags |= ECF_CONST; 625 flags |= ECF_CONST;
620 626
621 if (TREE_THIS_VOLATILE (exp)) 627 if (TREE_THIS_VOLATILE (exp))
622 flags |= ECF_NORETURN; 628 {
629 flags |= ECF_NORETURN;
630 if (flags & (ECF_CONST|ECF_PURE))
631 flags |= ECF_LOOPING_CONST_OR_PURE;
632 }
623 633
624 return flags; 634 return flags;
625 } 635 }
626 636
627 /* Detect flags from a CALL_EXPR. */ 637 /* Detect flags from a CALL_EXPR. */
662 *reg_parm_seen = 0; 672 *reg_parm_seen = 0;
663 673
664 for (i = 0; i < num_actuals; i++) 674 for (i = 0; i < num_actuals; i++)
665 if (args[i].reg != 0 && ! args[i].pass_on_stack) 675 if (args[i].reg != 0 && ! args[i].pass_on_stack)
666 { 676 {
667 *reg_parm_seen = 1; 677 *reg_parm_seen = 1;
668 678
669 if (args[i].value == 0) 679 if (args[i].value == 0)
670 { 680 {
671 push_temp_slots (); 681 push_temp_slots ();
672 args[i].value = expand_normal (args[i].tree_value); 682 args[i].value = expand_normal (args[i].tree_value);
673 preserve_temp_slots (args[i].value); 683 preserve_temp_slots (args[i].value);
674 pop_temp_slots (); 684 pop_temp_slots ();
675 } 685 }
676 686
677 /* If the value is a non-legitimate constant, force it into a 687 /* If the value is a non-legitimate constant, force it into a
678 pseudo now. TLS symbols sometimes need a call to resolve. */ 688 pseudo now. TLS symbols sometimes need a call to resolve. */
679 if (CONSTANT_P (args[i].value) 689 if (CONSTANT_P (args[i].value)
680 && !LEGITIMATE_CONSTANT_P (args[i].value)) 690 && !LEGITIMATE_CONSTANT_P (args[i].value))
681 args[i].value = force_reg (args[i].mode, args[i].value); 691 args[i].value = force_reg (args[i].mode, args[i].value);
682 692
683 /* If we are to promote the function arg to a wider mode, 693 /* If we are to promote the function arg to a wider mode,
684 do it now. */ 694 do it now. */
685 695
686 if (args[i].mode != TYPE_MODE (TREE_TYPE (args[i].tree_value))) 696 if (args[i].mode != TYPE_MODE (TREE_TYPE (args[i].tree_value)))
687 args[i].value 697 args[i].value
688 = convert_modes (args[i].mode, 698 = convert_modes (args[i].mode,
689 TYPE_MODE (TREE_TYPE (args[i].tree_value)), 699 TYPE_MODE (TREE_TYPE (args[i].tree_value)),
690 args[i].value, args[i].unsignedp); 700 args[i].value, args[i].unsignedp);
691 701
692 /* If we're going to have to load the value by parts, pull the 702 /* If we're going to have to load the value by parts, pull the
693 parts into pseudos. The part extraction process can involve 703 parts into pseudos. The part extraction process can involve
694 non-trivial computation. */ 704 non-trivial computation. */
695 if (GET_CODE (args[i].reg) == PARALLEL) 705 if (GET_CODE (args[i].reg) == PARALLEL)
696 { 706 {
697 tree type = TREE_TYPE (args[i].tree_value); 707 tree type = TREE_TYPE (args[i].tree_value);
698 args[i].parallel_value 708 args[i].parallel_value
699 = emit_group_load_into_temps (args[i].reg, args[i].value, 709 = emit_group_load_into_temps (args[i].reg, args[i].value,
700 type, int_size_in_bytes (type)); 710 type, int_size_in_bytes (type));
701 } 711 }
702 712
703 /* If the value is expensive, and we are inside an appropriately 713 /* If the value is expensive, and we are inside an appropriately
704 short loop, put the value into a pseudo and then put the pseudo 714 short loop, put the value into a pseudo and then put the pseudo
705 into the hard reg. 715 into the hard reg.
706 716
707 For small register classes, also do this if this call uses 717 For small register classes, also do this if this call uses
708 register parameters. This is to avoid reload conflicts while 718 register parameters. This is to avoid reload conflicts while
709 loading the parameters registers. */ 719 loading the parameters registers. */
710 720
711 else if ((! (REG_P (args[i].value) 721 else if ((! (REG_P (args[i].value)
712 || (GET_CODE (args[i].value) == SUBREG 722 || (GET_CODE (args[i].value) == SUBREG
713 && REG_P (SUBREG_REG (args[i].value))))) 723 && REG_P (SUBREG_REG (args[i].value)))))
714 && args[i].mode != BLKmode 724 && args[i].mode != BLKmode
715 && rtx_cost (args[i].value, SET, optimize_insn_for_speed_p ()) 725 && rtx_cost (args[i].value, SET, optimize_insn_for_speed_p ())
716 > COSTS_N_INSNS (1) 726 > COSTS_N_INSNS (1)
717 && ((SMALL_REGISTER_CLASSES && *reg_parm_seen) 727 && ((*reg_parm_seen
718 || optimize)) 728 && targetm.small_register_classes_for_mode_p (args[i].mode))
719 args[i].value = copy_to_mode_reg (args[i].mode, args[i].value); 729 || optimize))
730 args[i].value = copy_to_mode_reg (args[i].mode, args[i].value);
720 } 731 }
721 } 732 }
722 733
723 #ifdef REG_PARM_STACK_SPACE 734 #ifdef REG_PARM_STACK_SPACE
724 735
866 TREE_TYPE (args[i].tree_value), 1) 877 TREE_TYPE (args[i].tree_value), 1)
867 == downward) 878 == downward)
868 #else 879 #else
869 && BYTES_BIG_ENDIAN 880 && BYTES_BIG_ENDIAN
870 #endif 881 #endif
871 ) 882 )
872 endian_correction = BITS_PER_WORD - bytes * BITS_PER_UNIT; 883 endian_correction = BITS_PER_WORD - bytes * BITS_PER_UNIT;
873 884
874 for (j = 0; j < args[i].n_aligned_regs; j++) 885 for (j = 0; j < args[i].n_aligned_regs; j++)
875 { 886 {
876 rtx reg = gen_reg_rtx (word_mode); 887 rtx reg = gen_reg_rtx (word_mode);
877 rtx word = operand_subword_force (args[i].value, j, BLKmode); 888 rtx word = operand_subword_force (args[i].value, j, BLKmode);
878 int bitsize = MIN (bytes * BITS_PER_UNIT, BITS_PER_WORD); 889 int bitsize = MIN (bytes * BITS_PER_UNIT, BITS_PER_WORD);
879 890
880 args[i].aligned_regs[j] = reg; 891 args[i].aligned_regs[j] = reg;
881 word = extract_bit_field (word, bitsize, 0, 1, NULL_RTX, 892 word = extract_bit_field (word, bitsize, 0, 1, false, NULL_RTX,
882 word_mode, word_mode); 893 word_mode, word_mode);
883 894
884 /* There is no need to restrict this code to loading items 895 /* There is no need to restrict this code to loading items
885 in TYPE_ALIGN sized hunks. The bitfield instructions can 896 in TYPE_ALIGN sized hunks. The bitfield instructions can
886 load up entire word sized registers efficiently. 897 load up entire word sized registers efficiently.
887 898
888 ??? This may not be needed anymore. 899 ??? This may not be needed anymore.
889 We use to emit a clobber here but that doesn't let later 900 We use to emit a clobber here but that doesn't let later
890 passes optimize the instructions we emit. By storing 0 into 901 passes optimize the instructions we emit. By storing 0 into
891 the register later passes know the first AND to zero out the 902 the register later passes know the first AND to zero out the
892 bitfield being set in the register is unnecessary. The store 903 bitfield being set in the register is unnecessary. The store
893 of 0 will be deleted as will at least the first AND. */ 904 of 0 will be deleted as will at least the first AND. */
894 905
895 emit_move_insn (reg, const0_rtx); 906 emit_move_insn (reg, const0_rtx);
896 907
897 bytes -= bitsize / BITS_PER_UNIT; 908 bytes -= bitsize / BITS_PER_UNIT;
898 store_bit_field (reg, bitsize, endian_correction, word_mode, 909 store_bit_field (reg, bitsize, endian_correction, word_mode,
899 word); 910 word);
900 } 911 }
901 } 912 }
902 } 913 }
903 914
904 /* Fill in ARGS_SIZE and ARGS array based on the parameters found in 915 /* Fill in ARGS_SIZE and ARGS array based on the parameters found in
905 CALL_EXPR EXP. 916 CALL_EXPR EXP.
1011 1022
1012 /* Replace erroneous argument with constant zero. */ 1023 /* Replace erroneous argument with constant zero. */
1013 if (type == error_mark_node || !COMPLETE_TYPE_P (type)) 1024 if (type == error_mark_node || !COMPLETE_TYPE_P (type))
1014 args[i].tree_value = integer_zero_node, type = integer_type_node; 1025 args[i].tree_value = integer_zero_node, type = integer_type_node;
1015 1026
1016 /* If TYPE is a transparent union, pass things the way we would 1027 /* If TYPE is a transparent union or record, pass things the way
1017 pass the first field of the union. We have already verified that 1028 we would pass the first field of the union or record. We have
1018 the modes are the same. */ 1029 already verified that the modes are the same. */
1019 if (TREE_CODE (type) == UNION_TYPE && TYPE_TRANSPARENT_UNION (type)) 1030 if ((TREE_CODE (type) == UNION_TYPE || TREE_CODE (type) == RECORD_TYPE)
1020 type = TREE_TYPE (TYPE_FIELDS (type)); 1031 && TYPE_TRANSPARENT_AGGR (type))
1032 type = TREE_TYPE (first_field (type));
1021 1033
1022 /* Decide where to pass this arg. 1034 /* Decide where to pass this arg.
1023 1035
1024 args[i].reg is nonzero if all or part is passed in registers. 1036 args[i].reg is nonzero if all or part is passed in registers.
1025 1037
1033 These decisions are driven by the FUNCTION_... macros and must agree 1045 These decisions are driven by the FUNCTION_... macros and must agree
1034 with those made by function.c. */ 1046 with those made by function.c. */
1035 1047
1036 /* See if this argument should be passed by invisible reference. */ 1048 /* See if this argument should be passed by invisible reference. */
1037 if (pass_by_reference (args_so_far, TYPE_MODE (type), 1049 if (pass_by_reference (args_so_far, TYPE_MODE (type),
1038 type, argpos < n_named_args)) 1050 type, argpos < n_named_args))
1039 { 1051 {
1040 bool callee_copies; 1052 bool callee_copies;
1041 tree base; 1053 tree base;
1042 1054
1043 callee_copies 1055 callee_copies
1044 = reference_callee_copied (args_so_far, TYPE_MODE (type), 1056 = reference_callee_copied (args_so_far, TYPE_MODE (type),
1045 type, argpos < n_named_args); 1057 type, argpos < n_named_args);
1046 1058
1047 /* If we're compiling a thunk, pass through invisible references 1059 /* If we're compiling a thunk, pass through invisible references
1048 instead of making a copy. */ 1060 instead of making a copy. */
1049 if (call_from_thunk_p 1061 if (call_from_thunk_p
1050 || (callee_copies 1062 || (callee_copies
1051 && !TREE_ADDRESSABLE (type) 1063 && !TREE_ADDRESSABLE (type)
1052 && (base = get_base_address (args[i].tree_value)) 1064 && (base = get_base_address (args[i].tree_value))
1053 && TREE_CODE (base) != SSA_NAME 1065 && TREE_CODE (base) != SSA_NAME
1054 && (!DECL_P (base) || MEM_P (DECL_RTL (base))))) 1066 && (!DECL_P (base) || MEM_P (DECL_RTL (base)))))
1055 { 1067 {
1056 /* We can't use sibcalls if a callee-copied argument is 1068 /* We can't use sibcalls if a callee-copied argument is
1057 stored in the current function's frame. */ 1069 stored in the current function's frame. */
1058 if (!call_from_thunk_p && DECL_P (base) && !TREE_STATIC (base)) 1070 if (!call_from_thunk_p && DECL_P (base) && !TREE_STATIC (base))
1059 *may_tailcall = false; 1071 *may_tailcall = false;
1060 1072
1061 args[i].tree_value = build_fold_addr_expr_loc (loc, 1073 args[i].tree_value = build_fold_addr_expr_loc (loc,
1062 args[i].tree_value); 1074 args[i].tree_value);
1063 type = TREE_TYPE (args[i].tree_value); 1075 type = TREE_TYPE (args[i].tree_value);
1064 1076
1065 if (*ecf_flags & ECF_CONST) 1077 if (*ecf_flags & ECF_CONST)
1066 *ecf_flags &= ~(ECF_CONST | ECF_LOOPING_CONST_OR_PURE); 1078 *ecf_flags &= ~(ECF_CONST | ECF_LOOPING_CONST_OR_PURE);
1067 } 1079 }
1068 else 1080 else
1069 { 1081 {
1070 /* We make a copy of the object and pass the address to the 1082 /* We make a copy of the object and pass the address to the
1071 function being called. */ 1083 function being called. */
1072 rtx copy; 1084 rtx copy;
1073 1085
1074 if (!COMPLETE_TYPE_P (type) 1086 if (!COMPLETE_TYPE_P (type)
1075 || TREE_CODE (TYPE_SIZE_UNIT (type)) != INTEGER_CST 1087 || TREE_CODE (TYPE_SIZE_UNIT (type)) != INTEGER_CST
1076 || (flag_stack_check == GENERIC_STACK_CHECK 1088 || (flag_stack_check == GENERIC_STACK_CHECK
1077 && compare_tree_int (TYPE_SIZE_UNIT (type), 1089 && compare_tree_int (TYPE_SIZE_UNIT (type),
1078 STACK_CHECK_MAX_VAR_SIZE) > 0)) 1090 STACK_CHECK_MAX_VAR_SIZE) > 0))
1079 { 1091 {
1080 /* This is a variable-sized object. Make space on the stack 1092 /* This is a variable-sized object. Make space on the stack
1081 for it. */ 1093 for it. */
1082 rtx size_rtx = expr_size (args[i].tree_value); 1094 rtx size_rtx = expr_size (args[i].tree_value);
1083 1095
1084 if (*old_stack_level == 0) 1096 if (*old_stack_level == 0)
1085 { 1097 {
1086 emit_stack_save (SAVE_BLOCK, old_stack_level, NULL_RTX); 1098 emit_stack_save (SAVE_BLOCK, old_stack_level);
1087 *old_pending_adj = pending_stack_adjust; 1099 *old_pending_adj = pending_stack_adjust;
1088 pending_stack_adjust = 0; 1100 pending_stack_adjust = 0;
1089 } 1101 }
1090 1102
1091 copy = gen_rtx_MEM (BLKmode, 1103 /* We can pass TRUE as the 4th argument because we just
1092 allocate_dynamic_stack_space 1104 saved the stack pointer and will restore it right after
1093 (size_rtx, NULL_RTX, TYPE_ALIGN (type))); 1105 the call. */
1094 set_mem_attributes (copy, type, 1); 1106 copy = allocate_dynamic_stack_space (size_rtx,
1095 } 1107 TYPE_ALIGN (type),
1096 else 1108 TYPE_ALIGN (type),
1097 copy = assign_temp (type, 0, 1, 0); 1109 true);
1098 1110 copy = gen_rtx_MEM (BLKmode, copy);
1099 store_expr (args[i].tree_value, copy, 0, false); 1111 set_mem_attributes (copy, type, 1);
1100 1112 }
1101 /* Just change the const function to pure and then let 1113 else
1102 the next test clear the pure based on 1114 copy = assign_temp (type, 0, 1, 0);
1103 callee_copies. */ 1115
1104 if (*ecf_flags & ECF_CONST) 1116 store_expr (args[i].tree_value, copy, 0, false);
1105 { 1117
1106 *ecf_flags &= ~ECF_CONST; 1118 /* Just change the const function to pure and then let
1107 *ecf_flags |= ECF_PURE; 1119 the next test clear the pure based on
1108 } 1120 callee_copies. */
1109 1121 if (*ecf_flags & ECF_CONST)
1110 if (!callee_copies && *ecf_flags & ECF_PURE) 1122 {
1111 *ecf_flags &= ~(ECF_PURE | ECF_LOOPING_CONST_OR_PURE); 1123 *ecf_flags &= ~ECF_CONST;
1112 1124 *ecf_flags |= ECF_PURE;
1113 args[i].tree_value 1125 }
1114 = build_fold_addr_expr_loc (loc, make_tree (type, copy)); 1126
1115 type = TREE_TYPE (args[i].tree_value); 1127 if (!callee_copies && *ecf_flags & ECF_PURE)
1116 *may_tailcall = false; 1128 *ecf_flags &= ~(ECF_PURE | ECF_LOOPING_CONST_OR_PURE);
1117 } 1129
1118 } 1130 args[i].tree_value
1131 = build_fold_addr_expr_loc (loc, make_tree (type, copy));
1132 type = TREE_TYPE (args[i].tree_value);
1133 *may_tailcall = false;
1134 }
1135 }
1119 1136
1120 unsignedp = TYPE_UNSIGNED (type); 1137 unsignedp = TYPE_UNSIGNED (type);
1121 mode = promote_function_mode (type, TYPE_MODE (type), &unsignedp, 1138 mode = promote_function_mode (type, TYPE_MODE (type), &unsignedp,
1122 fndecl ? TREE_TYPE (fndecl) : fntype, 0); 1139 fndecl ? TREE_TYPE (fndecl) : fntype, 0);
1123 1140
1124 args[i].unsignedp = unsignedp; 1141 args[i].unsignedp = unsignedp;
1125 args[i].mode = mode; 1142 args[i].mode = mode;
1126 1143
1127 args[i].reg = FUNCTION_ARG (*args_so_far, mode, type, 1144 args[i].reg = targetm.calls.function_arg (args_so_far, mode, type,
1128 argpos < n_named_args); 1145 argpos < n_named_args);
1129 #ifdef FUNCTION_INCOMING_ARG 1146
1130 /* If this is a sibling call and the machine has register windows, the 1147 /* 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 1148 register window has to be unwinded before calling the routine, so
1132 arguments have to go into the incoming registers. */ 1149 arguments have to go into the incoming registers. */
1133 args[i].tail_call_reg = FUNCTION_INCOMING_ARG (*args_so_far, mode, type, 1150 if (targetm.calls.function_incoming_arg != targetm.calls.function_arg)
1134 argpos < n_named_args); 1151 args[i].tail_call_reg
1135 #else 1152 = targetm.calls.function_incoming_arg (args_so_far, mode, type,
1136 args[i].tail_call_reg = args[i].reg; 1153 argpos < n_named_args);
1137 #endif 1154 else
1155 args[i].tail_call_reg = args[i].reg;
1138 1156
1139 if (args[i].reg) 1157 if (args[i].reg)
1140 args[i].partial 1158 args[i].partial
1141 = targetm.calls.arg_partial_bytes (args_so_far, mode, type, 1159 = targetm.calls.arg_partial_bytes (args_so_far, mode, type,
1142 argpos < n_named_args); 1160 argpos < n_named_args);
1187 ADD_PARM_SIZE (*args_size, args[i].locate.size.var); 1205 ADD_PARM_SIZE (*args_size, args[i].locate.size.var);
1188 1206
1189 /* Increment ARGS_SO_FAR, which has info about which arg-registers 1207 /* Increment ARGS_SO_FAR, which has info about which arg-registers
1190 have been used, etc. */ 1208 have been used, etc. */
1191 1209
1192 FUNCTION_ARG_ADVANCE (*args_so_far, TYPE_MODE (type), type, 1210 targetm.calls.function_arg_advance (args_so_far, TYPE_MODE (type),
1193 argpos < n_named_args); 1211 type, argpos < n_named_args);
1194 } 1212 }
1195 } 1213 }
1196 1214
1197 /* Update ARGS_SIZE to contain the total size for the argument block. 1215 /* Update ARGS_SIZE to contain the total size for the argument block.
1198 Return the original constant component of the argument block's size. 1216 Return the original constant component of the argument block's size.
1652 reg, 1); 1670 reg, 1);
1653 if (x != reg) 1671 if (x != reg)
1654 emit_move_insn (reg, x); 1672 emit_move_insn (reg, x);
1655 } 1673 }
1656 #endif 1674 #endif
1657 } 1675 }
1658 1676
1659 /* If we have pre-computed the values to put in the registers in 1677 /* If we have pre-computed the values to put in the registers in
1660 the case of non-aligned structures, copy them in now. */ 1678 the case of non-aligned structures, copy them in now. */
1661 1679
1662 else if (args[i].n_aligned_regs != 0) 1680 else if (args[i].n_aligned_regs != 0)
1663 for (j = 0; j < args[i].n_aligned_regs; j++) 1681 for (j = 0; j < args[i].n_aligned_regs; j++)
1664 emit_move_insn (gen_rtx_REG (word_mode, REGNO (reg) + j), 1682 emit_move_insn (gen_rtx_REG (word_mode, REGNO (reg) + j),
1665 args[i].aligned_regs[j]); 1683 args[i].aligned_regs[j]);
1666 1684
1667 else if (partial == 0 || args[i].pass_on_stack) 1685 else if (partial == 0 || args[i].pass_on_stack)
1668 { 1686 {
1669 rtx mem = validize_mem (args[i].value); 1687 rtx mem = validize_mem (args[i].value);
1670 1688
1671 /* Check for overlap with already clobbered argument area. */ 1689 /* Check for overlap with already clobbered argument area,
1672 if (is_sibcall 1690 providing that this has non-zero size. */
1673 && mem_overlaps_already_clobbered_arg_p (XEXP (args[i].value, 0), 1691 if (is_sibcall
1674 size)) 1692 && (size == 0
1675 *sibcall_failure = 1; 1693 || mem_overlaps_already_clobbered_arg_p
1676 1694 (XEXP (args[i].value, 0), size)))
1677 /* Handle a BLKmode that needs shifting. */ 1695 *sibcall_failure = 1;
1678 if (nregs == 1 && size < UNITS_PER_WORD 1696
1697 /* Handle a BLKmode that needs shifting. */
1698 if (nregs == 1 && size < UNITS_PER_WORD
1679 #ifdef BLOCK_REG_PADDING 1699 #ifdef BLOCK_REG_PADDING
1680 && args[i].locate.where_pad == downward 1700 && args[i].locate.where_pad == downward
1681 #else 1701 #else
1682 && BYTES_BIG_ENDIAN 1702 && BYTES_BIG_ENDIAN
1683 #endif 1703 #endif
1888 { 1908 {
1889 rtx new_rtx; 1909 rtx new_rtx;
1890 1910
1891 if (REG_P (x) 1911 if (REG_P (x)
1892 && HARD_REGISTER_P (x) 1912 && HARD_REGISTER_P (x)
1893 && CLASS_LIKELY_SPILLED_P (REGNO_REG_CLASS (REGNO (x)))) 1913 && targetm.class_likely_spilled_p (REGNO_REG_CLASS (REGNO (x))))
1894 { 1914 {
1895 /* Make sure that we generate a REG rather than a CONCAT. 1915 /* Make sure that we generate a REG rather than a CONCAT.
1896 Moves into CONCATs can need nontrivial instructions, 1916 Moves into CONCATs can need nontrivial instructions,
1897 and the whole point of this function is to avoid 1917 and the whole point of this function is to avoid
1898 using the hard register directly in such a situation. */ 1918 using the hard register directly in such a situation. */
2093 must_preallocate = 1; 2113 must_preallocate = 1;
2094 2114
2095 /* Set up a place to return a structure. */ 2115 /* Set up a place to return a structure. */
2096 2116
2097 /* Cater to broken compilers. */ 2117 /* Cater to broken compilers. */
2098 if (aggregate_value_p (exp, (!fndecl ? fntype : fndecl))) 2118 if (aggregate_value_p (exp, fntype))
2099 { 2119 {
2100 /* This call returns a big structure. */ 2120 /* This call returns a big structure. */
2101 flags &= ~(ECF_CONST | ECF_PURE | ECF_LOOPING_CONST_OR_PURE); 2121 flags &= ~(ECF_CONST | ECF_PURE | ECF_LOOPING_CONST_OR_PURE);
2102 2122
2103 #ifdef PCC_STATIC_STRUCT_RETURN 2123 #ifdef PCC_STATIC_STRUCT_RETURN
2329 crtl->args.pretend_args_size is not part of the 2349 crtl->args.pretend_args_size is not part of the
2330 stack allocated by our caller. */ 2350 stack allocated by our caller. */
2331 || args_size.constant > (crtl->args.size 2351 || args_size.constant > (crtl->args.size
2332 - crtl->args.pretend_args_size) 2352 - crtl->args.pretend_args_size)
2333 /* If the callee pops its own arguments, then it must pop exactly 2353 /* If the callee pops its own arguments, then it must pop exactly
2334 the same number of arguments as the current function. */ 2354 the same number of arguments as the current function. */
2335 || (RETURN_POPS_ARGS (fndecl, funtype, args_size.constant) 2355 || (targetm.calls.return_pops_args (fndecl, funtype, args_size.constant)
2336 != RETURN_POPS_ARGS (current_function_decl, 2356 != targetm.calls.return_pops_args (current_function_decl,
2337 TREE_TYPE (current_function_decl), 2357 TREE_TYPE (current_function_decl),
2338 crtl->args.size)) 2358 crtl->args.size))
2339 || !lang_hooks.decls.ok_for_sibcall (fndecl)) 2359 || !lang_hooks.decls.ok_for_sibcall (fndecl))
2340 try_tail_call = 0; 2360 try_tail_call = 0;
2341 2361
2342 /* Check if caller and callee disagree in promotion of function 2362 /* Check if caller and callee disagree in promotion of function
2343 return value. */ 2363 return value. */
2551 } 2571 }
2552 2572
2553 /* If we have no actual push instructions, or shouldn't use them, 2573 /* If we have no actual push instructions, or shouldn't use them,
2554 make space for all args right now. */ 2574 make space for all args right now. */
2555 else if (adjusted_args_size.var != 0) 2575 else if (adjusted_args_size.var != 0)
2556 { 2576 {
2557 if (old_stack_level == 0) 2577 if (old_stack_level == 0)
2558 { 2578 {
2559 emit_stack_save (SAVE_BLOCK, &old_stack_level, NULL_RTX); 2579 emit_stack_save (SAVE_BLOCK, &old_stack_level);
2560 old_stack_pointer_delta = stack_pointer_delta; 2580 old_stack_pointer_delta = stack_pointer_delta;
2561 old_pending_adj = pending_stack_adjust; 2581 old_pending_adj = pending_stack_adjust;
2562 pending_stack_adjust = 0; 2582 pending_stack_adjust = 0;
2563 /* stack_arg_under_construction says whether a stack arg is 2583 /* stack_arg_under_construction says whether a stack arg is
2564 being constructed at the old stack level. Pushing the stack 2584 being constructed at the old stack level. Pushing the stack
2565 gets a clean outgoing argument block. */ 2585 gets a clean outgoing argument block. */
2566 old_stack_arg_under_construction = stack_arg_under_construction; 2586 old_stack_arg_under_construction = stack_arg_under_construction;
2567 stack_arg_under_construction = 0; 2587 stack_arg_under_construction = 0;
2568 } 2588 }
2569 argblock = push_block (ARGS_SIZE_RTX (adjusted_args_size), 0, 0); 2589 argblock = push_block (ARGS_SIZE_RTX (adjusted_args_size), 0, 0);
2570 } 2590 if (flag_stack_usage)
2591 current_function_has_unbounded_dynamic_stack_size = 1;
2592 }
2571 else 2593 else
2572 { 2594 {
2573 /* Note that we must go through the motions of allocating an argument 2595 /* Note that we must go through the motions of allocating an argument
2574 block even if the size is zero because we may be storing args 2596 block even if the size is zero because we may be storing args
2575 in the area reserved for register arguments, which may be part of 2597 in the area reserved for register arguments, which may be part of
2693 } 2715 }
2694 } 2716 }
2695 } 2717 }
2696 2718
2697 if (ACCUMULATE_OUTGOING_ARGS) 2719 if (ACCUMULATE_OUTGOING_ARGS)
2698 { 2720 {
2699 /* The save/restore code in store_one_arg handles all 2721 /* The save/restore code in store_one_arg handles all
2700 cases except one: a constructor call (including a C 2722 cases except one: a constructor call (including a C
2701 function returning a BLKmode struct) to initialize 2723 function returning a BLKmode struct) to initialize
2702 an argument. */ 2724 an argument. */
2703 if (stack_arg_under_construction) 2725 if (stack_arg_under_construction)
2704 { 2726 {
2705 rtx push_size 2727 rtx push_size
2706 = GEN_INT (adjusted_args_size.constant 2728 = GEN_INT (adjusted_args_size.constant
2707 + (OUTGOING_REG_PARM_STACK_SPACE ((!fndecl ? fntype 2729 + (OUTGOING_REG_PARM_STACK_SPACE ((!fndecl ? fntype
2708 : TREE_TYPE (fndecl))) ? 0 2730 : TREE_TYPE (fndecl))) ? 0
2709 : reg_parm_stack_space)); 2731 : reg_parm_stack_space));
2710 if (old_stack_level == 0) 2732 if (old_stack_level == 0)
2711 { 2733 {
2712 emit_stack_save (SAVE_BLOCK, &old_stack_level, 2734 emit_stack_save (SAVE_BLOCK, &old_stack_level);
2713 NULL_RTX); 2735 old_stack_pointer_delta = stack_pointer_delta;
2714 old_stack_pointer_delta = stack_pointer_delta; 2736 old_pending_adj = pending_stack_adjust;
2715 old_pending_adj = pending_stack_adjust; 2737 pending_stack_adjust = 0;
2716 pending_stack_adjust = 0; 2738 /* stack_arg_under_construction says whether a stack
2717 /* stack_arg_under_construction says whether a stack 2739 arg is being constructed at the old stack level.
2718 arg is being constructed at the old stack level. 2740 Pushing the stack gets a clean outgoing argument
2719 Pushing the stack gets a clean outgoing argument 2741 block. */
2720 block. */ 2742 old_stack_arg_under_construction
2721 old_stack_arg_under_construction 2743 = stack_arg_under_construction;
2722 = stack_arg_under_construction; 2744 stack_arg_under_construction = 0;
2723 stack_arg_under_construction = 0; 2745 /* Make a new map for the new argument list. */
2724 /* Make a new map for the new argument list. */ 2746 if (stack_usage_map_buf)
2725 if (stack_usage_map_buf) 2747 free (stack_usage_map_buf);
2726 free (stack_usage_map_buf); 2748 stack_usage_map_buf = XCNEWVEC (char, highest_outgoing_arg_in_use);
2727 stack_usage_map_buf = XCNEWVEC (char, highest_outgoing_arg_in_use); 2749 stack_usage_map = stack_usage_map_buf;
2728 stack_usage_map = stack_usage_map_buf; 2750 highest_outgoing_arg_in_use = 0;
2729 highest_outgoing_arg_in_use = 0; 2751 }
2730 } 2752 /* We can pass TRUE as the 4th argument because we just
2731 allocate_dynamic_stack_space (push_size, NULL_RTX, 2753 saved the stack pointer and will restore it right after
2732 BITS_PER_UNIT); 2754 the call. */
2733 } 2755 allocate_dynamic_stack_space (push_size, 0,
2734 2756 BIGGEST_ALIGNMENT, true);
2735 /* If argument evaluation might modify the stack pointer, 2757 }
2736 copy the address of the argument list to a register. */ 2758
2737 for (i = 0; i < num_actuals; i++) 2759 /* If argument evaluation might modify the stack pointer,
2738 if (args[i].pass_on_stack) 2760 copy the address of the argument list to a register. */
2739 { 2761 for (i = 0; i < num_actuals; i++)
2740 argblock = copy_addr_to_reg (argblock); 2762 if (args[i].pass_on_stack)
2741 break; 2763 {
2742 } 2764 argblock = copy_addr_to_reg (argblock);
2743 } 2765 break;
2766 }
2767 }
2744 2768
2745 compute_argument_addresses (args, argblock, num_actuals); 2769 compute_argument_addresses (args, argblock, num_actuals);
2746 2770
2747 /* If we push args individually in reverse order, perform stack alignment 2771 /* If we push args individually in reverse order, perform stack alignment
2748 before the first push (the last arg). */ 2772 before the first push (the last arg). */
2767 } 2791 }
2768 /* Now that the stack is properly aligned, pops can't safely 2792 /* Now that the stack is properly aligned, pops can't safely
2769 be deferred during the evaluation of the arguments. */ 2793 be deferred during the evaluation of the arguments. */
2770 NO_DEFER_POP; 2794 NO_DEFER_POP;
2771 2795
2796 /* Record the maximum pushed stack space size. We need to delay
2797 doing it this far to take into account the optimization done
2798 by combine_pending_stack_adjustment_and_call. */
2799 if (flag_stack_usage
2800 && !ACCUMULATE_OUTGOING_ARGS
2801 && pass
2802 && adjusted_args_size.var == 0)
2803 {
2804 int pushed = adjusted_args_size.constant + pending_stack_adjust;
2805 if (pushed > current_function_pushed_stack_size)
2806 current_function_pushed_stack_size = pushed;
2807 }
2808
2772 funexp = rtx_for_function_call (fndecl, addr); 2809 funexp = rtx_for_function_call (fndecl, addr);
2773 2810
2774 /* Figure out the register where the value, if any, will come back. */ 2811 /* Figure out the register where the value, if any, will come back. */
2775 valreg = 0; 2812 valreg = 0;
2776 if (TYPE_MODE (rettype) != VOIDmode 2813 if (TYPE_MODE (rettype) != VOIDmode
2907 /* Save a pointer to the last insn before the call, so that we can 2944 /* Save a pointer to the last insn before the call, so that we can
2908 later safely search backwards to find the CALL_INSN. */ 2945 later safely search backwards to find the CALL_INSN. */
2909 before_call = get_last_insn (); 2946 before_call = get_last_insn ();
2910 2947
2911 /* Set up next argument register. For sibling calls on machines 2948 /* Set up next argument register. For sibling calls on machines
2912 with register windows this should be the incoming register. */ 2949 with register windows this should be the incoming register. */
2913 #ifdef FUNCTION_INCOMING_ARG
2914 if (pass == 0) 2950 if (pass == 0)
2915 next_arg_reg = FUNCTION_INCOMING_ARG (args_so_far, VOIDmode, 2951 next_arg_reg = targetm.calls.function_incoming_arg (&args_so_far,
2916 void_type_node, 1); 2952 VOIDmode,
2953 void_type_node,
2954 true);
2917 else 2955 else
2918 #endif 2956 next_arg_reg = targetm.calls.function_arg (&args_so_far,
2919 next_arg_reg = FUNCTION_ARG (args_so_far, VOIDmode, 2957 VOIDmode, void_type_node,
2920 void_type_node, 1); 2958 true);
2921 2959
2922 /* All arguments and registers used for the call must be set up by 2960 /* All arguments and registers used for the call must be set up by
2923 now! */ 2961 now! */
2924 2962
2925 /* Stack must be properly aligned now. */ 2963 /* Stack must be properly aligned now. */
3147 3185
3148 /* If size of args is variable or this was a constructor call for a stack 3186 /* If size of args is variable or this was a constructor call for a stack
3149 argument, restore saved stack-pointer value. */ 3187 argument, restore saved stack-pointer value. */
3150 3188
3151 if (old_stack_level) 3189 if (old_stack_level)
3152 { 3190 {
3153 emit_stack_restore (SAVE_BLOCK, old_stack_level, NULL_RTX); 3191 emit_stack_restore (SAVE_BLOCK, old_stack_level);
3154 stack_pointer_delta = old_stack_pointer_delta; 3192 stack_pointer_delta = old_stack_pointer_delta;
3155 pending_stack_adjust = old_pending_adj; 3193 pending_stack_adjust = old_pending_adj;
3156 old_stack_allocated = stack_pointer_delta - pending_stack_adjust; 3194 old_stack_allocated = stack_pointer_delta - pending_stack_adjust;
3157 stack_arg_under_construction = old_stack_arg_under_construction; 3195 stack_arg_under_construction = old_stack_arg_under_construction;
3158 highest_outgoing_arg_in_use = initial_highest_arg_in_use; 3196 highest_outgoing_arg_in_use = initial_highest_arg_in_use;
3159 stack_usage_map = initial_stack_usage_map; 3197 stack_usage_map = initial_stack_usage_map;
3160 sibcall_failure = 1; 3198 sibcall_failure = 1;
3161 } 3199 }
3162 else if (ACCUMULATE_OUTGOING_ARGS && pass) 3200 else if (ACCUMULATE_OUTGOING_ARGS && pass)
3163 { 3201 {
3164 #ifdef REG_PARM_STACK_SPACE 3202 #ifdef REG_PARM_STACK_SPACE
3165 if (save_area) 3203 if (save_area)
3166 restore_fixed_argument_area (save_area, argblock, 3204 restore_fixed_argument_area (save_area, argblock,
3502 3540
3503 argvec[count].value = addr; 3541 argvec[count].value = addr;
3504 argvec[count].mode = Pmode; 3542 argvec[count].mode = Pmode;
3505 argvec[count].partial = 0; 3543 argvec[count].partial = 0;
3506 3544
3507 argvec[count].reg = FUNCTION_ARG (args_so_far, Pmode, NULL_TREE, 1); 3545 argvec[count].reg = targetm.calls.function_arg (&args_so_far,
3546 Pmode, NULL_TREE, true);
3508 gcc_assert (targetm.calls.arg_partial_bytes (&args_so_far, Pmode, 3547 gcc_assert (targetm.calls.arg_partial_bytes (&args_so_far, Pmode,
3509 NULL_TREE, 1) == 0); 3548 NULL_TREE, 1) == 0);
3510 3549
3511 locate_and_pad_parm (Pmode, NULL_TREE, 3550 locate_and_pad_parm (Pmode, NULL_TREE,
3512 #ifdef STACK_PARMS_IN_REG_PARM_AREA 3551 #ifdef STACK_PARMS_IN_REG_PARM_AREA
3518 3557
3519 if (argvec[count].reg == 0 || argvec[count].partial != 0 3558 if (argvec[count].reg == 0 || argvec[count].partial != 0
3520 || reg_parm_stack_space > 0) 3559 || reg_parm_stack_space > 0)
3521 args_size.constant += argvec[count].locate.size.constant; 3560 args_size.constant += argvec[count].locate.size.constant;
3522 3561
3523 FUNCTION_ARG_ADVANCE (args_so_far, Pmode, (tree) 0, 1); 3562 targetm.calls.function_arg_advance (&args_so_far, Pmode, (tree) 0, true);
3524 3563
3525 count++; 3564 count++;
3526 } 3565 }
3527 3566
3528 for (; count < nargs; count++) 3567 for (; count < nargs; count++)
3577 } 3616 }
3578 3617
3579 argvec[count].value = val; 3618 argvec[count].value = val;
3580 argvec[count].mode = mode; 3619 argvec[count].mode = mode;
3581 3620
3582 argvec[count].reg = FUNCTION_ARG (args_so_far, mode, NULL_TREE, 1); 3621 argvec[count].reg = targetm.calls.function_arg (&args_so_far, mode,
3622 NULL_TREE, true);
3583 3623
3584 argvec[count].partial 3624 argvec[count].partial
3585 = targetm.calls.arg_partial_bytes (&args_so_far, mode, NULL_TREE, 1); 3625 = targetm.calls.arg_partial_bytes (&args_so_far, mode, NULL_TREE, 1);
3586 3626
3587 locate_and_pad_parm (mode, NULL_TREE, 3627 locate_and_pad_parm (mode, NULL_TREE,
3597 3637
3598 if (argvec[count].reg == 0 || argvec[count].partial != 0 3638 if (argvec[count].reg == 0 || argvec[count].partial != 0
3599 || reg_parm_stack_space > 0) 3639 || reg_parm_stack_space > 0)
3600 args_size.constant += argvec[count].locate.size.constant; 3640 args_size.constant += argvec[count].locate.size.constant;
3601 3641
3602 FUNCTION_ARG_ADVANCE (args_so_far, mode, (tree) 0, 1); 3642 targetm.calls.function_arg_advance (&args_so_far, mode, (tree) 0, true);
3603 } 3643 }
3604 3644
3605 /* If this machine requires an external definition for library 3645 /* If this machine requires an external definition for library
3606 functions, write one out. */ 3646 functions, write one out. */
3607 assemble_external_libcall (fun); 3647 assemble_external_libcall (fun);
3620 if (! OUTGOING_REG_PARM_STACK_SPACE ((!fndecl ? fntype : TREE_TYPE (fndecl)))) 3660 if (! OUTGOING_REG_PARM_STACK_SPACE ((!fndecl ? fntype : TREE_TYPE (fndecl))))
3621 args_size.constant -= reg_parm_stack_space; 3661 args_size.constant -= reg_parm_stack_space;
3622 3662
3623 if (args_size.constant > crtl->outgoing_args_size) 3663 if (args_size.constant > crtl->outgoing_args_size)
3624 crtl->outgoing_args_size = args_size.constant; 3664 crtl->outgoing_args_size = args_size.constant;
3665
3666 if (flag_stack_usage && !ACCUMULATE_OUTGOING_ARGS)
3667 {
3668 int pushed = args_size.constant + pending_stack_adjust;
3669 if (pushed > current_function_pushed_stack_size)
3670 current_function_pushed_stack_size = pushed;
3671 }
3625 3672
3626 if (ACCUMULATE_OUTGOING_ARGS) 3673 if (ACCUMULATE_OUTGOING_ARGS)
3627 { 3674 {
3628 /* Since the stack pointer will never be pushed, it is possible for 3675 /* Since the stack pointer will never be pushed, it is possible for
3629 the evaluation of a parm to clobber something we have already 3676 the evaluation of a parm to clobber something we have already
3902 Signedness plays no role in that, so for simplicity, we pretend it's 3949 Signedness plays no role in that, so for simplicity, we pretend it's
3903 always signed. We also assume that the list of arguments passed has 3950 always signed. We also assume that the list of arguments passed has
3904 no impact, so we pretend it is unknown. */ 3951 no impact, so we pretend it is unknown. */
3905 3952
3906 emit_call_1 (fun, NULL, 3953 emit_call_1 (fun, NULL,
3907 get_identifier (XSTR (orgfun, 0)), 3954 get_identifier (XSTR (orgfun, 0)),
3908 build_function_type (tfom, NULL_TREE), 3955 build_function_type (tfom, NULL_TREE),
3909 original_args_size.constant, args_size.constant, 3956 original_args_size.constant, args_size.constant,
3910 struct_value_size, 3957 struct_value_size,
3911 FUNCTION_ARG (args_so_far, VOIDmode, void_type_node, 1), 3958 targetm.calls.function_arg (&args_so_far,
3912 valreg, 3959 VOIDmode, void_type_node, true),
3913 old_inhibit_defer_pop + 1, call_fusage, flags, & args_so_far); 3960 valreg,
3961 old_inhibit_defer_pop + 1, call_fusage, flags, & args_so_far);
3914 3962
3915 /* For calls to `setjmp', etc., inform function.c:setjmp_warnings 3963 /* For calls to `setjmp', etc., inform function.c:setjmp_warnings
3916 that it should complain if nonvolatile values are live. For 3964 that it should complain if nonvolatile values are live. For
3917 functions that cannot return, inform flow that control does not 3965 functions that cannot return, inform flow that control does not
3918 fall through. */ 3966 fall through. */