1 /* Convert function calls to rtl insns, for GNU C compiler.
2 Copyright (C) 1989, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
4 This file is part of GNU CC.
6 GNU CC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 GNU CC is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU CC; see the file COPYING. If not, write to
18 the Free Software Foundation, 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
33 #include "insn-flags.h"
35 /* Decide whether a function's arguments should be processed
36 from first to last or from last to first.
38 They should if the stack and args grow in opposite directions, but
39 only if we have push insns. */
43 #if defined (STACK_GROWS_DOWNWARD) != defined (ARGS_GROW_DOWNWARD)
44 #define PUSH_ARGS_REVERSED /* If it's last to first */
49 /* Like STACK_BOUNDARY but in units of bytes, not bits. */
50 #define STACK_BYTES (STACK_BOUNDARY / BITS_PER_UNIT)
52 /* Data structure and subroutines used within expand_call. */
56 /* Tree node for this argument. */
58 /* Mode for value; TYPE_MODE unless promoted. */
59 enum machine_mode mode;
60 /* Current RTL value for argument, or 0 if it isn't precomputed. */
62 /* Initially-compute RTL value for argument; only for const functions. */
64 /* Register to pass this argument in, 0 if passed on stack, or an
65 PARALLEL if the arg is to be copied into multiple non-contiguous
68 /* If REG was promoted from the actual mode of the argument expression,
69 indicates whether the promotion is sign- or zero-extended. */
71 /* Number of registers to use. 0 means put the whole arg in registers.
72 Also 0 if not passed in registers. */
74 /* Non-zero if argument must be passed on stack.
75 Note that some arguments may be passed on the stack
76 even though pass_on_stack is zero, just because FUNCTION_ARG says so.
77 pass_on_stack identifies arguments that *cannot* go in registers. */
79 /* Offset of this argument from beginning of stack-args. */
80 struct args_size offset;
81 /* Similar, but offset to the start of the stack slot. Different from
82 OFFSET if this arg pads downward. */
83 struct args_size slot_offset;
84 /* Size of this argument on the stack, rounded up for any padding it gets,
85 parts of the argument passed in registers do not count.
86 If REG_PARM_STACK_SPACE is defined, then register parms
87 are counted here as well. */
88 struct args_size size;
89 /* Location on the stack at which parameter should be stored. The store
90 has already been done if STACK == VALUE. */
92 /* Location on the stack of the start of this argument slot. This can
93 differ from STACK if this arg pads downward. This location is known
94 to be aligned to FUNCTION_ARG_BOUNDARY. */
96 #ifdef ACCUMULATE_OUTGOING_ARGS
97 /* Place that this stack area has been saved, if needed. */
100 /* If an argument's alignment does not permit direct copying into registers,
101 copy in smaller-sized pieces into pseudos. These are stored in a
102 block pointed to by this field. The next field says how many
103 word-sized pseudos we made. */
108 #ifdef ACCUMULATE_OUTGOING_ARGS
109 /* A vector of one char per byte of stack space. A byte if non-zero if
110 the corresponding stack location has been used.
111 This vector is used to prevent a function call within an argument from
112 clobbering any stack already set up. */
113 static char *stack_usage_map;
115 /* Size of STACK_USAGE_MAP. */
116 static int highest_outgoing_arg_in_use;
118 /* stack_arg_under_construction is nonzero when an argument may be
119 initialized with a constructor call (including a C function that
120 returns a BLKmode struct) and expand_call must take special action
121 to make sure the object being constructed does not overlap the
122 argument list for the constructor call. */
123 int stack_arg_under_construction;
126 static int calls_function PROTO((tree, int));
127 static int calls_function_1 PROTO((tree, int));
128 static void emit_call_1 PROTO((rtx, tree, tree, int, int, rtx, rtx,
130 static void store_one_arg PROTO ((struct arg_data *, rtx, int, int,
133 /* If WHICH is 1, return 1 if EXP contains a call to the built-in function
136 If WHICH is 0, return 1 if EXP contains a call to any function.
137 Actually, we only need return 1 if evaluating EXP would require pushing
138 arguments on the stack, but that is too difficult to compute, so we just
139 assume any function call might require the stack. */
141 static tree calls_function_save_exprs;
144 calls_function (exp, which)
149 calls_function_save_exprs = 0;
150 val = calls_function_1 (exp, which);
151 calls_function_save_exprs = 0;
156 calls_function_1 (exp, which)
161 enum tree_code code = TREE_CODE (exp);
162 int type = TREE_CODE_CLASS (code);
163 int length = tree_code_length[(int) code];
165 /* If this code is language-specific, we don't know what it will do. */
166 if ((int) code >= NUM_TREE_CODES)
169 /* Only expressions and references can contain calls. */
170 if (type != 'e' && type != '<' && type != '1' && type != '2' && type != 'r'
179 else if (TREE_CODE (TREE_OPERAND (exp, 0)) == ADDR_EXPR
180 && (TREE_CODE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0))
183 tree fndecl = TREE_OPERAND (TREE_OPERAND (exp, 0), 0);
185 if ((DECL_BUILT_IN (fndecl)
186 && DECL_FUNCTION_CODE (fndecl) == BUILT_IN_ALLOCA)
187 || (DECL_SAVED_INSNS (fndecl)
188 && (FUNCTION_FLAGS (DECL_SAVED_INSNS (fndecl))
189 & FUNCTION_FLAGS_CALLS_ALLOCA)))
193 /* Third operand is RTL. */
198 if (SAVE_EXPR_RTL (exp) != 0)
200 if (value_member (exp, calls_function_save_exprs))
202 calls_function_save_exprs = tree_cons (NULL_TREE, exp,
203 calls_function_save_exprs);
204 return (TREE_OPERAND (exp, 0) != 0
205 && calls_function_1 (TREE_OPERAND (exp, 0), which));
211 for (local = BLOCK_VARS (exp); local; local = TREE_CHAIN (local))
212 if (DECL_INITIAL (local) != 0
213 && calls_function_1 (DECL_INITIAL (local), which))
217 register tree subblock;
219 for (subblock = BLOCK_SUBBLOCKS (exp);
221 subblock = TREE_CHAIN (subblock))
222 if (calls_function_1 (subblock, which))
227 case METHOD_CALL_EXPR:
231 case WITH_CLEANUP_EXPR:
242 for (i = 0; i < length; i++)
243 if (TREE_OPERAND (exp, i) != 0
244 && calls_function_1 (TREE_OPERAND (exp, i), which))
250 /* Force FUNEXP into a form suitable for the address of a CALL,
251 and return that as an rtx. Also load the static chain register
252 if FNDECL is a nested function.
254 CALL_FUSAGE points to a variable holding the prospective
255 CALL_INSN_FUNCTION_USAGE information. */
258 prepare_call_address (funexp, fndecl, call_fusage, reg_parm_seen)
264 rtx static_chain_value = 0;
266 funexp = protect_from_queue (funexp, 0);
269 /* Get possible static chain value for nested function in C. */
270 static_chain_value = lookup_static_chain (fndecl);
272 /* Make a valid memory address and copy constants thru pseudo-regs,
273 but not for a constant address if -fno-function-cse. */
274 if (GET_CODE (funexp) != SYMBOL_REF)
275 /* If we are using registers for parameters, force the
276 function address into a register now. */
277 funexp = ((SMALL_REGISTER_CLASSES && reg_parm_seen)
278 ? force_not_mem (memory_address (FUNCTION_MODE, funexp))
279 : memory_address (FUNCTION_MODE, funexp));
282 #ifndef NO_FUNCTION_CSE
283 if (optimize && ! flag_no_function_cse)
284 #ifdef NO_RECURSIVE_FUNCTION_CSE
285 if (fndecl != current_function_decl)
287 funexp = force_reg (Pmode, funexp);
291 if (static_chain_value != 0)
293 emit_move_insn (static_chain_rtx, static_chain_value);
295 if (GET_CODE (static_chain_rtx) == REG)
296 use_reg (call_fusage, static_chain_rtx);
302 /* Generate instructions to call function FUNEXP,
303 and optionally pop the results.
304 The CALL_INSN is the first insn generated.
306 FNDECL is the declaration node of the function. This is given to the
307 macro RETURN_POPS_ARGS to determine whether this function pops its own args.
309 FUNTYPE is the data type of the function. This is given to the macro
310 RETURN_POPS_ARGS to determine whether this function pops its own args.
311 We used to allow an identifier for library functions, but that doesn't
312 work when the return type is an aggregate type and the calling convention
313 says that the pointer to this aggregate is to be popped by the callee.
315 STACK_SIZE is the number of bytes of arguments on the stack,
316 rounded up to STACK_BOUNDARY; zero if the size is variable.
317 This is both to put into the call insn and
318 to generate explicit popping code if necessary.
320 STRUCT_VALUE_SIZE is the number of bytes wanted in a structure value.
321 It is zero if this call doesn't want a structure value.
323 NEXT_ARG_REG is the rtx that results from executing
324 FUNCTION_ARG (args_so_far, VOIDmode, void_type_node, 1)
325 just after all the args have had their registers assigned.
326 This could be whatever you like, but normally it is the first
327 arg-register beyond those used for args in this call,
328 or 0 if all the arg-registers are used in this call.
329 It is passed on to `gen_call' so you can put this info in the call insn.
331 VALREG is a hard register in which a value is returned,
332 or 0 if the call does not return a value.
334 OLD_INHIBIT_DEFER_POP is the value that `inhibit_defer_pop' had before
335 the args to this call were processed.
336 We restore `inhibit_defer_pop' to that value.
338 CALL_FUSAGE is either empty or an EXPR_LIST of USE expressions that
339 denote registers used by the called function.
341 IS_CONST is true if this is a `const' call. */
344 emit_call_1 (funexp, fndecl, funtype, stack_size, struct_value_size,
345 next_arg_reg, valreg, old_inhibit_defer_pop, call_fusage,
351 int struct_value_size;
354 int old_inhibit_defer_pop;
358 rtx stack_size_rtx = GEN_INT (stack_size);
359 rtx struct_value_size_rtx = GEN_INT (struct_value_size);
361 int already_popped = 0;
363 /* Ensure address is valid. SYMBOL_REF is already valid, so no need,
364 and we don't want to load it into a register as an optimization,
365 because prepare_call_address already did it if it should be done. */
366 if (GET_CODE (funexp) != SYMBOL_REF)
367 funexp = memory_address (FUNCTION_MODE, funexp);
369 #ifndef ACCUMULATE_OUTGOING_ARGS
370 #if defined (HAVE_call_pop) && defined (HAVE_call_value_pop)
371 if (HAVE_call_pop && HAVE_call_value_pop
372 && (RETURN_POPS_ARGS (fndecl, funtype, stack_size) > 0
375 rtx n_pop = GEN_INT (RETURN_POPS_ARGS (fndecl, funtype, stack_size));
378 /* If this subroutine pops its own args, record that in the call insn
379 if possible, for the sake of frame pointer elimination. */
382 pat = gen_call_value_pop (valreg,
383 gen_rtx_MEM (FUNCTION_MODE, funexp),
384 stack_size_rtx, next_arg_reg, n_pop);
386 pat = gen_call_pop (gen_rtx_MEM (FUNCTION_MODE, funexp),
387 stack_size_rtx, next_arg_reg, n_pop);
389 emit_call_insn (pat);
396 #if defined (HAVE_call) && defined (HAVE_call_value)
397 if (HAVE_call && HAVE_call_value)
400 emit_call_insn (gen_call_value (valreg,
401 gen_rtx_MEM (FUNCTION_MODE, funexp),
402 stack_size_rtx, next_arg_reg,
405 emit_call_insn (gen_call (gen_rtx_MEM (FUNCTION_MODE, funexp),
406 stack_size_rtx, next_arg_reg,
407 struct_value_size_rtx));
413 /* Find the CALL insn we just emitted. */
414 for (call_insn = get_last_insn ();
415 call_insn && GET_CODE (call_insn) != CALL_INSN;
416 call_insn = PREV_INSN (call_insn))
422 /* Put the register usage information on the CALL. If there is already
423 some usage information, put ours at the end. */
424 if (CALL_INSN_FUNCTION_USAGE (call_insn))
428 for (link = CALL_INSN_FUNCTION_USAGE (call_insn); XEXP (link, 1) != 0;
429 link = XEXP (link, 1))
432 XEXP (link, 1) = call_fusage;
435 CALL_INSN_FUNCTION_USAGE (call_insn) = call_fusage;
437 /* If this is a const call, then set the insn's unchanging bit. */
439 CONST_CALL_P (call_insn) = 1;
441 /* Restore this now, so that we do defer pops for this call's args
442 if the context of the call as a whole permits. */
443 inhibit_defer_pop = old_inhibit_defer_pop;
445 #ifndef ACCUMULATE_OUTGOING_ARGS
446 /* If returning from the subroutine does not automatically pop the args,
447 we need an instruction to pop them sooner or later.
448 Perhaps do it now; perhaps just record how much space to pop later.
450 If returning from the subroutine does pop the args, indicate that the
451 stack pointer will be changed. */
453 if (stack_size != 0 && RETURN_POPS_ARGS (fndecl, funtype, stack_size) > 0)
456 CALL_INSN_FUNCTION_USAGE (call_insn)
457 = gen_rtx_EXPR_LIST (VOIDmode,
458 gen_rtx_CLOBBER (VOIDmode, stack_pointer_rtx),
459 CALL_INSN_FUNCTION_USAGE (call_insn));
460 stack_size -= RETURN_POPS_ARGS (fndecl, funtype, stack_size);
461 stack_size_rtx = GEN_INT (stack_size);
466 if (flag_defer_pop && inhibit_defer_pop == 0 && !is_const)
467 pending_stack_adjust += stack_size;
469 adjust_stack (stack_size_rtx);
474 /* Generate all the code for a function call
475 and return an rtx for its value.
476 Store the value in TARGET (specified as an rtx) if convenient.
477 If the value is stored in TARGET then TARGET is returned.
478 If IGNORE is nonzero, then we ignore the value of the function call. */
481 expand_call (exp, target, ignore)
486 /* List of actual parameters. */
487 tree actparms = TREE_OPERAND (exp, 1);
488 /* RTX for the function to be called. */
490 /* Data type of the function. */
492 /* Declaration of the function being called,
493 or 0 if the function is computed (not known by name). */
497 /* Register in which non-BLKmode value will be returned,
498 or 0 if no value or if value is BLKmode. */
500 /* Address where we should return a BLKmode value;
501 0 if value not BLKmode. */
502 rtx structure_value_addr = 0;
503 /* Nonzero if that address is being passed by treating it as
504 an extra, implicit first parameter. Otherwise,
505 it is passed by being copied directly into struct_value_rtx. */
506 int structure_value_addr_parm = 0;
507 /* Size of aggregate value wanted, or zero if none wanted
508 or if we are using the non-reentrant PCC calling convention
509 or expecting the value in registers. */
510 int struct_value_size = 0;
511 /* Nonzero if called function returns an aggregate in memory PCC style,
512 by returning the address of where to find it. */
513 int pcc_struct_value = 0;
515 /* Number of actual parameters in this call, including struct value addr. */
517 /* Number of named args. Args after this are anonymous ones
518 and they must all go on the stack. */
520 /* Count arg position in order args appear. */
523 /* Vector of information about each argument.
524 Arguments are numbered in the order they will be pushed,
525 not the order they are written. */
526 struct arg_data *args;
528 /* Total size in bytes of all the stack-parms scanned so far. */
529 struct args_size args_size;
530 /* Size of arguments before any adjustments (such as rounding). */
531 struct args_size original_args_size;
532 /* Data on reg parms scanned so far. */
533 CUMULATIVE_ARGS args_so_far;
534 /* Nonzero if a reg parm has been scanned. */
536 /* Nonzero if this is an indirect function call. */
538 /* Nonzero if we must avoid push-insns in the args for this call.
539 If stack space is allocated for register parameters, but not by the
540 caller, then it is preallocated in the fixed part of the stack frame.
541 So the entire argument block must then be preallocated (i.e., we
542 ignore PUSH_ROUNDING in that case). */
544 #if defined(REG_PARM_STACK_SPACE) && ! defined(OUTGOING_REG_PARM_STACK_SPACE)
545 int must_preallocate = 1;
548 int must_preallocate = 0;
550 int must_preallocate = 1;
554 /* Size of the stack reserved for parameter registers. */
555 int reg_parm_stack_space = 0;
557 /* 1 if scanning parms front to back, -1 if scanning back to front. */
559 /* Address of space preallocated for stack parms
560 (on machines that lack push insns), or 0 if space not preallocated. */
563 /* Nonzero if it is plausible that this is a call to alloca. */
565 /* Nonzero if this is a call to malloc or a related function. */
567 /* Nonzero if this is a call to setjmp or a related function. */
569 /* Nonzero if this is a call to `longjmp'. */
571 /* Nonzero if this is a call to an inline function. */
572 int is_integrable = 0;
573 /* Nonzero if this is a call to a `const' function.
574 Note that only explicitly named functions are handled as `const' here. */
576 /* Nonzero if this is a call to a `volatile' function. */
578 #if defined(ACCUMULATE_OUTGOING_ARGS) && defined(REG_PARM_STACK_SPACE)
579 /* Define the boundary of the register parm stack space that needs to be
581 int low_to_save = -1, high_to_save;
582 rtx save_area = 0; /* Place that it is saved */
585 #ifdef ACCUMULATE_OUTGOING_ARGS
586 int initial_highest_arg_in_use = highest_outgoing_arg_in_use;
587 char *initial_stack_usage_map = stack_usage_map;
590 rtx old_stack_level = 0;
591 int old_pending_adj = 0;
592 int old_stack_arg_under_construction;
593 int old_inhibit_defer_pop = inhibit_defer_pop;
598 /* The value of the function call can be put in a hard register. But
599 if -fcheck-memory-usage, code which invokes functions (and thus
600 damages some hard registers) can be inserted before using the value.
601 So, target is always a pseudo-register in that case. */
602 if (flag_check_memory_usage)
605 /* See if we can find a DECL-node for the actual function.
606 As a result, decide whether this is a call to an integrable function. */
608 p = TREE_OPERAND (exp, 0);
609 if (TREE_CODE (p) == ADDR_EXPR)
611 fndecl = TREE_OPERAND (p, 0);
612 if (TREE_CODE (fndecl) != FUNCTION_DECL)
617 && fndecl != current_function_decl
618 && DECL_INLINE (fndecl)
619 && DECL_SAVED_INSNS (fndecl)
620 && RTX_INTEGRATED_P (DECL_SAVED_INSNS (fndecl)))
622 else if (! TREE_ADDRESSABLE (fndecl))
624 /* In case this function later becomes inlinable,
625 record that there was already a non-inline call to it.
627 Use abstraction instead of setting TREE_ADDRESSABLE
629 if (DECL_INLINE (fndecl) && warn_inline && !flag_no_inline
632 warning_with_decl (fndecl, "can't inline call to `%s'");
633 warning ("called from here");
635 mark_addressable (fndecl);
638 if (TREE_READONLY (fndecl) && ! TREE_THIS_VOLATILE (fndecl)
639 && TYPE_MODE (TREE_TYPE (exp)) != VOIDmode)
642 if (TREE_THIS_VOLATILE (fndecl))
647 /* If we don't have specific function to call, see if we have a
648 constant or `noreturn' function from the type. */
651 is_const = TREE_READONLY (TREE_TYPE (TREE_TYPE (p)));
652 is_volatile = TREE_THIS_VOLATILE (TREE_TYPE (TREE_TYPE (p)));
655 #ifdef REG_PARM_STACK_SPACE
656 #ifdef MAYBE_REG_PARM_STACK_SPACE
657 reg_parm_stack_space = MAYBE_REG_PARM_STACK_SPACE;
659 reg_parm_stack_space = REG_PARM_STACK_SPACE (fndecl);
663 /* Warn if this value is an aggregate type,
664 regardless of which calling convention we are using for it. */
665 if (warn_aggregate_return && AGGREGATE_TYPE_P (TREE_TYPE (exp)))
666 warning ("function call has aggregate value");
668 /* Set up a place to return a structure. */
670 /* Cater to broken compilers. */
671 if (aggregate_value_p (exp))
673 /* This call returns a big structure. */
676 #ifdef PCC_STATIC_STRUCT_RETURN
678 pcc_struct_value = 1;
679 /* Easier than making that case work right. */
682 /* In case this is a static function, note that it has been
684 if (! TREE_ADDRESSABLE (fndecl))
685 mark_addressable (fndecl);
689 #else /* not PCC_STATIC_STRUCT_RETURN */
691 struct_value_size = int_size_in_bytes (TREE_TYPE (exp));
693 if (target && GET_CODE (target) == MEM)
694 structure_value_addr = XEXP (target, 0);
697 /* Assign a temporary to hold the value. */
700 /* For variable-sized objects, we must be called with a target
701 specified. If we were to allocate space on the stack here,
702 we would have no way of knowing when to free it. */
704 if (struct_value_size < 0)
707 /* This DECL is just something to feed to mark_addressable;
708 it doesn't get pushed. */
709 d = build_decl (VAR_DECL, NULL_TREE, TREE_TYPE (exp));
710 DECL_RTL (d) = assign_temp (TREE_TYPE (exp), 1, 0, 1);
711 mark_addressable (d);
712 structure_value_addr = XEXP (DECL_RTL (d), 0);
713 MEM_IN_STRUCT_P (structure_value_addr)
714 = AGGREGATE_TYPE_P (TREE_TYPE (exp));
718 #endif /* not PCC_STATIC_STRUCT_RETURN */
721 /* If called function is inline, try to integrate it. */
726 rtx before_call = get_last_insn ();
728 temp = expand_inline_function (fndecl, actparms, target,
729 ignore, TREE_TYPE (exp),
730 structure_value_addr);
732 /* If inlining succeeded, return. */
733 if ((HOST_WIDE_INT) temp != -1)
735 #ifdef ACCUMULATE_OUTGOING_ARGS
736 /* If the outgoing argument list must be preserved, push
737 the stack before executing the inlined function if it
740 for (i = reg_parm_stack_space - 1; i >= 0; i--)
741 if (i < highest_outgoing_arg_in_use && stack_usage_map[i] != 0)
744 if (stack_arg_under_construction || i >= 0)
747 = before_call ? NEXT_INSN (before_call) : get_insns ();
750 /* Look for a call in the inline function code.
751 If OUTGOING_ARGS_SIZE (DECL_SAVED_INSNS (fndecl)) is
752 nonzero then there is a call and it is not necessary
753 to scan the insns. */
755 if (OUTGOING_ARGS_SIZE (DECL_SAVED_INSNS (fndecl)) == 0)
756 for (insn = first_insn; insn; insn = NEXT_INSN (insn))
757 if (GET_CODE (insn) == CALL_INSN)
762 /* Reserve enough stack space so that the largest
763 argument list of any function call in the inline
764 function does not overlap the argument list being
765 evaluated. This is usually an overestimate because
766 allocate_dynamic_stack_space reserves space for an
767 outgoing argument list in addition to the requested
768 space, but there is no way to ask for stack space such
769 that an argument list of a certain length can be
770 safely constructed. */
772 int adjust = OUTGOING_ARGS_SIZE (DECL_SAVED_INSNS (fndecl));
773 #ifdef REG_PARM_STACK_SPACE
774 /* Add the stack space reserved for register arguments
775 in the inline function. What is really needed is the
776 largest value of reg_parm_stack_space in the inline
777 function, but that is not available. Using the current
778 value of reg_parm_stack_space is wrong, but gives
779 correct results on all supported machines. */
780 adjust += reg_parm_stack_space;
783 emit_stack_save (SAVE_BLOCK, &old_stack_level, NULL_RTX);
784 allocate_dynamic_stack_space (GEN_INT (adjust),
785 NULL_RTX, BITS_PER_UNIT);
788 emit_insns_before (seq, first_insn);
789 emit_stack_restore (SAVE_BLOCK, old_stack_level, NULL_RTX);
794 /* If the result is equivalent to TARGET, return TARGET to simplify
795 checks in store_expr. They can be equivalent but not equal in the
796 case of a function that returns BLKmode. */
797 if (temp != target && rtx_equal_p (temp, target))
802 /* If inlining failed, mark FNDECL as needing to be compiled
803 separately after all. If function was declared inline,
805 if (DECL_INLINE (fndecl) && warn_inline && !flag_no_inline
806 && optimize > 0 && ! TREE_ADDRESSABLE (fndecl))
808 warning_with_decl (fndecl, "inlining failed in call to `%s'");
809 warning ("called from here");
811 mark_addressable (fndecl);
814 /* When calling a const function, we must pop the stack args right away,
815 so that the pop is deleted or moved with the call. */
819 function_call_count++;
821 if (fndecl && DECL_NAME (fndecl))
822 name = IDENTIFIER_POINTER (DECL_NAME (fndecl));
825 /* Unless it's a call to a specific function that isn't alloca,
826 if it has one argument, we must assume it might be alloca. */
829 = (!(fndecl != 0 && strcmp (name, "alloca"))
831 && TREE_CHAIN (actparms) == 0);
833 /* We assume that alloca will always be called by name. It
834 makes no sense to pass it as a pointer-to-function to
835 anything that does not understand its behavior. */
837 = (name && ((IDENTIFIER_LENGTH (DECL_NAME (fndecl)) == 6
839 && ! strcmp (name, "alloca"))
840 || (IDENTIFIER_LENGTH (DECL_NAME (fndecl)) == 16
842 && ! strcmp (name, "__builtin_alloca"))));
845 /* See if this is a call to a function that can return more than once
846 or a call to longjmp. */
852 if (name != 0 && IDENTIFIER_LENGTH (DECL_NAME (fndecl)) <= 15
853 /* Exclude functions not at the file scope, or not `extern',
854 since they are not the magic functions we would otherwise
856 && DECL_CONTEXT (fndecl) == NULL_TREE && TREE_PUBLIC (fndecl))
860 /* Disregard prefix _, __ or __x. */
863 if (name[1] == '_' && name[2] == 'x')
865 else if (name[1] == '_')
875 && (! strcmp (tname, "setjmp")
876 || ! strcmp (tname, "setjmp_syscall")))
878 && ! strcmp (tname, "sigsetjmp"))
880 && ! strcmp (tname, "savectx")));
882 && ! strcmp (tname, "siglongjmp"))
885 else if ((tname[0] == 'q' && tname[1] == 's'
886 && ! strcmp (tname, "qsetjmp"))
887 || (tname[0] == 'v' && tname[1] == 'f'
888 && ! strcmp (tname, "vfork")))
891 else if (tname[0] == 'l' && tname[1] == 'o'
892 && ! strcmp (tname, "longjmp"))
894 /* XXX should have "malloc" attribute on functions instead
895 of recognizing them by name. */
896 else if (! strcmp (tname, "malloc")
897 || ! strcmp (tname, "calloc")
898 || ! strcmp (tname, "realloc")
899 || ! strcmp (tname, "__builtin_new")
900 || ! strcmp (tname, "__builtin_vec_new"))
905 current_function_calls_alloca = 1;
907 /* Don't let pending stack adjusts add up to too much.
908 Also, do all pending adjustments now
909 if there is any chance this might be a call to alloca. */
911 if (pending_stack_adjust >= 32
912 || (pending_stack_adjust > 0 && may_be_alloca))
913 do_pending_stack_adjust ();
915 /* Operand 0 is a pointer-to-function; get the type of the function. */
916 funtype = TREE_TYPE (TREE_OPERAND (exp, 0));
917 if (TREE_CODE (funtype) != POINTER_TYPE)
919 funtype = TREE_TYPE (funtype);
921 /* Push the temporary stack slot level so that we can free any temporaries
925 /* Start updating where the next arg would go.
927 On some machines (such as the PA) indirect calls have a different
928 calling convention than normal calls. The last argument in
929 INIT_CUMULATIVE_ARGS tells the backend if this is an indirect call
931 INIT_CUMULATIVE_ARGS (args_so_far, funtype, NULL_RTX, (fndecl == 0));
933 /* If struct_value_rtx is 0, it means pass the address
934 as if it were an extra parameter. */
935 if (structure_value_addr && struct_value_rtx == 0)
937 /* If structure_value_addr is a REG other than
938 virtual_outgoing_args_rtx, we can use always use it. If it
939 is not a REG, we must always copy it into a register.
940 If it is virtual_outgoing_args_rtx, we must copy it to another
941 register in some cases. */
942 rtx temp = (GET_CODE (structure_value_addr) != REG
943 #ifdef ACCUMULATE_OUTGOING_ARGS
944 || (stack_arg_under_construction
945 && structure_value_addr == virtual_outgoing_args_rtx)
947 ? copy_addr_to_reg (structure_value_addr)
948 : structure_value_addr);
951 = tree_cons (error_mark_node,
952 make_tree (build_pointer_type (TREE_TYPE (funtype)),
955 structure_value_addr_parm = 1;
958 /* Count the arguments and set NUM_ACTUALS. */
959 for (p = actparms, i = 0; p; p = TREE_CHAIN (p)) i++;
962 /* Compute number of named args.
963 Normally, don't include the last named arg if anonymous args follow.
964 We do include the last named arg if STRICT_ARGUMENT_NAMING is defined.
965 (If no anonymous args follow, the result of list_length is actually
966 one too large. This is harmless.)
968 If SETUP_INCOMING_VARARGS is defined and STRICT_ARGUMENT_NAMING is not,
969 this machine will be able to place unnamed args that were passed in
970 registers into the stack. So treat all args as named. This allows the
971 insns emitting for a specific argument list to be independent of the
972 function declaration.
974 If SETUP_INCOMING_VARARGS is not defined, we do not have any reliable
975 way to pass unnamed args in registers, so we must force them into
977 #if !defined(SETUP_INCOMING_VARARGS) || defined(STRICT_ARGUMENT_NAMING)
978 if (TYPE_ARG_TYPES (funtype) != 0)
980 = (list_length (TYPE_ARG_TYPES (funtype))
981 #ifndef STRICT_ARGUMENT_NAMING
982 /* Don't include the last named arg. */
985 /* Count the struct value address, if it is passed as a parm. */
986 + structure_value_addr_parm);
989 /* If we know nothing, treat all args as named. */
990 n_named_args = num_actuals;
992 /* Make a vector to hold all the information about each arg. */
993 args = (struct arg_data *) alloca (num_actuals * sizeof (struct arg_data));
994 bzero ((char *) args, num_actuals * sizeof (struct arg_data));
996 args_size.constant = 0;
999 /* In this loop, we consider args in the order they are written.
1000 We fill up ARGS from the front or from the back if necessary
1001 so that in any case the first arg to be pushed ends up at the front. */
1003 #ifdef PUSH_ARGS_REVERSED
1004 i = num_actuals - 1, inc = -1;
1005 /* In this case, must reverse order of args
1006 so that we compute and push the last arg first. */
1011 /* I counts args in order (to be) pushed; ARGPOS counts in order written. */
1012 for (p = actparms, argpos = 0; p; p = TREE_CHAIN (p), i += inc, argpos++)
1014 tree type = TREE_TYPE (TREE_VALUE (p));
1016 enum machine_mode mode;
1018 args[i].tree_value = TREE_VALUE (p);
1020 /* Replace erroneous argument with constant zero. */
1021 if (type == error_mark_node || TYPE_SIZE (type) == 0)
1022 args[i].tree_value = integer_zero_node, type = integer_type_node;
1024 /* If TYPE is a transparent union, pass things the way we would
1025 pass the first field of the union. We have already verified that
1026 the modes are the same. */
1027 if (TYPE_TRANSPARENT_UNION (type))
1028 type = TREE_TYPE (TYPE_FIELDS (type));
1030 /* Decide where to pass this arg.
1032 args[i].reg is nonzero if all or part is passed in registers.
1034 args[i].partial is nonzero if part but not all is passed in registers,
1035 and the exact value says how many words are passed in registers.
1037 args[i].pass_on_stack is nonzero if the argument must at least be
1038 computed on the stack. It may then be loaded back into registers
1039 if args[i].reg is nonzero.
1041 These decisions are driven by the FUNCTION_... macros and must agree
1042 with those made by function.c. */
1044 /* See if this argument should be passed by invisible reference. */
1045 if ((TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST
1046 && contains_placeholder_p (TYPE_SIZE (type)))
1047 || TREE_ADDRESSABLE (type)
1048 #ifdef FUNCTION_ARG_PASS_BY_REFERENCE
1049 || FUNCTION_ARG_PASS_BY_REFERENCE (args_so_far, TYPE_MODE (type),
1050 type, argpos < n_named_args)
1054 /* If we're compiling a thunk, pass through invisible
1055 references instead of making a copy. */
1056 if (current_function_is_thunk
1057 #ifdef FUNCTION_ARG_CALLEE_COPIES
1058 || (FUNCTION_ARG_CALLEE_COPIES (args_so_far, TYPE_MODE (type),
1059 type, argpos < n_named_args)
1060 /* If it's in a register, we must make a copy of it too. */
1061 /* ??? Is this a sufficient test? Is there a better one? */
1062 && !(TREE_CODE (args[i].tree_value) == VAR_DECL
1063 && REG_P (DECL_RTL (args[i].tree_value)))
1064 && ! TREE_ADDRESSABLE (type))
1068 args[i].tree_value = build1 (ADDR_EXPR,
1069 build_pointer_type (type),
1070 args[i].tree_value);
1071 type = build_pointer_type (type);
1075 /* We make a copy of the object and pass the address to the
1076 function being called. */
1079 if (TYPE_SIZE (type) == 0
1080 || TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST
1081 || (flag_stack_check && ! STACK_CHECK_BUILTIN
1082 && (TREE_INT_CST_HIGH (TYPE_SIZE (type)) != 0
1083 || (TREE_INT_CST_LOW (TYPE_SIZE (type))
1084 > STACK_CHECK_MAX_VAR_SIZE * BITS_PER_UNIT))))
1086 /* This is a variable-sized object. Make space on the stack
1088 rtx size_rtx = expr_size (TREE_VALUE (p));
1090 if (old_stack_level == 0)
1092 emit_stack_save (SAVE_BLOCK, &old_stack_level, NULL_RTX);
1093 old_pending_adj = pending_stack_adjust;
1094 pending_stack_adjust = 0;
1097 copy = gen_rtx_MEM (BLKmode,
1098 allocate_dynamic_stack_space (size_rtx,
1100 TYPE_ALIGN (type)));
1104 int size = int_size_in_bytes (type);
1105 copy = assign_stack_temp (TYPE_MODE (type), size, 0);
1108 MEM_IN_STRUCT_P (copy) = AGGREGATE_TYPE_P (type);
1110 store_expr (args[i].tree_value, copy, 0);
1113 args[i].tree_value = build1 (ADDR_EXPR,
1114 build_pointer_type (type),
1115 make_tree (type, copy));
1116 type = build_pointer_type (type);
1120 mode = TYPE_MODE (type);
1121 unsignedp = TREE_UNSIGNED (type);
1123 #ifdef PROMOTE_FUNCTION_ARGS
1124 mode = promote_mode (type, mode, &unsignedp, 1);
1127 args[i].unsignedp = unsignedp;
1128 args[i].mode = mode;
1129 args[i].reg = FUNCTION_ARG (args_so_far, mode, type,
1130 argpos < n_named_args);
1131 #ifdef FUNCTION_ARG_PARTIAL_NREGS
1134 = FUNCTION_ARG_PARTIAL_NREGS (args_so_far, mode, type,
1135 argpos < n_named_args);
1138 args[i].pass_on_stack = MUST_PASS_IN_STACK (mode, type);
1140 /* If FUNCTION_ARG returned a (parallel [(expr_list (nil) ...) ...]),
1141 it means that we are to pass this arg in the register(s) designated
1142 by the PARALLEL, but also to pass it in the stack. */
1143 if (args[i].reg && GET_CODE (args[i].reg) == PARALLEL
1144 && XEXP (XVECEXP (args[i].reg, 0, 0), 0) == 0)
1145 args[i].pass_on_stack = 1;
1147 /* If this is an addressable type, we must preallocate the stack
1148 since we must evaluate the object into its final location.
1150 If this is to be passed in both registers and the stack, it is simpler
1152 if (TREE_ADDRESSABLE (type)
1153 || (args[i].pass_on_stack && args[i].reg != 0))
1154 must_preallocate = 1;
1156 /* If this is an addressable type, we cannot pre-evaluate it. Thus,
1157 we cannot consider this function call constant. */
1158 if (TREE_ADDRESSABLE (type))
1161 /* Compute the stack-size of this argument. */
1162 if (args[i].reg == 0 || args[i].partial != 0
1163 #ifdef REG_PARM_STACK_SPACE
1164 || reg_parm_stack_space > 0
1166 || args[i].pass_on_stack)
1167 locate_and_pad_parm (mode, type,
1168 #ifdef STACK_PARMS_IN_REG_PARM_AREA
1173 fndecl, &args_size, &args[i].offset,
1176 #ifndef ARGS_GROW_DOWNWARD
1177 args[i].slot_offset = args_size;
1180 #ifndef REG_PARM_STACK_SPACE
1181 /* If a part of the arg was put into registers,
1182 don't include that part in the amount pushed. */
1183 if (! args[i].pass_on_stack)
1184 args[i].size.constant -= ((args[i].partial * UNITS_PER_WORD)
1185 / (PARM_BOUNDARY / BITS_PER_UNIT)
1186 * (PARM_BOUNDARY / BITS_PER_UNIT));
1189 /* Update ARGS_SIZE, the total stack space for args so far. */
1191 args_size.constant += args[i].size.constant;
1192 if (args[i].size.var)
1194 ADD_PARM_SIZE (args_size, args[i].size.var);
1197 /* Since the slot offset points to the bottom of the slot,
1198 we must record it after incrementing if the args grow down. */
1199 #ifdef ARGS_GROW_DOWNWARD
1200 args[i].slot_offset = args_size;
1202 args[i].slot_offset.constant = -args_size.constant;
1205 SUB_PARM_SIZE (args[i].slot_offset, args_size.var);
1209 /* Increment ARGS_SO_FAR, which has info about which arg-registers
1210 have been used, etc. */
1212 FUNCTION_ARG_ADVANCE (args_so_far, TYPE_MODE (type), type,
1213 argpos < n_named_args);
1216 #ifdef FINAL_REG_PARM_STACK_SPACE
1217 reg_parm_stack_space = FINAL_REG_PARM_STACK_SPACE (args_size.constant,
1221 /* Compute the actual size of the argument block required. The variable
1222 and constant sizes must be combined, the size may have to be rounded,
1223 and there may be a minimum required size. */
1225 original_args_size = args_size;
1228 /* If this function requires a variable-sized argument list, don't try to
1229 make a cse'able block for this call. We may be able to do this
1230 eventually, but it is too complicated to keep track of what insns go
1231 in the cse'able block and which don't. */
1234 must_preallocate = 1;
1236 args_size.var = ARGS_SIZE_TREE (args_size);
1237 args_size.constant = 0;
1239 #ifdef STACK_BOUNDARY
1240 if (STACK_BOUNDARY != BITS_PER_UNIT)
1241 args_size.var = round_up (args_size.var, STACK_BYTES);
1244 #ifdef REG_PARM_STACK_SPACE
1245 if (reg_parm_stack_space > 0)
1248 = size_binop (MAX_EXPR, args_size.var,
1249 size_int (REG_PARM_STACK_SPACE (fndecl)));
1251 #ifndef OUTGOING_REG_PARM_STACK_SPACE
1252 /* The area corresponding to register parameters is not to count in
1253 the size of the block we need. So make the adjustment. */
1255 = size_binop (MINUS_EXPR, args_size.var,
1256 size_int (reg_parm_stack_space));
1263 #ifdef STACK_BOUNDARY
1264 args_size.constant = (((args_size.constant + (STACK_BYTES - 1))
1265 / STACK_BYTES) * STACK_BYTES);
1268 #ifdef REG_PARM_STACK_SPACE
1269 args_size.constant = MAX (args_size.constant,
1270 reg_parm_stack_space);
1271 #ifdef MAYBE_REG_PARM_STACK_SPACE
1272 if (reg_parm_stack_space == 0)
1273 args_size.constant = 0;
1275 #ifndef OUTGOING_REG_PARM_STACK_SPACE
1276 args_size.constant -= reg_parm_stack_space;
1281 /* See if we have or want to preallocate stack space.
1283 If we would have to push a partially-in-regs parm
1284 before other stack parms, preallocate stack space instead.
1286 If the size of some parm is not a multiple of the required stack
1287 alignment, we must preallocate.
1289 If the total size of arguments that would otherwise create a copy in
1290 a temporary (such as a CALL) is more than half the total argument list
1291 size, preallocation is faster.
1293 Another reason to preallocate is if we have a machine (like the m88k)
1294 where stack alignment is required to be maintained between every
1295 pair of insns, not just when the call is made. However, we assume here
1296 that such machines either do not have push insns (and hence preallocation
1297 would occur anyway) or the problem is taken care of with
1300 if (! must_preallocate)
1302 int partial_seen = 0;
1303 int copy_to_evaluate_size = 0;
1305 for (i = 0; i < num_actuals && ! must_preallocate; i++)
1307 if (args[i].partial > 0 && ! args[i].pass_on_stack)
1309 else if (partial_seen && args[i].reg == 0)
1310 must_preallocate = 1;
1312 if (TYPE_MODE (TREE_TYPE (args[i].tree_value)) == BLKmode
1313 && (TREE_CODE (args[i].tree_value) == CALL_EXPR
1314 || TREE_CODE (args[i].tree_value) == TARGET_EXPR
1315 || TREE_CODE (args[i].tree_value) == COND_EXPR
1316 || TREE_ADDRESSABLE (TREE_TYPE (args[i].tree_value))))
1317 copy_to_evaluate_size
1318 += int_size_in_bytes (TREE_TYPE (args[i].tree_value));
1321 if (copy_to_evaluate_size * 2 >= args_size.constant
1322 && args_size.constant > 0)
1323 must_preallocate = 1;
1326 /* If the structure value address will reference the stack pointer, we must
1327 stabilize it. We don't need to do this if we know that we are not going
1328 to adjust the stack pointer in processing this call. */
1330 if (structure_value_addr
1331 && (reg_mentioned_p (virtual_stack_dynamic_rtx, structure_value_addr)
1332 || reg_mentioned_p (virtual_outgoing_args_rtx, structure_value_addr))
1334 #ifndef ACCUMULATE_OUTGOING_ARGS
1335 || args_size.constant
1338 structure_value_addr = copy_to_reg (structure_value_addr);
1340 /* If this function call is cse'able, precompute all the parameters.
1341 Note that if the parameter is constructed into a temporary, this will
1342 cause an additional copy because the parameter will be constructed
1343 into a temporary location and then copied into the outgoing arguments.
1344 If a parameter contains a call to alloca and this function uses the
1345 stack, precompute the parameter. */
1347 /* If we preallocated the stack space, and some arguments must be passed
1348 on the stack, then we must precompute any parameter which contains a
1349 function call which will store arguments on the stack.
1350 Otherwise, evaluating the parameter may clobber previous parameters
1351 which have already been stored into the stack. */
1353 for (i = 0; i < num_actuals; i++)
1355 || ((args_size.var != 0 || args_size.constant != 0)
1356 && calls_function (args[i].tree_value, 1))
1357 || (must_preallocate && (args_size.var != 0 || args_size.constant != 0)
1358 && calls_function (args[i].tree_value, 0)))
1360 /* If this is an addressable type, we cannot pre-evaluate it. */
1361 if (TREE_ADDRESSABLE (TREE_TYPE (args[i].tree_value)))
1366 args[i].initial_value = args[i].value
1367 = expand_expr (args[i].tree_value, NULL_RTX, VOIDmode, 0);
1369 preserve_temp_slots (args[i].value);
1372 /* ANSI doesn't require a sequence point here,
1373 but PCC has one, so this will avoid some problems. */
1376 args[i].initial_value = args[i].value
1377 = protect_from_queue (args[i].initial_value, 0);
1379 if (TYPE_MODE (TREE_TYPE (args[i].tree_value)) != args[i].mode)
1381 = convert_modes (args[i].mode,
1382 TYPE_MODE (TREE_TYPE (args[i].tree_value)),
1383 args[i].value, args[i].unsignedp);
1386 /* Now we are about to start emitting insns that can be deleted
1387 if a libcall is deleted. */
1388 if (is_const || is_malloc)
1391 /* If we have no actual push instructions, or shouldn't use them,
1392 make space for all args right now. */
1394 if (args_size.var != 0)
1396 if (old_stack_level == 0)
1398 emit_stack_save (SAVE_BLOCK, &old_stack_level, NULL_RTX);
1399 old_pending_adj = pending_stack_adjust;
1400 pending_stack_adjust = 0;
1401 #ifdef ACCUMULATE_OUTGOING_ARGS
1402 /* stack_arg_under_construction says whether a stack arg is
1403 being constructed at the old stack level. Pushing the stack
1404 gets a clean outgoing argument block. */
1405 old_stack_arg_under_construction = stack_arg_under_construction;
1406 stack_arg_under_construction = 0;
1409 argblock = push_block (ARGS_SIZE_RTX (args_size), 0, 0);
1413 /* Note that we must go through the motions of allocating an argument
1414 block even if the size is zero because we may be storing args
1415 in the area reserved for register arguments, which may be part of
1418 int needed = args_size.constant;
1420 /* Store the maximum argument space used. It will be pushed by
1421 the prologue (if ACCUMULATE_OUTGOING_ARGS, or stack overflow
1424 if (needed > current_function_outgoing_args_size)
1425 current_function_outgoing_args_size = needed;
1427 if (must_preallocate)
1429 #ifdef ACCUMULATE_OUTGOING_ARGS
1430 /* Since the stack pointer will never be pushed, it is possible for
1431 the evaluation of a parm to clobber something we have already
1432 written to the stack. Since most function calls on RISC machines
1433 do not use the stack, this is uncommon, but must work correctly.
1435 Therefore, we save any area of the stack that was already written
1436 and that we are using. Here we set up to do this by making a new
1437 stack usage map from the old one. The actual save will be done
1440 Another approach might be to try to reorder the argument
1441 evaluations to avoid this conflicting stack usage. */
1443 #if defined(REG_PARM_STACK_SPACE) && ! defined(OUTGOING_REG_PARM_STACK_SPACE)
1444 /* Since we will be writing into the entire argument area, the
1445 map must be allocated for its entire size, not just the part that
1446 is the responsibility of the caller. */
1447 needed += reg_parm_stack_space;
1450 #ifdef ARGS_GROW_DOWNWARD
1451 highest_outgoing_arg_in_use = MAX (initial_highest_arg_in_use,
1454 highest_outgoing_arg_in_use = MAX (initial_highest_arg_in_use,
1457 stack_usage_map = (char *) alloca (highest_outgoing_arg_in_use);
1459 if (initial_highest_arg_in_use)
1460 bcopy (initial_stack_usage_map, stack_usage_map,
1461 initial_highest_arg_in_use);
1463 if (initial_highest_arg_in_use != highest_outgoing_arg_in_use)
1464 bzero (&stack_usage_map[initial_highest_arg_in_use],
1465 highest_outgoing_arg_in_use - initial_highest_arg_in_use);
1468 /* The address of the outgoing argument list must not be copied to a
1469 register here, because argblock would be left pointing to the
1470 wrong place after the call to allocate_dynamic_stack_space below.
1473 argblock = virtual_outgoing_args_rtx;
1475 #else /* not ACCUMULATE_OUTGOING_ARGS */
1476 if (inhibit_defer_pop == 0)
1478 /* Try to reuse some or all of the pending_stack_adjust
1479 to get this space. Maybe we can avoid any pushing. */
1480 if (needed > pending_stack_adjust)
1482 needed -= pending_stack_adjust;
1483 pending_stack_adjust = 0;
1487 pending_stack_adjust -= needed;
1491 /* Special case this because overhead of `push_block' in this
1492 case is non-trivial. */
1494 argblock = virtual_outgoing_args_rtx;
1496 argblock = push_block (GEN_INT (needed), 0, 0);
1498 /* We only really need to call `copy_to_reg' in the case where push
1499 insns are going to be used to pass ARGBLOCK to a function
1500 call in ARGS. In that case, the stack pointer changes value
1501 from the allocation point to the call point, and hence
1502 the value of VIRTUAL_OUTGOING_ARGS_RTX changes as well.
1503 But might as well always do it. */
1504 argblock = copy_to_reg (argblock);
1505 #endif /* not ACCUMULATE_OUTGOING_ARGS */
1509 #ifdef ACCUMULATE_OUTGOING_ARGS
1510 /* The save/restore code in store_one_arg handles all cases except one:
1511 a constructor call (including a C function returning a BLKmode struct)
1512 to initialize an argument. */
1513 if (stack_arg_under_construction)
1515 #if defined(REG_PARM_STACK_SPACE) && ! defined(OUTGOING_REG_PARM_STACK_SPACE)
1516 rtx push_size = GEN_INT (reg_parm_stack_space + args_size.constant);
1518 rtx push_size = GEN_INT (args_size.constant);
1520 if (old_stack_level == 0)
1522 emit_stack_save (SAVE_BLOCK, &old_stack_level, NULL_RTX);
1523 old_pending_adj = pending_stack_adjust;
1524 pending_stack_adjust = 0;
1525 /* stack_arg_under_construction says whether a stack arg is
1526 being constructed at the old stack level. Pushing the stack
1527 gets a clean outgoing argument block. */
1528 old_stack_arg_under_construction = stack_arg_under_construction;
1529 stack_arg_under_construction = 0;
1530 /* Make a new map for the new argument list. */
1531 stack_usage_map = (char *)alloca (highest_outgoing_arg_in_use);
1532 bzero (stack_usage_map, highest_outgoing_arg_in_use);
1533 highest_outgoing_arg_in_use = 0;
1535 allocate_dynamic_stack_space (push_size, NULL_RTX, BITS_PER_UNIT);
1537 /* If argument evaluation might modify the stack pointer, copy the
1538 address of the argument list to a register. */
1539 for (i = 0; i < num_actuals; i++)
1540 if (args[i].pass_on_stack)
1542 argblock = copy_addr_to_reg (argblock);
1548 /* If we preallocated stack space, compute the address of each argument.
1549 We need not ensure it is a valid memory address here; it will be
1550 validized when it is used. */
1553 rtx arg_reg = argblock;
1556 if (GET_CODE (argblock) == PLUS)
1557 arg_reg = XEXP (argblock, 0), arg_offset = INTVAL (XEXP (argblock, 1));
1559 for (i = 0; i < num_actuals; i++)
1561 rtx offset = ARGS_SIZE_RTX (args[i].offset);
1562 rtx slot_offset = ARGS_SIZE_RTX (args[i].slot_offset);
1565 /* Skip this parm if it will not be passed on the stack. */
1566 if (! args[i].pass_on_stack && args[i].reg != 0)
1569 if (GET_CODE (offset) == CONST_INT)
1570 addr = plus_constant (arg_reg, INTVAL (offset));
1572 addr = gen_rtx_PLUS (Pmode, arg_reg, offset);
1574 addr = plus_constant (addr, arg_offset);
1575 args[i].stack = gen_rtx_MEM (args[i].mode, addr);
1576 MEM_IN_STRUCT_P (args[i].stack)
1577 = AGGREGATE_TYPE_P (TREE_TYPE (args[i].tree_value));
1579 if (GET_CODE (slot_offset) == CONST_INT)
1580 addr = plus_constant (arg_reg, INTVAL (slot_offset));
1582 addr = gen_rtx_PLUS (Pmode, arg_reg, slot_offset);
1584 addr = plus_constant (addr, arg_offset);
1585 args[i].stack_slot = gen_rtx_MEM (args[i].mode, addr);
1589 #ifdef PUSH_ARGS_REVERSED
1590 #ifdef STACK_BOUNDARY
1591 /* If we push args individually in reverse order, perform stack alignment
1592 before the first push (the last arg). */
1594 anti_adjust_stack (GEN_INT (args_size.constant
1595 - original_args_size.constant));
1599 /* Don't try to defer pops if preallocating, not even from the first arg,
1600 since ARGBLOCK probably refers to the SP. */
1604 /* Get the function to call, in the form of RTL. */
1607 /* If this is the first use of the function, see if we need to
1608 make an external definition for it. */
1609 if (! TREE_USED (fndecl))
1611 assemble_external (fndecl);
1612 TREE_USED (fndecl) = 1;
1615 /* Get a SYMBOL_REF rtx for the function address. */
1616 funexp = XEXP (DECL_RTL (fndecl), 0);
1619 /* Generate an rtx (probably a pseudo-register) for the address. */
1622 funexp = expand_expr (TREE_OPERAND (exp, 0), NULL_RTX, VOIDmode, 0);
1623 pop_temp_slots (); /* FUNEXP can't be BLKmode */
1625 /* Check the function is executable. */
1626 if (flag_check_memory_usage)
1627 emit_library_call (chkr_check_exec_libfunc, 1,
1633 /* Figure out the register where the value, if any, will come back. */
1635 if (TYPE_MODE (TREE_TYPE (exp)) != VOIDmode
1636 && ! structure_value_addr)
1638 if (pcc_struct_value)
1639 valreg = hard_function_value (build_pointer_type (TREE_TYPE (exp)),
1642 valreg = hard_function_value (TREE_TYPE (exp), fndecl);
1645 /* Precompute all register parameters. It isn't safe to compute anything
1646 once we have started filling any specific hard regs. */
1648 for (i = 0; i < num_actuals; i++)
1649 if (args[i].reg != 0 && ! args[i].pass_on_stack)
1653 if (args[i].value == 0)
1656 args[i].value = expand_expr (args[i].tree_value, NULL_RTX,
1658 preserve_temp_slots (args[i].value);
1661 /* ANSI doesn't require a sequence point here,
1662 but PCC has one, so this will avoid some problems. */
1666 /* If we are to promote the function arg to a wider mode,
1669 if (args[i].mode != TYPE_MODE (TREE_TYPE (args[i].tree_value)))
1671 = convert_modes (args[i].mode,
1672 TYPE_MODE (TREE_TYPE (args[i].tree_value)),
1673 args[i].value, args[i].unsignedp);
1675 /* If the value is expensive, and we are inside an appropriately
1676 short loop, put the value into a pseudo and then put the pseudo
1679 For small register classes, also do this if this call uses
1680 register parameters. This is to avoid reload conflicts while
1681 loading the parameters registers. */
1683 if ((! (GET_CODE (args[i].value) == REG
1684 || (GET_CODE (args[i].value) == SUBREG
1685 && GET_CODE (SUBREG_REG (args[i].value)) == REG)))
1686 && args[i].mode != BLKmode
1687 && rtx_cost (args[i].value, SET) > 2
1688 && ((SMALL_REGISTER_CLASSES && reg_parm_seen)
1689 || preserve_subexpressions_p ()))
1690 args[i].value = copy_to_mode_reg (args[i].mode, args[i].value);
1693 #if defined(ACCUMULATE_OUTGOING_ARGS) && defined(REG_PARM_STACK_SPACE)
1694 /* The argument list is the property of the called routine and it
1695 may clobber it. If the fixed area has been used for previous
1696 parameters, we must save and restore it.
1698 Here we compute the boundary of the that needs to be saved, if any. */
1700 #ifdef ARGS_GROW_DOWNWARD
1701 for (i = 0; i < reg_parm_stack_space + 1; i++)
1703 for (i = 0; i < reg_parm_stack_space; i++)
1706 if (i >= highest_outgoing_arg_in_use
1707 || stack_usage_map[i] == 0)
1710 if (low_to_save == -1)
1716 if (low_to_save >= 0)
1718 int num_to_save = high_to_save - low_to_save + 1;
1719 enum machine_mode save_mode
1720 = mode_for_size (num_to_save * BITS_PER_UNIT, MODE_INT, 1);
1723 /* If we don't have the required alignment, must do this in BLKmode. */
1724 if ((low_to_save & (MIN (GET_MODE_SIZE (save_mode),
1725 BIGGEST_ALIGNMENT / UNITS_PER_WORD) - 1)))
1726 save_mode = BLKmode;
1728 #ifdef ARGS_GROW_DOWNWARD
1729 stack_area = gen_rtx_MEM (save_mode,
1730 memory_address (save_mode,
1731 plus_constant (argblock,
1734 stack_area = gen_rtx_MEM (save_mode,
1735 memory_address (save_mode,
1736 plus_constant (argblock,
1739 if (save_mode == BLKmode)
1741 save_area = assign_stack_temp (BLKmode, num_to_save, 0);
1742 MEM_IN_STRUCT_P (save_area) = 0;
1743 emit_block_move (validize_mem (save_area), stack_area,
1744 GEN_INT (num_to_save),
1745 PARM_BOUNDARY / BITS_PER_UNIT);
1749 save_area = gen_reg_rtx (save_mode);
1750 emit_move_insn (save_area, stack_area);
1756 /* Now store (and compute if necessary) all non-register parms.
1757 These come before register parms, since they can require block-moves,
1758 which could clobber the registers used for register parms.
1759 Parms which have partial registers are not stored here,
1760 but we do preallocate space here if they want that. */
1762 for (i = 0; i < num_actuals; i++)
1763 if (args[i].reg == 0 || args[i].pass_on_stack)
1764 store_one_arg (&args[i], argblock, may_be_alloca,
1765 args_size.var != 0, fndecl, reg_parm_stack_space);
1767 /* If we have a parm that is passed in registers but not in memory
1768 and whose alignment does not permit a direct copy into registers,
1769 make a group of pseudos that correspond to each register that we
1772 if (STRICT_ALIGNMENT)
1773 for (i = 0; i < num_actuals; i++)
1774 if (args[i].reg != 0 && ! args[i].pass_on_stack
1775 && args[i].mode == BLKmode
1776 && (TYPE_ALIGN (TREE_TYPE (args[i].tree_value))
1777 < MIN (BIGGEST_ALIGNMENT, BITS_PER_WORD)))
1779 int bytes = int_size_in_bytes (TREE_TYPE (args[i].tree_value));
1780 int big_endian_correction = 0;
1782 args[i].n_aligned_regs
1783 = args[i].partial ? args[i].partial
1784 : (bytes + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD;
1786 args[i].aligned_regs = (rtx *) alloca (sizeof (rtx)
1787 * args[i].n_aligned_regs);
1789 /* Structures smaller than a word are aligned to the least
1790 significant byte (to the right). On a BYTES_BIG_ENDIAN machine,
1791 this means we must skip the empty high order bytes when
1792 calculating the bit offset. */
1793 if (BYTES_BIG_ENDIAN && bytes < UNITS_PER_WORD)
1794 big_endian_correction = (BITS_PER_WORD - (bytes * BITS_PER_UNIT));
1796 for (j = 0; j < args[i].n_aligned_regs; j++)
1798 rtx reg = gen_reg_rtx (word_mode);
1799 rtx word = operand_subword_force (args[i].value, j, BLKmode);
1800 int bitsize = TYPE_ALIGN (TREE_TYPE (args[i].tree_value));
1803 args[i].aligned_regs[j] = reg;
1805 /* Clobber REG and move each partword into it. Ensure we don't
1806 go past the end of the structure. Note that the loop below
1807 works because we've already verified that padding
1808 and endianness are compatible.
1810 We use to emit a clobber here but that doesn't let later
1811 passes optimize the instructions we emit. By storing 0 into
1812 the register later passes know the first AND to zero out the
1813 bitfield being set in the register is unnecessary. The store
1814 of 0 will be deleted as will at least the first AND. */
1816 emit_move_insn (reg, const0_rtx);
1819 bitpos < BITS_PER_WORD && bytes > 0;
1820 bitpos += bitsize, bytes -= bitsize / BITS_PER_UNIT)
1822 int xbitpos = bitpos + big_endian_correction;
1824 store_bit_field (reg, bitsize, xbitpos, word_mode,
1825 extract_bit_field (word, bitsize, bitpos, 1,
1826 NULL_RTX, word_mode,
1828 bitsize / BITS_PER_UNIT,
1830 bitsize / BITS_PER_UNIT, BITS_PER_WORD);
1835 /* Now store any partially-in-registers parm.
1836 This is the last place a block-move can happen. */
1838 for (i = 0; i < num_actuals; i++)
1839 if (args[i].partial != 0 && ! args[i].pass_on_stack)
1840 store_one_arg (&args[i], argblock, may_be_alloca,
1841 args_size.var != 0, fndecl, reg_parm_stack_space);
1843 #ifndef PUSH_ARGS_REVERSED
1844 #ifdef STACK_BOUNDARY
1845 /* If we pushed args in forward order, perform stack alignment
1846 after pushing the last arg. */
1848 anti_adjust_stack (GEN_INT (args_size.constant
1849 - original_args_size.constant));
1853 /* If register arguments require space on the stack and stack space
1854 was not preallocated, allocate stack space here for arguments
1855 passed in registers. */
1856 #if ! defined(ACCUMULATE_OUTGOING_ARGS) && defined(OUTGOING_REG_PARM_STACK_SPACE)
1857 if (must_preallocate == 0 && reg_parm_stack_space > 0)
1858 anti_adjust_stack (GEN_INT (reg_parm_stack_space));
1861 /* Pass the function the address in which to return a structure value. */
1862 if (structure_value_addr && ! structure_value_addr_parm)
1864 emit_move_insn (struct_value_rtx,
1866 force_operand (structure_value_addr,
1869 /* Mark the memory for the aggregate as write-only. */
1870 if (flag_check_memory_usage)
1871 emit_library_call (chkr_set_right_libfunc, 1,
1873 structure_value_addr, ptr_mode,
1874 GEN_INT (struct_value_size), TYPE_MODE (sizetype),
1875 GEN_INT (MEMORY_USE_WO),
1876 TYPE_MODE (integer_type_node));
1878 if (GET_CODE (struct_value_rtx) == REG)
1879 use_reg (&call_fusage, struct_value_rtx);
1882 funexp = prepare_call_address (funexp, fndecl, &call_fusage, reg_parm_seen);
1884 /* Now do the register loads required for any wholly-register parms or any
1885 parms which are passed both on the stack and in a register. Their
1886 expressions were already evaluated.
1888 Mark all register-parms as living through the call, putting these USE
1889 insns in the CALL_INSN_FUNCTION_USAGE field. */
1891 #ifdef LOAD_ARGS_REVERSED
1892 for (i = num_actuals - 1; i >= 0; i--)
1894 for (i = 0; i < num_actuals; i++)
1897 rtx reg = args[i].reg;
1898 int partial = args[i].partial;
1903 /* Set to non-negative if must move a word at a time, even if just
1904 one word (e.g, partial == 1 && mode == DFmode). Set to -1 if
1905 we just use a normal move insn. This value can be zero if the
1906 argument is a zero size structure with no fields. */
1907 nregs = (partial ? partial
1908 : (TYPE_MODE (TREE_TYPE (args[i].tree_value)) == BLKmode
1909 ? ((int_size_in_bytes (TREE_TYPE (args[i].tree_value))
1910 + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD)
1913 /* Handle calls that pass values in multiple non-contiguous
1914 locations. The Irix 6 ABI has examples of this. */
1916 if (GET_CODE (reg) == PARALLEL)
1917 emit_group_load (reg, args[i].value);
1919 /* If simple case, just do move. If normal partial, store_one_arg
1920 has already loaded the register for us. In all other cases,
1921 load the register(s) from memory. */
1923 else if (nregs == -1)
1924 emit_move_insn (reg, args[i].value);
1926 /* If we have pre-computed the values to put in the registers in
1927 the case of non-aligned structures, copy them in now. */
1929 else if (args[i].n_aligned_regs != 0)
1930 for (j = 0; j < args[i].n_aligned_regs; j++)
1931 emit_move_insn (gen_rtx_REG (word_mode, REGNO (reg) + j),
1932 args[i].aligned_regs[j]);
1934 else if (partial == 0 || args[i].pass_on_stack)
1935 move_block_to_reg (REGNO (reg),
1936 validize_mem (args[i].value), nregs,
1939 /* Handle calls that pass values in multiple non-contiguous
1940 locations. The Irix 6 ABI has examples of this. */
1941 if (GET_CODE (reg) == PARALLEL)
1942 use_group_regs (&call_fusage, reg);
1943 else if (nregs == -1)
1944 use_reg (&call_fusage, reg);
1946 use_regs (&call_fusage, REGNO (reg), nregs == 0 ? 1 : nregs);
1950 /* Perform postincrements before actually calling the function. */
1953 /* All arguments and registers used for the call must be set up by now! */
1955 /* Generate the actual call instruction. */
1956 emit_call_1 (funexp, fndecl, funtype, args_size.constant, struct_value_size,
1957 FUNCTION_ARG (args_so_far, VOIDmode, void_type_node, 1),
1958 valreg, old_inhibit_defer_pop, call_fusage, is_const);
1960 /* If call is cse'able, make appropriate pair of reg-notes around it.
1961 Test valreg so we don't crash; may safely ignore `const'
1962 if return type is void. Disable for PARALLEL return values, because
1963 we have no way to move such values into a pseudo register. */
1964 if (is_const && valreg != 0 && GET_CODE (valreg) != PARALLEL)
1967 rtx temp = gen_reg_rtx (GET_MODE (valreg));
1970 /* Mark the return value as a pointer if needed. */
1971 if (TREE_CODE (TREE_TYPE (exp)) == POINTER_TYPE)
1973 tree pointed_to = TREE_TYPE (TREE_TYPE (exp));
1974 mark_reg_pointer (temp, TYPE_ALIGN (pointed_to) / BITS_PER_UNIT);
1977 /* Construct an "equal form" for the value which mentions all the
1978 arguments in order as well as the function name. */
1979 #ifdef PUSH_ARGS_REVERSED
1980 for (i = 0; i < num_actuals; i++)
1981 note = gen_rtx_EXPR_LIST (VOIDmode, args[i].initial_value, note);
1983 for (i = num_actuals - 1; i >= 0; i--)
1984 note = gen_rtx_EXPR_LIST (VOIDmode, args[i].initial_value, note);
1986 note = gen_rtx_EXPR_LIST (VOIDmode, funexp, note);
1988 insns = get_insns ();
1991 emit_libcall_block (insns, temp, valreg, note);
1997 /* Otherwise, just write out the sequence without a note. */
1998 rtx insns = get_insns ();
2005 rtx temp = gen_reg_rtx (GET_MODE (valreg));
2008 /* The return value from a malloc-like function is a pointer. */
2009 if (TREE_CODE (TREE_TYPE (exp)) == POINTER_TYPE)
2010 mark_reg_pointer (temp, BIGGEST_ALIGNMENT / BITS_PER_UNIT);
2012 emit_move_insn (temp, valreg);
2014 /* The return value from a malloc-like function can not alias
2016 last = get_last_insn ();
2018 gen_rtx_EXPR_LIST (REG_NOALIAS, temp, REG_NOTES (last));
2020 /* Write out the sequence. */
2021 insns = get_insns ();
2027 /* For calls to `setjmp', etc., inform flow.c it should complain
2028 if nonvolatile values are live. */
2032 emit_note (name, NOTE_INSN_SETJMP);
2033 current_function_calls_setjmp = 1;
2037 current_function_calls_longjmp = 1;
2039 /* Notice functions that cannot return.
2040 If optimizing, insns emitted below will be dead.
2041 If not optimizing, they will exist, which is useful
2042 if the user uses the `return' command in the debugger. */
2044 if (is_volatile || is_longjmp)
2047 /* If value type not void, return an rtx for the value. */
2049 /* If there are cleanups to be called, don't use a hard reg as target.
2050 We need to double check this and see if it matters anymore. */
2051 if (any_pending_cleanups (1)
2052 && target && REG_P (target)
2053 && REGNO (target) < FIRST_PSEUDO_REGISTER)
2056 if (TYPE_MODE (TREE_TYPE (exp)) == VOIDmode
2059 target = const0_rtx;
2061 else if (structure_value_addr)
2063 if (target == 0 || GET_CODE (target) != MEM)
2065 target = gen_rtx_MEM (TYPE_MODE (TREE_TYPE (exp)),
2066 memory_address (TYPE_MODE (TREE_TYPE (exp)),
2067 structure_value_addr));
2068 MEM_IN_STRUCT_P (target) = AGGREGATE_TYPE_P (TREE_TYPE (exp));
2071 else if (pcc_struct_value)
2073 /* This is the special C++ case where we need to
2074 know what the true target was. We take care to
2075 never use this value more than once in one expression. */
2076 target = gen_rtx_MEM (TYPE_MODE (TREE_TYPE (exp)),
2077 copy_to_reg (valreg));
2078 MEM_IN_STRUCT_P (target) = AGGREGATE_TYPE_P (TREE_TYPE (exp));
2080 /* Handle calls that return values in multiple non-contiguous locations.
2081 The Irix 6 ABI has examples of this. */
2082 else if (GET_CODE (valreg) == PARALLEL)
2086 int bytes = int_size_in_bytes (TREE_TYPE (exp));
2087 target = assign_stack_temp (TYPE_MODE (TREE_TYPE (exp)), bytes, 0);
2088 MEM_IN_STRUCT_P (target) = AGGREGATE_TYPE_P (TREE_TYPE (exp));
2089 preserve_temp_slots (target);
2092 emit_group_store (target, valreg);
2094 else if (target && GET_MODE (target) == TYPE_MODE (TREE_TYPE (exp))
2095 && GET_MODE (target) == GET_MODE (valreg))
2096 /* TARGET and VALREG cannot be equal at this point because the latter
2097 would not have REG_FUNCTION_VALUE_P true, while the former would if
2098 it were referring to the same register.
2100 If they refer to the same register, this move will be a no-op, except
2101 when function inlining is being done. */
2102 emit_move_insn (target, valreg);
2103 else if (TYPE_MODE (TREE_TYPE (exp)) == BLKmode)
2105 /* Some machines (the PA for example) want to return all small
2106 structures in registers regardless of the structure's alignment.
2108 Deal with them explicitly by copying from the return registers
2109 into the target MEM locations. */
2110 int bytes = int_size_in_bytes (TREE_TYPE (exp));
2113 int bitsize = MIN (TYPE_ALIGN (TREE_TYPE (exp)), BITS_PER_WORD);
2114 int bitpos, xbitpos, big_endian_correction = 0;
2118 target = assign_stack_temp (BLKmode, bytes, 0);
2119 MEM_IN_STRUCT_P (target) = AGGREGATE_TYPE_P (TREE_TYPE (exp));
2120 preserve_temp_slots (target);
2123 /* This code assumes valreg is at least a full word. If it isn't,
2124 copy it into a new pseudo which is a full word. */
2125 if (GET_MODE (valreg) != BLKmode
2126 && GET_MODE_SIZE (GET_MODE (valreg)) < UNITS_PER_WORD)
2127 valreg = convert_to_mode (word_mode, valreg,
2128 TREE_UNSIGNED (TREE_TYPE (exp)));
2130 /* Structures whose size is not a multiple of a word are aligned
2131 to the least significant byte (to the right). On a BYTES_BIG_ENDIAN
2132 machine, this means we must skip the empty high order bytes when
2133 calculating the bit offset. */
2134 if (BYTES_BIG_ENDIAN && bytes % UNITS_PER_WORD)
2135 big_endian_correction = (BITS_PER_WORD - ((bytes % UNITS_PER_WORD)
2138 /* Copy the structure BITSIZE bites at a time.
2140 We could probably emit more efficient code for machines
2141 which do not use strict alignment, but it doesn't seem
2142 worth the effort at the current time. */
2143 for (bitpos = 0, xbitpos = big_endian_correction;
2144 bitpos < bytes * BITS_PER_UNIT;
2145 bitpos += bitsize, xbitpos += bitsize)
2148 /* We need a new source operand each time xbitpos is on a
2149 word boundary and when xbitpos == big_endian_correction
2150 (the first time through). */
2151 if (xbitpos % BITS_PER_WORD == 0
2152 || xbitpos == big_endian_correction)
2153 src = operand_subword_force (valreg,
2154 xbitpos / BITS_PER_WORD,
2157 /* We need a new destination operand each time bitpos is on
2159 if (bitpos % BITS_PER_WORD == 0)
2160 dst = operand_subword (target, bitpos / BITS_PER_WORD, 1, BLKmode);
2162 /* Use xbitpos for the source extraction (right justified) and
2163 xbitpos for the destination store (left justified). */
2164 store_bit_field (dst, bitsize, bitpos % BITS_PER_WORD, word_mode,
2165 extract_bit_field (src, bitsize,
2166 xbitpos % BITS_PER_WORD, 1,
2167 NULL_RTX, word_mode,
2169 bitsize / BITS_PER_UNIT,
2171 bitsize / BITS_PER_UNIT, BITS_PER_WORD);
2175 target = copy_to_reg (valreg);
2177 #ifdef PROMOTE_FUNCTION_RETURN
2178 /* If we promoted this return value, make the proper SUBREG. TARGET
2179 might be const0_rtx here, so be careful. */
2180 if (GET_CODE (target) == REG
2181 && TYPE_MODE (TREE_TYPE (exp)) != BLKmode
2182 && GET_MODE (target) != TYPE_MODE (TREE_TYPE (exp)))
2184 tree type = TREE_TYPE (exp);
2185 int unsignedp = TREE_UNSIGNED (type);
2187 /* If we don't promote as expected, something is wrong. */
2188 if (GET_MODE (target)
2189 != promote_mode (type, TYPE_MODE (type), &unsignedp, 1))
2192 target = gen_rtx_SUBREG (TYPE_MODE (type), target, 0);
2193 SUBREG_PROMOTED_VAR_P (target) = 1;
2194 SUBREG_PROMOTED_UNSIGNED_P (target) = unsignedp;
2198 /* If size of args is variable or this was a constructor call for a stack
2199 argument, restore saved stack-pointer value. */
2201 if (old_stack_level)
2203 emit_stack_restore (SAVE_BLOCK, old_stack_level, NULL_RTX);
2204 pending_stack_adjust = old_pending_adj;
2205 #ifdef ACCUMULATE_OUTGOING_ARGS
2206 stack_arg_under_construction = old_stack_arg_under_construction;
2207 highest_outgoing_arg_in_use = initial_highest_arg_in_use;
2208 stack_usage_map = initial_stack_usage_map;
2211 #ifdef ACCUMULATE_OUTGOING_ARGS
2214 #ifdef REG_PARM_STACK_SPACE
2217 enum machine_mode save_mode = GET_MODE (save_area);
2218 #ifdef ARGS_GROW_DOWNWARD
2220 = gen_rtx_MEM (save_mode,
2221 memory_address (save_mode,
2222 plus_constant (argblock,
2226 = gen_rtx_MEM (save_mode,
2227 memory_address (save_mode,
2228 plus_constant (argblock,
2232 if (save_mode != BLKmode)
2233 emit_move_insn (stack_area, save_area);
2235 emit_block_move (stack_area, validize_mem (save_area),
2236 GEN_INT (high_to_save - low_to_save + 1),
2237 PARM_BOUNDARY / BITS_PER_UNIT);
2241 /* If we saved any argument areas, restore them. */
2242 for (i = 0; i < num_actuals; i++)
2243 if (args[i].save_area)
2245 enum machine_mode save_mode = GET_MODE (args[i].save_area);
2247 = gen_rtx_MEM (save_mode,
2248 memory_address (save_mode,
2249 XEXP (args[i].stack_slot, 0)));
2251 if (save_mode != BLKmode)
2252 emit_move_insn (stack_area, args[i].save_area);
2254 emit_block_move (stack_area, validize_mem (args[i].save_area),
2255 GEN_INT (args[i].size.constant),
2256 PARM_BOUNDARY / BITS_PER_UNIT);
2259 highest_outgoing_arg_in_use = initial_highest_arg_in_use;
2260 stack_usage_map = initial_stack_usage_map;
2264 /* If this was alloca, record the new stack level for nonlocal gotos.
2265 Check for the handler slots since we might not have a save area
2266 for non-local gotos. */
2268 if (may_be_alloca && nonlocal_goto_handler_slot != 0)
2269 emit_stack_save (SAVE_NONLOCAL, &nonlocal_goto_stack_level, NULL_RTX);
2276 /* Output a library call to function FUN (a SYMBOL_REF rtx)
2277 (emitting the queue unless NO_QUEUE is nonzero),
2278 for a value of mode OUTMODE,
2279 with NARGS different arguments, passed as alternating rtx values
2280 and machine_modes to convert them to.
2281 The rtx values should have been passed through protect_from_queue already.
2283 NO_QUEUE will be true if and only if the library call is a `const' call
2284 which will be enclosed in REG_LIBCALL/REG_RETVAL notes; it is equivalent
2285 to the variable is_const in expand_call.
2287 NO_QUEUE must be true for const calls, because if it isn't, then
2288 any pending increment will be emitted between REG_LIBCALL/REG_RETVAL notes,
2289 and will be lost if the libcall sequence is optimized away.
2291 NO_QUEUE must be false for non-const calls, because if it isn't, the
2292 call insn will have its CONST_CALL_P bit set, and it will be incorrectly
2293 optimized. For instance, the instruction scheduler may incorrectly
2294 move memory references across the non-const call. */
2297 emit_library_call VPROTO((rtx orgfun, int no_queue, enum machine_mode outmode,
2303 enum machine_mode outmode;
2307 /* Total size in bytes of all the stack-parms scanned so far. */
2308 struct args_size args_size;
2309 /* Size of arguments before any adjustments (such as rounding). */
2310 struct args_size original_args_size;
2311 register int argnum;
2316 CUMULATIVE_ARGS args_so_far;
2317 struct arg { rtx value; enum machine_mode mode; rtx reg; int partial;
2318 struct args_size offset; struct args_size size; rtx save_area; };
2320 int old_inhibit_defer_pop = inhibit_defer_pop;
2321 rtx call_fusage = 0;
2322 /* Size of the stack reserved for parameter registers. */
2323 int reg_parm_stack_space = 0;
2324 #if defined(ACCUMULATE_OUTGOING_ARGS) && defined(REG_PARM_STACK_SPACE)
2325 /* Define the boundary of the register parm stack space that needs to be
2327 int low_to_save = -1, high_to_save;
2328 rtx save_area = 0; /* Place that it is saved */
2331 #ifdef ACCUMULATE_OUTGOING_ARGS
2332 int initial_highest_arg_in_use = highest_outgoing_arg_in_use;
2333 char *initial_stack_usage_map = stack_usage_map;
2337 #ifdef REG_PARM_STACK_SPACE
2338 #ifdef MAYBE_REG_PARM_STACK_SPACE
2339 reg_parm_stack_space = MAYBE_REG_PARM_STACK_SPACE;
2341 reg_parm_stack_space = REG_PARM_STACK_SPACE (fndecl);
2345 VA_START (p, nargs);
2348 orgfun = va_arg (p, rtx);
2349 no_queue = va_arg (p, int);
2350 outmode = va_arg (p, enum machine_mode);
2351 nargs = va_arg (p, int);
2356 /* Copy all the libcall-arguments out of the varargs data
2357 and into a vector ARGVEC.
2359 Compute how to pass each argument. We only support a very small subset
2360 of the full argument passing conventions to limit complexity here since
2361 library functions shouldn't have many args. */
2363 argvec = (struct arg *) alloca (nargs * sizeof (struct arg));
2364 bzero ((char *) argvec, nargs * sizeof (struct arg));
2367 INIT_CUMULATIVE_ARGS (args_so_far, NULL_TREE, fun, 0);
2369 args_size.constant = 0;
2374 for (count = 0; count < nargs; count++)
2376 rtx val = va_arg (p, rtx);
2377 enum machine_mode mode = va_arg (p, enum machine_mode);
2379 /* We cannot convert the arg value to the mode the library wants here;
2380 must do it earlier where we know the signedness of the arg. */
2382 || (GET_MODE (val) != mode && GET_MODE (val) != VOIDmode))
2385 /* On some machines, there's no way to pass a float to a library fcn.
2386 Pass it as a double instead. */
2387 #ifdef LIBGCC_NEEDS_DOUBLE
2388 if (LIBGCC_NEEDS_DOUBLE && mode == SFmode)
2389 val = convert_modes (DFmode, SFmode, val, 0), mode = DFmode;
2392 /* There's no need to call protect_from_queue, because
2393 either emit_move_insn or emit_push_insn will do that. */
2395 /* Make sure it is a reasonable operand for a move or push insn. */
2396 if (GET_CODE (val) != REG && GET_CODE (val) != MEM
2397 && ! (CONSTANT_P (val) && LEGITIMATE_CONSTANT_P (val)))
2398 val = force_operand (val, NULL_RTX);
2400 #ifdef FUNCTION_ARG_PASS_BY_REFERENCE
2401 if (FUNCTION_ARG_PASS_BY_REFERENCE (args_so_far, mode, NULL_TREE, 1))
2403 /* We do not support FUNCTION_ARG_CALLEE_COPIES here since it can
2404 be viewed as just an efficiency improvement. */
2405 rtx slot = assign_stack_temp (mode, GET_MODE_SIZE (mode), 0);
2406 emit_move_insn (slot, val);
2407 val = force_operand (XEXP (slot, 0), NULL_RTX);
2412 argvec[count].value = val;
2413 argvec[count].mode = mode;
2415 argvec[count].reg = FUNCTION_ARG (args_so_far, mode, NULL_TREE, 1);
2416 if (argvec[count].reg && GET_CODE (argvec[count].reg) == PARALLEL)
2418 #ifdef FUNCTION_ARG_PARTIAL_NREGS
2419 argvec[count].partial
2420 = FUNCTION_ARG_PARTIAL_NREGS (args_so_far, mode, NULL_TREE, 1);
2422 argvec[count].partial = 0;
2425 locate_and_pad_parm (mode, NULL_TREE,
2426 argvec[count].reg && argvec[count].partial == 0,
2427 NULL_TREE, &args_size, &argvec[count].offset,
2428 &argvec[count].size);
2430 if (argvec[count].size.var)
2433 #ifndef REG_PARM_STACK_SPACE
2434 if (argvec[count].partial)
2435 argvec[count].size.constant -= argvec[count].partial * UNITS_PER_WORD;
2438 if (argvec[count].reg == 0 || argvec[count].partial != 0
2439 #ifdef REG_PARM_STACK_SPACE
2443 args_size.constant += argvec[count].size.constant;
2445 FUNCTION_ARG_ADVANCE (args_so_far, mode, (tree) 0, 1);
2449 #ifdef FINAL_REG_PARM_STACK_SPACE
2450 reg_parm_stack_space = FINAL_REG_PARM_STACK_SPACE (args_size.constant,
2454 /* If this machine requires an external definition for library
2455 functions, write one out. */
2456 assemble_external_libcall (fun);
2458 original_args_size = args_size;
2459 #ifdef STACK_BOUNDARY
2460 args_size.constant = (((args_size.constant + (STACK_BYTES - 1))
2461 / STACK_BYTES) * STACK_BYTES);
2464 #ifdef REG_PARM_STACK_SPACE
2465 args_size.constant = MAX (args_size.constant,
2466 reg_parm_stack_space);
2467 #ifndef OUTGOING_REG_PARM_STACK_SPACE
2468 args_size.constant -= reg_parm_stack_space;
2472 if (args_size.constant > current_function_outgoing_args_size)
2473 current_function_outgoing_args_size = args_size.constant;
2475 #ifdef ACCUMULATE_OUTGOING_ARGS
2476 /* Since the stack pointer will never be pushed, it is possible for
2477 the evaluation of a parm to clobber something we have already
2478 written to the stack. Since most function calls on RISC machines
2479 do not use the stack, this is uncommon, but must work correctly.
2481 Therefore, we save any area of the stack that was already written
2482 and that we are using. Here we set up to do this by making a new
2483 stack usage map from the old one.
2485 Another approach might be to try to reorder the argument
2486 evaluations to avoid this conflicting stack usage. */
2488 needed = args_size.constant;
2489 #if defined(REG_PARM_STACK_SPACE) && ! defined(OUTGOING_REG_PARM_STACK_SPACE)
2490 /* Since we will be writing into the entire argument area, the
2491 map must be allocated for its entire size, not just the part that
2492 is the responsibility of the caller. */
2493 needed += reg_parm_stack_space;
2496 #ifdef ARGS_GROW_DOWNWARD
2497 highest_outgoing_arg_in_use = MAX (initial_highest_arg_in_use,
2500 highest_outgoing_arg_in_use = MAX (initial_highest_arg_in_use,
2503 stack_usage_map = (char *) alloca (highest_outgoing_arg_in_use);
2505 if (initial_highest_arg_in_use)
2506 bcopy (initial_stack_usage_map, stack_usage_map,
2507 initial_highest_arg_in_use);
2509 if (initial_highest_arg_in_use != highest_outgoing_arg_in_use)
2510 bzero (&stack_usage_map[initial_highest_arg_in_use],
2511 highest_outgoing_arg_in_use - initial_highest_arg_in_use);
2514 /* The address of the outgoing argument list must not be copied to a
2515 register here, because argblock would be left pointing to the
2516 wrong place after the call to allocate_dynamic_stack_space below.
2519 argblock = virtual_outgoing_args_rtx;
2520 #else /* not ACCUMULATE_OUTGOING_ARGS */
2521 #ifndef PUSH_ROUNDING
2522 argblock = push_block (GEN_INT (args_size.constant), 0, 0);
2526 #ifdef PUSH_ARGS_REVERSED
2527 #ifdef STACK_BOUNDARY
2528 /* If we push args individually in reverse order, perform stack alignment
2529 before the first push (the last arg). */
2531 anti_adjust_stack (GEN_INT (args_size.constant
2532 - original_args_size.constant));
2536 #ifdef PUSH_ARGS_REVERSED
2544 #if defined(ACCUMULATE_OUTGOING_ARGS) && defined(REG_PARM_STACK_SPACE)
2545 /* The argument list is the property of the called routine and it
2546 may clobber it. If the fixed area has been used for previous
2547 parameters, we must save and restore it.
2549 Here we compute the boundary of the that needs to be saved, if any. */
2551 #ifdef ARGS_GROW_DOWNWARD
2552 for (count = 0; count < reg_parm_stack_space + 1; count++)
2554 for (count = 0; count < reg_parm_stack_space; count++)
2557 if (count >= highest_outgoing_arg_in_use
2558 || stack_usage_map[count] == 0)
2561 if (low_to_save == -1)
2562 low_to_save = count;
2564 high_to_save = count;
2567 if (low_to_save >= 0)
2569 int num_to_save = high_to_save - low_to_save + 1;
2570 enum machine_mode save_mode
2571 = mode_for_size (num_to_save * BITS_PER_UNIT, MODE_INT, 1);
2574 /* If we don't have the required alignment, must do this in BLKmode. */
2575 if ((low_to_save & (MIN (GET_MODE_SIZE (save_mode),
2576 BIGGEST_ALIGNMENT / UNITS_PER_WORD) - 1)))
2577 save_mode = BLKmode;
2579 #ifdef ARGS_GROW_DOWNWARD
2580 stack_area = gen_rtx_MEM (save_mode,
2581 memory_address (save_mode,
2582 plus_constant (argblock,
2585 stack_area = gen_rtx_MEM (save_mode,
2586 memory_address (save_mode,
2587 plus_constant (argblock,
2590 if (save_mode == BLKmode)
2592 save_area = assign_stack_temp (BLKmode, num_to_save, 0);
2593 MEM_IN_STRUCT_P (save_area) = 0;
2594 emit_block_move (validize_mem (save_area), stack_area,
2595 GEN_INT (num_to_save),
2596 PARM_BOUNDARY / BITS_PER_UNIT);
2600 save_area = gen_reg_rtx (save_mode);
2601 emit_move_insn (save_area, stack_area);
2606 /* Push the args that need to be pushed. */
2608 /* ARGNUM indexes the ARGVEC array in the order in which the arguments
2609 are to be pushed. */
2610 for (count = 0; count < nargs; count++, argnum += inc)
2612 register enum machine_mode mode = argvec[argnum].mode;
2613 register rtx val = argvec[argnum].value;
2614 rtx reg = argvec[argnum].reg;
2615 int partial = argvec[argnum].partial;
2616 int lower_bound, upper_bound, i;
2618 if (! (reg != 0 && partial == 0))
2620 #ifdef ACCUMULATE_OUTGOING_ARGS
2621 /* If this is being stored into a pre-allocated, fixed-size, stack
2622 area, save any previous data at that location. */
2624 #ifdef ARGS_GROW_DOWNWARD
2625 /* stack_slot is negative, but we want to index stack_usage_map
2626 with positive values. */
2627 upper_bound = -argvec[argnum].offset.constant + 1;
2628 lower_bound = upper_bound - argvec[argnum].size.constant;
2630 lower_bound = argvec[argnum].offset.constant;
2631 upper_bound = lower_bound + argvec[argnum].size.constant;
2634 for (i = lower_bound; i < upper_bound; i++)
2635 if (stack_usage_map[i]
2636 #ifdef REG_PARM_STACK_SPACE
2637 /* Don't store things in the fixed argument area at this point;
2638 it has already been saved. */
2639 && i > reg_parm_stack_space
2644 if (i != upper_bound)
2646 /* We need to make a save area. See what mode we can make it. */
2647 enum machine_mode save_mode
2648 = mode_for_size (argvec[argnum].size.constant * BITS_PER_UNIT,
2651 = gen_rtx_MEM (save_mode,
2652 memory_address (save_mode,
2653 plus_constant (argblock, argvec[argnum].offset.constant)));
2654 argvec[argnum].save_area = gen_reg_rtx (save_mode);
2655 emit_move_insn (argvec[argnum].save_area, stack_area);
2658 emit_push_insn (val, mode, NULL_TREE, NULL_RTX, 0, partial, reg, 0,
2659 argblock, GEN_INT (argvec[argnum].offset.constant));
2661 #ifdef ACCUMULATE_OUTGOING_ARGS
2662 /* Now mark the segment we just used. */
2663 for (i = lower_bound; i < upper_bound; i++)
2664 stack_usage_map[i] = 1;
2671 #ifndef PUSH_ARGS_REVERSED
2672 #ifdef STACK_BOUNDARY
2673 /* If we pushed args in forward order, perform stack alignment
2674 after pushing the last arg. */
2676 anti_adjust_stack (GEN_INT (args_size.constant
2677 - original_args_size.constant));
2681 #ifdef PUSH_ARGS_REVERSED
2687 fun = prepare_call_address (fun, NULL_TREE, &call_fusage, 0);
2689 /* Now load any reg parms into their regs. */
2691 /* ARGNUM indexes the ARGVEC array in the order in which the arguments
2692 are to be pushed. */
2693 for (count = 0; count < nargs; count++, argnum += inc)
2695 register enum machine_mode mode = argvec[argnum].mode;
2696 register rtx val = argvec[argnum].value;
2697 rtx reg = argvec[argnum].reg;
2698 int partial = argvec[argnum].partial;
2700 if (reg != 0 && partial == 0)
2701 emit_move_insn (reg, val);
2705 /* For version 1.37, try deleting this entirely. */
2709 /* Any regs containing parms remain in use through the call. */
2710 for (count = 0; count < nargs; count++)
2711 if (argvec[count].reg != 0)
2712 use_reg (&call_fusage, argvec[count].reg);
2714 /* Don't allow popping to be deferred, since then
2715 cse'ing of library calls could delete a call and leave the pop. */
2718 /* We pass the old value of inhibit_defer_pop + 1 to emit_call_1, which
2719 will set inhibit_defer_pop to that value. */
2721 /* The return type is needed to decide how many bytes the function pops.
2722 Signedness plays no role in that, so for simplicity, we pretend it's
2723 always signed. We also assume that the list of arguments passed has
2724 no impact, so we pretend it is unknown. */
2727 get_identifier (XSTR (orgfun, 0)),
2728 build_function_type (outmode == VOIDmode ? void_type_node
2729 : type_for_mode (outmode, 0), NULL_TREE),
2730 args_size.constant, 0,
2731 FUNCTION_ARG (args_so_far, VOIDmode, void_type_node, 1),
2732 outmode != VOIDmode ? hard_libcall_value (outmode) : NULL_RTX,
2733 old_inhibit_defer_pop + 1, call_fusage, no_queue);
2737 /* Now restore inhibit_defer_pop to its actual original value. */
2740 #ifdef ACCUMULATE_OUTGOING_ARGS
2741 #ifdef REG_PARM_STACK_SPACE
2744 enum machine_mode save_mode = GET_MODE (save_area);
2745 #ifdef ARGS_GROW_DOWNWARD
2747 = gen_rtx_MEM (save_mode,
2748 memory_address (save_mode,
2749 plus_constant (argblock,
2753 = gen_rtx_MEM (save_mode,
2754 memory_address (save_mode,
2755 plus_constant (argblock, low_to_save)));
2758 if (save_mode != BLKmode)
2759 emit_move_insn (stack_area, save_area);
2761 emit_block_move (stack_area, validize_mem (save_area),
2762 GEN_INT (high_to_save - low_to_save + 1),
2763 PARM_BOUNDARY / BITS_PER_UNIT);
2767 /* If we saved any argument areas, restore them. */
2768 for (count = 0; count < nargs; count++)
2769 if (argvec[count].save_area)
2771 enum machine_mode save_mode = GET_MODE (argvec[count].save_area);
2773 = gen_rtx_MEM (save_mode,
2774 memory_address (save_mode,
2775 plus_constant (argblock, argvec[count].offset.constant)));
2777 emit_move_insn (stack_area, argvec[count].save_area);
2780 highest_outgoing_arg_in_use = initial_highest_arg_in_use;
2781 stack_usage_map = initial_stack_usage_map;
2785 /* Like emit_library_call except that an extra argument, VALUE,
2786 comes second and says where to store the result.
2787 (If VALUE is zero, this function chooses a convenient way
2788 to return the value.
2790 This function returns an rtx for where the value is to be found.
2791 If VALUE is nonzero, VALUE is returned. */
2794 emit_library_call_value VPROTO((rtx orgfun, rtx value, int no_queue,
2795 enum machine_mode outmode, int nargs, ...))
2801 enum machine_mode outmode;
2805 /* Total size in bytes of all the stack-parms scanned so far. */
2806 struct args_size args_size;
2807 /* Size of arguments before any adjustments (such as rounding). */
2808 struct args_size original_args_size;
2809 register int argnum;
2814 CUMULATIVE_ARGS args_so_far;
2815 struct arg { rtx value; enum machine_mode mode; rtx reg; int partial;
2816 struct args_size offset; struct args_size size; rtx save_area; };
2818 int old_inhibit_defer_pop = inhibit_defer_pop;
2819 rtx call_fusage = 0;
2820 /* Size of the stack reserved for parameter registers. */
2821 int reg_parm_stack_space = 0;
2823 int pcc_struct_value = 0;
2824 int struct_value_size = 0;
2828 #if defined(ACCUMULATE_OUTGOING_ARGS) && defined(REG_PARM_STACK_SPACE)
2829 /* Define the boundary of the register parm stack space that needs to be
2831 int low_to_save = -1, high_to_save;
2832 rtx save_area = 0; /* Place that it is saved */
2835 #ifdef ACCUMULATE_OUTGOING_ARGS
2836 int initial_highest_arg_in_use = highest_outgoing_arg_in_use;
2837 char *initial_stack_usage_map = stack_usage_map;
2840 #ifdef REG_PARM_STACK_SPACE
2841 #ifdef MAYBE_REG_PARM_STACK_SPACE
2842 reg_parm_stack_space = MAYBE_REG_PARM_STACK_SPACE;
2844 reg_parm_stack_space = REG_PARM_STACK_SPACE (fndecl);
2848 VA_START (p, nargs);
2851 orgfun = va_arg (p, rtx);
2852 value = va_arg (p, rtx);
2853 no_queue = va_arg (p, int);
2854 outmode = va_arg (p, enum machine_mode);
2855 nargs = va_arg (p, int);
2858 is_const = no_queue;
2861 /* If this kind of value comes back in memory,
2862 decide where in memory it should come back. */
2863 if (aggregate_value_p (type_for_mode (outmode, 0)))
2865 #ifdef PCC_STATIC_STRUCT_RETURN
2867 = hard_function_value (build_pointer_type (type_for_mode (outmode, 0)),
2869 mem_value = gen_rtx_MEM (outmode, pointer_reg);
2870 pcc_struct_value = 1;
2872 value = gen_reg_rtx (outmode);
2873 #else /* not PCC_STATIC_STRUCT_RETURN */
2874 struct_value_size = GET_MODE_SIZE (outmode);
2875 if (value != 0 && GET_CODE (value) == MEM)
2878 mem_value = assign_stack_temp (outmode, GET_MODE_SIZE (outmode), 0);
2881 /* This call returns a big structure. */
2885 /* ??? Unfinished: must pass the memory address as an argument. */
2887 /* Copy all the libcall-arguments out of the varargs data
2888 and into a vector ARGVEC.
2890 Compute how to pass each argument. We only support a very small subset
2891 of the full argument passing conventions to limit complexity here since
2892 library functions shouldn't have many args. */
2894 argvec = (struct arg *) alloca ((nargs + 1) * sizeof (struct arg));
2895 bzero ((char *) argvec, (nargs + 1) * sizeof (struct arg));
2897 INIT_CUMULATIVE_ARGS (args_so_far, NULL_TREE, fun, 0);
2899 args_size.constant = 0;
2906 /* If there's a structure value address to be passed,
2907 either pass it in the special place, or pass it as an extra argument. */
2908 if (mem_value && struct_value_rtx == 0 && ! pcc_struct_value)
2910 rtx addr = XEXP (mem_value, 0);
2913 /* Make sure it is a reasonable operand for a move or push insn. */
2914 if (GET_CODE (addr) != REG && GET_CODE (addr) != MEM
2915 && ! (CONSTANT_P (addr) && LEGITIMATE_CONSTANT_P (addr)))
2916 addr = force_operand (addr, NULL_RTX);
2918 argvec[count].value = addr;
2919 argvec[count].mode = Pmode;
2920 argvec[count].partial = 0;
2922 argvec[count].reg = FUNCTION_ARG (args_so_far, Pmode, NULL_TREE, 1);
2923 #ifdef FUNCTION_ARG_PARTIAL_NREGS
2924 if (FUNCTION_ARG_PARTIAL_NREGS (args_so_far, Pmode, NULL_TREE, 1))
2928 locate_and_pad_parm (Pmode, NULL_TREE,
2929 argvec[count].reg && argvec[count].partial == 0,
2930 NULL_TREE, &args_size, &argvec[count].offset,
2931 &argvec[count].size);
2934 if (argvec[count].reg == 0 || argvec[count].partial != 0
2935 #ifdef REG_PARM_STACK_SPACE
2939 args_size.constant += argvec[count].size.constant;
2941 FUNCTION_ARG_ADVANCE (args_so_far, Pmode, (tree) 0, 1);
2946 for (; count < nargs; count++)
2948 rtx val = va_arg (p, rtx);
2949 enum machine_mode mode = va_arg (p, enum machine_mode);
2951 /* We cannot convert the arg value to the mode the library wants here;
2952 must do it earlier where we know the signedness of the arg. */
2954 || (GET_MODE (val) != mode && GET_MODE (val) != VOIDmode))
2957 /* On some machines, there's no way to pass a float to a library fcn.
2958 Pass it as a double instead. */
2959 #ifdef LIBGCC_NEEDS_DOUBLE
2960 if (LIBGCC_NEEDS_DOUBLE && mode == SFmode)
2961 val = convert_modes (DFmode, SFmode, val, 0), mode = DFmode;
2964 /* There's no need to call protect_from_queue, because
2965 either emit_move_insn or emit_push_insn will do that. */
2967 /* Make sure it is a reasonable operand for a move or push insn. */
2968 if (GET_CODE (val) != REG && GET_CODE (val) != MEM
2969 && ! (CONSTANT_P (val) && LEGITIMATE_CONSTANT_P (val)))
2970 val = force_operand (val, NULL_RTX);
2972 #ifdef FUNCTION_ARG_PASS_BY_REFERENCE
2973 if (FUNCTION_ARG_PASS_BY_REFERENCE (args_so_far, mode, NULL_TREE, 1))
2975 /* We do not support FUNCTION_ARG_CALLEE_COPIES here since it can
2976 be viewed as just an efficiency improvement. */
2977 rtx slot = assign_stack_temp (mode, GET_MODE_SIZE (mode), 0);
2978 emit_move_insn (slot, val);
2979 val = XEXP (slot, 0);
2984 argvec[count].value = val;
2985 argvec[count].mode = mode;
2987 argvec[count].reg = FUNCTION_ARG (args_so_far, mode, NULL_TREE, 1);
2988 if (argvec[count].reg && GET_CODE (argvec[count].reg) == PARALLEL)
2990 #ifdef FUNCTION_ARG_PARTIAL_NREGS
2991 argvec[count].partial
2992 = FUNCTION_ARG_PARTIAL_NREGS (args_so_far, mode, NULL_TREE, 1);
2994 argvec[count].partial = 0;
2997 locate_and_pad_parm (mode, NULL_TREE,
2998 argvec[count].reg && argvec[count].partial == 0,
2999 NULL_TREE, &args_size, &argvec[count].offset,
3000 &argvec[count].size);
3002 if (argvec[count].size.var)
3005 #ifndef REG_PARM_STACK_SPACE
3006 if (argvec[count].partial)
3007 argvec[count].size.constant -= argvec[count].partial * UNITS_PER_WORD;
3010 if (argvec[count].reg == 0 || argvec[count].partial != 0
3011 #ifdef REG_PARM_STACK_SPACE
3015 args_size.constant += argvec[count].size.constant;
3017 FUNCTION_ARG_ADVANCE (args_so_far, mode, (tree) 0, 1);
3021 #ifdef FINAL_REG_PARM_STACK_SPACE
3022 reg_parm_stack_space = FINAL_REG_PARM_STACK_SPACE (args_size.constant,
3025 /* If this machine requires an external definition for library
3026 functions, write one out. */
3027 assemble_external_libcall (fun);
3029 original_args_size = args_size;
3030 #ifdef STACK_BOUNDARY
3031 args_size.constant = (((args_size.constant + (STACK_BYTES - 1))
3032 / STACK_BYTES) * STACK_BYTES);
3035 #ifdef REG_PARM_STACK_SPACE
3036 args_size.constant = MAX (args_size.constant,
3037 reg_parm_stack_space);
3038 #ifndef OUTGOING_REG_PARM_STACK_SPACE
3039 args_size.constant -= reg_parm_stack_space;
3043 if (args_size.constant > current_function_outgoing_args_size)
3044 current_function_outgoing_args_size = args_size.constant;
3046 #ifdef ACCUMULATE_OUTGOING_ARGS
3047 /* Since the stack pointer will never be pushed, it is possible for
3048 the evaluation of a parm to clobber something we have already
3049 written to the stack. Since most function calls on RISC machines
3050 do not use the stack, this is uncommon, but must work correctly.
3052 Therefore, we save any area of the stack that was already written
3053 and that we are using. Here we set up to do this by making a new
3054 stack usage map from the old one.
3056 Another approach might be to try to reorder the argument
3057 evaluations to avoid this conflicting stack usage. */
3059 needed = args_size.constant;
3060 #if defined(REG_PARM_STACK_SPACE) && ! defined(OUTGOING_REG_PARM_STACK_SPACE)
3061 /* Since we will be writing into the entire argument area, the
3062 map must be allocated for its entire size, not just the part that
3063 is the responsibility of the caller. */
3064 needed += reg_parm_stack_space;
3067 #ifdef ARGS_GROW_DOWNWARD
3068 highest_outgoing_arg_in_use = MAX (initial_highest_arg_in_use,
3071 highest_outgoing_arg_in_use = MAX (initial_highest_arg_in_use,
3074 stack_usage_map = (char *) alloca (highest_outgoing_arg_in_use);
3076 if (initial_highest_arg_in_use)
3077 bcopy (initial_stack_usage_map, stack_usage_map,
3078 initial_highest_arg_in_use);
3080 if (initial_highest_arg_in_use != highest_outgoing_arg_in_use)
3081 bzero (&stack_usage_map[initial_highest_arg_in_use],
3082 highest_outgoing_arg_in_use - initial_highest_arg_in_use);
3085 /* The address of the outgoing argument list must not be copied to a
3086 register here, because argblock would be left pointing to the
3087 wrong place after the call to allocate_dynamic_stack_space below.
3090 argblock = virtual_outgoing_args_rtx;
3091 #else /* not ACCUMULATE_OUTGOING_ARGS */
3092 #ifndef PUSH_ROUNDING
3093 argblock = push_block (GEN_INT (args_size.constant), 0, 0);
3097 #ifdef PUSH_ARGS_REVERSED
3098 #ifdef STACK_BOUNDARY
3099 /* If we push args individually in reverse order, perform stack alignment
3100 before the first push (the last arg). */
3102 anti_adjust_stack (GEN_INT (args_size.constant
3103 - original_args_size.constant));
3107 #ifdef PUSH_ARGS_REVERSED
3115 #if defined(ACCUMULATE_OUTGOING_ARGS) && defined(REG_PARM_STACK_SPACE)
3116 /* The argument list is the property of the called routine and it
3117 may clobber it. If the fixed area has been used for previous
3118 parameters, we must save and restore it.
3120 Here we compute the boundary of the that needs to be saved, if any. */
3122 #ifdef ARGS_GROW_DOWNWARD
3123 for (count = 0; count < reg_parm_stack_space + 1; count++)
3125 for (count = 0; count < reg_parm_stack_space; count++)
3128 if (count >= highest_outgoing_arg_in_use
3129 || stack_usage_map[count] == 0)
3132 if (low_to_save == -1)
3133 low_to_save = count;
3135 high_to_save = count;
3138 if (low_to_save >= 0)
3140 int num_to_save = high_to_save - low_to_save + 1;
3141 enum machine_mode save_mode
3142 = mode_for_size (num_to_save * BITS_PER_UNIT, MODE_INT, 1);
3145 /* If we don't have the required alignment, must do this in BLKmode. */
3146 if ((low_to_save & (MIN (GET_MODE_SIZE (save_mode),
3147 BIGGEST_ALIGNMENT / UNITS_PER_WORD) - 1)))
3148 save_mode = BLKmode;
3150 #ifdef ARGS_GROW_DOWNWARD
3151 stack_area = gen_rtx_MEM (save_mode,
3152 memory_address (save_mode,
3153 plus_constant (argblock,
3156 stack_area = gen_rtx_MEM (save_mode,
3157 memory_address (save_mode,
3158 plus_constant (argblock,
3161 if (save_mode == BLKmode)
3163 save_area = assign_stack_temp (BLKmode, num_to_save, 0);
3164 MEM_IN_STRUCT_P (save_area) = 0;
3165 emit_block_move (validize_mem (save_area), stack_area,
3166 GEN_INT (num_to_save),
3167 PARM_BOUNDARY / BITS_PER_UNIT);
3171 save_area = gen_reg_rtx (save_mode);
3172 emit_move_insn (save_area, stack_area);
3177 /* Push the args that need to be pushed. */
3179 /* ARGNUM indexes the ARGVEC array in the order in which the arguments
3180 are to be pushed. */
3181 for (count = 0; count < nargs; count++, argnum += inc)
3183 register enum machine_mode mode = argvec[argnum].mode;
3184 register rtx val = argvec[argnum].value;
3185 rtx reg = argvec[argnum].reg;
3186 int partial = argvec[argnum].partial;
3187 int lower_bound, upper_bound, i;
3189 if (! (reg != 0 && partial == 0))
3191 #ifdef ACCUMULATE_OUTGOING_ARGS
3192 /* If this is being stored into a pre-allocated, fixed-size, stack
3193 area, save any previous data at that location. */
3195 #ifdef ARGS_GROW_DOWNWARD
3196 /* stack_slot is negative, but we want to index stack_usage_map
3197 with positive values. */
3198 upper_bound = -argvec[argnum].offset.constant + 1;
3199 lower_bound = upper_bound - argvec[argnum].size.constant;
3201 lower_bound = argvec[argnum].offset.constant;
3202 upper_bound = lower_bound + argvec[argnum].size.constant;
3205 for (i = lower_bound; i < upper_bound; i++)
3206 if (stack_usage_map[i]
3207 #ifdef REG_PARM_STACK_SPACE
3208 /* Don't store things in the fixed argument area at this point;
3209 it has already been saved. */
3210 && i > reg_parm_stack_space
3215 if (i != upper_bound)
3217 /* We need to make a save area. See what mode we can make it. */
3218 enum machine_mode save_mode
3219 = mode_for_size (argvec[argnum].size.constant * BITS_PER_UNIT,
3222 = gen_rtx_MEM (save_mode,
3223 memory_address (save_mode,
3224 plus_constant (argblock,
3225 argvec[argnum].offset.constant)));
3226 argvec[argnum].save_area = gen_reg_rtx (save_mode);
3227 emit_move_insn (argvec[argnum].save_area, stack_area);
3230 emit_push_insn (val, mode, NULL_TREE, NULL_RTX, 0, partial, reg, 0,
3231 argblock, GEN_INT (argvec[argnum].offset.constant));
3233 #ifdef ACCUMULATE_OUTGOING_ARGS
3234 /* Now mark the segment we just used. */
3235 for (i = lower_bound; i < upper_bound; i++)
3236 stack_usage_map[i] = 1;
3243 #ifndef PUSH_ARGS_REVERSED
3244 #ifdef STACK_BOUNDARY
3245 /* If we pushed args in forward order, perform stack alignment
3246 after pushing the last arg. */
3248 anti_adjust_stack (GEN_INT (args_size.constant
3249 - original_args_size.constant));
3253 #ifdef PUSH_ARGS_REVERSED
3259 fun = prepare_call_address (fun, NULL_TREE, &call_fusage, 0);
3261 /* Now load any reg parms into their regs. */
3263 /* ARGNUM indexes the ARGVEC array in the order in which the arguments
3264 are to be pushed. */
3265 for (count = 0; count < nargs; count++, argnum += inc)
3267 register enum machine_mode mode = argvec[argnum].mode;
3268 register rtx val = argvec[argnum].value;
3269 rtx reg = argvec[argnum].reg;
3270 int partial = argvec[argnum].partial;
3272 if (reg != 0 && partial == 0)
3273 emit_move_insn (reg, val);
3278 /* For version 1.37, try deleting this entirely. */
3283 /* Any regs containing parms remain in use through the call. */
3284 for (count = 0; count < nargs; count++)
3285 if (argvec[count].reg != 0)
3286 use_reg (&call_fusage, argvec[count].reg);
3288 /* Pass the function the address in which to return a structure value. */
3289 if (mem_value != 0 && struct_value_rtx != 0 && ! pcc_struct_value)
3291 emit_move_insn (struct_value_rtx,
3293 force_operand (XEXP (mem_value, 0),
3295 if (GET_CODE (struct_value_rtx) == REG)
3296 use_reg (&call_fusage, struct_value_rtx);
3299 /* Don't allow popping to be deferred, since then
3300 cse'ing of library calls could delete a call and leave the pop. */
3303 /* We pass the old value of inhibit_defer_pop + 1 to emit_call_1, which
3304 will set inhibit_defer_pop to that value. */
3305 /* See the comment in emit_library_call about the function type we build
3309 get_identifier (XSTR (orgfun, 0)),
3310 build_function_type (type_for_mode (outmode, 0), NULL_TREE),
3311 args_size.constant, struct_value_size,
3312 FUNCTION_ARG (args_so_far, VOIDmode, void_type_node, 1),
3313 mem_value == 0 ? hard_libcall_value (outmode) : NULL_RTX,
3314 old_inhibit_defer_pop + 1, call_fusage, is_const);
3316 /* Now restore inhibit_defer_pop to its actual original value. */
3321 /* Copy the value to the right place. */
3322 if (outmode != VOIDmode)
3328 if (value != mem_value)
3329 emit_move_insn (value, mem_value);
3331 else if (value != 0)
3332 emit_move_insn (value, hard_libcall_value (outmode));
3334 value = hard_libcall_value (outmode);
3337 #ifdef ACCUMULATE_OUTGOING_ARGS
3338 #ifdef REG_PARM_STACK_SPACE
3341 enum machine_mode save_mode = GET_MODE (save_area);
3342 #ifdef ARGS_GROW_DOWNWARD
3344 = gen_rtx_MEM (save_mode,
3345 memory_address (save_mode,
3346 plus_constant (argblock,
3350 = gen_rtx_MEM (save_mode,
3351 memory_address (save_mode,
3352 plus_constant (argblock, low_to_save)));
3354 if (save_mode != BLKmode)
3355 emit_move_insn (stack_area, save_area);
3357 emit_block_move (stack_area, validize_mem (save_area),
3358 GEN_INT (high_to_save - low_to_save + 1),
3359 PARM_BOUNDARY / BITS_PER_UNIT);
3363 /* If we saved any argument areas, restore them. */
3364 for (count = 0; count < nargs; count++)
3365 if (argvec[count].save_area)
3367 enum machine_mode save_mode = GET_MODE (argvec[count].save_area);
3369 = gen_rtx_MEM (save_mode,
3370 memory_address (save_mode, plus_constant (argblock,
3371 argvec[count].offset.constant)));
3373 emit_move_insn (stack_area, argvec[count].save_area);
3376 highest_outgoing_arg_in_use = initial_highest_arg_in_use;
3377 stack_usage_map = initial_stack_usage_map;
3384 /* Return an rtx which represents a suitable home on the stack
3385 given TYPE, the type of the argument looking for a home.
3386 This is called only for BLKmode arguments.
3388 SIZE is the size needed for this target.
3389 ARGS_ADDR is the address of the bottom of the argument block for this call.
3390 OFFSET describes this parameter's offset into ARGS_ADDR. It is meaningless
3391 if this machine uses push insns. */
3394 target_for_arg (type, size, args_addr, offset)
3398 struct args_size offset;
3401 rtx offset_rtx = ARGS_SIZE_RTX (offset);
3403 /* We do not call memory_address if possible,
3404 because we want to address as close to the stack
3405 as possible. For non-variable sized arguments,
3406 this will be stack-pointer relative addressing. */
3407 if (GET_CODE (offset_rtx) == CONST_INT)
3408 target = plus_constant (args_addr, INTVAL (offset_rtx));
3411 /* I have no idea how to guarantee that this
3412 will work in the presence of register parameters. */
3413 target = gen_rtx_PLUS (Pmode, args_addr, offset_rtx);
3414 target = memory_address (QImode, target);
3417 return gen_rtx_MEM (BLKmode, target);
3421 /* Store a single argument for a function call
3422 into the register or memory area where it must be passed.
3423 *ARG describes the argument value and where to pass it.
3425 ARGBLOCK is the address of the stack-block for all the arguments,
3426 or 0 on a machine where arguments are pushed individually.
3428 MAY_BE_ALLOCA nonzero says this could be a call to `alloca'
3429 so must be careful about how the stack is used.
3431 VARIABLE_SIZE nonzero says that this was a variable-sized outgoing
3432 argument stack. This is used if ACCUMULATE_OUTGOING_ARGS to indicate
3433 that we need not worry about saving and restoring the stack.
3435 FNDECL is the declaration of the function we are calling. */
3438 store_one_arg (arg, argblock, may_be_alloca, variable_size, fndecl,
3439 reg_parm_stack_space)
3440 struct arg_data *arg;
3445 int reg_parm_stack_space;
3447 register tree pval = arg->tree_value;
3451 int i, lower_bound, upper_bound;
3453 if (TREE_CODE (pval) == ERROR_MARK)
3456 /* Push a new temporary level for any temporaries we make for
3460 #ifdef ACCUMULATE_OUTGOING_ARGS
3461 /* If this is being stored into a pre-allocated, fixed-size, stack area,
3462 save any previous data at that location. */
3463 if (argblock && ! variable_size && arg->stack)
3465 #ifdef ARGS_GROW_DOWNWARD
3466 /* stack_slot is negative, but we want to index stack_usage_map
3467 with positive values. */
3468 if (GET_CODE (XEXP (arg->stack_slot, 0)) == PLUS)
3469 upper_bound = -INTVAL (XEXP (XEXP (arg->stack_slot, 0), 1)) + 1;
3473 lower_bound = upper_bound - arg->size.constant;
3475 if (GET_CODE (XEXP (arg->stack_slot, 0)) == PLUS)
3476 lower_bound = INTVAL (XEXP (XEXP (arg->stack_slot, 0), 1));
3480 upper_bound = lower_bound + arg->size.constant;
3483 for (i = lower_bound; i < upper_bound; i++)
3484 if (stack_usage_map[i]
3485 #ifdef REG_PARM_STACK_SPACE
3486 /* Don't store things in the fixed argument area at this point;
3487 it has already been saved. */
3488 && i > reg_parm_stack_space
3493 if (i != upper_bound)
3495 /* We need to make a save area. See what mode we can make it. */
3496 enum machine_mode save_mode
3497 = mode_for_size (arg->size.constant * BITS_PER_UNIT, MODE_INT, 1);
3499 = gen_rtx_MEM (save_mode,
3500 memory_address (save_mode,
3501 XEXP (arg->stack_slot, 0)));
3503 if (save_mode == BLKmode)
3505 arg->save_area = assign_stack_temp (BLKmode,
3506 arg->size.constant, 0);
3507 MEM_IN_STRUCT_P (arg->save_area)
3508 = AGGREGATE_TYPE_P (TREE_TYPE (arg->tree_value));
3509 preserve_temp_slots (arg->save_area);
3510 emit_block_move (validize_mem (arg->save_area), stack_area,
3511 GEN_INT (arg->size.constant),
3512 PARM_BOUNDARY / BITS_PER_UNIT);
3516 arg->save_area = gen_reg_rtx (save_mode);
3517 emit_move_insn (arg->save_area, stack_area);
3523 /* If this isn't going to be placed on both the stack and in registers,
3524 set up the register and number of words. */
3525 if (! arg->pass_on_stack)
3526 reg = arg->reg, partial = arg->partial;
3528 if (reg != 0 && partial == 0)
3529 /* Being passed entirely in a register. We shouldn't be called in
3533 /* If this arg needs special alignment, don't load the registers
3535 if (arg->n_aligned_regs != 0)
3538 /* If this is being passed partially in a register, we can't evaluate
3539 it directly into its stack slot. Otherwise, we can. */
3540 if (arg->value == 0)
3542 #ifdef ACCUMULATE_OUTGOING_ARGS
3543 /* stack_arg_under_construction is nonzero if a function argument is
3544 being evaluated directly into the outgoing argument list and
3545 expand_call must take special action to preserve the argument list
3546 if it is called recursively.
3548 For scalar function arguments stack_usage_map is sufficient to
3549 determine which stack slots must be saved and restored. Scalar
3550 arguments in general have pass_on_stack == 0.
3552 If this argument is initialized by a function which takes the
3553 address of the argument (a C++ constructor or a C function
3554 returning a BLKmode structure), then stack_usage_map is
3555 insufficient and expand_call must push the stack around the
3556 function call. Such arguments have pass_on_stack == 1.
3558 Note that it is always safe to set stack_arg_under_construction,
3559 but this generates suboptimal code if set when not needed. */
3561 if (arg->pass_on_stack)
3562 stack_arg_under_construction++;
3564 arg->value = expand_expr (pval,
3566 || TYPE_MODE (TREE_TYPE (pval)) != arg->mode)
3567 ? NULL_RTX : arg->stack,
3570 /* If we are promoting object (or for any other reason) the mode
3571 doesn't agree, convert the mode. */
3573 if (arg->mode != TYPE_MODE (TREE_TYPE (pval)))
3574 arg->value = convert_modes (arg->mode, TYPE_MODE (TREE_TYPE (pval)),
3575 arg->value, arg->unsignedp);
3577 #ifdef ACCUMULATE_OUTGOING_ARGS
3578 if (arg->pass_on_stack)
3579 stack_arg_under_construction--;
3583 /* Don't allow anything left on stack from computation
3584 of argument to alloca. */
3586 do_pending_stack_adjust ();
3588 if (arg->value == arg->stack)
3590 /* If the value is already in the stack slot, we are done. */
3591 if (flag_check_memory_usage && GET_CODE (arg->stack) == MEM)
3593 if (arg->mode == BLKmode)
3596 emit_library_call (chkr_set_right_libfunc, 1, VOIDmode, 3,
3597 XEXP (arg->stack, 0), ptr_mode,
3598 GEN_INT (GET_MODE_SIZE (arg->mode)),
3599 TYPE_MODE (sizetype),
3600 GEN_INT (MEMORY_USE_RW),
3601 TYPE_MODE (integer_type_node));
3604 else if (arg->mode != BLKmode)
3608 /* Argument is a scalar, not entirely passed in registers.
3609 (If part is passed in registers, arg->partial says how much
3610 and emit_push_insn will take care of putting it there.)
3612 Push it, and if its size is less than the
3613 amount of space allocated to it,
3614 also bump stack pointer by the additional space.
3615 Note that in C the default argument promotions
3616 will prevent such mismatches. */
3618 size = GET_MODE_SIZE (arg->mode);
3619 /* Compute how much space the push instruction will push.
3620 On many machines, pushing a byte will advance the stack
3621 pointer by a halfword. */
3622 #ifdef PUSH_ROUNDING
3623 size = PUSH_ROUNDING (size);
3627 /* Compute how much space the argument should get:
3628 round up to a multiple of the alignment for arguments. */
3629 if (none != FUNCTION_ARG_PADDING (arg->mode, TREE_TYPE (pval)))
3630 used = (((size + PARM_BOUNDARY / BITS_PER_UNIT - 1)
3631 / (PARM_BOUNDARY / BITS_PER_UNIT))
3632 * (PARM_BOUNDARY / BITS_PER_UNIT));
3634 /* This isn't already where we want it on the stack, so put it there.
3635 This can either be done with push or copy insns. */
3636 emit_push_insn (arg->value, arg->mode, TREE_TYPE (pval), NULL_RTX,
3637 0, partial, reg, used - size,
3638 argblock, ARGS_SIZE_RTX (arg->offset));
3642 /* BLKmode, at least partly to be pushed. */
3644 register int excess;
3647 /* Pushing a nonscalar.
3648 If part is passed in registers, PARTIAL says how much
3649 and emit_push_insn will take care of putting it there. */
3651 /* Round its size up to a multiple
3652 of the allocation unit for arguments. */
3654 if (arg->size.var != 0)
3657 size_rtx = ARGS_SIZE_RTX (arg->size);
3661 /* PUSH_ROUNDING has no effect on us, because
3662 emit_push_insn for BLKmode is careful to avoid it. */
3663 excess = (arg->size.constant - int_size_in_bytes (TREE_TYPE (pval))
3664 + partial * UNITS_PER_WORD);
3665 size_rtx = expr_size (pval);
3668 emit_push_insn (arg->value, arg->mode, TREE_TYPE (pval), size_rtx,
3669 TYPE_ALIGN (TREE_TYPE (pval)) / BITS_PER_UNIT, partial,
3670 reg, excess, argblock, ARGS_SIZE_RTX (arg->offset));
3674 /* Unless this is a partially-in-register argument, the argument is now
3677 ??? Note that this can change arg->value from arg->stack to
3678 arg->stack_slot and it matters when they are not the same.
3679 It isn't totally clear that this is correct in all cases. */
3681 arg->value = arg->stack_slot;
3683 /* Once we have pushed something, pops can't safely
3684 be deferred during the rest of the arguments. */
3687 /* ANSI doesn't require a sequence point here,
3688 but PCC has one, so this will avoid some problems. */
3691 /* Free any temporary slots made in processing this argument. Show
3692 that we might have taken the address of something and pushed that
3694 preserve_temp_slots (NULL_RTX);
3698 #ifdef ACCUMULATE_OUTGOING_ARGS
3699 /* Now mark the segment we just used. */
3700 if (argblock && ! variable_size && arg->stack)
3701 for (i = lower_bound; i < upper_bound; i++)
3702 stack_usage_map[i] = 1;