1 /* Convert function calls to rtl insns, for GNU C compiler.
2 Copyright (C) 1989, 1992 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, 675 Mass Ave, Cambridge, MA 02139, USA. */
25 #include "insn-flags.h"
27 /* Decide whether a function's arguments should be processed
28 from first to last or from last to first.
30 They should if the stack and args grow in opposite directions, but
31 only if we have push insns. */
35 #if defined (STACK_GROWS_DOWNWARD) != defined (ARGS_GROW_DOWNARD)
36 #define PUSH_ARGS_REVERSED /* If it's last to first */
41 /* Like STACK_BOUNDARY but in units of bytes, not bits. */
42 #define STACK_BYTES (STACK_BOUNDARY / BITS_PER_UNIT)
44 /* Data structure and subroutines used within expand_call. */
48 /* Tree node for this argument. */
50 /* Mode for value; TYPE_MODE unless promoted. */
51 enum machine_mode mode;
52 /* Current RTL value for argument, or 0 if it isn't precomputed. */
54 /* Initially-compute RTL value for argument; only for const functions. */
56 /* Register to pass this argument in, 0 if passed on stack, or an
57 EXPR_LIST if the arg is to be copied into multiple different
60 /* If REG was promoted from the actual mode of the argument expression,
61 indicates whether the promotion is sign- or zero-extended. */
63 /* Number of registers to use. 0 means put the whole arg in registers.
64 Also 0 if not passed in registers. */
66 /* Non-zero if argument must be passed on stack.
67 Note that some arguments may be passed on the stack
68 even though pass_on_stack is zero, just because FUNCTION_ARG says so.
69 pass_on_stack identifies arguments that *cannot* go in registers. */
71 /* Offset of this argument from beginning of stack-args. */
72 struct args_size offset;
73 /* Similar, but offset to the start of the stack slot. Different from
74 OFFSET if this arg pads downward. */
75 struct args_size slot_offset;
76 /* Size of this argument on the stack, rounded up for any padding it gets,
77 parts of the argument passed in registers do not count.
78 If REG_PARM_STACK_SPACE is defined, then register parms
79 are counted here as well. */
80 struct args_size size;
81 /* Location on the stack at which parameter should be stored. The store
82 has already been done if STACK == VALUE. */
84 /* Location on the stack of the start of this argument slot. This can
85 differ from STACK if this arg pads downward. This location is known
86 to be aligned to FUNCTION_ARG_BOUNDARY. */
88 #ifdef ACCUMULATE_OUTGOING_ARGS
89 /* Place that this stack area has been saved, if needed. */
92 #ifdef STRICT_ALIGNMENT
93 /* If an argument's alignment does not permit direct copying into registers,
94 copy in smaller-sized pieces into pseudos. These are stored in a
95 block pointed to by this field. The next field says how many
96 word-sized pseudos we made. */
102 #ifdef ACCUMULATE_OUTGOING_ARGS
103 /* A vector of one char per byte of stack space. A byte if non-zero if
104 the corresponding stack location has been used.
105 This vector is used to prevent a function call within an argument from
106 clobbering any stack already set up. */
107 static char *stack_usage_map;
109 /* Size of STACK_USAGE_MAP. */
110 static int highest_outgoing_arg_in_use;
112 /* stack_arg_under_construction is nonzero when an argument may be
113 initialized with a constructor call (including a C function that
114 returns a BLKmode struct) and expand_call must take special action
115 to make sure the object being constructed does not overlap the
116 argument list for the constructor call. */
117 int stack_arg_under_construction;
120 static void store_one_arg ();
121 extern enum machine_mode mode_for_size ();
123 /* If WHICH is 1, return 1 if EXP contains a call to the built-in function
126 If WHICH is 0, return 1 if EXP contains a call to any function.
127 Actually, we only need return 1 if evaluating EXP would require pushing
128 arguments on the stack, but that is too difficult to compute, so we just
129 assume any function call might require the stack. */
132 calls_function (exp, which)
137 int type = TREE_CODE_CLASS (TREE_CODE (exp));
138 int length = tree_code_length[(int) TREE_CODE (exp)];
140 /* Only expressions and references can contain calls. */
142 if (type != 'e' && type != '<' && type != '1' && type != '2' && type != 'r'
146 switch (TREE_CODE (exp))
151 else if (TREE_CODE (TREE_OPERAND (exp, 0)) == ADDR_EXPR
152 && (TREE_CODE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0))
154 && DECL_BUILT_IN (TREE_OPERAND (TREE_OPERAND (exp, 0), 0))
155 && (DECL_FUNCTION_CODE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0))
159 /* Third operand is RTL. */
164 if (SAVE_EXPR_RTL (exp) != 0)
172 for (local = BLOCK_VARS (exp); local; local = TREE_CHAIN (local))
173 if (DECL_INITIAL (local) != 0
174 && calls_function (DECL_INITIAL (local), which))
178 register tree subblock;
180 for (subblock = BLOCK_SUBBLOCKS (exp);
182 subblock = TREE_CHAIN (subblock))
183 if (calls_function (subblock, which))
188 case METHOD_CALL_EXPR:
192 case WITH_CLEANUP_EXPR:
200 for (i = 0; i < length; i++)
201 if (TREE_OPERAND (exp, i) != 0
202 && calls_function (TREE_OPERAND (exp, i), which))
208 /* Force FUNEXP into a form suitable for the address of a CALL,
209 and return that as an rtx. Also load the static chain register
210 if FNDECL is a nested function.
212 USE_INSNS points to a variable holding a chain of USE insns
213 to which a USE of the static chain
214 register should be added, if required. */
217 prepare_call_address (funexp, fndecl, use_insns)
222 rtx static_chain_value = 0;
224 funexp = protect_from_queue (funexp, 0);
227 /* Get possible static chain value for nested function in C. */
228 static_chain_value = lookup_static_chain (fndecl);
230 /* Make a valid memory address and copy constants thru pseudo-regs,
231 but not for a constant address if -fno-function-cse. */
232 if (GET_CODE (funexp) != SYMBOL_REF)
233 funexp = memory_address (FUNCTION_MODE, funexp);
236 #ifndef NO_FUNCTION_CSE
237 if (optimize && ! flag_no_function_cse)
238 #ifdef NO_RECURSIVE_FUNCTION_CSE
239 if (fndecl != current_function_decl)
241 funexp = force_reg (Pmode, funexp);
245 if (static_chain_value != 0)
247 emit_move_insn (static_chain_rtx, static_chain_value);
249 /* Put the USE insn in the chain we were passed. It will later be
250 output immediately in front of the CALL insn. */
251 push_to_sequence (*use_insns);
252 emit_insn (gen_rtx (USE, VOIDmode, static_chain_rtx));
253 *use_insns = get_insns ();
260 /* Generate instructions to call function FUNEXP,
261 and optionally pop the results.
262 The CALL_INSN is the first insn generated.
264 FUNTYPE is the data type of the function, or, for a library call,
265 the identifier for the name of the call. This is given to the
266 macro RETURN_POPS_ARGS to determine whether this function pops its own args.
268 STACK_SIZE is the number of bytes of arguments on the stack,
269 rounded up to STACK_BOUNDARY; zero if the size is variable.
270 This is both to put into the call insn and
271 to generate explicit popping code if necessary.
273 STRUCT_VALUE_SIZE is the number of bytes wanted in a structure value.
274 It is zero if this call doesn't want a structure value.
276 NEXT_ARG_REG is the rtx that results from executing
277 FUNCTION_ARG (args_so_far, VOIDmode, void_type_node, 1)
278 just after all the args have had their registers assigned.
279 This could be whatever you like, but normally it is the first
280 arg-register beyond those used for args in this call,
281 or 0 if all the arg-registers are used in this call.
282 It is passed on to `gen_call' so you can put this info in the call insn.
284 VALREG is a hard register in which a value is returned,
285 or 0 if the call does not return a value.
287 OLD_INHIBIT_DEFER_POP is the value that `inhibit_defer_pop' had before
288 the args to this call were processed.
289 We restore `inhibit_defer_pop' to that value.
291 USE_INSNS is a chain of USE insns to be emitted immediately before
292 the actual CALL insn.
294 IS_CONST is true if this is a `const' call. */
297 emit_call_1 (funexp, funtype, stack_size, struct_value_size, next_arg_reg,
298 valreg, old_inhibit_defer_pop, use_insns, is_const)
302 int struct_value_size;
305 int old_inhibit_defer_pop;
309 rtx stack_size_rtx = GEN_INT (stack_size);
310 rtx struct_value_size_rtx = GEN_INT (struct_value_size);
312 int already_popped = 0;
314 /* Ensure address is valid. SYMBOL_REF is already valid, so no need,
315 and we don't want to load it into a register as an optimization,
316 because prepare_call_address already did it if it should be done. */
317 if (GET_CODE (funexp) != SYMBOL_REF)
318 funexp = memory_address (FUNCTION_MODE, funexp);
320 #ifndef ACCUMULATE_OUTGOING_ARGS
321 #if defined (HAVE_call_pop) && defined (HAVE_call_value_pop)
322 if (HAVE_call_pop && HAVE_call_value_pop
323 && (RETURN_POPS_ARGS (funtype, stack_size) > 0 || stack_size == 0))
325 rtx n_pop = GEN_INT (RETURN_POPS_ARGS (funtype, stack_size));
328 /* If this subroutine pops its own args, record that in the call insn
329 if possible, for the sake of frame pointer elimination. */
331 pat = gen_call_value_pop (valreg,
332 gen_rtx (MEM, FUNCTION_MODE, funexp),
333 stack_size_rtx, next_arg_reg, n_pop);
335 pat = gen_call_pop (gen_rtx (MEM, FUNCTION_MODE, funexp),
336 stack_size_rtx, next_arg_reg, n_pop);
338 emit_call_insn (pat);
345 #if defined (HAVE_call) && defined (HAVE_call_value)
346 if (HAVE_call && HAVE_call_value)
349 emit_call_insn (gen_call_value (valreg,
350 gen_rtx (MEM, FUNCTION_MODE, funexp),
351 stack_size_rtx, next_arg_reg,
354 emit_call_insn (gen_call (gen_rtx (MEM, FUNCTION_MODE, funexp),
355 stack_size_rtx, next_arg_reg,
356 struct_value_size_rtx));
362 /* Find the CALL insn we just emitted and write the USE insns before it. */
363 for (call_insn = get_last_insn ();
364 call_insn && GET_CODE (call_insn) != CALL_INSN;
365 call_insn = PREV_INSN (call_insn))
371 /* Put the USE insns before the CALL. */
372 emit_insns_before (use_insns, call_insn);
374 /* If this is a const call, then set the insn's unchanging bit. */
376 CONST_CALL_P (call_insn) = 1;
378 /* Restore this now, so that we do defer pops for this call's args
379 if the context of the call as a whole permits. */
380 inhibit_defer_pop = old_inhibit_defer_pop;
382 #ifndef ACCUMULATE_OUTGOING_ARGS
383 /* If returning from the subroutine does not automatically pop the args,
384 we need an instruction to pop them sooner or later.
385 Perhaps do it now; perhaps just record how much space to pop later.
387 If returning from the subroutine does pop the args, indicate that the
388 stack pointer will be changed. */
390 if (stack_size != 0 && RETURN_POPS_ARGS (funtype, stack_size) > 0)
393 emit_insn (gen_rtx (CLOBBER, VOIDmode, stack_pointer_rtx));
394 stack_size -= RETURN_POPS_ARGS (funtype, stack_size);
395 stack_size_rtx = GEN_INT (stack_size);
400 if (flag_defer_pop && inhibit_defer_pop == 0 && !is_const)
401 pending_stack_adjust += stack_size;
403 adjust_stack (stack_size_rtx);
408 /* Generate all the code for a function call
409 and return an rtx for its value.
410 Store the value in TARGET (specified as an rtx) if convenient.
411 If the value is stored in TARGET then TARGET is returned.
412 If IGNORE is nonzero, then we ignore the value of the function call. */
415 expand_call (exp, target, ignore)
420 /* List of actual parameters. */
421 tree actparms = TREE_OPERAND (exp, 1);
422 /* RTX for the function to be called. */
424 /* Tree node for the function to be called (not the address!). */
426 /* Data type of the function. */
428 /* Declaration of the function being called,
429 or 0 if the function is computed (not known by name). */
433 /* Register in which non-BLKmode value will be returned,
434 or 0 if no value or if value is BLKmode. */
436 /* Address where we should return a BLKmode value;
437 0 if value not BLKmode. */
438 rtx structure_value_addr = 0;
439 /* Nonzero if that address is being passed by treating it as
440 an extra, implicit first parameter. Otherwise,
441 it is passed by being copied directly into struct_value_rtx. */
442 int structure_value_addr_parm = 0;
443 /* Size of aggregate value wanted, or zero if none wanted
444 or if we are using the non-reentrant PCC calling convention
445 or expecting the value in registers. */
446 int struct_value_size = 0;
447 /* Nonzero if called function returns an aggregate in memory PCC style,
448 by returning the address of where to find it. */
449 int pcc_struct_value = 0;
451 /* Number of actual parameters in this call, including struct value addr. */
453 /* Number of named args. Args after this are anonymous ones
454 and they must all go on the stack. */
456 /* Count arg position in order args appear. */
459 /* Vector of information about each argument.
460 Arguments are numbered in the order they will be pushed,
461 not the order they are written. */
462 struct arg_data *args;
464 /* Total size in bytes of all the stack-parms scanned so far. */
465 struct args_size args_size;
466 /* Size of arguments before any adjustments (such as rounding). */
467 struct args_size original_args_size;
468 /* Data on reg parms scanned so far. */
469 CUMULATIVE_ARGS args_so_far;
470 /* Nonzero if a reg parm has been scanned. */
473 /* Nonzero if we must avoid push-insns in the args for this call.
474 If stack space is allocated for register parameters, but not by the
475 caller, then it is preallocated in the fixed part of the stack frame.
476 So the entire argument block must then be preallocated (i.e., we
477 ignore PUSH_ROUNDING in that case). */
479 #if defined(REG_PARM_STACK_SPACE) && ! defined(OUTGOING_REG_PARM_STACK_SPACE)
480 int must_preallocate = 1;
483 int must_preallocate = 0;
485 int must_preallocate = 1;
489 /* Size of the stack reserved for parameter registers. */
490 int reg_parm_stack_space = 0;
492 /* 1 if scanning parms front to back, -1 if scanning back to front. */
494 /* Address of space preallocated for stack parms
495 (on machines that lack push insns), or 0 if space not preallocated. */
498 /* Nonzero if it is plausible that this is a call to alloca. */
500 /* Nonzero if this is a call to setjmp or a related function. */
502 /* Nonzero if this is a call to `longjmp'. */
504 /* Nonzero if this is a call to an inline function. */
505 int is_integrable = 0;
506 /* Nonzero if this is a call to a `const' function.
507 Note that only explicitly named functions are handled as `const' here. */
509 /* Nonzero if this is a call to a `volatile' function. */
511 #if defined(ACCUMULATE_OUTGOING_ARGS) && defined(REG_PARM_STACK_SPACE)
512 /* Define the boundary of the register parm stack space that needs to be
514 int low_to_save = -1, high_to_save;
515 rtx save_area = 0; /* Place that it is saved */
518 #ifdef ACCUMULATE_OUTGOING_ARGS
519 int initial_highest_arg_in_use = highest_outgoing_arg_in_use;
520 char *initial_stack_usage_map = stack_usage_map;
523 rtx old_stack_level = 0;
525 int old_stack_arg_under_construction;
526 int old_inhibit_defer_pop = inhibit_defer_pop;
527 tree old_cleanups = cleanups_this_call;
534 /* See if we can find a DECL-node for the actual function.
535 As a result, decide whether this is a call to an integrable function. */
537 p = TREE_OPERAND (exp, 0);
538 if (TREE_CODE (p) == ADDR_EXPR)
540 fndecl = TREE_OPERAND (p, 0);
541 if (TREE_CODE (fndecl) != FUNCTION_DECL)
543 /* May still be a `const' function if it is
544 a call through a pointer-to-const.
545 But we don't handle that. */
551 && fndecl != current_function_decl
552 && DECL_SAVED_INSNS (fndecl))
554 else if (! TREE_ADDRESSABLE (fndecl))
556 /* In case this function later becomes inlinable,
557 record that there was already a non-inline call to it.
559 Use abstraction instead of setting TREE_ADDRESSABLE
561 if (DECL_INLINE (fndecl) && extra_warnings && !flag_no_inline)
562 warning_with_decl (fndecl, "can't inline call to `%s' which was declared inline");
563 mark_addressable (fndecl);
566 if (TREE_READONLY (fndecl) && ! TREE_THIS_VOLATILE (fndecl)
567 && TYPE_MODE (TREE_TYPE (exp)) != VOIDmode)
572 is_volatile = TYPE_VOLATILE (TREE_TYPE (TREE_TYPE (p)));
574 #ifdef REG_PARM_STACK_SPACE
575 #ifdef MAYBE_REG_PARM_STACK_SPACE
576 reg_parm_stack_space = MAYBE_REG_PARM_STACK_SPACE;
578 reg_parm_stack_space = REG_PARM_STACK_SPACE (fndecl);
582 /* Warn if this value is an aggregate type,
583 regardless of which calling convention we are using for it. */
584 if (warn_aggregate_return
585 && (TREE_CODE (TREE_TYPE (exp)) == RECORD_TYPE
586 || TREE_CODE (TREE_TYPE (exp)) == UNION_TYPE
587 || TREE_CODE (TREE_TYPE (exp)) == ARRAY_TYPE))
588 warning ("function call has aggregate value");
590 /* Set up a place to return a structure. */
592 /* Cater to broken compilers. */
593 if (aggregate_value_p (exp))
595 /* This call returns a big structure. */
598 #ifdef PCC_STATIC_STRUCT_RETURN
599 if (flag_pcc_struct_return)
601 pcc_struct_value = 1;
602 is_integrable = 0; /* Easier than making that case work right. */
607 struct_value_size = int_size_in_bytes (TREE_TYPE (exp));
609 if (struct_value_size < 0)
612 if (target && GET_CODE (target) == MEM)
613 structure_value_addr = XEXP (target, 0);
616 /* Assign a temporary on the stack to hold the value. */
618 /* For variable-sized objects, we must be called with a target
619 specified. If we were to allocate space on the stack here,
620 we would have no way of knowing when to free it. */
623 = XEXP (assign_stack_temp (BLKmode, struct_value_size, 1), 0);
629 /* If called function is inline, try to integrate it. */
634 rtx before_call = get_last_insn ();
636 temp = expand_inline_function (fndecl, actparms, target,
637 ignore, TREE_TYPE (exp),
638 structure_value_addr);
640 /* If inlining succeeded, return. */
641 if ((HOST_WIDE_INT) temp != -1)
643 /* Perform all cleanups needed for the arguments of this call
644 (i.e. destructors in C++). It is ok if these destructors
645 clobber RETURN_VALUE_REG, because the only time we care about
646 this is when TARGET is that register. But in C++, we take
647 care to never return that register directly. */
648 expand_cleanups_to (old_cleanups);
650 #ifdef ACCUMULATE_OUTGOING_ARGS
651 /* If the outgoing argument list must be preserved, push
652 the stack before executing the inlined function if it
655 for (i = reg_parm_stack_space - 1; i >= 0; i--)
656 if (i < highest_outgoing_arg_in_use && stack_usage_map[i] != 0)
659 if (stack_arg_under_construction || i >= 0)
661 rtx insn = NEXT_INSN (before_call), seq;
663 /* Look for a call in the inline function code.
664 If OUTGOING_ARGS_SIZE (DECL_SAVED_INSNS (fndecl)) is
665 nonzero then there is a call and it is not necessary
666 to scan the insns. */
668 if (OUTGOING_ARGS_SIZE (DECL_SAVED_INSNS (fndecl)) == 0)
669 for (; insn; insn = NEXT_INSN (insn))
670 if (GET_CODE (insn) == CALL_INSN)
675 /* Reserve enough stack space so that the largest
676 argument list of any function call in the inline
677 function does not overlap the argument list being
678 evaluated. This is usually an overestimate because
679 allocate_dynamic_stack_space reserves space for an
680 outgoing argument list in addition to the requested
681 space, but there is no way to ask for stack space such
682 that an argument list of a certain length can be
683 safely constructed. */
685 int adjust = OUTGOING_ARGS_SIZE (DECL_SAVED_INSNS (fndecl));
686 #ifdef REG_PARM_STACK_SPACE
687 /* Add the stack space reserved for register arguments
688 in the inline function. What is really needed is the
689 largest value of reg_parm_stack_space in the inline
690 function, but that is not available. Using the current
691 value of reg_parm_stack_space is wrong, but gives
692 correct results on all supported machines. */
693 adjust += reg_parm_stack_space;
696 emit_stack_save (SAVE_BLOCK, &old_stack_level, 0);
697 allocate_dynamic_stack_space (GEN_INT (adjust),
698 NULL_RTX, BITS_PER_UNIT);
701 emit_insns_before (seq, NEXT_INSN (before_call));
702 emit_stack_restore (SAVE_BLOCK, old_stack_level, NULL_RTX);
707 /* If the result is equivalent to TARGET, return TARGET to simplify
708 checks in store_expr. They can be equivalent but not equal in the
709 case of a function that returns BLKmode. */
710 if (temp != target && rtx_equal_p (temp, target))
715 /* If inlining failed, mark FNDECL as needing to be compiled
716 separately after all. */
717 mark_addressable (fndecl);
720 /* When calling a const function, we must pop the stack args right away,
721 so that the pop is deleted or moved with the call. */
725 function_call_count++;
727 if (fndecl && DECL_NAME (fndecl))
728 name = IDENTIFIER_POINTER (DECL_NAME (fndecl));
731 /* Unless it's a call to a specific function that isn't alloca,
732 if it has one argument, we must assume it might be alloca. */
735 (!(fndecl != 0 && strcmp (name, "alloca"))
737 && TREE_CHAIN (actparms) == 0);
739 /* We assume that alloca will always be called by name. It
740 makes no sense to pass it as a pointer-to-function to
741 anything that does not understand its behavior. */
743 (name && ((IDENTIFIER_LENGTH (DECL_NAME (fndecl)) == 6
745 && ! strcmp (name, "alloca"))
746 || (IDENTIFIER_LENGTH (DECL_NAME (fndecl)) == 16
748 && ! strcmp (name, "__builtin_alloca"))));
751 /* See if this is a call to a function that can return more than once
752 or a call to longjmp. */
757 if (name != 0 && IDENTIFIER_LENGTH (DECL_NAME (fndecl)) <= 15)
762 tname += ((name[1] == '_' && name[2] == 'x') ? 3 : 1);
768 && (! strcmp (tname, "setjmp")
769 || ! strcmp (tname, "setjmp_syscall")))
771 && ! strcmp (tname, "sigsetjmp"))
773 && ! strcmp (tname, "savectx")));
775 && ! strcmp (tname, "siglongjmp"))
778 else if ((tname[0] == 'q' && tname[1] == 's'
779 && ! strcmp (tname, "qsetjmp"))
780 || (tname[0] == 'v' && tname[1] == 'f'
781 && ! strcmp (tname, "vfork")))
784 else if (tname[0] == 'l' && tname[1] == 'o'
785 && ! strcmp (tname, "longjmp"))
790 current_function_calls_alloca = 1;
792 /* Don't let pending stack adjusts add up to too much.
793 Also, do all pending adjustments now
794 if there is any chance this might be a call to alloca. */
796 if (pending_stack_adjust >= 32
797 || (pending_stack_adjust > 0 && may_be_alloca))
798 do_pending_stack_adjust ();
800 /* Operand 0 is a pointer-to-function; get the type of the function. */
801 funtype = TREE_TYPE (TREE_OPERAND (exp, 0));
802 if (TREE_CODE (funtype) != POINTER_TYPE)
804 funtype = TREE_TYPE (funtype);
806 /* Push the temporary stack slot level so that we can free temporaries used
807 by each of the arguments separately. */
810 /* Start updating where the next arg would go. */
811 INIT_CUMULATIVE_ARGS (args_so_far, funtype, NULL_RTX);
813 /* If struct_value_rtx is 0, it means pass the address
814 as if it were an extra parameter. */
815 if (structure_value_addr && struct_value_rtx == 0)
817 #ifdef ACCUMULATE_OUTGOING_ARGS
818 /* If the stack will be adjusted, make sure the structure address
819 does not refer to virtual_outgoing_args_rtx. */
820 rtx temp = (stack_arg_under_construction
821 ? copy_addr_to_reg (structure_value_addr)
822 : force_reg (Pmode, structure_value_addr));
824 rtx temp = force_reg (Pmode, structure_value_addr);
828 = tree_cons (error_mark_node,
829 make_tree (build_pointer_type (TREE_TYPE (funtype)),
832 structure_value_addr_parm = 1;
835 /* Count the arguments and set NUM_ACTUALS. */
836 for (p = actparms, i = 0; p; p = TREE_CHAIN (p)) i++;
839 /* Compute number of named args.
840 Normally, don't include the last named arg if anonymous args follow.
841 (If no anonymous args follow, the result of list_length
842 is actually one too large.)
844 If SETUP_INCOMING_VARARGS is defined, this machine will be able to
845 place unnamed args that were passed in registers into the stack. So
846 treat all args as named. This allows the insns emitting for a specific
847 argument list to be independent of the function declaration.
849 If SETUP_INCOMING_VARARGS is not defined, we do not have any reliable
850 way to pass unnamed args in registers, so we must force them into
852 #ifndef SETUP_INCOMING_VARARGS
853 if (TYPE_ARG_TYPES (funtype) != 0)
855 = list_length (TYPE_ARG_TYPES (funtype)) - 1
856 /* Count the struct value address, if it is passed as a parm. */
857 + structure_value_addr_parm;
860 /* If we know nothing, treat all args as named. */
861 n_named_args = num_actuals;
863 /* Make a vector to hold all the information about each arg. */
864 args = (struct arg_data *) alloca (num_actuals * sizeof (struct arg_data));
865 bzero (args, num_actuals * sizeof (struct arg_data));
867 args_size.constant = 0;
870 /* In this loop, we consider args in the order they are written.
871 We fill up ARGS from the front of from the back if necessary
872 so that in any case the first arg to be pushed ends up at the front. */
874 #ifdef PUSH_ARGS_REVERSED
875 i = num_actuals - 1, inc = -1;
876 /* In this case, must reverse order of args
877 so that we compute and push the last arg first. */
882 /* I counts args in order (to be) pushed; ARGPOS counts in order written. */
883 for (p = actparms, argpos = 0; p; p = TREE_CHAIN (p), i += inc, argpos++)
885 tree type = TREE_TYPE (TREE_VALUE (p));
886 enum machine_mode mode;
888 args[i].tree_value = TREE_VALUE (p);
890 /* Replace erroneous argument with constant zero. */
891 if (type == error_mark_node || TYPE_SIZE (type) == 0)
892 args[i].tree_value = integer_zero_node, type = integer_type_node;
894 /* Decide where to pass this arg.
896 args[i].reg is nonzero if all or part is passed in registers.
898 args[i].partial is nonzero if part but not all is passed in registers,
899 and the exact value says how many words are passed in registers.
901 args[i].pass_on_stack is nonzero if the argument must at least be
902 computed on the stack. It may then be loaded back into registers
903 if args[i].reg is nonzero.
905 These decisions are driven by the FUNCTION_... macros and must agree
906 with those made by function.c. */
908 #ifdef FUNCTION_ARG_PASS_BY_REFERENCE
909 /* See if this argument should be passed by invisible reference. */
910 if (FUNCTION_ARG_PASS_BY_REFERENCE (args_so_far, TYPE_MODE (type), type,
911 argpos < n_named_args))
913 /* We make a copy of the object and pass the address to the function
917 if (TYPE_SIZE (type) == 0
918 || TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST)
920 /* This is a variable-sized object. Make space on the stack
922 rtx size_rtx = expand_expr (size_in_bytes (type), NULL_RTX,
925 if (old_stack_level == 0)
927 emit_stack_save (SAVE_BLOCK, &old_stack_level, NULL_RTX);
928 old_pending_adj = pending_stack_adjust;
929 pending_stack_adjust = 0;
932 copy = gen_rtx (MEM, BLKmode,
933 allocate_dynamic_stack_space (size_rtx, NULL_RTX,
938 int size = int_size_in_bytes (type);
939 copy = assign_stack_temp (TYPE_MODE (type), size, 1);
942 store_expr (args[i].tree_value, copy, 0);
944 args[i].tree_value = build1 (ADDR_EXPR, build_pointer_type (type),
945 make_tree (type, copy));
946 type = build_pointer_type (type);
950 mode = TYPE_MODE (type);
952 #ifdef PROMOTE_FUNCTION_ARGS
953 /* Compute the mode in which the arg is actually to be extended to. */
954 if (TREE_CODE (type) == INTEGER_TYPE || TREE_CODE (type) == ENUMERAL_TYPE
955 || TREE_CODE (type) == BOOLEAN_TYPE || TREE_CODE (type) == CHAR_TYPE
956 || TREE_CODE (type) == REAL_TYPE || TREE_CODE (type) == POINTER_TYPE
957 || TREE_CODE (type) == OFFSET_TYPE)
959 int unsignedp = TREE_UNSIGNED (type);
960 PROMOTE_MODE (mode, unsignedp, type);
961 args[i].unsignedp = unsignedp;
966 args[i].reg = FUNCTION_ARG (args_so_far, mode, type,
967 argpos < n_named_args);
968 #ifdef FUNCTION_ARG_PARTIAL_NREGS
971 = FUNCTION_ARG_PARTIAL_NREGS (args_so_far, mode, type,
972 argpos < n_named_args);
975 args[i].pass_on_stack = MUST_PASS_IN_STACK (mode, type);
977 /* If FUNCTION_ARG returned an (expr_list (nil) FOO), it means that
978 we are to pass this arg in the register(s) designated by FOO, but
979 also to pass it in the stack. */
980 if (args[i].reg && GET_CODE (args[i].reg) == EXPR_LIST
981 && XEXP (args[i].reg, 0) == 0)
982 args[i].pass_on_stack = 1, args[i].reg = XEXP (args[i].reg, 1);
984 /* If this is an addressable type, we must preallocate the stack
985 since we must evaluate the object into its final location.
987 If this is to be passed in both registers and the stack, it is simpler
989 if (TREE_ADDRESSABLE (type)
990 || (args[i].pass_on_stack && args[i].reg != 0))
991 must_preallocate = 1;
993 /* If this is an addressable type, we cannot pre-evaluate it. Thus,
994 we cannot consider this function call constant. */
995 if (TREE_ADDRESSABLE (type))
998 /* Compute the stack-size of this argument. */
999 if (args[i].reg == 0 || args[i].partial != 0
1000 #ifdef REG_PARM_STACK_SPACE
1001 || reg_parm_stack_space > 0
1003 || args[i].pass_on_stack)
1004 locate_and_pad_parm (mode, type,
1005 #ifdef STACK_PARMS_IN_REG_PARM_AREA
1010 fndecl, &args_size, &args[i].offset,
1013 #ifndef ARGS_GROW_DOWNWARD
1014 args[i].slot_offset = args_size;
1017 #ifndef REG_PARM_STACK_SPACE
1018 /* If a part of the arg was put into registers,
1019 don't include that part in the amount pushed. */
1020 if (! args[i].pass_on_stack)
1021 args[i].size.constant -= ((args[i].partial * UNITS_PER_WORD)
1022 / (PARM_BOUNDARY / BITS_PER_UNIT)
1023 * (PARM_BOUNDARY / BITS_PER_UNIT));
1026 /* Update ARGS_SIZE, the total stack space for args so far. */
1028 args_size.constant += args[i].size.constant;
1029 if (args[i].size.var)
1031 ADD_PARM_SIZE (args_size, args[i].size.var);
1034 /* Since the slot offset points to the bottom of the slot,
1035 we must record it after incrementing if the args grow down. */
1036 #ifdef ARGS_GROW_DOWNWARD
1037 args[i].slot_offset = args_size;
1039 args[i].slot_offset.constant = -args_size.constant;
1042 SUB_PARM_SIZE (args[i].slot_offset, args_size.var);
1046 /* Increment ARGS_SO_FAR, which has info about which arg-registers
1047 have been used, etc. */
1049 FUNCTION_ARG_ADVANCE (args_so_far, TYPE_MODE (type), type,
1050 argpos < n_named_args);
1053 #ifdef FINAL_REG_PARM_STACK_SPACE
1054 reg_parm_stack_space = FINAL_REG_PARM_STACK_SPACE (args_size.constant,
1058 /* Compute the actual size of the argument block required. The variable
1059 and constant sizes must be combined, the size may have to be rounded,
1060 and there may be a minimum required size. */
1062 original_args_size = args_size;
1065 /* If this function requires a variable-sized argument list, don't try to
1066 make a cse'able block for this call. We may be able to do this
1067 eventually, but it is too complicated to keep track of what insns go
1068 in the cse'able block and which don't. */
1071 must_preallocate = 1;
1073 args_size.var = ARGS_SIZE_TREE (args_size);
1074 args_size.constant = 0;
1076 #ifdef STACK_BOUNDARY
1077 if (STACK_BOUNDARY != BITS_PER_UNIT)
1078 args_size.var = round_up (args_size.var, STACK_BYTES);
1081 #ifdef REG_PARM_STACK_SPACE
1082 if (reg_parm_stack_space > 0)
1085 = size_binop (MAX_EXPR, args_size.var,
1086 size_int (REG_PARM_STACK_SPACE (fndecl)));
1088 #ifndef OUTGOING_REG_PARM_STACK_SPACE
1089 /* The area corresponding to register parameters is not to count in
1090 the size of the block we need. So make the adjustment. */
1092 = size_binop (MINUS_EXPR, args_size.var,
1093 size_int (reg_parm_stack_space));
1100 #ifdef STACK_BOUNDARY
1101 args_size.constant = (((args_size.constant + (STACK_BYTES - 1))
1102 / STACK_BYTES) * STACK_BYTES);
1105 #ifdef REG_PARM_STACK_SPACE
1106 args_size.constant = MAX (args_size.constant,
1107 reg_parm_stack_space);
1108 #ifdef MAYBE_REG_PARM_STACK_SPACE
1109 if (reg_parm_stack_space == 0)
1110 args_size.constant = 0;
1112 #ifndef OUTGOING_REG_PARM_STACK_SPACE
1113 args_size.constant -= reg_parm_stack_space;
1118 /* See if we have or want to preallocate stack space.
1120 If we would have to push a partially-in-regs parm
1121 before other stack parms, preallocate stack space instead.
1123 If the size of some parm is not a multiple of the required stack
1124 alignment, we must preallocate.
1126 If the total size of arguments that would otherwise create a copy in
1127 a temporary (such as a CALL) is more than half the total argument list
1128 size, preallocation is faster.
1130 Another reason to preallocate is if we have a machine (like the m88k)
1131 where stack alignment is required to be maintained between every
1132 pair of insns, not just when the call is made. However, we assume here
1133 that such machines either do not have push insns (and hence preallocation
1134 would occur anyway) or the problem is taken care of with
1137 if (! must_preallocate)
1139 int partial_seen = 0;
1140 int copy_to_evaluate_size = 0;
1142 for (i = 0; i < num_actuals && ! must_preallocate; i++)
1144 if (args[i].partial > 0 && ! args[i].pass_on_stack)
1146 else if (partial_seen && args[i].reg == 0)
1147 must_preallocate = 1;
1149 if (TYPE_MODE (TREE_TYPE (args[i].tree_value)) == BLKmode
1150 && (TREE_CODE (args[i].tree_value) == CALL_EXPR
1151 || TREE_CODE (args[i].tree_value) == TARGET_EXPR
1152 || TREE_CODE (args[i].tree_value) == COND_EXPR
1153 || TREE_ADDRESSABLE (TREE_TYPE (args[i].tree_value))))
1154 copy_to_evaluate_size
1155 += int_size_in_bytes (TREE_TYPE (args[i].tree_value));
1158 if (copy_to_evaluate_size * 2 >= args_size.constant
1159 && args_size.constant > 0)
1160 must_preallocate = 1;
1163 /* If the structure value address will reference the stack pointer, we must
1164 stabilize it. We don't need to do this if we know that we are not going
1165 to adjust the stack pointer in processing this call. */
1167 if (structure_value_addr
1168 && (reg_mentioned_p (virtual_stack_dynamic_rtx, structure_value_addr)
1169 || reg_mentioned_p (virtual_outgoing_args_rtx, structure_value_addr))
1171 #ifndef ACCUMULATE_OUTGOING_ARGS
1172 || args_size.constant
1175 structure_value_addr = copy_to_reg (structure_value_addr);
1177 /* If this function call is cse'able, precompute all the parameters.
1178 Note that if the parameter is constructed into a temporary, this will
1179 cause an additional copy because the parameter will be constructed
1180 into a temporary location and then copied into the outgoing arguments.
1181 If a parameter contains a call to alloca and this function uses the
1182 stack, precompute the parameter. */
1184 /* If we preallocated the stack space, and some arguments must be passed
1185 on the stack, then we must precompute any parameter which contains a
1186 function call which will store arguments on the stack.
1187 Otherwise, evaluating the parameter may clobber previous parameters
1188 which have already been stored into the stack. */
1190 for (i = 0; i < num_actuals; i++)
1192 || ((args_size.var != 0 || args_size.constant != 0)
1193 && calls_function (args[i].tree_value, 1))
1194 || (must_preallocate && (args_size.var != 0 || args_size.constant != 0)
1195 && calls_function (args[i].tree_value, 0)))
1197 args[i].initial_value = args[i].value
1198 = expand_expr (args[i].tree_value, NULL_RTX, VOIDmode, 0);
1200 if (GET_MODE (args[i].value ) != VOIDmode
1201 && GET_MODE (args[i].value) != args[i].mode)
1202 args[i].value = convert_to_mode (args[i].mode, args[i].value,
1204 preserve_temp_slots (args[i].value);
1208 /* ANSI doesn't require a sequence point here,
1209 but PCC has one, so this will avoid some problems. */
1213 /* Now we are about to start emitting insns that can be deleted
1214 if a libcall is deleted. */
1218 /* If we have no actual push instructions, or shouldn't use them,
1219 make space for all args right now. */
1221 if (args_size.var != 0)
1223 if (old_stack_level == 0)
1225 emit_stack_save (SAVE_BLOCK, &old_stack_level, NULL_RTX);
1226 old_pending_adj = pending_stack_adjust;
1227 pending_stack_adjust = 0;
1228 #ifdef ACCUMULATE_OUTGOING_ARGS
1229 /* stack_arg_under_construction says whether a stack arg is
1230 being constructed at the old stack level. Pushing the stack
1231 gets a clean outgoing argument block. */
1232 old_stack_arg_under_construction = stack_arg_under_construction;
1233 stack_arg_under_construction = 0;
1236 argblock = push_block (ARGS_SIZE_RTX (args_size), 0, 0);
1238 else if (must_preallocate)
1240 /* Note that we must go through the motions of allocating an argument
1241 block even if the size is zero because we may be storing args
1242 in the area reserved for register arguments, which may be part of
1244 int needed = args_size.constant;
1246 #ifdef ACCUMULATE_OUTGOING_ARGS
1247 /* Store the maximum argument space used. It will be pushed by the
1250 Since the stack pointer will never be pushed, it is possible for
1251 the evaluation of a parm to clobber something we have already
1252 written to the stack. Since most function calls on RISC machines
1253 do not use the stack, this is uncommon, but must work correctly.
1255 Therefore, we save any area of the stack that was already written
1256 and that we are using. Here we set up to do this by making a new
1257 stack usage map from the old one. The actual save will be done
1260 Another approach might be to try to reorder the argument
1261 evaluations to avoid this conflicting stack usage. */
1263 if (needed > current_function_outgoing_args_size)
1264 current_function_outgoing_args_size = needed;
1266 #if defined(REG_PARM_STACK_SPACE) && ! defined(OUTGOING_REG_PARM_STACK_SPACE)
1267 /* Since we will be writing into the entire argument area, the
1268 map must be allocated for its entire size, not just the part that
1269 is the responsibility of the caller. */
1270 needed += reg_parm_stack_space;
1273 #ifdef ARGS_GROW_DOWNWARD
1274 highest_outgoing_arg_in_use = MAX (initial_highest_arg_in_use,
1277 highest_outgoing_arg_in_use = MAX (initial_highest_arg_in_use, needed);
1279 stack_usage_map = (char *) alloca (highest_outgoing_arg_in_use);
1281 if (initial_highest_arg_in_use)
1282 bcopy (initial_stack_usage_map, stack_usage_map,
1283 initial_highest_arg_in_use);
1285 if (initial_highest_arg_in_use != highest_outgoing_arg_in_use)
1286 bzero (&stack_usage_map[initial_highest_arg_in_use],
1287 highest_outgoing_arg_in_use - initial_highest_arg_in_use);
1290 /* The address of the outgoing argument list must not be copied to a
1291 register here, because argblock would be left pointing to the
1292 wrong place after the call to allocate_dynamic_stack_space below. */
1294 argblock = virtual_outgoing_args_rtx;
1296 #else /* not ACCUMULATE_OUTGOING_ARGS */
1297 if (inhibit_defer_pop == 0)
1299 /* Try to reuse some or all of the pending_stack_adjust
1300 to get this space. Maybe we can avoid any pushing. */
1301 if (needed > pending_stack_adjust)
1303 needed -= pending_stack_adjust;
1304 pending_stack_adjust = 0;
1308 pending_stack_adjust -= needed;
1312 /* Special case this because overhead of `push_block' in this
1313 case is non-trivial. */
1315 argblock = virtual_outgoing_args_rtx;
1317 argblock = push_block (GEN_INT (needed), 0, 0);
1319 /* We only really need to call `copy_to_reg' in the case where push
1320 insns are going to be used to pass ARGBLOCK to a function
1321 call in ARGS. In that case, the stack pointer changes value
1322 from the allocation point to the call point, and hence
1323 the value of VIRTUAL_OUTGOING_ARGS_RTX changes as well.
1324 But might as well always do it. */
1325 argblock = copy_to_reg (argblock);
1326 #endif /* not ACCUMULATE_OUTGOING_ARGS */
1330 #ifdef ACCUMULATE_OUTGOING_ARGS
1331 /* The save/restore code in store_one_arg handles all cases except one:
1332 a constructor call (including a C function returning a BLKmode struct)
1333 to initialize an argument. */
1334 if (stack_arg_under_construction)
1336 #if defined(REG_PARM_STACK_SPACE) && ! defined(OUTGOING_REG_PARM_STACK_SPACE)
1337 rtx push_size = GEN_INT (reg_parm_stack_space + args_size.constant);
1339 rtx push_size = GEN_INT (args_size.constant);
1341 if (old_stack_level == 0)
1343 emit_stack_save (SAVE_BLOCK, &old_stack_level, NULL_RTX);
1344 old_pending_adj = pending_stack_adjust;
1345 pending_stack_adjust = 0;
1346 /* stack_arg_under_construction says whether a stack arg is
1347 being constructed at the old stack level. Pushing the stack
1348 gets a clean outgoing argument block. */
1349 old_stack_arg_under_construction = stack_arg_under_construction;
1350 stack_arg_under_construction = 0;
1351 /* Make a new map for the new argument list. */
1352 stack_usage_map = (char *)alloca (highest_outgoing_arg_in_use);
1353 bzero (stack_usage_map, highest_outgoing_arg_in_use);
1354 highest_outgoing_arg_in_use = 0;
1356 allocate_dynamic_stack_space (push_size, NULL_RTX, BITS_PER_UNIT);
1358 /* If argument evaluation might modify the stack pointer, copy the
1359 address of the argument list to a register. */
1360 for (i = 0; i < num_actuals; i++)
1361 if (args[i].pass_on_stack)
1363 argblock = copy_addr_to_reg (argblock);
1369 /* If we preallocated stack space, compute the address of each argument.
1370 We need not ensure it is a valid memory address here; it will be
1371 validized when it is used. */
1374 rtx arg_reg = argblock;
1377 if (GET_CODE (argblock) == PLUS)
1378 arg_reg = XEXP (argblock, 0), arg_offset = INTVAL (XEXP (argblock, 1));
1380 for (i = 0; i < num_actuals; i++)
1382 rtx offset = ARGS_SIZE_RTX (args[i].offset);
1383 rtx slot_offset = ARGS_SIZE_RTX (args[i].slot_offset);
1386 /* Skip this parm if it will not be passed on the stack. */
1387 if (! args[i].pass_on_stack && args[i].reg != 0)
1390 if (GET_CODE (offset) == CONST_INT)
1391 addr = plus_constant (arg_reg, INTVAL (offset));
1393 addr = gen_rtx (PLUS, Pmode, arg_reg, offset);
1395 addr = plus_constant (addr, arg_offset);
1396 args[i].stack = gen_rtx (MEM, args[i].mode, addr);
1398 if (GET_CODE (slot_offset) == CONST_INT)
1399 addr = plus_constant (arg_reg, INTVAL (slot_offset));
1401 addr = gen_rtx (PLUS, Pmode, arg_reg, slot_offset);
1403 addr = plus_constant (addr, arg_offset);
1404 args[i].stack_slot = gen_rtx (MEM, args[i].mode, addr);
1408 #ifdef PUSH_ARGS_REVERSED
1409 #ifdef STACK_BOUNDARY
1410 /* If we push args individually in reverse order, perform stack alignment
1411 before the first push (the last arg). */
1413 anti_adjust_stack (GEN_INT (args_size.constant
1414 - original_args_size.constant));
1418 /* Don't try to defer pops if preallocating, not even from the first arg,
1419 since ARGBLOCK probably refers to the SP. */
1423 /* Get the function to call, in the form of RTL. */
1425 /* Get a SYMBOL_REF rtx for the function address. */
1426 funexp = XEXP (DECL_RTL (fndecl), 0);
1428 /* Generate an rtx (probably a pseudo-register) for the address. */
1430 funexp = expand_expr (TREE_OPERAND (exp, 0), NULL_RTX, VOIDmode, 0);
1431 free_temp_slots (); /* FUNEXP can't be BLKmode */
1435 /* Figure out the register where the value, if any, will come back. */
1437 if (TYPE_MODE (TREE_TYPE (exp)) != VOIDmode
1438 && ! structure_value_addr)
1440 if (pcc_struct_value)
1441 valreg = hard_function_value (build_pointer_type (TREE_TYPE (exp)),
1444 valreg = hard_function_value (TREE_TYPE (exp), fndecl);
1447 /* Precompute all register parameters. It isn't safe to compute anything
1448 once we have started filling any specific hard regs. */
1450 for (i = 0; i < num_actuals; i++)
1451 if (args[i].reg != 0 && ! args[i].pass_on_stack)
1455 if (args[i].value == 0)
1457 args[i].value = expand_expr (args[i].tree_value, NULL_RTX,
1459 preserve_temp_slots (args[i].value);
1462 /* ANSI doesn't require a sequence point here,
1463 but PCC has one, so this will avoid some problems. */
1467 /* If we are to promote the function arg to a wider mode,
1470 if (GET_MODE (args[i].value) != VOIDmode
1471 && GET_MODE (args[i].value) != args[i].mode)
1472 args[i].value = convert_to_mode (args[i].mode, args[i].value,
1476 #if defined(ACCUMULATE_OUTGOING_ARGS) && defined(REG_PARM_STACK_SPACE)
1477 /* The argument list is the property of the called routine and it
1478 may clobber it. If the fixed area has been used for previous
1479 parameters, we must save and restore it.
1481 Here we compute the boundary of the that needs to be saved, if any. */
1483 #ifdef ARGS_GROW_DOWNWARD
1484 for (i = 0; i < reg_parm_stack_space + 1; i++)
1486 for (i = 0; i < reg_parm_stack_space; i++)
1489 if (i >= highest_outgoing_arg_in_use
1490 || stack_usage_map[i] == 0)
1493 if (low_to_save == -1)
1499 if (low_to_save >= 0)
1501 int num_to_save = high_to_save - low_to_save + 1;
1502 enum machine_mode save_mode
1503 = mode_for_size (num_to_save * BITS_PER_UNIT, MODE_INT, 1);
1506 /* If we don't have the required alignment, must do this in BLKmode. */
1507 if ((low_to_save & (MIN (GET_MODE_SIZE (save_mode),
1508 BIGGEST_ALIGNMENT / UNITS_PER_WORD) - 1)))
1509 save_mode = BLKmode;
1511 stack_area = gen_rtx (MEM, save_mode,
1512 memory_address (save_mode,
1514 #ifdef ARGS_GROW_DOWNWARD
1515 plus_constant (argblock,
1518 plus_constant (argblock,
1522 if (save_mode == BLKmode)
1524 save_area = assign_stack_temp (BLKmode, num_to_save, 1);
1525 emit_block_move (validize_mem (save_area), stack_area,
1526 GEN_INT (num_to_save),
1527 PARM_BOUNDARY / BITS_PER_UNIT);
1531 save_area = gen_reg_rtx (save_mode);
1532 emit_move_insn (save_area, stack_area);
1538 /* Now store (and compute if necessary) all non-register parms.
1539 These come before register parms, since they can require block-moves,
1540 which could clobber the registers used for register parms.
1541 Parms which have partial registers are not stored here,
1542 but we do preallocate space here if they want that. */
1544 for (i = 0; i < num_actuals; i++)
1545 if (args[i].reg == 0 || args[i].pass_on_stack)
1546 store_one_arg (&args[i], argblock, may_be_alloca,
1547 args_size.var != 0, fndecl, reg_parm_stack_space);
1549 #ifdef STRICT_ALIGNMENT
1550 /* If we have a parm that is passed in registers but not in memory
1551 and whose alignment does not permit a direct copy into registers,
1552 make a group of pseudos that correspond to each register that we
1555 for (i = 0; i < num_actuals; i++)
1556 if (args[i].reg != 0 && ! args[i].pass_on_stack
1557 && args[i].mode == BLKmode
1558 && (TYPE_ALIGN (TREE_TYPE (args[i].tree_value))
1559 < MIN (BIGGEST_ALIGNMENT, BITS_PER_WORD)))
1561 int bytes = int_size_in_bytes (TREE_TYPE (args[i].tree_value));
1563 args[i].n_aligned_regs
1564 = args[i].partial ? args[i].partial
1565 : (bytes + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD;
1567 args[i].aligned_regs = (rtx *) alloca (sizeof (rtx)
1568 * args[i].n_aligned_regs);
1570 for (j = 0; j < args[i].n_aligned_regs; j++)
1572 rtx reg = gen_reg_rtx (word_mode);
1573 rtx word = operand_subword_force (args[i].value, j, BLKmode);
1574 int bitsize = TYPE_ALIGN (TREE_TYPE (args[i].tree_value));
1577 args[i].aligned_regs[j] = reg;
1579 /* Clobber REG and move each partword into it. Ensure we don't
1580 go past the end of the structure. Note that the loop below
1581 works because we've already verified that padding
1582 and endianness are compatible. */
1584 emit_insn (gen_rtx (CLOBBER, VOIDmode, reg));
1587 bitpos < BITS_PER_WORD && bytes > 0;
1588 bitpos += bitsize, bytes -= bitsize / BITS_PER_UNIT)
1590 int xbitpos = (BYTES_BIG_ENDIAN
1591 ? BITS_PER_WORD - bitpos - bitsize
1594 store_bit_field (reg, bitsize, xbitpos, word_mode,
1595 extract_bit_field (word, bitsize, xbitpos, 1,
1596 NULL_RTX, word_mode,
1598 bitsize / BITS_PER_UNIT,
1600 bitsize / BITS_PER_UNIT, BITS_PER_WORD);
1606 /* Now store any partially-in-registers parm.
1607 This is the last place a block-move can happen. */
1609 for (i = 0; i < num_actuals; i++)
1610 if (args[i].partial != 0 && ! args[i].pass_on_stack)
1611 store_one_arg (&args[i], argblock, may_be_alloca,
1612 args_size.var != 0, fndecl, reg_parm_stack_space);
1614 #ifndef PUSH_ARGS_REVERSED
1615 #ifdef STACK_BOUNDARY
1616 /* If we pushed args in forward order, perform stack alignment
1617 after pushing the last arg. */
1619 anti_adjust_stack (GEN_INT (args_size.constant
1620 - original_args_size.constant));
1624 /* If register arguments require space on the stack and stack space
1625 was not preallocated, allocate stack space here for arguments
1626 passed in registers. */
1627 #if ! defined(ALLOCATE_OUTGOING_ARGS) && defined(OUTGOING_REG_PARM_STACK_SPACE)
1628 if (must_preallocate == 0 && reg_parm_stack_space > 0)
1629 anti_adjust_stack (GEN_INT (reg_parm_stack_space));
1632 /* Pass the function the address in which to return a structure value. */
1633 if (structure_value_addr && ! structure_value_addr_parm)
1635 emit_move_insn (struct_value_rtx,
1637 force_operand (structure_value_addr,
1639 if (GET_CODE (struct_value_rtx) == REG)
1641 push_to_sequence (use_insns);
1642 emit_insn (gen_rtx (USE, VOIDmode, struct_value_rtx));
1643 use_insns = get_insns ();
1648 /* Now do the register loads required for any wholly-register parms or any
1649 parms which are passed both on the stack and in a register. Their
1650 expressions were already evaluated.
1652 Mark all register-parms as living through the call, putting these USE
1653 insns in a list headed by USE_INSNS. */
1655 for (i = 0; i < num_actuals; i++)
1657 rtx list = args[i].reg;
1658 int partial = args[i].partial;
1665 /* Process each register that needs to get this arg. */
1666 if (GET_CODE (list) == EXPR_LIST)
1667 reg = XEXP (list, 0), list = XEXP (list, 1);
1669 reg = list, list = 0;
1671 /* Set to non-zero if must move a word at a time, even if just one
1672 word (e.g, partial == 1 && mode == DFmode). Set to zero if
1673 we just use a normal move insn. */
1674 nregs = (partial ? partial
1675 : (TYPE_MODE (TREE_TYPE (args[i].tree_value)) == BLKmode
1676 ? ((int_size_in_bytes (TREE_TYPE (args[i].tree_value))
1677 + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD)
1680 /* If simple case, just do move. If normal partial, store_one_arg
1681 has already loaded the register for us. In all other cases,
1682 load the register(s) from memory. */
1685 emit_move_insn (reg, args[i].value);
1687 #ifdef STRICT_ALIGNMENT
1688 /* If we have pre-computed the values to put in the registers in
1689 the case of non-aligned structures, copy them in now. */
1691 else if (args[i].n_aligned_regs != 0)
1692 for (j = 0; j < args[i].n_aligned_regs; j++)
1693 emit_move_insn (gen_rtx (REG, word_mode, REGNO (reg) + j),
1694 args[i].aligned_regs[j]);
1697 else if (args[i].partial == 0 || args[i].pass_on_stack)
1698 move_block_to_reg (REGNO (reg),
1699 validize_mem (args[i].value), nregs,
1702 push_to_sequence (use_insns);
1704 emit_insn (gen_rtx (USE, VOIDmode, reg));
1706 use_regs (REGNO (reg), nregs);
1707 use_insns = get_insns ();
1710 /* PARTIAL referred only to the first register, so clear it for the
1716 /* Perform postincrements before actually calling the function. */
1719 /* All arguments and registers used for the call must be set up by now! */
1721 funexp = prepare_call_address (funexp, fndecl, &use_insns);
1723 /* Generate the actual call instruction. */
1724 emit_call_1 (funexp, funtype, args_size.constant, struct_value_size,
1725 FUNCTION_ARG (args_so_far, VOIDmode, void_type_node, 1),
1726 valreg, old_inhibit_defer_pop, use_insns, is_const);
1728 /* If call is cse'able, make appropriate pair of reg-notes around it.
1729 Test valreg so we don't crash; may safely ignore `const'
1730 if return type is void. */
1731 if (is_const && valreg != 0)
1734 rtx temp = gen_reg_rtx (GET_MODE (valreg));
1737 /* Construct an "equal form" for the value which mentions all the
1738 arguments in order as well as the function name. */
1739 #ifdef PUSH_ARGS_REVERSED
1740 for (i = 0; i < num_actuals; i++)
1741 note = gen_rtx (EXPR_LIST, VOIDmode, args[i].initial_value, note);
1743 for (i = num_actuals - 1; i >= 0; i--)
1744 note = gen_rtx (EXPR_LIST, VOIDmode, args[i].initial_value, note);
1746 note = gen_rtx (EXPR_LIST, VOIDmode, funexp, note);
1748 insns = get_insns ();
1751 emit_libcall_block (insns, temp, valreg, note);
1756 /* For calls to `setjmp', etc., inform flow.c it should complain
1757 if nonvolatile values are live. */
1761 emit_note (name, NOTE_INSN_SETJMP);
1762 current_function_calls_setjmp = 1;
1766 current_function_calls_longjmp = 1;
1768 /* Notice functions that cannot return.
1769 If optimizing, insns emitted below will be dead.
1770 If not optimizing, they will exist, which is useful
1771 if the user uses the `return' command in the debugger. */
1773 if (is_volatile || is_longjmp)
1776 /* If value type not void, return an rtx for the value. */
1778 /* If there are cleanups to be called, don't use a hard reg as target. */
1779 if (cleanups_this_call != old_cleanups
1780 && target && REG_P (target)
1781 && REGNO (target) < FIRST_PSEUDO_REGISTER)
1784 if (TYPE_MODE (TREE_TYPE (exp)) == VOIDmode
1787 target = const0_rtx;
1789 else if (structure_value_addr)
1791 if (target == 0 || GET_CODE (target) != MEM)
1793 target = gen_rtx (MEM, TYPE_MODE (TREE_TYPE (exp)),
1794 memory_address (TYPE_MODE (TREE_TYPE (exp)),
1795 structure_value_addr));
1796 MEM_IN_STRUCT_P (target)
1797 = (TREE_CODE (TREE_TYPE (exp)) == ARRAY_TYPE
1798 || TREE_CODE (TREE_TYPE (exp)) == RECORD_TYPE
1799 || TREE_CODE (TREE_TYPE (exp)) == UNION_TYPE);
1802 else if (pcc_struct_value)
1806 target = gen_rtx (MEM, TYPE_MODE (TREE_TYPE (exp)),
1807 copy_to_reg (valreg));
1808 MEM_IN_STRUCT_P (target)
1809 = (TREE_CODE (TREE_TYPE (exp)) == ARRAY_TYPE
1810 || TREE_CODE (TREE_TYPE (exp)) == RECORD_TYPE
1811 || TREE_CODE (TREE_TYPE (exp)) == UNION_TYPE);
1813 else if (TYPE_MODE (TREE_TYPE (exp)) != BLKmode)
1814 emit_move_insn (target, gen_rtx (MEM, TYPE_MODE (TREE_TYPE (exp)),
1815 copy_to_reg (valreg)));
1817 emit_block_move (target, gen_rtx (MEM, BLKmode, copy_to_reg (valreg)),
1819 TYPE_ALIGN (TREE_TYPE (exp)) / BITS_PER_UNIT);
1821 else if (target && GET_MODE (target) == TYPE_MODE (TREE_TYPE (exp))
1822 && GET_MODE (target) == GET_MODE (valreg))
1823 /* TARGET and VALREG cannot be equal at this point because the latter
1824 would not have REG_FUNCTION_VALUE_P true, while the former would if
1825 it were referring to the same register.
1827 If they refer to the same register, this move will be a no-op, except
1828 when function inlining is being done. */
1829 emit_move_insn (target, valreg);
1831 target = copy_to_reg (valreg);
1833 #ifdef PROMOTE_FUNCTION_RETURN
1834 /* If we promoted this return value, make the proper SUBREG. */
1835 if (GET_MODE (target) != TYPE_MODE (TREE_TYPE (exp)))
1837 enum machine_mode mode = GET_MODE (target);
1838 int unsignedp = TREE_UNSIGNED (TREE_TYPE (exp));
1840 if (TREE_CODE (TREE_TYPE (exp)) == INTEGER_TYPE
1841 || TREE_CODE (TREE_TYPE (exp)) == ENUMERAL_TYPE
1842 || TREE_CODE (TREE_TYPE (exp)) == BOOLEAN_TYPE
1843 || TREE_CODE (TREE_TYPE (exp)) == CHAR_TYPE
1844 || TREE_CODE (TREE_TYPE (exp)) == REAL_TYPE
1845 || TREE_CODE (TREE_TYPE (exp)) == POINTER_TYPE
1846 || TREE_CODE (TREE_TYPE (exp)) == OFFSET_TYPE)
1848 PROMOTE_MODE (mode, unsignedp, TREE_TYPE (exp));
1851 target = gen_rtx (SUBREG, TYPE_MODE (TREE_TYPE (exp)), target, 0);
1852 SUBREG_PROMOTED_VAR_P (target) = 1;
1853 SUBREG_PROMOTED_UNSIGNED_P (target) = unsignedp;
1857 /* Perform all cleanups needed for the arguments of this call
1858 (i.e. destructors in C++). */
1859 expand_cleanups_to (old_cleanups);
1861 /* If size of args is variable or this was a constructor call for a stack
1862 argument, restore saved stack-pointer value. */
1864 if (old_stack_level)
1866 emit_stack_restore (SAVE_BLOCK, old_stack_level, NULL_RTX);
1867 pending_stack_adjust = old_pending_adj;
1868 #ifdef ACCUMULATE_OUTGOING_ARGS
1869 stack_arg_under_construction = old_stack_arg_under_construction;
1870 highest_outgoing_arg_in_use = initial_highest_arg_in_use;
1871 stack_usage_map = initial_stack_usage_map;
1874 #ifdef ACCUMULATE_OUTGOING_ARGS
1877 #ifdef REG_PARM_STACK_SPACE
1880 enum machine_mode save_mode = GET_MODE (save_area);
1882 = gen_rtx (MEM, save_mode,
1883 memory_address (save_mode,
1884 #ifdef ARGS_GROW_DOWNWARD
1885 plus_constant (argblock, - high_to_save)
1887 plus_constant (argblock, low_to_save)
1891 if (save_mode != BLKmode)
1892 emit_move_insn (stack_area, save_area);
1894 emit_block_move (stack_area, validize_mem (save_area),
1895 GEN_INT (high_to_save - low_to_save + 1),
1896 PARM_BOUNDARY / BITS_PER_UNIT);
1900 /* If we saved any argument areas, restore them. */
1901 for (i = 0; i < num_actuals; i++)
1902 if (args[i].save_area)
1904 enum machine_mode save_mode = GET_MODE (args[i].save_area);
1906 = gen_rtx (MEM, save_mode,
1907 memory_address (save_mode,
1908 XEXP (args[i].stack_slot, 0)));
1910 if (save_mode != BLKmode)
1911 emit_move_insn (stack_area, args[i].save_area);
1913 emit_block_move (stack_area, validize_mem (args[i].save_area),
1914 GEN_INT (args[i].size.constant),
1915 PARM_BOUNDARY / BITS_PER_UNIT);
1918 highest_outgoing_arg_in_use = initial_highest_arg_in_use;
1919 stack_usage_map = initial_stack_usage_map;
1923 /* If this was alloca, record the new stack level for nonlocal gotos.
1924 Check for the handler slots since we might not have a save area
1925 for non-local gotos. */
1927 if (may_be_alloca && nonlocal_goto_handler_slot != 0)
1928 emit_stack_save (SAVE_NONLOCAL, &nonlocal_goto_stack_level, NULL_RTX);
1936 /* Return an rtx which represents a suitable home on the stack
1937 given TYPE, the type of the argument looking for a home.
1938 This is called only for BLKmode arguments.
1940 SIZE is the size needed for this target.
1941 ARGS_ADDR is the address of the bottom of the argument block for this call.
1942 OFFSET describes this parameter's offset into ARGS_ADDR. It is meaningless
1943 if this machine uses push insns. */
1946 target_for_arg (type, size, args_addr, offset)
1950 struct args_size offset;
1953 rtx offset_rtx = ARGS_SIZE_RTX (offset);
1955 /* We do not call memory_address if possible,
1956 because we want to address as close to the stack
1957 as possible. For non-variable sized arguments,
1958 this will be stack-pointer relative addressing. */
1959 if (GET_CODE (offset_rtx) == CONST_INT)
1960 target = plus_constant (args_addr, INTVAL (offset_rtx));
1963 /* I have no idea how to guarantee that this
1964 will work in the presence of register parameters. */
1965 target = gen_rtx (PLUS, Pmode, args_addr, offset_rtx);
1966 target = memory_address (QImode, target);
1969 return gen_rtx (MEM, BLKmode, target);
1973 /* Store a single argument for a function call
1974 into the register or memory area where it must be passed.
1975 *ARG describes the argument value and where to pass it.
1977 ARGBLOCK is the address of the stack-block for all the arguments,
1978 or 0 on a machine where arguments are pushed individually.
1980 MAY_BE_ALLOCA nonzero says this could be a call to `alloca'
1981 so must be careful about how the stack is used.
1983 VARIABLE_SIZE nonzero says that this was a variable-sized outgoing
1984 argument stack. This is used if ACCUMULATE_OUTGOING_ARGS to indicate
1985 that we need not worry about saving and restoring the stack.
1987 FNDECL is the declaration of the function we are calling. */
1990 store_one_arg (arg, argblock, may_be_alloca, variable_size, fndecl,
1991 reg_parm_stack_space)
1992 struct arg_data *arg;
1997 int reg_parm_stack_space;
1999 register tree pval = arg->tree_value;
2003 int i, lower_bound, upper_bound;
2005 if (TREE_CODE (pval) == ERROR_MARK)
2008 #ifdef ACCUMULATE_OUTGOING_ARGS
2009 /* If this is being stored into a pre-allocated, fixed-size, stack area,
2010 save any previous data at that location. */
2011 if (argblock && ! variable_size && arg->stack)
2013 #ifdef ARGS_GROW_DOWNWARD
2014 /* stack_slot is negative, but we want to index stack_usage_map */
2015 /* with positive values. */
2016 if (GET_CODE (XEXP (arg->stack_slot, 0)) == PLUS)
2017 upper_bound = -INTVAL (XEXP (XEXP (arg->stack_slot, 0), 1)) + 1;
2021 lower_bound = upper_bound - arg->size.constant;
2023 if (GET_CODE (XEXP (arg->stack_slot, 0)) == PLUS)
2024 lower_bound = INTVAL (XEXP (XEXP (arg->stack_slot, 0), 1));
2028 upper_bound = lower_bound + arg->size.constant;
2031 for (i = lower_bound; i < upper_bound; i++)
2032 if (stack_usage_map[i]
2033 #ifdef REG_PARM_STACK_SPACE
2034 /* Don't store things in the fixed argument area at this point;
2035 it has already been saved. */
2036 && i > reg_parm_stack_space
2041 if (i != upper_bound)
2043 /* We need to make a save area. See what mode we can make it. */
2044 enum machine_mode save_mode
2045 = mode_for_size (arg->size.constant * BITS_PER_UNIT, MODE_INT, 1);
2047 = gen_rtx (MEM, save_mode,
2048 memory_address (save_mode, XEXP (arg->stack_slot, 0)));
2050 if (save_mode == BLKmode)
2052 arg->save_area = assign_stack_temp (BLKmode,
2053 arg->size.constant, 1);
2054 emit_block_move (validize_mem (arg->save_area), stack_area,
2055 GEN_INT (arg->size.constant),
2056 PARM_BOUNDARY / BITS_PER_UNIT);
2060 arg->save_area = gen_reg_rtx (save_mode);
2061 emit_move_insn (arg->save_area, stack_area);
2067 /* If this isn't going to be placed on both the stack and in registers,
2068 set up the register and number of words. */
2069 if (! arg->pass_on_stack)
2070 reg = arg->reg, partial = arg->partial;
2072 if (reg != 0 && partial == 0)
2073 /* Being passed entirely in a register. We shouldn't be called in
2077 #ifdef STRICT_ALIGNMENT
2078 /* If this arg needs special alignment, don't load the registers
2080 if (arg->n_aligned_regs != 0)
2084 /* If this is being partially passed in a register, but multiple locations
2085 are specified, we assume that the one partially used is the one that is
2087 if (reg && GET_CODE (reg) == EXPR_LIST)
2088 reg = XEXP (reg, 0);
2090 /* If this is being passed partially in a register, we can't evaluate
2091 it directly into its stack slot. Otherwise, we can. */
2092 if (arg->value == 0)
2094 #ifdef ACCUMULATE_OUTGOING_ARGS
2095 /* stack_arg_under_construction is nonzero if a function argument is
2096 being evaluated directly into the outgoing argument list and
2097 expand_call must take special action to preserve the argument list
2098 if it is called recursively.
2100 For scalar function arguments stack_usage_map is sufficient to
2101 determine which stack slots must be saved and restored. Scalar
2102 arguments in general have pass_on_stack == 0.
2104 If this argument is initialized by a function which takes the
2105 address of the argument (a C++ constructor or a C function
2106 returning a BLKmode structure), then stack_usage_map is
2107 insufficient and expand_call must push the stack around the
2108 function call. Such arguments have pass_on_stack == 1.
2110 Note that it is always safe to set stack_arg_under_construction,
2111 but this generates suboptimal code if set when not needed. */
2113 if (arg->pass_on_stack)
2114 stack_arg_under_construction++;
2116 arg->value = expand_expr (pval, partial ? NULL_RTX : arg->stack,
2119 /* If we are promoting object (or for any other reason) the mode
2120 doesn't agree, convert the mode. */
2122 if (GET_MODE (arg->value) != VOIDmode
2123 && GET_MODE (arg->value) != arg->mode)
2124 arg->value = convert_to_mode (arg->mode, arg->value, arg->unsignedp);
2126 #ifdef ACCUMULATE_OUTGOING_ARGS
2127 if (arg->pass_on_stack)
2128 stack_arg_under_construction--;
2132 /* Don't allow anything left on stack from computation
2133 of argument to alloca. */
2135 do_pending_stack_adjust ();
2137 if (arg->value == arg->stack)
2138 /* If the value is already in the stack slot, we are done. */
2140 else if (arg->mode != BLKmode)
2144 /* Argument is a scalar, not entirely passed in registers.
2145 (If part is passed in registers, arg->partial says how much
2146 and emit_push_insn will take care of putting it there.)
2148 Push it, and if its size is less than the
2149 amount of space allocated to it,
2150 also bump stack pointer by the additional space.
2151 Note that in C the default argument promotions
2152 will prevent such mismatches. */
2154 size = GET_MODE_SIZE (arg->mode);
2155 /* Compute how much space the push instruction will push.
2156 On many machines, pushing a byte will advance the stack
2157 pointer by a halfword. */
2158 #ifdef PUSH_ROUNDING
2159 size = PUSH_ROUNDING (size);
2163 /* Compute how much space the argument should get:
2164 round up to a multiple of the alignment for arguments. */
2165 if (none != FUNCTION_ARG_PADDING (arg->mode, TREE_TYPE (pval)))
2166 used = (((size + PARM_BOUNDARY / BITS_PER_UNIT - 1)
2167 / (PARM_BOUNDARY / BITS_PER_UNIT))
2168 * (PARM_BOUNDARY / BITS_PER_UNIT));
2170 /* This isn't already where we want it on the stack, so put it there.
2171 This can either be done with push or copy insns. */
2172 emit_push_insn (arg->value, arg->mode, TREE_TYPE (pval), 0, 0, partial,
2173 reg, used - size, argblock, ARGS_SIZE_RTX (arg->offset));
2177 /* BLKmode, at least partly to be pushed. */
2179 register int excess;
2182 /* Pushing a nonscalar.
2183 If part is passed in registers, PARTIAL says how much
2184 and emit_push_insn will take care of putting it there. */
2186 /* Round its size up to a multiple
2187 of the allocation unit for arguments. */
2189 if (arg->size.var != 0)
2192 size_rtx = ARGS_SIZE_RTX (arg->size);
2196 register tree size = size_in_bytes (TREE_TYPE (pval));
2197 /* PUSH_ROUNDING has no effect on us, because
2198 emit_push_insn for BLKmode is careful to avoid it. */
2199 excess = (arg->size.constant - TREE_INT_CST_LOW (size)
2200 + partial * UNITS_PER_WORD);
2201 size_rtx = expand_expr (size, NULL_RTX, VOIDmode, 0);
2204 emit_push_insn (arg->value, arg->mode, TREE_TYPE (pval), size_rtx,
2205 TYPE_ALIGN (TREE_TYPE (pval)) / BITS_PER_UNIT, partial,
2206 reg, excess, argblock, ARGS_SIZE_RTX (arg->offset));
2210 /* Unless this is a partially-in-register argument, the argument is now
2213 ??? Note that this can change arg->value from arg->stack to
2214 arg->stack_slot and it matters when they are not the same.
2215 It isn't totally clear that this is correct in all cases. */
2217 arg->value = arg->stack_slot;
2219 /* Once we have pushed something, pops can't safely
2220 be deferred during the rest of the arguments. */
2223 /* ANSI doesn't require a sequence point here,
2224 but PCC has one, so this will avoid some problems. */
2227 /* Free any temporary slots made in processing this argument. */
2230 #ifdef ACCUMULATE_OUTGOING_ARGS
2231 /* Now mark the segment we just used. */
2232 if (argblock && ! variable_size && arg->stack)
2233 for (i = lower_bound; i < upper_bound; i++)
2234 stack_usage_map[i] = 1;