Annotation of gcc/calls.c, revision 1.1.1.4

1.1       root        1: /* Convert function calls to rtl insns, for GNU C compiler.
                      2:    Copyright (C) 1989, 1992 Free Software Foundation, Inc.
                      3: 
                      4: This file is part of GNU CC.
                      5: 
                      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)
                      9: any later version.
                     10: 
                     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.
                     15: 
                     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.  */
                     19: 
                     20: #include "config.h"
                     21: #include "rtl.h"
                     22: #include "tree.h"
                     23: #include "flags.h"
                     24: #include "expr.h"
                     25: #include "insn-flags.h"
                     26: 
                     27: /* Decide whether a function's arguments should be processed
                     28:    from first to last or from last to first.  */
                     29: 
                     30: #ifdef STACK_GROWS_DOWNWARD
                     31: #ifdef PUSH_ROUNDING
                     32: #define PUSH_ARGS_REVERSED     /* If it's last to first */
                     33: #endif
                     34: #endif
                     35: 
                     36: /* Like STACK_BOUNDARY but in units of bytes, not bits.  */
                     37: #define STACK_BYTES (STACK_BOUNDARY / BITS_PER_UNIT)
                     38: 
                     39: /* Data structure and subroutines used within expand_call.  */
                     40: 
                     41: struct arg_data
                     42: {
                     43:   /* Tree node for this argument.  */
                     44:   tree tree_value;
                     45:   /* Current RTL value for argument, or 0 if it isn't precomputed.  */
                     46:   rtx value;
                     47:   /* Initially-compute RTL value for argument; only for const functions.  */
                     48:   rtx initial_value;
                     49:   /* Register to pass this argument in, 0 if passed on stack, or an
                     50:      EXPR_LIST if the arg is to be copied into multiple different
                     51:      registers.  */
                     52:   rtx reg;
1.1.1.4 ! root       53:   /* If REG was promoted from the actual mode of the argument expression,
        !            54:      indicates whether the promotion is sign- or zero-extended.  */
        !            55:   int unsignedp;
1.1       root       56:   /* Number of registers to use.  0 means put the whole arg in registers.
                     57:      Also 0 if not passed in registers.  */
                     58:   int partial;
1.1.1.3   root       59:   /* Non-zero if argument must be passed on stack.
                     60:      Note that some arguments may be passed on the stack
                     61:      even though pass_on_stack is zero, just because FUNCTION_ARG says so.
                     62:      pass_on_stack identifies arguments that *cannot* go in registers.  */
1.1       root       63:   int pass_on_stack;
                     64:   /* Offset of this argument from beginning of stack-args.  */
                     65:   struct args_size offset;
                     66:   /* Similar, but offset to the start of the stack slot.  Different from
                     67:      OFFSET if this arg pads downward.  */
                     68:   struct args_size slot_offset;
                     69:   /* Size of this argument on the stack, rounded up for any padding it gets,
                     70:      parts of the argument passed in registers do not count.
                     71:      If REG_PARM_STACK_SPACE is defined, then register parms
                     72:      are counted here as well.  */
                     73:   struct args_size size;
                     74:   /* Location on the stack at which parameter should be stored.  The store
                     75:      has already been done if STACK == VALUE.  */
                     76:   rtx stack;
                     77:   /* Location on the stack of the start of this argument slot.  This can
                     78:      differ from STACK if this arg pads downward.  This location is known
                     79:      to be aligned to FUNCTION_ARG_BOUNDARY.  */
                     80:   rtx stack_slot;
                     81: #ifdef ACCUMULATE_OUTGOING_ARGS
                     82:   /* Place that this stack area has been saved, if needed.  */
                     83:   rtx save_area;
                     84: #endif
                     85: };
                     86: 
                     87: #ifdef ACCUMULATE_OUTGOING_ARGS
1.1.1.4 ! root       88: /* A vector of one char per byte of stack space.  A byte if non-zero if
1.1       root       89:    the corresponding stack location has been used.
                     90:    This vector is used to prevent a function call within an argument from
                     91:    clobbering any stack already set up.  */
                     92: static char *stack_usage_map;
                     93: 
                     94: /* Size of STACK_USAGE_MAP.  */
                     95: static int highest_outgoing_arg_in_use;
1.1.1.3   root       96: 
                     97: /* stack_arg_under_construction is nonzero when an argument may be
                     98:    initialized with a constructor call (including a C function that
                     99:    returns a BLKmode struct) and expand_call must take special action
                    100:    to make sure the object being constructed does not overlap the
                    101:    argument list for the constructor call.  */
                    102: int stack_arg_under_construction;
1.1       root      103: #endif
                    104: 
                    105: static void store_one_arg ();
                    106: extern enum machine_mode mode_for_size ();
                    107: 
                    108: /* Return 1 if EXP contains a call to the built-in function `alloca'.  */
                    109: 
                    110: static int
                    111: calls_alloca (exp)
                    112:      tree exp;
                    113: {
                    114:   register int i;
                    115:   int type = TREE_CODE_CLASS (TREE_CODE (exp));
                    116:   int length = tree_code_length[(int) TREE_CODE (exp)];
                    117: 
                    118:   /* Only expressions and references can contain calls.  */
                    119: 
1.1.1.4 ! root      120:   if (type != 'e' && type != '<' && type != '1' && type != '2' && type != 'r'
        !           121:       && type != 'b')
1.1       root      122:     return 0;
                    123: 
                    124:   switch (TREE_CODE (exp))
                    125:     {
                    126:     case CALL_EXPR:
                    127:       if (TREE_CODE (TREE_OPERAND (exp, 0)) == ADDR_EXPR
                    128:          && (TREE_CODE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0))
                    129:              == FUNCTION_DECL)
                    130:          && DECL_BUILT_IN (TREE_OPERAND (TREE_OPERAND (exp, 0), 0))
                    131:          && (DECL_FUNCTION_CODE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0))
                    132:              == BUILT_IN_ALLOCA))
                    133:        return 1;
                    134: 
                    135:       /* Third operand is RTL.  */
                    136:       length = 2;
                    137:       break;
                    138: 
                    139:     case SAVE_EXPR:
                    140:       if (SAVE_EXPR_RTL (exp) != 0)
                    141:        return 0;
                    142:       break;
                    143: 
                    144:     case BLOCK:
1.1.1.4 ! root      145:       {
        !           146:        register tree local;
        !           147: 
        !           148:        for (local = BLOCK_VARS (exp); local; local = TREE_CHAIN (local))
        !           149:          if (DECL_INITIAL (local) != 0 && calls_alloca (DECL_INITIAL (local)))
        !           150:            return 1;
        !           151:       }
        !           152:       {
        !           153:        register tree subblock;
        !           154: 
        !           155:        for (subblock = BLOCK_SUBBLOCKS (exp);
        !           156:             subblock;
        !           157:             subblock = TREE_CHAIN (subblock))
        !           158:          if (calls_alloca (subblock))
        !           159:            return 1;
        !           160:       }
        !           161:       return 0;
1.1       root      162: 
                    163:     case METHOD_CALL_EXPR:
                    164:       length = 3;
                    165:       break;
                    166: 
                    167:     case WITH_CLEANUP_EXPR:
                    168:       length = 1;
                    169:       break;
                    170: 
                    171:     case RTL_EXPR:
                    172:       return 0;
                    173:     }
                    174: 
                    175:   for (i = 0; i < length; i++)
                    176:     if (TREE_OPERAND (exp, i) != 0
                    177:        && calls_alloca (TREE_OPERAND (exp, i)))
                    178:       return 1;
                    179: 
                    180:   return 0;
                    181: }
                    182: 
                    183: /* Force FUNEXP into a form suitable for the address of a CALL,
                    184:    and return that as an rtx.  Also load the static chain register
                    185:    if FNDECL is a nested function.
                    186: 
                    187:    USE_INSNS points to a variable holding a chain of USE insns
                    188:    to which a USE of the static chain
                    189:    register should be added, if required.  */
                    190: 
                    191: rtx
                    192: prepare_call_address (funexp, fndecl, use_insns)
                    193:      rtx funexp;
                    194:      tree fndecl;
                    195:      rtx *use_insns;
                    196: {
                    197:   rtx static_chain_value = 0;
                    198: 
                    199:   funexp = protect_from_queue (funexp, 0);
                    200: 
                    201:   if (fndecl != 0)
                    202:     /* Get possible static chain value for nested function in C. */
                    203:     static_chain_value = lookup_static_chain (fndecl);
                    204: 
                    205:   /* Make a valid memory address and copy constants thru pseudo-regs,
                    206:      but not for a constant address if -fno-function-cse.  */
                    207:   if (GET_CODE (funexp) != SYMBOL_REF)
                    208:     funexp = memory_address (FUNCTION_MODE, funexp);
                    209:   else
                    210:     {
                    211: #ifndef NO_FUNCTION_CSE
                    212:       if (optimize && ! flag_no_function_cse)
                    213: #ifdef NO_RECURSIVE_FUNCTION_CSE
                    214:        if (fndecl != current_function_decl)
                    215: #endif
                    216:          funexp = force_reg (Pmode, funexp);
                    217: #endif
                    218:     }
                    219: 
                    220:   if (static_chain_value != 0)
                    221:     {
                    222:       emit_move_insn (static_chain_rtx, static_chain_value);
                    223: 
                    224:       /* Put the USE insn in the chain we were passed.  It will later be
                    225:         output immediately in front of the CALL insn.  */
                    226:       push_to_sequence (*use_insns);
                    227:       emit_insn (gen_rtx (USE, VOIDmode, static_chain_rtx));
                    228:       *use_insns = get_insns ();
                    229:       end_sequence ();
                    230:     }
                    231: 
                    232:   return funexp;
                    233: }
                    234: 
                    235: /* Generate instructions to call function FUNEXP,
                    236:    and optionally pop the results.
                    237:    The CALL_INSN is the first insn generated.
                    238: 
                    239:    FUNTYPE is the data type of the function, or, for a library call,
                    240:    the identifier for the name of the call.  This is given to the
                    241:    macro RETURN_POPS_ARGS to determine whether this function pops its own args.
                    242: 
                    243:    STACK_SIZE is the number of bytes of arguments on the stack,
                    244:    rounded up to STACK_BOUNDARY; zero if the size is variable.
                    245:    This is both to put into the call insn and
                    246:    to generate explicit popping code if necessary.
                    247: 
                    248:    STRUCT_VALUE_SIZE is the number of bytes wanted in a structure value.
                    249:    It is zero if this call doesn't want a structure value.
                    250: 
                    251:    NEXT_ARG_REG is the rtx that results from executing
                    252:      FUNCTION_ARG (args_so_far, VOIDmode, void_type_node, 1)
                    253:    just after all the args have had their registers assigned.
                    254:    This could be whatever you like, but normally it is the first
                    255:    arg-register beyond those used for args in this call,
                    256:    or 0 if all the arg-registers are used in this call.
                    257:    It is passed on to `gen_call' so you can put this info in the call insn.
                    258: 
                    259:    VALREG is a hard register in which a value is returned,
                    260:    or 0 if the call does not return a value.
                    261: 
                    262:    OLD_INHIBIT_DEFER_POP is the value that `inhibit_defer_pop' had before
                    263:    the args to this call were processed.
                    264:    We restore `inhibit_defer_pop' to that value.
                    265: 
                    266:    USE_INSNS is a chain of USE insns to be emitted immediately before
                    267:    the actual CALL insn.
                    268: 
                    269:    IS_CONST is true if this is a `const' call.  */
                    270: 
                    271: void
                    272: emit_call_1 (funexp, funtype, stack_size, struct_value_size, next_arg_reg,
                    273:             valreg, old_inhibit_defer_pop, use_insns, is_const)
                    274:      rtx funexp;
                    275:      tree funtype;
                    276:      int stack_size;
                    277:      int struct_value_size;
                    278:      rtx next_arg_reg;
                    279:      rtx valreg;
                    280:      int old_inhibit_defer_pop;
                    281:      rtx use_insns;
                    282:      int is_const;
                    283: {
1.1.1.4 ! root      284:   rtx stack_size_rtx = GEN_INT (stack_size);
        !           285:   rtx struct_value_size_rtx = GEN_INT (struct_value_size);
1.1       root      286:   rtx call_insn;
                    287:   int already_popped = 0;
                    288: 
                    289:   /* Ensure address is valid.  SYMBOL_REF is already valid, so no need,
                    290:      and we don't want to load it into a register as an optimization,
                    291:      because prepare_call_address already did it if it should be done.  */
                    292:   if (GET_CODE (funexp) != SYMBOL_REF)
                    293:     funexp = memory_address (FUNCTION_MODE, funexp);
                    294: 
                    295: #ifndef ACCUMULATE_OUTGOING_ARGS
                    296: #if defined (HAVE_call_pop) && defined (HAVE_call_value_pop)
                    297:   if (HAVE_call_pop && HAVE_call_value_pop
                    298:       && (RETURN_POPS_ARGS (funtype, stack_size) > 0 || stack_size == 0))
                    299:     {
1.1.1.4 ! root      300:       rtx n_pop = GEN_INT (RETURN_POPS_ARGS (funtype, stack_size));
1.1       root      301:       rtx pat;
                    302: 
                    303:       /* If this subroutine pops its own args, record that in the call insn
                    304:         if possible, for the sake of frame pointer elimination.  */
                    305:       if (valreg)
                    306:        pat = gen_call_value_pop (valreg,
                    307:                                  gen_rtx (MEM, FUNCTION_MODE, funexp),
                    308:                                  stack_size_rtx, next_arg_reg, n_pop);
                    309:       else
                    310:        pat = gen_call_pop (gen_rtx (MEM, FUNCTION_MODE, funexp),
                    311:                            stack_size_rtx, next_arg_reg, n_pop);
                    312: 
                    313:       emit_call_insn (pat);
                    314:       already_popped = 1;
                    315:     }
                    316:   else
                    317: #endif
                    318: #endif
                    319: 
                    320: #if defined (HAVE_call) && defined (HAVE_call_value)
                    321:   if (HAVE_call && HAVE_call_value)
                    322:     {
                    323:       if (valreg)
                    324:        emit_call_insn (gen_call_value (valreg,
                    325:                                        gen_rtx (MEM, FUNCTION_MODE, funexp),
                    326:                                        stack_size_rtx, next_arg_reg));
                    327:       else
                    328:        emit_call_insn (gen_call (gen_rtx (MEM, FUNCTION_MODE, funexp),
                    329:                                  stack_size_rtx, next_arg_reg,
                    330:                                  struct_value_size_rtx));
                    331:     }
                    332:   else
                    333: #endif
                    334:     abort ();
                    335: 
                    336:   /* Find the CALL insn we just emitted and write the USE insns before it.  */
                    337:   for (call_insn = get_last_insn ();
                    338:        call_insn && GET_CODE (call_insn) != CALL_INSN;
                    339:        call_insn = PREV_INSN (call_insn))
                    340:     ;
                    341: 
                    342:   if (! call_insn)
                    343:     abort ();
                    344: 
                    345:   /* Put the USE insns before the CALL.  */
                    346:   emit_insns_before (use_insns, call_insn);
                    347: 
                    348:   /* If this is a const call, then set the insn's unchanging bit.  */
                    349:   if (is_const)
                    350:     CONST_CALL_P (call_insn) = 1;
                    351: 
                    352: #ifndef ACCUMULATE_OUTGOING_ARGS
                    353:   /* If returning from the subroutine does not automatically pop the args,
                    354:      we need an instruction to pop them sooner or later.
                    355:      Perhaps do it now; perhaps just record how much space to pop later.
                    356: 
                    357:      If returning from the subroutine does pop the args, indicate that the
                    358:      stack pointer will be changed.  */
                    359: 
                    360:   if (stack_size != 0 && RETURN_POPS_ARGS (funtype, stack_size) > 0)
                    361:     {
                    362:       if (!already_popped)
                    363:        emit_insn (gen_rtx (CLOBBER, VOIDmode, stack_pointer_rtx));
                    364:       stack_size -= RETURN_POPS_ARGS (funtype, stack_size);
1.1.1.4 ! root      365:       stack_size_rtx = GEN_INT (stack_size);
1.1       root      366:     }
                    367: 
                    368:   if (stack_size != 0)
                    369:     {
                    370:       if (flag_defer_pop && inhibit_defer_pop == 0)
                    371:        pending_stack_adjust += stack_size;
                    372:       else
                    373:        adjust_stack (stack_size_rtx);
                    374:     }
                    375: #endif
1.1.1.3   root      376: 
                    377:   inhibit_defer_pop = old_inhibit_defer_pop;
1.1       root      378: }
                    379: 
                    380: /* Generate all the code for a function call
                    381:    and return an rtx for its value.
                    382:    Store the value in TARGET (specified as an rtx) if convenient.
                    383:    If the value is stored in TARGET then TARGET is returned.
                    384:    If IGNORE is nonzero, then we ignore the value of the function call.  */
                    385: 
                    386: rtx
1.1.1.3   root      387: expand_call (exp, target, ignore)
1.1       root      388:      tree exp;
                    389:      rtx target;
                    390:      int ignore;
                    391: {
                    392:   /* List of actual parameters.  */
                    393:   tree actparms = TREE_OPERAND (exp, 1);
                    394:   /* RTX for the function to be called.  */
                    395:   rtx funexp;
                    396:   /* Tree node for the function to be called (not the address!).  */
                    397:   tree funtree;
                    398:   /* Data type of the function.  */
                    399:   tree funtype;
                    400:   /* Declaration of the function being called,
                    401:      or 0 if the function is computed (not known by name).  */
                    402:   tree fndecl = 0;
                    403:   char *name = 0;
                    404: 
                    405:   /* Register in which non-BLKmode value will be returned,
                    406:      or 0 if no value or if value is BLKmode.  */
                    407:   rtx valreg;
                    408:   /* Address where we should return a BLKmode value;
                    409:      0 if value not BLKmode.  */
                    410:   rtx structure_value_addr = 0;
                    411:   /* Nonzero if that address is being passed by treating it as
                    412:      an extra, implicit first parameter.  Otherwise,
                    413:      it is passed by being copied directly into struct_value_rtx.  */
                    414:   int structure_value_addr_parm = 0;
                    415:   /* Size of aggregate value wanted, or zero if none wanted
                    416:      or if we are using the non-reentrant PCC calling convention
                    417:      or expecting the value in registers.  */
                    418:   int struct_value_size = 0;
                    419:   /* Nonzero if called function returns an aggregate in memory PCC style,
                    420:      by returning the address of where to find it.  */
                    421:   int pcc_struct_value = 0;
                    422: 
                    423:   /* Number of actual parameters in this call, including struct value addr.  */
                    424:   int num_actuals;
                    425:   /* Number of named args.  Args after this are anonymous ones
                    426:      and they must all go on the stack.  */
                    427:   int n_named_args;
                    428:   /* Count arg position in order args appear.  */
                    429:   int argpos;
                    430: 
                    431:   /* Vector of information about each argument.
                    432:      Arguments are numbered in the order they will be pushed,
                    433:      not the order they are written.  */
                    434:   struct arg_data *args;
                    435: 
                    436:   /* Total size in bytes of all the stack-parms scanned so far.  */
                    437:   struct args_size args_size;
                    438:   /* Size of arguments before any adjustments (such as rounding).  */
                    439:   struct args_size original_args_size;
                    440:   /* Data on reg parms scanned so far.  */
                    441:   CUMULATIVE_ARGS args_so_far;
                    442:   /* Nonzero if a reg parm has been scanned.  */
                    443:   int reg_parm_seen;
                    444: 
                    445:   /* Nonzero if we must avoid push-insns in the args for this call. 
                    446:      If stack space is allocated for register parameters, but not by the
                    447:      caller, then it is preallocated in the fixed part of the stack frame.
                    448:      So the entire argument block must then be preallocated (i.e., we
                    449:      ignore PUSH_ROUNDING in that case).  */
                    450: 
                    451: #if defined(REG_PARM_STACK_SPACE) && ! defined(OUTGOING_REG_PARM_STACK_SPACE)
                    452:   int must_preallocate = 1;
                    453: #else
                    454: #ifdef PUSH_ROUNDING
                    455:   int must_preallocate = 0;
                    456: #else
                    457:   int must_preallocate = 1;
                    458: #endif
                    459: #endif
                    460: 
1.1.1.4 ! root      461:   /* Size of the stack reserved for parameter registers.  */
1.1.1.3   root      462:   int reg_parm_stack_space = 0;
                    463: 
1.1       root      464:   /* 1 if scanning parms front to back, -1 if scanning back to front.  */
                    465:   int inc;
                    466:   /* Address of space preallocated for stack parms
                    467:      (on machines that lack push insns), or 0 if space not preallocated.  */
                    468:   rtx argblock = 0;
                    469: 
                    470:   /* Nonzero if it is plausible that this is a call to alloca.  */
                    471:   int may_be_alloca;
                    472:   /* Nonzero if this is a call to setjmp or a related function.  */
                    473:   int returns_twice;
                    474:   /* Nonzero if this is a call to `longjmp'.  */
                    475:   int is_longjmp;
                    476:   /* Nonzero if this is a call to an inline function.  */
                    477:   int is_integrable = 0;
                    478:   /* Nonzero if this is a call to a `const' function.
                    479:      Note that only explicitly named functions are handled as `const' here.  */
                    480:   int is_const = 0;
                    481:   /* Nonzero if this is a call to a `volatile' function.  */
                    482:   int is_volatile = 0;
                    483: #if defined(ACCUMULATE_OUTGOING_ARGS) && defined(REG_PARM_STACK_SPACE)
                    484:   /* Define the boundary of the register parm stack space that needs to be
                    485:      save, if any.  */
                    486:   int low_to_save = -1, high_to_save;
                    487:   rtx save_area = 0;           /* Place that it is saved */
                    488: #endif
                    489: 
                    490: #ifdef ACCUMULATE_OUTGOING_ARGS
                    491:   int initial_highest_arg_in_use = highest_outgoing_arg_in_use;
                    492:   char *initial_stack_usage_map = stack_usage_map;
                    493: #endif
                    494: 
                    495:   rtx old_stack_level = 0;
                    496:   int old_pending_adj;
1.1.1.3   root      497:   int old_stack_arg_under_construction;
1.1       root      498:   int old_inhibit_defer_pop = inhibit_defer_pop;
                    499:   tree old_cleanups = cleanups_this_call;
                    500: 
                    501:   rtx use_insns = 0;
                    502: 
                    503:   register tree p;
                    504:   register int i;
                    505: 
                    506:   /* See if we can find a DECL-node for the actual function.
                    507:      As a result, decide whether this is a call to an integrable function.  */
                    508: 
                    509:   p = TREE_OPERAND (exp, 0);
                    510:   if (TREE_CODE (p) == ADDR_EXPR)
                    511:     {
                    512:       fndecl = TREE_OPERAND (p, 0);
                    513:       if (TREE_CODE (fndecl) != FUNCTION_DECL)
                    514:        {
                    515:          /* May still be a `const' function if it is
                    516:             a call through a pointer-to-const.
                    517:             But we don't handle that.  */
                    518:          fndecl = 0;
                    519:        }
                    520:       else
                    521:        {
                    522:          if (!flag_no_inline
                    523:              && fndecl != current_function_decl
                    524:              && DECL_SAVED_INSNS (fndecl))
                    525:            is_integrable = 1;
                    526:          else if (! TREE_ADDRESSABLE (fndecl))
                    527:            {
                    528:              /* In case this function later becomes inlineable,
                    529:                 record that there was already a non-inline call to it.
                    530: 
                    531:                 Use abstraction instead of setting TREE_ADDRESSABLE
                    532:                 directly.  */
1.1.1.4 ! root      533:              if (DECL_INLINE (fndecl) && extra_warnings && !flag_no_inline)
1.1       root      534:                warning_with_decl (fndecl, "can't inline call to `%s' which was declared inline");
                    535:              mark_addressable (fndecl);
                    536:            }
                    537: 
                    538:          if (TREE_READONLY (fndecl) && ! TREE_THIS_VOLATILE (fndecl)
                    539:              && TYPE_MODE (TREE_TYPE (exp)) != VOIDmode)
                    540:            is_const = 1;
                    541:        }
                    542:     }
                    543: 
                    544:   is_volatile = TYPE_VOLATILE (TREE_TYPE (TREE_TYPE (p)));
                    545: 
1.1.1.3   root      546: #ifdef REG_PARM_STACK_SPACE
                    547: #ifdef MAYBE_REG_PARM_STACK_SPACE
                    548:   reg_parm_stack_space = MAYBE_REG_PARM_STACK_SPACE;
                    549: #else
                    550:   reg_parm_stack_space = REG_PARM_STACK_SPACE (fndecl);
                    551: #endif
                    552: #endif
                    553: 
1.1       root      554:   /* Warn if this value is an aggregate type,
                    555:      regardless of which calling convention we are using for it.  */
                    556:   if (warn_aggregate_return
                    557:       && (TREE_CODE (TREE_TYPE (exp)) == RECORD_TYPE
                    558:          || TREE_CODE (TREE_TYPE (exp)) == UNION_TYPE
                    559:          || TREE_CODE (TREE_TYPE (exp)) == ARRAY_TYPE))
                    560:     warning ("function call has aggregate value");
                    561: 
                    562:   /* Set up a place to return a structure.  */
                    563: 
                    564:   /* Cater to broken compilers.  */
                    565:   if (aggregate_value_p (exp))
                    566:     {
                    567:       /* This call returns a big structure.  */
                    568:       is_const = 0;
                    569: 
                    570: #ifdef PCC_STATIC_STRUCT_RETURN
                    571:       if (flag_pcc_struct_return)
                    572:        {
                    573:          pcc_struct_value = 1;
                    574:          is_integrable = 0;  /* Easier than making that case work right.  */
                    575:        }
                    576:       else
                    577: #endif
                    578:        {
                    579:          struct_value_size = int_size_in_bytes (TREE_TYPE (exp));
                    580: 
                    581:          if (struct_value_size < 0)
                    582:            abort ();
                    583: 
                    584:          if (target && GET_CODE (target) == MEM)
                    585:            structure_value_addr = XEXP (target, 0);
                    586:          else
                    587:            {
                    588:              /* Assign a temporary on the stack to hold the value.  */
                    589: 
                    590:              /* For variable-sized objects, we must be called with a target
                    591:                 specified.  If we were to allocate space on the stack here,
                    592:                 we would have no way of knowing when to free it.  */
                    593: 
                    594:              structure_value_addr
                    595:                = XEXP (assign_stack_temp (BLKmode, struct_value_size, 1), 0);
                    596:              target = 0;
                    597:            }
                    598:        }
                    599:     }
                    600: 
                    601:   /* If called function is inline, try to integrate it.  */
                    602: 
                    603:   if (is_integrable)
                    604:     {
                    605:       rtx temp;
1.1.1.3   root      606:       rtx before_call = get_last_insn ();
1.1       root      607: 
                    608:       temp = expand_inline_function (fndecl, actparms, target,
                    609:                                     ignore, TREE_TYPE (exp),
                    610:                                     structure_value_addr);
                    611: 
                    612:       /* If inlining succeeded, return.  */
1.1.1.4 ! root      613:       if ((HOST_WIDE_INT) temp != -1)
1.1       root      614:        {
1.1.1.3   root      615:          int i;
                    616: 
1.1       root      617:          /* Perform all cleanups needed for the arguments of this call
                    618:             (i.e. destructors in C++).  It is ok if these destructors
                    619:             clobber RETURN_VALUE_REG, because the only time we care about
                    620:             this is when TARGET is that register.  But in C++, we take
                    621:             care to never return that register directly.  */
                    622:          expand_cleanups_to (old_cleanups);
                    623: 
1.1.1.3   root      624: #ifdef ACCUMULATE_OUTGOING_ARGS
                    625:          /* If the outgoing argument list must be preserved, push
                    626:             the stack before executing the inlined function if it
                    627:             makes any calls.  */
                    628: 
                    629:          for (i = reg_parm_stack_space - 1; i >= 0; i--)
                    630:            if (i < highest_outgoing_arg_in_use && stack_usage_map[i] != 0)
                    631:              break;
                    632: 
                    633:          if (stack_arg_under_construction || i >= 0)
                    634:            {
                    635:              rtx insn = NEXT_INSN (before_call), seq;
                    636: 
                    637:              /* Look for a call in the inline function code.
                    638:                 If OUTGOING_ARGS_SIZE (DECL_SAVED_INSNS (fndecl)) is
                    639:                 nonzero then there is a call and it is not necessary
                    640:                 to scan the insns.  */
                    641: 
                    642:              if (OUTGOING_ARGS_SIZE (DECL_SAVED_INSNS (fndecl)) == 0)
                    643:                for (; insn; insn = NEXT_INSN (insn))
                    644:                  if (GET_CODE (insn) == CALL_INSN)
                    645:                    break;
                    646: 
                    647:              if (insn)
                    648:                {
                    649:                  /* Reserve enough stack space so that the largest
                    650:                     argument list of any function call in the inline
                    651:                     function does not overlap the argument list being
                    652:                     evaluated.  This is usually an overestimate because
                    653:                     allocate_dynamic_stack_space reserves space for an
                    654:                     outgoing argument list in addition to the requested
                    655:                     space, but there is no way to ask for stack space such
                    656:                     that an argument list of a certain length can be
                    657:                     safely constructed.  */
                    658: 
                    659:                  int adjust = OUTGOING_ARGS_SIZE (DECL_SAVED_INSNS (fndecl));
                    660: #ifdef REG_PARM_STACK_SPACE
                    661:                  /* Add the stack space reserved for register arguments
                    662:                     in the inline function.  What is really needed is the
                    663:                     largest value of reg_parm_stack_space in the inline
                    664:                     function, but that is not available.  Using the current
                    665:                     value of reg_parm_stack_space is wrong, but gives
                    666:                     correct results on all supported machines.  */
                    667:                  adjust += reg_parm_stack_space;
                    668: #endif
                    669:                  start_sequence ();
                    670:                  emit_stack_save (SAVE_BLOCK, &old_stack_level, 0);
1.1.1.4 ! root      671:                  allocate_dynamic_stack_space (GEN_INT (adjust),
        !           672:                                                NULL_RTX, BITS_PER_UNIT);
1.1.1.3   root      673:                  seq = get_insns ();
                    674:                  end_sequence ();
                    675:                  emit_insns_before (seq, NEXT_INSN (before_call));
1.1.1.4 ! root      676:                  emit_stack_restore (SAVE_BLOCK, old_stack_level, NULL_RTX);
1.1.1.3   root      677:                }
                    678:            }
                    679: #endif
                    680: 
1.1       root      681:          /* If the result is equivalent to TARGET, return TARGET to simplify
                    682:             checks in store_expr.  They can be equivalent but not equal in the
                    683:             case of a function that returns BLKmode.  */
                    684:          if (temp != target && rtx_equal_p (temp, target))
                    685:            return target;
                    686:          return temp;
                    687:        }
                    688: 
                    689:       /* If inlining failed, mark FNDECL as needing to be compiled
                    690:         separately after all.  */
                    691:       mark_addressable (fndecl);
                    692:     }
                    693: 
                    694:   /* When calling a const function, we must pop the stack args right away,
                    695:      so that the pop is deleted or moved with the call.  */
                    696:   if (is_const)
                    697:     NO_DEFER_POP;
                    698: 
                    699:   function_call_count++;
                    700: 
                    701:   if (fndecl && DECL_NAME (fndecl))
                    702:     name = IDENTIFIER_POINTER (DECL_NAME (fndecl));
                    703: 
                    704: #if 0
                    705:   /* Unless it's a call to a specific function that isn't alloca,
                    706:      if it has one argument, we must assume it might be alloca.  */
                    707: 
                    708:   may_be_alloca =
                    709:     (!(fndecl != 0 && strcmp (name, "alloca"))
                    710:      && actparms != 0
                    711:      && TREE_CHAIN (actparms) == 0);
                    712: #else
                    713:   /* We assume that alloca will always be called by name.  It
                    714:      makes no sense to pass it as a pointer-to-function to
                    715:      anything that does not understand its behavior.  */
                    716:   may_be_alloca =
                    717:     (name && ((IDENTIFIER_LENGTH (DECL_NAME (fndecl)) == 6
                    718:                 && name[0] == 'a'
                    719:                 && ! strcmp (name, "alloca"))
                    720:                || (IDENTIFIER_LENGTH (DECL_NAME (fndecl)) == 16
                    721:                    && name[0] == '_'
                    722:                    && ! strcmp (name, "__builtin_alloca"))));
                    723: #endif
                    724: 
                    725:   /* See if this is a call to a function that can return more than once
                    726:      or a call to longjmp.  */
                    727: 
                    728:   returns_twice = 0;
                    729:   is_longjmp = 0;
                    730: 
                    731:   if (name != 0 && IDENTIFIER_LENGTH (DECL_NAME (fndecl)) <= 15)
                    732:     {
                    733:       char *tname = name;
                    734: 
                    735:       if (name[0] == '_')
                    736:        tname += ((name[1] == '_' && name[2] == 'x') ? 3 : 1);
                    737: 
                    738:       if (tname[0] == 's')
                    739:        {
                    740:          returns_twice
                    741:            = ((tname[1] == 'e'
                    742:                && (! strcmp (tname, "setjmp")
                    743:                    || ! strcmp (tname, "setjmp_syscall")))
                    744:               || (tname[1] == 'i'
                    745:                   && ! strcmp (tname, "sigsetjmp"))
                    746:               || (tname[1] == 'a'
                    747:                   && ! strcmp (tname, "savectx")));
                    748:          if (tname[1] == 'i'
                    749:              && ! strcmp (tname, "siglongjmp"))
                    750:            is_longjmp = 1;
                    751:        }
                    752:       else if ((tname[0] == 'q' && tname[1] == 's'
                    753:                && ! strcmp (tname, "qsetjmp"))
                    754:               || (tname[0] == 'v' && tname[1] == 'f'
                    755:                   && ! strcmp (tname, "vfork")))
                    756:        returns_twice = 1;
                    757: 
                    758:       else if (tname[0] == 'l' && tname[1] == 'o'
                    759:               && ! strcmp (tname, "longjmp"))
                    760:        is_longjmp = 1;
                    761:     }
                    762: 
                    763:   if (may_be_alloca)
                    764:     current_function_calls_alloca = 1;
                    765: 
                    766:   /* Don't let pending stack adjusts add up to too much.
                    767:      Also, do all pending adjustments now
                    768:      if there is any chance this might be a call to alloca.  */
                    769: 
                    770:   if (pending_stack_adjust >= 32
                    771:       || (pending_stack_adjust > 0 && may_be_alloca))
                    772:     do_pending_stack_adjust ();
                    773: 
                    774:   /* Operand 0 is a pointer-to-function; get the type of the function.  */
                    775:   funtype = TREE_TYPE (TREE_OPERAND (exp, 0));
                    776:   if (TREE_CODE (funtype) != POINTER_TYPE)
                    777:     abort ();
                    778:   funtype = TREE_TYPE (funtype);
                    779: 
                    780:   /* Push the temporary stack slot level so that we can free temporaries used
                    781:      by each of the arguments separately.  */
                    782:   push_temp_slots ();
                    783: 
                    784:   /* Start updating where the next arg would go.  */
1.1.1.4 ! root      785:   INIT_CUMULATIVE_ARGS (args_so_far, funtype, NULL_PTR);
1.1       root      786: 
                    787:   /* If struct_value_rtx is 0, it means pass the address
                    788:      as if it were an extra parameter.  */
                    789:   if (structure_value_addr && struct_value_rtx == 0)
                    790:     {
1.1.1.3   root      791: #ifdef ACCUMULATE_OUTGOING_ARGS
                    792:       /* If the stack will be adjusted, make sure the structure address
                    793:         does not refer to virtual_outgoing_args_rtx.  */
                    794:       rtx temp = (stack_arg_under_construction
                    795:                  ? copy_addr_to_reg (structure_value_addr)
                    796:                  : force_reg (Pmode, structure_value_addr));
                    797: #else
                    798:       rtx temp = force_reg (Pmode, structure_value_addr);
                    799: #endif
                    800: 
1.1       root      801:       actparms
                    802:        = tree_cons (error_mark_node,
                    803:                     make_tree (build_pointer_type (TREE_TYPE (funtype)),
1.1.1.3   root      804:                                temp),
1.1       root      805:                     actparms);
                    806:       structure_value_addr_parm = 1;
                    807:     }
                    808: 
                    809:   /* Count the arguments and set NUM_ACTUALS.  */
                    810:   for (p = actparms, i = 0; p; p = TREE_CHAIN (p)) i++;
                    811:   num_actuals = i;
                    812: 
                    813:   /* Compute number of named args.
                    814:      Normally, don't include the last named arg if anonymous args follow.
                    815:      (If no anonymous args follow, the result of list_length
                    816:      is actually one too large.)
                    817: 
                    818:      If SETUP_INCOMING_VARARGS is defined, this machine will be able to
                    819:      place unnamed args that were passed in registers into the stack.  So
                    820:      treat all args as named.  This allows the insns emitting for a specific
1.1.1.2   root      821:      argument list to be independent of the function declaration.
1.1       root      822: 
                    823:      If SETUP_INCOMING_VARARGS is not defined, we do not have any reliable
                    824:      way to pass unnamed args in registers, so we must force them into
                    825:      memory.  */
                    826: #ifndef SETUP_INCOMING_VARARGS
                    827:   if (TYPE_ARG_TYPES (funtype) != 0)
                    828:     n_named_args
                    829:       = list_length (TYPE_ARG_TYPES (funtype)) - 1
                    830:        /* Count the struct value address, if it is passed as a parm.  */
                    831:        + structure_value_addr_parm;
                    832:   else
                    833: #endif
                    834:     /* If we know nothing, treat all args as named.  */
                    835:     n_named_args = num_actuals;
                    836: 
                    837:   /* Make a vector to hold all the information about each arg.  */
                    838:   args = (struct arg_data *) alloca (num_actuals * sizeof (struct arg_data));
                    839:   bzero (args, num_actuals * sizeof (struct arg_data));
                    840: 
                    841:   args_size.constant = 0;
                    842:   args_size.var = 0;
                    843: 
                    844:   /* In this loop, we consider args in the order they are written.
                    845:      We fill up ARGS from the front of from the back if necessary
                    846:      so that in any case the first arg to be pushed ends up at the front.  */
                    847: 
                    848: #ifdef PUSH_ARGS_REVERSED
                    849:   i = num_actuals - 1, inc = -1;
                    850:   /* In this case, must reverse order of args
                    851:      so that we compute and push the last arg first.  */
                    852: #else
                    853:   i = 0, inc = 1;
                    854: #endif
                    855: 
                    856:   /* I counts args in order (to be) pushed; ARGPOS counts in order written.  */
                    857:   for (p = actparms, argpos = 0; p; p = TREE_CHAIN (p), i += inc, argpos++)
                    858:     {
                    859:       tree type = TREE_TYPE (TREE_VALUE (p));
1.1.1.4 ! root      860:       enum machine_mode mode;
1.1       root      861: 
                    862:       args[i].tree_value = TREE_VALUE (p);
                    863: 
                    864:       /* Replace erroneous argument with constant zero.  */
                    865:       if (type == error_mark_node || TYPE_SIZE (type) == 0)
                    866:        args[i].tree_value = integer_zero_node, type = integer_type_node;
                    867: 
                    868:       /* Decide where to pass this arg.
                    869: 
                    870:         args[i].reg is nonzero if all or part is passed in registers.
                    871: 
                    872:         args[i].partial is nonzero if part but not all is passed in registers,
                    873:         and the exact value says how many words are passed in registers.
                    874: 
                    875:         args[i].pass_on_stack is nonzero if the argument must at least be
                    876:         computed on the stack.  It may then be loaded back into registers
                    877:         if args[i].reg is nonzero.
                    878: 
                    879:         These decisions are driven by the FUNCTION_... macros and must agree
                    880:         with those made by function.c.  */
                    881: 
                    882: #ifdef FUNCTION_ARG_PASS_BY_REFERENCE
                    883:       /* See if this argument should be passed by invisible reference.  */
                    884:       if (FUNCTION_ARG_PASS_BY_REFERENCE (args_so_far, TYPE_MODE (type), type,
                    885:                                          argpos < n_named_args))
                    886:        {
                    887:          /* We make a copy of the object and pass the address to the function
                    888:             being called.  */
                    889:          int size = int_size_in_bytes (type);
                    890:          rtx copy;
                    891: 
                    892:          if (size < 0)
                    893:            {
                    894:              /* This is a variable-sized object.  Make space on the stack
                    895:                 for it.  */
1.1.1.4 ! root      896:              rtx size_rtx = expand_expr (size_in_bytes (type), NULL_RTX,
1.1       root      897:                                          VOIDmode, 0);
                    898: 
                    899:              if (old_stack_level == 0)
                    900:                {
1.1.1.4 ! root      901:                  emit_stack_save (SAVE_BLOCK, &old_stack_level, NULL_RTX);
1.1       root      902:                  old_pending_adj = pending_stack_adjust;
                    903:                  pending_stack_adjust = 0;
                    904:                }
                    905: 
                    906:              copy = gen_rtx (MEM, BLKmode,
1.1.1.4 ! root      907:                              allocate_dynamic_stack_space (size_rtx, NULL_RTX,
1.1.1.3   root      908:                                                            TYPE_ALIGN (type)));
1.1       root      909:            }
                    910:          else
                    911:            copy = assign_stack_temp (TYPE_MODE (type), size, 1);
                    912: 
                    913:          store_expr (args[i].tree_value, copy, 0);
                    914: 
                    915:          args[i].tree_value = build1 (ADDR_EXPR, build_pointer_type (type),
                    916:                                       make_tree (type, copy));
                    917:          type = build_pointer_type (type);
                    918:        }
                    919: #endif
                    920: 
1.1.1.4 ! root      921:       mode = TYPE_MODE (type);
        !           922: 
        !           923: #ifdef PROMOTE_FUNCTION_ARGS
        !           924:       /* Compute the mode in which the arg is actually to be extended to.  */
        !           925:       if (TREE_CODE (type) == INTEGER_TYPE || TREE_CODE (type) == ENUMERAL_TYPE
        !           926:          || TREE_CODE (type) == BOOLEAN_TYPE || TREE_CODE (type) == CHAR_TYPE
        !           927:          || TREE_CODE (type) == REAL_TYPE || TREE_CODE (type) == POINTER_TYPE
        !           928:          || TREE_CODE (type) == OFFSET_TYPE)
        !           929:        {
        !           930:          int unsignedp = TREE_UNSIGNED (type);
        !           931:          PROMOTE_MODE (mode, unsignedp, type);
        !           932:          args[i].unsignedp = unsignedp;
        !           933:        }
        !           934: #endif
        !           935: 
        !           936:       args[i].reg = FUNCTION_ARG (args_so_far, mode, type,
1.1       root      937:                                  argpos < n_named_args);
                    938: #ifdef FUNCTION_ARG_PARTIAL_NREGS
                    939:       if (args[i].reg)
                    940:        args[i].partial
1.1.1.4 ! root      941:          = FUNCTION_ARG_PARTIAL_NREGS (args_so_far, mode, type,
1.1       root      942:                                        argpos < n_named_args);
                    943: #endif
                    944: 
1.1.1.4 ! root      945:       args[i].pass_on_stack = MUST_PASS_IN_STACK (mode, type);
1.1       root      946: 
                    947:       /* If FUNCTION_ARG returned an (expr_list (nil) FOO), it means that
                    948:         we are to pass this arg in the register(s) designated by FOO, but
                    949:         also to pass it in the stack.  */
                    950:       if (args[i].reg && GET_CODE (args[i].reg) == EXPR_LIST
                    951:          && XEXP (args[i].reg, 0) == 0)
                    952:        args[i].pass_on_stack = 1, args[i].reg = XEXP (args[i].reg, 1);
                    953: 
                    954:       /* If this is an addressable type, we must preallocate the stack
                    955:         since we must evaluate the object into its final location.
                    956: 
                    957:         If this is to be passed in both registers and the stack, it is simpler
                    958:         to preallocate.  */
                    959:       if (TREE_ADDRESSABLE (type)
                    960:          || (args[i].pass_on_stack && args[i].reg != 0))
                    961:        must_preallocate = 1;
                    962: 
                    963:       /* If this is an addressable type, we cannot pre-evaluate it.  Thus,
                    964:         we cannot consider this function call constant.  */
                    965:       if (TREE_ADDRESSABLE (type))
                    966:        is_const = 0;
                    967: 
                    968:       /* Compute the stack-size of this argument.  */
                    969:       if (args[i].reg == 0 || args[i].partial != 0
                    970: #ifdef REG_PARM_STACK_SPACE
1.1.1.3   root      971:          || reg_parm_stack_space > 0
1.1       root      972: #endif
                    973:          || args[i].pass_on_stack)
                    974:        locate_and_pad_parm (TYPE_MODE (type), type,
                    975: #ifdef STACK_PARMS_IN_REG_PARM_AREA
                    976:                             1,
                    977: #else
                    978:                             args[i].reg != 0,
                    979: #endif
                    980:                             fndecl, &args_size, &args[i].offset,
                    981:                             &args[i].size);
                    982: 
                    983: #ifndef ARGS_GROW_DOWNWARD
                    984:       args[i].slot_offset = args_size;
                    985: #endif
                    986: 
                    987: #ifndef REG_PARM_STACK_SPACE
                    988:       /* If a part of the arg was put into registers,
                    989:         don't include that part in the amount pushed.  */
                    990:       if (! args[i].pass_on_stack)
                    991:        args[i].size.constant -= ((args[i].partial * UNITS_PER_WORD)
                    992:                                  / (PARM_BOUNDARY / BITS_PER_UNIT)
                    993:                                  * (PARM_BOUNDARY / BITS_PER_UNIT));
                    994: #endif
                    995:       
                    996:       /* Update ARGS_SIZE, the total stack space for args so far.  */
                    997: 
                    998:       args_size.constant += args[i].size.constant;
                    999:       if (args[i].size.var)
                   1000:        {
                   1001:          ADD_PARM_SIZE (args_size, args[i].size.var);
                   1002:        }
                   1003: 
                   1004:       /* Since the slot offset points to the bottom of the slot,
                   1005:         we must record it after incrementing if the args grow down.  */
                   1006: #ifdef ARGS_GROW_DOWNWARD
                   1007:       args[i].slot_offset = args_size;
                   1008: 
                   1009:       args[i].slot_offset.constant = -args_size.constant;
                   1010:       if (args_size.var)
                   1011:        {
                   1012:          SUB_PARM_SIZE (args[i].slot_offset, args_size.var);
                   1013:        }
                   1014: #endif
                   1015: 
                   1016:       /* Increment ARGS_SO_FAR, which has info about which arg-registers
                   1017:         have been used, etc.  */
                   1018: 
                   1019:       FUNCTION_ARG_ADVANCE (args_so_far, TYPE_MODE (type), type,
                   1020:                            argpos < n_named_args);
                   1021:     }
                   1022: 
1.1.1.3   root     1023: #ifdef FINAL_REG_PARM_STACK_SPACE
                   1024:   reg_parm_stack_space = FINAL_REG_PARM_STACK_SPACE (args_size.constant,
                   1025:                                                     args_size.var);
                   1026: #endif
                   1027:       
1.1       root     1028:   /* Compute the actual size of the argument block required.  The variable
                   1029:      and constant sizes must be combined, the size may have to be rounded,
                   1030:      and there may be a minimum required size.  */
                   1031: 
                   1032:   original_args_size = args_size;
                   1033:   if (args_size.var)
                   1034:     {
                   1035:       /* If this function requires a variable-sized argument list, don't try to
                   1036:         make a cse'able block for this call.  We may be able to do this
                   1037:         eventually, but it is too complicated to keep track of what insns go
                   1038:         in the cse'able block and which don't.  */
                   1039: 
                   1040:       is_const = 0;
                   1041:       must_preallocate = 1;
                   1042: 
                   1043:       args_size.var = ARGS_SIZE_TREE (args_size);
                   1044:       args_size.constant = 0;
                   1045: 
                   1046: #ifdef STACK_BOUNDARY
                   1047:       if (STACK_BOUNDARY != BITS_PER_UNIT)
                   1048:        args_size.var = round_up (args_size.var, STACK_BYTES);
                   1049: #endif
                   1050: 
                   1051: #ifdef REG_PARM_STACK_SPACE
1.1.1.3   root     1052:       if (reg_parm_stack_space > 0)
1.1       root     1053:        {
                   1054:          args_size.var
                   1055:            = size_binop (MAX_EXPR, args_size.var,
                   1056:                          size_int (REG_PARM_STACK_SPACE (fndecl)));
                   1057: 
                   1058: #ifndef OUTGOING_REG_PARM_STACK_SPACE
                   1059:          /* The area corresponding to register parameters is not to count in
                   1060:             the size of the block we need.  So make the adjustment.  */
                   1061:          args_size.var
                   1062:            = size_binop (MINUS_EXPR, args_size.var,
1.1.1.3   root     1063:                          size_int (reg_parm_stack_space));
1.1       root     1064: #endif
                   1065:        }
                   1066: #endif
                   1067:     }
                   1068:   else
                   1069:     {
                   1070: #ifdef STACK_BOUNDARY
                   1071:       args_size.constant = (((args_size.constant + (STACK_BYTES - 1))
                   1072:                             / STACK_BYTES) * STACK_BYTES);
                   1073: #endif
                   1074: 
                   1075: #ifdef REG_PARM_STACK_SPACE
                   1076:       args_size.constant = MAX (args_size.constant,
1.1.1.3   root     1077:                                reg_parm_stack_space);
1.1       root     1078: #ifndef OUTGOING_REG_PARM_STACK_SPACE
1.1.1.3   root     1079:       args_size.constant -= reg_parm_stack_space;
1.1       root     1080: #endif
                   1081: #endif
                   1082:     }
                   1083: 
                   1084:   /* See if we have or want to preallocate stack space.
                   1085: 
                   1086:      If we would have to push a partially-in-regs parm
                   1087:      before other stack parms, preallocate stack space instead.
                   1088: 
                   1089:      If the size of some parm is not a multiple of the required stack
                   1090:      alignment, we must preallocate.
                   1091: 
                   1092:      If the total size of arguments that would otherwise create a copy in
                   1093:      a temporary (such as a CALL) is more than half the total argument list
                   1094:      size, preallocation is faster.
                   1095: 
                   1096:      Another reason to preallocate is if we have a machine (like the m88k)
                   1097:      where stack alignment is required to be maintained between every
                   1098:      pair of insns, not just when the call is made.  However, we assume here
                   1099:      that such machines either do not have push insns (and hence preallocation
                   1100:      would occur anyway) or the problem is taken care of with
                   1101:      PUSH_ROUNDING.  */
                   1102: 
                   1103:   if (! must_preallocate)
                   1104:     {
                   1105:       int partial_seen = 0;
                   1106:       int copy_to_evaluate_size = 0;
                   1107: 
                   1108:       for (i = 0; i < num_actuals && ! must_preallocate; i++)
                   1109:        {
                   1110:          if (args[i].partial > 0 && ! args[i].pass_on_stack)
                   1111:            partial_seen = 1;
                   1112:          else if (partial_seen && args[i].reg == 0)
                   1113:            must_preallocate = 1;
                   1114: 
                   1115:          if (TYPE_MODE (TREE_TYPE (args[i].tree_value)) == BLKmode
                   1116:              && (TREE_CODE (args[i].tree_value) == CALL_EXPR
                   1117:                  || TREE_CODE (args[i].tree_value) == TARGET_EXPR
                   1118:                  || TREE_CODE (args[i].tree_value) == COND_EXPR
                   1119:                  || TREE_ADDRESSABLE (TREE_TYPE (args[i].tree_value))))
                   1120:            copy_to_evaluate_size
                   1121:              += int_size_in_bytes (TREE_TYPE (args[i].tree_value));
                   1122:        }
                   1123: 
1.1.1.3   root     1124:       if (copy_to_evaluate_size * 2 >= args_size.constant
                   1125:          && args_size.constant > 0)
1.1       root     1126:        must_preallocate = 1;
                   1127:     }
                   1128: 
                   1129:   /* If the structure value address will reference the stack pointer, we must
                   1130:      stabilize it.  We don't need to do this if we know that we are not going
                   1131:      to adjust the stack pointer in processing this call.  */
                   1132: 
                   1133:   if (structure_value_addr
                   1134:       && (reg_mentioned_p (virtual_stack_dynamic_rtx, structure_value_addr)
                   1135:        || reg_mentioned_p (virtual_outgoing_args_rtx, structure_value_addr))
                   1136:       && (args_size.var
                   1137: #ifndef ACCUMULATE_OUTGOING_ARGS
                   1138:          || args_size.constant
                   1139: #endif
                   1140:          ))
                   1141:     structure_value_addr = copy_to_reg (structure_value_addr);
                   1142: 
                   1143:   /* If this function call is cse'able, precompute all the parameters.
                   1144:      Note that if the parameter is constructed into a temporary, this will
                   1145:      cause an additional copy because the parameter will be constructed
                   1146:      into a temporary location and then copied into the outgoing arguments.
                   1147:      If a parameter contains a call to alloca and this function uses the
                   1148:      stack, precompute the parameter.  */
                   1149: 
                   1150:   for (i = 0; i < num_actuals; i++)
                   1151:     if (is_const
                   1152:        || ((args_size.var != 0 || args_size.constant != 0)
                   1153:            && calls_alloca (args[i].tree_value)))
                   1154:       {
                   1155:        args[i].initial_value = args[i].value
1.1.1.4 ! root     1156:          = expand_expr (args[i].tree_value, NULL_RTX, VOIDmode, 0);
1.1       root     1157:        preserve_temp_slots (args[i].value);
                   1158:        free_temp_slots ();
                   1159: 
                   1160:        /* ANSI doesn't require a sequence point here,
                   1161:           but PCC has one, so this will avoid some problems.  */
                   1162:        emit_queue ();
                   1163:       }
                   1164: 
                   1165:   /* Now we are about to start emitting insns that can be deleted
                   1166:      if a libcall is deleted.  */
                   1167:   if (is_const)
                   1168:     start_sequence ();
                   1169: 
                   1170:   /* If we have no actual push instructions, or shouldn't use them,
                   1171:      make space for all args right now.  */
                   1172: 
                   1173:   if (args_size.var != 0)
                   1174:     {
                   1175:       if (old_stack_level == 0)
                   1176:        {
1.1.1.4 ! root     1177:          emit_stack_save (SAVE_BLOCK, &old_stack_level, NULL_RTX);
1.1       root     1178:          old_pending_adj = pending_stack_adjust;
                   1179:          pending_stack_adjust = 0;
1.1.1.3   root     1180: #ifdef ACCUMULATE_OUTGOING_ARGS
                   1181:          /* stack_arg_under_construction says whether a stack arg is
                   1182:             being constructed at the old stack level.  Pushing the stack
                   1183:             gets a clean outgoing argument block.  */
                   1184:          old_stack_arg_under_construction = stack_arg_under_construction;
                   1185:          stack_arg_under_construction = 0;
                   1186: #endif
1.1       root     1187:        }
                   1188:       argblock = push_block (ARGS_SIZE_RTX (args_size), 0, 0);
                   1189:     }
                   1190:   else if (must_preallocate)
                   1191:     {
                   1192:       /* Note that we must go through the motions of allocating an argument
                   1193:         block even if the size is zero because we may be storing args
                   1194:         in the area reserved for register arguments, which may be part of
                   1195:         the stack frame.  */
                   1196:       int needed = args_size.constant;
                   1197: 
                   1198: #ifdef ACCUMULATE_OUTGOING_ARGS
                   1199:       /* Store the maximum argument space used.  It will be pushed by the
                   1200:         prologue.
                   1201: 
                   1202:         Since the stack pointer will never be pushed, it is possible for
                   1203:         the evaluation of a parm to clobber something we have already
                   1204:         written to the stack.  Since most function calls on RISC machines
                   1205:         do not use the stack, this is uncommon, but must work correctly.
                   1206:         
                   1207:         Therefore, we save any area of the stack that was already written
                   1208:         and that we are using.  Here we set up to do this by making a new
                   1209:         stack usage map from the old one.  The actual save will be done
                   1210:         by store_one_arg. 
                   1211: 
                   1212:         Another approach might be to try to reorder the argument
                   1213:         evaluations to avoid this conflicting stack usage.  */
                   1214: 
                   1215:       if (needed > current_function_outgoing_args_size)
                   1216:        current_function_outgoing_args_size = needed;
                   1217: 
                   1218: #if defined(REG_PARM_STACK_SPACE) && ! defined(OUTGOING_REG_PARM_STACK_SPACE)
                   1219:       /* Since we will be writing into the entire argument area, the
                   1220:         map must be allocated for its entire size, not just the part that
                   1221:         is the responsibility of the caller.  */
1.1.1.3   root     1222:       needed += reg_parm_stack_space;
1.1       root     1223: #endif
                   1224: 
                   1225: #ifdef ARGS_GROW_DOWNWARD
                   1226:       highest_outgoing_arg_in_use = MAX (initial_highest_arg_in_use,
                   1227:                                         needed + 1);
                   1228: #else
                   1229:       highest_outgoing_arg_in_use = MAX (initial_highest_arg_in_use, needed);
                   1230: #endif
                   1231:       stack_usage_map = (char *) alloca (highest_outgoing_arg_in_use);
                   1232: 
                   1233:       if (initial_highest_arg_in_use)
                   1234:        bcopy (initial_stack_usage_map, stack_usage_map,
                   1235:               initial_highest_arg_in_use);
                   1236: 
                   1237:       if (initial_highest_arg_in_use != highest_outgoing_arg_in_use)
                   1238:        bzero (&stack_usage_map[initial_highest_arg_in_use],
                   1239:               highest_outgoing_arg_in_use - initial_highest_arg_in_use);
                   1240:       needed = 0;
1.1.1.3   root     1241: 
                   1242:       /* The address of the outgoing argument list must not be copied to a
                   1243:         register here, because argblock would be left pointing to the
                   1244:         wrong place after the call to allocate_dynamic_stack_space below. */
                   1245: 
1.1       root     1246:       argblock = virtual_outgoing_args_rtx;
1.1.1.3   root     1247: 
1.1       root     1248: #else /* not ACCUMULATE_OUTGOING_ARGS */
                   1249:       if (inhibit_defer_pop == 0)
                   1250:        {
                   1251:          /* Try to reuse some or all of the pending_stack_adjust
                   1252:             to get this space.  Maybe we can avoid any pushing.  */
                   1253:          if (needed > pending_stack_adjust)
                   1254:            {
                   1255:              needed -= pending_stack_adjust;
                   1256:              pending_stack_adjust = 0;
                   1257:            }
                   1258:          else
                   1259:            {
                   1260:              pending_stack_adjust -= needed;
                   1261:              needed = 0;
                   1262:            }
                   1263:        }
                   1264:       /* Special case this because overhead of `push_block' in this
                   1265:         case is non-trivial.  */
                   1266:       if (needed == 0)
                   1267:        argblock = virtual_outgoing_args_rtx;
                   1268:       else
1.1.1.4 ! root     1269:        argblock = push_block (GEN_INT (needed), 0, 0);
1.1       root     1270: 
                   1271:       /* We only really need to call `copy_to_reg' in the case where push
                   1272:         insns are going to be used to pass ARGBLOCK to a function
                   1273:         call in ARGS.  In that case, the stack pointer changes value
                   1274:         from the allocation point to the call point, and hence
                   1275:         the value of VIRTUAL_OUTGOING_ARGS_RTX changes as well.
                   1276:         But might as well always do it.  */
                   1277:       argblock = copy_to_reg (argblock);
                   1278: #endif /* not ACCUMULATE_OUTGOING_ARGS */
                   1279:     }
                   1280: 
1.1.1.3   root     1281: 
                   1282: #ifdef ACCUMULATE_OUTGOING_ARGS
                   1283:   /* The save/restore code in store_one_arg handles all cases except one:
                   1284:      a constructor call (including a C function returning a BLKmode struct)
                   1285:      to initialize an argument.  */
                   1286:   if (stack_arg_under_construction)
                   1287:     {
                   1288: #if defined(REG_PARM_STACK_SPACE) && ! defined(OUTGOING_REG_PARM_STACK_SPACE)
1.1.1.4 ! root     1289:       rtx push_size = GEN_INT (reg_parm_stack_space + args_size.constant);
1.1.1.3   root     1290: #else
1.1.1.4 ! root     1291:       rtx push_size = GEN_INT (args_size.constant);
1.1.1.3   root     1292: #endif
                   1293:       if (old_stack_level == 0)
                   1294:        {
1.1.1.4 ! root     1295:          emit_stack_save (SAVE_BLOCK, &old_stack_level, NULL_RTX);
1.1.1.3   root     1296:          old_pending_adj = pending_stack_adjust;
                   1297:          pending_stack_adjust = 0;
                   1298:          /* stack_arg_under_construction says whether a stack arg is
                   1299:             being constructed at the old stack level.  Pushing the stack
                   1300:             gets a clean outgoing argument block.  */
                   1301:          old_stack_arg_under_construction = stack_arg_under_construction;
                   1302:          stack_arg_under_construction = 0;
                   1303:          /* Make a new map for the new argument list.  */
                   1304:          stack_usage_map = (char *)alloca (highest_outgoing_arg_in_use);
                   1305:          bzero (stack_usage_map, highest_outgoing_arg_in_use);
                   1306:          highest_outgoing_arg_in_use = 0;
                   1307:        }
1.1.1.4 ! root     1308:       allocate_dynamic_stack_space (push_size, NULL_RTX, BITS_PER_UNIT);
1.1.1.3   root     1309:     }
                   1310:   /* If argument evaluation might modify the stack pointer, copy the
                   1311:      address of the argument list to a register.  */
                   1312:   for (i = 0; i < num_actuals; i++)
                   1313:     if (args[i].pass_on_stack)
                   1314:       {
                   1315:        argblock = copy_addr_to_reg (argblock);
                   1316:        break;
                   1317:       }
                   1318: #endif
                   1319: 
                   1320: 
1.1       root     1321:   /* If we preallocated stack space, compute the address of each argument.
                   1322:      We need not ensure it is a valid memory address here; it will be 
                   1323:      validized when it is used.  */
                   1324:   if (argblock)
                   1325:     {
                   1326:       rtx arg_reg = argblock;
                   1327:       int arg_offset = 0;
                   1328: 
                   1329:       if (GET_CODE (argblock) == PLUS)
                   1330:        arg_reg = XEXP (argblock, 0), arg_offset = INTVAL (XEXP (argblock, 1));
                   1331: 
                   1332:       for (i = 0; i < num_actuals; i++)
                   1333:        {
                   1334:          rtx offset = ARGS_SIZE_RTX (args[i].offset);
                   1335:          rtx slot_offset = ARGS_SIZE_RTX (args[i].slot_offset);
                   1336:          rtx addr;
                   1337: 
                   1338:          /* Skip this parm if it will not be passed on the stack.  */
                   1339:          if (! args[i].pass_on_stack && args[i].reg != 0)
                   1340:            continue;
                   1341: 
                   1342:          if (GET_CODE (offset) == CONST_INT)
                   1343:            addr = plus_constant (arg_reg, INTVAL (offset));
                   1344:          else
                   1345:            addr = gen_rtx (PLUS, Pmode, arg_reg, offset);
                   1346: 
                   1347:          addr = plus_constant (addr, arg_offset);
                   1348:          args[i].stack
                   1349:            = gen_rtx (MEM, TYPE_MODE (TREE_TYPE (args[i].tree_value)), addr);
                   1350: 
                   1351:          if (GET_CODE (slot_offset) == CONST_INT)
                   1352:            addr = plus_constant (arg_reg, INTVAL (slot_offset));
                   1353:          else
                   1354:            addr = gen_rtx (PLUS, Pmode, arg_reg, slot_offset);
                   1355: 
                   1356:          addr = plus_constant (addr, arg_offset);
                   1357:          args[i].stack_slot
                   1358:            = gen_rtx (MEM, TYPE_MODE (TREE_TYPE (args[i].tree_value)), addr);
                   1359:        }
                   1360:     }
                   1361:                                               
                   1362: #ifdef PUSH_ARGS_REVERSED
                   1363: #ifdef STACK_BOUNDARY
                   1364:   /* If we push args individually in reverse order, perform stack alignment
                   1365:      before the first push (the last arg).  */
                   1366:   if (argblock == 0)
1.1.1.4 ! root     1367:     anti_adjust_stack (GEN_INT (args_size.constant
        !          1368:                                - original_args_size.constant));
1.1       root     1369: #endif
                   1370: #endif
                   1371: 
                   1372:   /* Don't try to defer pops if preallocating, not even from the first arg,
                   1373:      since ARGBLOCK probably refers to the SP.  */
                   1374:   if (argblock)
                   1375:     NO_DEFER_POP;
                   1376: 
                   1377:   /* Get the function to call, in the form of RTL.  */
                   1378:   if (fndecl)
                   1379:     /* Get a SYMBOL_REF rtx for the function address.  */
                   1380:     funexp = XEXP (DECL_RTL (fndecl), 0);
                   1381:   else
                   1382:     /* Generate an rtx (probably a pseudo-register) for the address.  */
                   1383:     {
1.1.1.4 ! root     1384:       funexp = expand_expr (TREE_OPERAND (exp, 0), NULL_RTX, VOIDmode, 0);
1.1       root     1385:       free_temp_slots ();      /* FUNEXP can't be BLKmode */
                   1386:       emit_queue ();
                   1387:     }
                   1388: 
                   1389:   /* Figure out the register where the value, if any, will come back.  */
                   1390:   valreg = 0;
                   1391:   if (TYPE_MODE (TREE_TYPE (exp)) != VOIDmode
                   1392:       && ! structure_value_addr)
                   1393:     {
                   1394:       if (pcc_struct_value)
                   1395:        valreg = hard_function_value (build_pointer_type (TREE_TYPE (exp)),
                   1396:                                      fndecl);
                   1397:       else
                   1398:        valreg = hard_function_value (TREE_TYPE (exp), fndecl);
                   1399:     }
                   1400: 
                   1401:   /* Precompute all register parameters.  It isn't safe to compute anything
                   1402:      once we have started filling any specific hard regs. */
                   1403:   reg_parm_seen = 0;
                   1404:   for (i = 0; i < num_actuals; i++)
                   1405:     if (args[i].reg != 0 && ! args[i].pass_on_stack)
                   1406:       {
1.1.1.4 ! root     1407:        enum machine_mode mode;
        !          1408: 
1.1       root     1409:        reg_parm_seen = 1;
                   1410: 
                   1411:        if (args[i].value == 0)
                   1412:          {
1.1.1.4 ! root     1413:            args[i].value = expand_expr (args[i].tree_value, NULL_RTX,
        !          1414:                                         VOIDmode, 0);
1.1       root     1415:            preserve_temp_slots (args[i].value);
                   1416:            free_temp_slots ();
                   1417: 
                   1418:            /* ANSI doesn't require a sequence point here,
                   1419:               but PCC has one, so this will avoid some problems.  */
                   1420:            emit_queue ();
                   1421:          }
1.1.1.4 ! root     1422: 
        !          1423:        /* If we are to promote the function arg to a wider mode,
        !          1424:           do it now.  */
        !          1425:        mode = (GET_CODE (args[i].reg) == EXPR_LIST 
        !          1426:                ? GET_MODE (XEXP (args[i].reg, 0)) : GET_MODE (args[i].reg));
        !          1427: 
        !          1428:        if (TYPE_MODE (TREE_TYPE (args[i].tree_value)) != mode)
        !          1429:          args[i].value = convert_to_mode (mode, args[i].value,
        !          1430:                                           args[i].unsignedp);
1.1       root     1431:       }
                   1432: 
                   1433: #if defined(ACCUMULATE_OUTGOING_ARGS) && defined(REG_PARM_STACK_SPACE)
                   1434:   /* The argument list is the property of the called routine and it
                   1435:      may clobber it.  If the fixed area has been used for previous
                   1436:      parameters, we must save and restore it.
                   1437: 
                   1438:      Here we compute the boundary of the that needs to be saved, if any.  */
                   1439: 
1.1.1.4 ! root     1440: #ifdef ARGS_GROW_DOWNWARD
        !          1441:   for (i = 0; i < reg_parm_stack_space + 1; i++)
        !          1442: #else
1.1.1.3   root     1443:   for (i = 0; i < reg_parm_stack_space; i++)
1.1.1.4 ! root     1444: #endif
1.1       root     1445:     {
                   1446:       if (i >=  highest_outgoing_arg_in_use
                   1447:          || stack_usage_map[i] == 0)
                   1448:        continue;
                   1449: 
                   1450:       if (low_to_save == -1)
                   1451:        low_to_save = i;
                   1452: 
                   1453:       high_to_save = i;
                   1454:     }
                   1455: 
                   1456:   if (low_to_save >= 0)
                   1457:     {
                   1458:       int num_to_save = high_to_save - low_to_save + 1;
                   1459:       enum machine_mode save_mode
                   1460:        = mode_for_size (num_to_save * BITS_PER_UNIT, MODE_INT, 1);
                   1461:       rtx stack_area;
                   1462: 
                   1463:       /* If we don't have the required alignment, must do this in BLKmode.  */
                   1464:       if ((low_to_save & (MIN (GET_MODE_SIZE (save_mode),
                   1465:                               BIGGEST_ALIGNMENT / UNITS_PER_WORD) - 1)))
                   1466:        save_mode = BLKmode;
                   1467: 
                   1468:       stack_area = gen_rtx (MEM, save_mode,
                   1469:                            memory_address (save_mode,
1.1.1.4 ! root     1470:                                            
        !          1471: #ifdef ARGS_GROW_DOWNWARD
        !          1472:                                            plus_constant (argblock,
        !          1473:                                                           - high_to_save)
        !          1474: #else
1.1       root     1475:                                            plus_constant (argblock,
1.1.1.4 ! root     1476:                                                           low_to_save)
        !          1477: #endif
        !          1478:                                            ));
1.1       root     1479:       if (save_mode == BLKmode)
                   1480:        {
                   1481:          save_area = assign_stack_temp (BLKmode, num_to_save, 1);
                   1482:          emit_block_move (validize_mem (save_area), stack_area,
1.1.1.4 ! root     1483:                           GEN_INT (num_to_save),
1.1       root     1484:                           PARM_BOUNDARY / BITS_PER_UNIT);
                   1485:        }
                   1486:       else
                   1487:        {
                   1488:          save_area = gen_reg_rtx (save_mode);
                   1489:          emit_move_insn (save_area, stack_area);
                   1490:        }
                   1491:     }
                   1492: #endif
                   1493:          
                   1494: 
                   1495:   /* Now store (and compute if necessary) all non-register parms.
                   1496:      These come before register parms, since they can require block-moves,
                   1497:      which could clobber the registers used for register parms.
                   1498:      Parms which have partial registers are not stored here,
                   1499:      but we do preallocate space here if they want that.  */
                   1500: 
                   1501:   for (i = 0; i < num_actuals; i++)
                   1502:     if (args[i].reg == 0 || args[i].pass_on_stack)
                   1503:       store_one_arg (&args[i], argblock, may_be_alloca,
1.1.1.3   root     1504:                     args_size.var != 0, fndecl, reg_parm_stack_space);
1.1       root     1505: 
                   1506:   /* Now store any partially-in-registers parm.
                   1507:      This is the last place a block-move can happen.  */
                   1508:   if (reg_parm_seen)
                   1509:     for (i = 0; i < num_actuals; i++)
                   1510:       if (args[i].partial != 0 && ! args[i].pass_on_stack)
                   1511:        store_one_arg (&args[i], argblock, may_be_alloca,
1.1.1.3   root     1512:                       args_size.var != 0, fndecl, reg_parm_stack_space);
1.1       root     1513: 
                   1514: #ifndef PUSH_ARGS_REVERSED
                   1515: #ifdef STACK_BOUNDARY
                   1516:   /* If we pushed args in forward order, perform stack alignment
                   1517:      after pushing the last arg.  */
                   1518:   if (argblock == 0)
1.1.1.4 ! root     1519:     anti_adjust_stack (GEN_INT (args_size.constant
        !          1520:                                - original_args_size.constant));
1.1       root     1521: #endif
                   1522: #endif
                   1523: 
1.1.1.3   root     1524:   /* If register arguments require space on the stack and stack space
                   1525:      was not preallocated, allocate stack space here for arguments
                   1526:      passed in registers.  */
                   1527: #if ! defined(ALLOCATE_OUTGOING_ARGS) && defined(OUTGOING_REG_PARM_STACK_SPACE)
                   1528:   if (must_preallocate == 0 && reg_parm_stack_space > 0)
1.1.1.4 ! root     1529:     anti_adjust_stack (GEN_INT (reg_parm_stack_space));
1.1.1.3   root     1530: #endif
                   1531: 
1.1       root     1532:   /* Pass the function the address in which to return a structure value.  */
                   1533:   if (structure_value_addr && ! structure_value_addr_parm)
                   1534:     {
                   1535:       emit_move_insn (struct_value_rtx,
                   1536:                      force_reg (Pmode,
1.1.1.4 ! root     1537:                                 force_operand (structure_value_addr,
        !          1538:                                                NULL_RTX)));
1.1       root     1539:       if (GET_CODE (struct_value_rtx) == REG)
                   1540:        {
                   1541:          push_to_sequence (use_insns);
                   1542:          emit_insn (gen_rtx (USE, VOIDmode, struct_value_rtx));
                   1543:          use_insns = get_insns ();
                   1544:          end_sequence ();
                   1545:        }
                   1546:     }
                   1547: 
                   1548:   /* Now do the register loads required for any wholly-register parms or any
                   1549:      parms which are passed both on the stack and in a register.  Their
                   1550:      expressions were already evaluated. 
                   1551: 
                   1552:      Mark all register-parms as living through the call, putting these USE
                   1553:      insns in a list headed by USE_INSNS.  */
                   1554: 
                   1555:   for (i = 0; i < num_actuals; i++)
                   1556:     {
                   1557:       rtx list = args[i].reg;
                   1558:       int partial = args[i].partial;
                   1559: 
                   1560:       while (list)
                   1561:        {
                   1562:          rtx reg;
                   1563:          int nregs;
                   1564: 
                   1565:          /* Process each register that needs to get this arg.  */
                   1566:          if (GET_CODE (list) == EXPR_LIST)
                   1567:            reg = XEXP (list, 0), list = XEXP (list, 1);
                   1568:          else
                   1569:            reg = list, list = 0;
                   1570: 
                   1571:          /* Set to non-zero if must move a word at a time, even if just one
                   1572:             word (e.g, partial == 1 && mode == DFmode).  Set to zero if
                   1573:             we just use a normal move insn.  */
                   1574:          nregs = (partial ? partial
                   1575:                   : (TYPE_MODE (TREE_TYPE (args[i].tree_value)) == BLKmode
                   1576:                      ? ((int_size_in_bytes (TREE_TYPE (args[i].tree_value))
                   1577:                          + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD)
                   1578:                      : 0));
                   1579: 
                   1580:          /* If simple case, just do move.  If normal partial, store_one_arg
                   1581:             has already loaded the register for us.  In all other cases,
                   1582:             load the register(s) from memory.  */
                   1583: 
                   1584:          if (nregs == 0)
                   1585:            emit_move_insn (reg, args[i].value);
                   1586:          else if (args[i].partial == 0 || args[i].pass_on_stack)
                   1587:            move_block_to_reg (REGNO (reg),
                   1588:                               validize_mem (args[i].value), nregs,
                   1589:                               TYPE_MODE (TREE_TYPE (args[i].tree_value)));
                   1590:        
                   1591:          push_to_sequence (use_insns);
                   1592:          if (nregs == 0)
                   1593:            emit_insn (gen_rtx (USE, VOIDmode, reg));
                   1594:          else
                   1595:            use_regs (REGNO (reg), nregs);
                   1596:          use_insns = get_insns ();
                   1597:          end_sequence ();
                   1598: 
                   1599:          /* PARTIAL referred only to the first register, so clear it for the
                   1600:             next time.  */
                   1601:          partial = 0;
                   1602:        }
                   1603:     }
                   1604: 
                   1605:   /* Perform postincrements before actually calling the function.  */
                   1606:   emit_queue ();
                   1607: 
                   1608:   /* All arguments and registers used for the call must be set up by now!  */
                   1609: 
                   1610:   funexp = prepare_call_address (funexp, fndecl, &use_insns);
                   1611: 
                   1612:   /* Generate the actual call instruction.  */
                   1613:   emit_call_1 (funexp, funtype, args_size.constant, struct_value_size,
                   1614:               FUNCTION_ARG (args_so_far, VOIDmode, void_type_node, 1),
                   1615:               valreg, old_inhibit_defer_pop, use_insns, is_const);
                   1616: 
                   1617:   /* If call is cse'able, make appropriate pair of reg-notes around it.
                   1618:      Test valreg so we don't crash; may safely ignore `const'
                   1619:      if return type is void.  */
                   1620:   if (is_const && valreg != 0)
                   1621:     {
                   1622:       rtx note = 0;
                   1623:       rtx temp = gen_reg_rtx (GET_MODE (valreg));
                   1624:       rtx insns;
                   1625: 
                   1626:       /* Construct an "equal form" for the value which mentions all the
                   1627:         arguments in order as well as the function name.  */
                   1628: #ifdef PUSH_ARGS_REVERSED
                   1629:       for (i = 0; i < num_actuals; i++)
                   1630:        note = gen_rtx (EXPR_LIST, VOIDmode, args[i].initial_value, note);
                   1631: #else
                   1632:       for (i = num_actuals - 1; i >= 0; i--)
                   1633:        note = gen_rtx (EXPR_LIST, VOIDmode, args[i].initial_value, note);
                   1634: #endif
                   1635:       note = gen_rtx (EXPR_LIST, VOIDmode, funexp, note);
                   1636: 
                   1637:       insns = get_insns ();
                   1638:       end_sequence ();
                   1639: 
                   1640:       emit_libcall_block (insns, temp, valreg, note);
                   1641: 
                   1642:       valreg = temp;
                   1643:     }
                   1644: 
                   1645:   /* For calls to `setjmp', etc., inform flow.c it should complain
                   1646:      if nonvolatile values are live.  */
                   1647: 
                   1648:   if (returns_twice)
                   1649:     {
                   1650:       emit_note (name, NOTE_INSN_SETJMP);
                   1651:       current_function_calls_setjmp = 1;
                   1652:     }
                   1653: 
                   1654:   if (is_longjmp)
                   1655:     current_function_calls_longjmp = 1;
                   1656: 
                   1657:   /* Notice functions that cannot return.
                   1658:      If optimizing, insns emitted below will be dead.
                   1659:      If not optimizing, they will exist, which is useful
                   1660:      if the user uses the `return' command in the debugger.  */
                   1661: 
                   1662:   if (is_volatile || is_longjmp)
                   1663:     emit_barrier ();
                   1664: 
                   1665:   /* If value type not void, return an rtx for the value.  */
                   1666: 
                   1667:   /* If there are cleanups to be called, don't use a hard reg as target.  */
                   1668:   if (cleanups_this_call != old_cleanups
                   1669:       && target && REG_P (target)
                   1670:       && REGNO (target) < FIRST_PSEUDO_REGISTER)
                   1671:     target = 0;
                   1672: 
                   1673:   if (TYPE_MODE (TREE_TYPE (exp)) == VOIDmode
                   1674:       || ignore)
                   1675:     {
                   1676:       target = const0_rtx;
                   1677:     }
                   1678:   else if (structure_value_addr)
                   1679:     {
                   1680:       if (target == 0 || GET_CODE (target) != MEM)
1.1.1.3   root     1681:        {
                   1682:          target = gen_rtx (MEM, TYPE_MODE (TREE_TYPE (exp)),
                   1683:                            memory_address (TYPE_MODE (TREE_TYPE (exp)),
                   1684:                                            structure_value_addr));
                   1685:          MEM_IN_STRUCT_P (target)
                   1686:            = (TREE_CODE (TREE_TYPE (exp)) == ARRAY_TYPE
                   1687:               || TREE_CODE (TREE_TYPE (exp)) == RECORD_TYPE
                   1688:               || TREE_CODE (TREE_TYPE (exp)) == UNION_TYPE);
                   1689:        }
1.1       root     1690:     }
                   1691:   else if (pcc_struct_value)
                   1692:     {
                   1693:       if (target == 0)
1.1.1.3   root     1694:        {
                   1695:          target = gen_rtx (MEM, TYPE_MODE (TREE_TYPE (exp)),
                   1696:                            copy_to_reg (valreg));
                   1697:          MEM_IN_STRUCT_P (target)
                   1698:            = (TREE_CODE (TREE_TYPE (exp)) == ARRAY_TYPE
                   1699:               || TREE_CODE (TREE_TYPE (exp)) == RECORD_TYPE
                   1700:               || TREE_CODE (TREE_TYPE (exp)) == UNION_TYPE);
                   1701:        }
1.1       root     1702:       else if (TYPE_MODE (TREE_TYPE (exp)) != BLKmode)
                   1703:        emit_move_insn (target, gen_rtx (MEM, TYPE_MODE (TREE_TYPE (exp)),
                   1704:                                         copy_to_reg (valreg)));
                   1705:       else
                   1706:        emit_block_move (target, gen_rtx (MEM, BLKmode, copy_to_reg (valreg)),
                   1707:                         expr_size (exp),
                   1708:                         TYPE_ALIGN (TREE_TYPE (exp)) / BITS_PER_UNIT);
                   1709:     }
1.1.1.4 ! root     1710:   else if (target && GET_MODE (target) == TYPE_MODE (TREE_TYPE (exp))
        !          1711:           && GET_MODE (target) == GET_MODE (valreg))
1.1       root     1712:     /* TARGET and VALREG cannot be equal at this point because the latter
                   1713:        would not have REG_FUNCTION_VALUE_P true, while the former would if
                   1714:        it were referring to the same register.
                   1715: 
                   1716:        If they refer to the same register, this move will be a no-op, except
                   1717:        when function inlining is being done.  */
                   1718:     emit_move_insn (target, valreg);
                   1719:   else
                   1720:     target = copy_to_reg (valreg);
                   1721: 
1.1.1.4 ! root     1722: #ifdef PROMOTE_FUNCTION_RETURN
        !          1723:   /* If we promoted this return value, make the proper SUBREG.  */
        !          1724:   if (GET_MODE (target) != TYPE_MODE (TREE_TYPE (exp)))
        !          1725:     {
        !          1726:       enum machine_mode mode = GET_MODE (target);
        !          1727:       int unsignedp = TREE_UNSIGNED (TREE_TYPE (exp));
        !          1728: 
        !          1729:       if (TREE_CODE (TREE_TYPE (exp)) == INTEGER_TYPE
        !          1730:          || TREE_CODE (TREE_TYPE (exp)) == ENUMERAL_TYPE
        !          1731:          || TREE_CODE (TREE_TYPE (exp)) == BOOLEAN_TYPE
        !          1732:          || TREE_CODE (TREE_TYPE (exp)) == CHAR_TYPE
        !          1733:          || TREE_CODE (TREE_TYPE (exp)) == REAL_TYPE
        !          1734:          || TREE_CODE (TREE_TYPE (exp)) == POINTER_TYPE
        !          1735:          || TREE_CODE (TREE_TYPE (exp)) == OFFSET_TYPE)
        !          1736:        {
        !          1737:          PROMOTE_MODE (mode, unsignedp, TREE_TYPE (exp));
        !          1738:        }
        !          1739: 
        !          1740:       target = gen_rtx (SUBREG, TYPE_MODE (TREE_TYPE (exp)), target, 0);
        !          1741:       SUBREG_PROMOTED_VAR_P (target) = 1;
        !          1742:       SUBREG_PROMOTED_UNSIGNED_P (target) = unsignedp;
        !          1743:     }
        !          1744: #endif
        !          1745: 
1.1       root     1746:   /* Perform all cleanups needed for the arguments of this call
                   1747:      (i.e. destructors in C++).  */
                   1748:   expand_cleanups_to (old_cleanups);
                   1749: 
1.1.1.3   root     1750:   /* If size of args is variable or this was a constructor call for a stack
                   1751:      argument, restore saved stack-pointer value.  */
1.1       root     1752: 
                   1753:   if (old_stack_level)
                   1754:     {
1.1.1.4 ! root     1755:       emit_stack_restore (SAVE_BLOCK, old_stack_level, NULL_RTX);
1.1       root     1756:       pending_stack_adjust = old_pending_adj;
1.1.1.3   root     1757: #ifdef ACCUMULATE_OUTGOING_ARGS
                   1758:       stack_arg_under_construction = old_stack_arg_under_construction;
                   1759:       highest_outgoing_arg_in_use = initial_highest_arg_in_use;
                   1760:       stack_usage_map = initial_stack_usage_map;
                   1761: #endif
1.1       root     1762:     }
                   1763: #ifdef ACCUMULATE_OUTGOING_ARGS
                   1764:   else
                   1765:     {
                   1766: #ifdef REG_PARM_STACK_SPACE
                   1767:       if (save_area)
                   1768:        {
                   1769:          enum machine_mode save_mode = GET_MODE (save_area);
                   1770:          rtx stack_area
                   1771:            = gen_rtx (MEM, save_mode,
                   1772:                       memory_address (save_mode,
1.1.1.4 ! root     1773: #ifdef ARGS_GROW_DOWNWARD
        !          1774:                                       plus_constant (argblock, - high_to_save)
        !          1775: #else
        !          1776:                                       plus_constant (argblock, low_to_save)
        !          1777: #endif
        !          1778:                                       ));
1.1       root     1779: 
                   1780:          if (save_mode != BLKmode)
                   1781:            emit_move_insn (stack_area, save_area);
                   1782:          else
                   1783:            emit_block_move (stack_area, validize_mem (save_area),
1.1.1.4 ! root     1784:                             GEN_INT (high_to_save - low_to_save + 1),
        !          1785:                             PARM_BOUNDARY / BITS_PER_UNIT);
1.1       root     1786:        }
                   1787: #endif
                   1788:          
                   1789:       /* If we saved any argument areas, restore them.  */
                   1790:       for (i = 0; i < num_actuals; i++)
                   1791:        if (args[i].save_area)
                   1792:          {
                   1793:            enum machine_mode save_mode = GET_MODE (args[i].save_area);
                   1794:            rtx stack_area
                   1795:              = gen_rtx (MEM, save_mode,
                   1796:                         memory_address (save_mode,
                   1797:                                         XEXP (args[i].stack_slot, 0)));
                   1798: 
                   1799:            if (save_mode != BLKmode)
                   1800:              emit_move_insn (stack_area, args[i].save_area);
                   1801:            else
                   1802:              emit_block_move (stack_area, validize_mem (args[i].save_area),
1.1.1.4 ! root     1803:                               GEN_INT (args[i].size.constant),
1.1       root     1804:                               PARM_BOUNDARY / BITS_PER_UNIT);
                   1805:          }
                   1806: 
                   1807:       highest_outgoing_arg_in_use = initial_highest_arg_in_use;
                   1808:       stack_usage_map = initial_stack_usage_map;
                   1809:     }
                   1810: #endif
                   1811: 
1.1.1.3   root     1812:   /* If this was alloca, record the new stack level for nonlocal gotos.  
                   1813:      Check for the handler slots since we might not have a save area
                   1814:      for non-local gotos. */
                   1815: 
                   1816:   if (may_be_alloca && nonlocal_goto_handler_slot != 0)
1.1.1.4 ! root     1817:     emit_stack_save (SAVE_NONLOCAL, &nonlocal_goto_stack_level, NULL_RTX);
1.1       root     1818: 
                   1819:   pop_temp_slots ();
                   1820: 
                   1821:   return target;
                   1822: }
                   1823: 
                   1824: #if 0
                   1825: /* Return an rtx which represents a suitable home on the stack
                   1826:    given TYPE, the type of the argument looking for a home.
                   1827:    This is called only for BLKmode arguments.
                   1828: 
                   1829:    SIZE is the size needed for this target.
                   1830:    ARGS_ADDR is the address of the bottom of the argument block for this call.
                   1831:    OFFSET describes this parameter's offset into ARGS_ADDR.  It is meaningless
                   1832:    if this machine uses push insns.  */
                   1833: 
                   1834: static rtx
                   1835: target_for_arg (type, size, args_addr, offset)
                   1836:      tree type;
                   1837:      rtx size;
                   1838:      rtx args_addr;
                   1839:      struct args_size offset;
                   1840: {
                   1841:   rtx target;
                   1842:   rtx offset_rtx = ARGS_SIZE_RTX (offset);
                   1843: 
                   1844:   /* We do not call memory_address if possible,
                   1845:      because we want to address as close to the stack
                   1846:      as possible.  For non-variable sized arguments,
                   1847:      this will be stack-pointer relative addressing.  */
                   1848:   if (GET_CODE (offset_rtx) == CONST_INT)
                   1849:     target = plus_constant (args_addr, INTVAL (offset_rtx));
                   1850:   else
                   1851:     {
                   1852:       /* I have no idea how to guarantee that this
                   1853:         will work in the presence of register parameters.  */
                   1854:       target = gen_rtx (PLUS, Pmode, args_addr, offset_rtx);
                   1855:       target = memory_address (QImode, target);
                   1856:     }
                   1857: 
                   1858:   return gen_rtx (MEM, BLKmode, target);
                   1859: }
                   1860: #endif
                   1861: 
                   1862: /* Store a single argument for a function call
                   1863:    into the register or memory area where it must be passed.
                   1864:    *ARG describes the argument value and where to pass it.
                   1865: 
                   1866:    ARGBLOCK is the address of the stack-block for all the arguments,
1.1.1.2   root     1867:    or 0 on a machine where arguments are pushed individually.
1.1       root     1868: 
                   1869:    MAY_BE_ALLOCA nonzero says this could be a call to `alloca'
                   1870:    so must be careful about how the stack is used. 
                   1871: 
                   1872:    VARIABLE_SIZE nonzero says that this was a variable-sized outgoing
                   1873:    argument stack.  This is used if ACCUMULATE_OUTGOING_ARGS to indicate
                   1874:    that we need not worry about saving and restoring the stack.
                   1875: 
                   1876:    FNDECL is the declaration of the function we are calling.  */
                   1877: 
                   1878: static void
1.1.1.3   root     1879: store_one_arg (arg, argblock, may_be_alloca, variable_size, fndecl,
                   1880:               reg_parm_stack_space)
1.1       root     1881:      struct arg_data *arg;
                   1882:      rtx argblock;
                   1883:      int may_be_alloca;
                   1884:      int variable_size;
                   1885:      tree fndecl;
1.1.1.3   root     1886:      int reg_parm_stack_space;
1.1       root     1887: {
                   1888:   register tree pval = arg->tree_value;
                   1889:   rtx reg = 0;
                   1890:   int partial = 0;
                   1891:   int used = 0;
                   1892:   int i, lower_bound, upper_bound;
                   1893: 
                   1894:   if (TREE_CODE (pval) == ERROR_MARK)
                   1895:     return;
                   1896: 
                   1897: #ifdef ACCUMULATE_OUTGOING_ARGS
                   1898:   /* If this is being stored into a pre-allocated, fixed-size, stack area,
                   1899:      save any previous data at that location.  */
                   1900:   if (argblock && ! variable_size && arg->stack)
                   1901:     {
                   1902: #ifdef ARGS_GROW_DOWNWARD
                   1903:       /* stack_slot is negative, but we want to index stack_usage_map */
                   1904:       /* with positive values. */
                   1905:       if (GET_CODE (XEXP (arg->stack_slot, 0)) == PLUS)
                   1906:        upper_bound = -INTVAL (XEXP (XEXP (arg->stack_slot, 0), 1)) + 1;
                   1907:       else
                   1908:        abort ();
                   1909: 
                   1910:       lower_bound = upper_bound - arg->size.constant;
                   1911: #else
                   1912:       if (GET_CODE (XEXP (arg->stack_slot, 0)) == PLUS)
                   1913:        lower_bound = INTVAL (XEXP (XEXP (arg->stack_slot, 0), 1));
                   1914:       else
                   1915:        lower_bound = 0;
                   1916: 
                   1917:       upper_bound = lower_bound + arg->size.constant;
                   1918: #endif
                   1919: 
                   1920:       for (i = lower_bound; i < upper_bound; i++)
                   1921:        if (stack_usage_map[i]
                   1922: #ifdef REG_PARM_STACK_SPACE
                   1923:            /* Don't store things in the fixed argument area at this point;
                   1924:               it has already been saved.  */
1.1.1.3   root     1925:            && i > reg_parm_stack_space
1.1       root     1926: #endif
                   1927:            )
                   1928:          break;
                   1929: 
                   1930:       if (i != upper_bound)
                   1931:        {
                   1932:          /* We need to make a save area.  See what mode we can make it.  */
                   1933:          enum machine_mode save_mode
                   1934:            = mode_for_size (arg->size.constant * BITS_PER_UNIT, MODE_INT, 1);
                   1935:          rtx stack_area
                   1936:            = gen_rtx (MEM, save_mode,
                   1937:                       memory_address (save_mode, XEXP (arg->stack_slot, 0)));
                   1938: 
                   1939:          if (save_mode == BLKmode)
                   1940:            {
                   1941:              arg->save_area = assign_stack_temp (BLKmode,
                   1942:                                                  arg->size.constant, 1);
                   1943:              emit_block_move (validize_mem (arg->save_area), stack_area,
1.1.1.4 ! root     1944:                               GEN_INT (arg->size.constant),
1.1       root     1945:                               PARM_BOUNDARY / BITS_PER_UNIT);
                   1946:            }
                   1947:          else
                   1948:            {
                   1949:              arg->save_area = gen_reg_rtx (save_mode);
                   1950:              emit_move_insn (arg->save_area, stack_area);
                   1951:            }
                   1952:        }
                   1953:     }
                   1954: #endif
                   1955: 
                   1956:   /* If this isn't going to be placed on both the stack and in registers,
                   1957:      set up the register and number of words.  */
                   1958:   if (! arg->pass_on_stack)
                   1959:     reg = arg->reg, partial = arg->partial;
                   1960: 
                   1961:   if (reg != 0 && partial == 0)
                   1962:     /* Being passed entirely in a register.  We shouldn't be called in
                   1963:        this case.   */
                   1964:     abort ();
                   1965: 
                   1966:   /* If this is being partially passed in a register, but multiple locations
                   1967:      are specified, we assume that the one partially used is the one that is
                   1968:      listed first.  */
                   1969:   if (reg && GET_CODE (reg) == EXPR_LIST)
                   1970:     reg = XEXP (reg, 0);
                   1971: 
                   1972:   /* If this is being passes partially in a register, we can't evaluate
                   1973:      it directly into its stack slot.  Otherwise, we can.  */
                   1974:   if (arg->value == 0)
1.1.1.3   root     1975:     {
                   1976: #ifdef ACCUMULATE_OUTGOING_ARGS
                   1977:       /* stack_arg_under_construction is nonzero if a function argument is
                   1978:         being evaluated directly into the outgoing argument list and
                   1979:         expand_call must take special action to preserve the argument list
                   1980:         if it is called recursively.
                   1981: 
                   1982:         For scalar function arguments stack_usage_map is sufficient to
                   1983:         determine which stack slots must be saved and restored.  Scalar
                   1984:         arguments in general have pass_on_stack == 0.
                   1985: 
                   1986:         If this argument is initialized by a function which takes the
                   1987:         address of the argument (a C++ constructor or a C function
                   1988:         returning a BLKmode structure), then stack_usage_map is
                   1989:         insufficient and expand_call must push the stack around the
                   1990:         function call.  Such arguments have pass_on_stack == 1.
                   1991: 
                   1992:         Note that it is always safe to set stack_arg_under_construction,
                   1993:         but this generates suboptimal code if set when not needed.  */
                   1994: 
                   1995:       if (arg->pass_on_stack)
                   1996:        stack_arg_under_construction++;
                   1997: #endif
1.1.1.4 ! root     1998:       arg->value = expand_expr (pval, partial ? NULL_RTX : arg->stack,
        !          1999:                                VOIDmode, 0);
1.1.1.3   root     2000: #ifdef ACCUMULATE_OUTGOING_ARGS
                   2001:       if (arg->pass_on_stack)
                   2002:        stack_arg_under_construction--;
                   2003: #endif
                   2004:     }
1.1       root     2005: 
                   2006:   /* Don't allow anything left on stack from computation
                   2007:      of argument to alloca.  */
                   2008:   if (may_be_alloca)
                   2009:     do_pending_stack_adjust ();
                   2010: 
                   2011:   if (arg->value == arg->stack)
                   2012:     /* If the value is already in the stack slot, we are done.  */
                   2013:     ;
                   2014:   else if (TYPE_MODE (TREE_TYPE (pval)) != BLKmode)
                   2015:     {
                   2016:       register int size;
                   2017: 
                   2018:       /* Argument is a scalar, not entirely passed in registers.
                   2019:         (If part is passed in registers, arg->partial says how much
                   2020:         and emit_push_insn will take care of putting it there.)
                   2021:         
                   2022:         Push it, and if its size is less than the
                   2023:         amount of space allocated to it,
                   2024:         also bump stack pointer by the additional space.
                   2025:         Note that in C the default argument promotions
                   2026:         will prevent such mismatches.  */
                   2027: 
                   2028:       size = GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (pval)));
                   2029:       /* Compute how much space the push instruction will push.
                   2030:         On many machines, pushing a byte will advance the stack
                   2031:         pointer by a halfword.  */
                   2032: #ifdef PUSH_ROUNDING
                   2033:       size = PUSH_ROUNDING (size);
                   2034: #endif
                   2035:       used = size;
                   2036: 
                   2037:       /* Compute how much space the argument should get:
                   2038:         round up to a multiple of the alignment for arguments.  */
                   2039:       if (none != FUNCTION_ARG_PADDING (TYPE_MODE (TREE_TYPE (pval)),
                   2040:                                        TREE_TYPE (pval)))
                   2041:        used = (((size + PARM_BOUNDARY / BITS_PER_UNIT - 1)
                   2042:                 / (PARM_BOUNDARY / BITS_PER_UNIT))
                   2043:                * (PARM_BOUNDARY / BITS_PER_UNIT));
                   2044: 
                   2045:       /* This isn't already where we want it on the stack, so put it there.
                   2046:         This can either be done with push or copy insns.  */
                   2047:       emit_push_insn (arg->value, TYPE_MODE (TREE_TYPE (pval)),
                   2048:                      TREE_TYPE (pval), 0, 0, partial, reg,
                   2049:                      used - size, argblock, ARGS_SIZE_RTX (arg->offset));
                   2050:     }
                   2051:   else
                   2052:     {
                   2053:       /* BLKmode, at least partly to be pushed.  */
                   2054: 
                   2055:       register int excess;
                   2056:       rtx size_rtx;
                   2057: 
                   2058:       /* Pushing a nonscalar.
                   2059:         If part is passed in registers, PARTIAL says how much
                   2060:         and emit_push_insn will take care of putting it there.  */
                   2061: 
                   2062:       /* Round its size up to a multiple
                   2063:         of the allocation unit for arguments.  */
                   2064: 
                   2065:       if (arg->size.var != 0)
                   2066:        {
                   2067:          excess = 0;
                   2068:          size_rtx = ARGS_SIZE_RTX (arg->size);
                   2069:        }
                   2070:       else
                   2071:        {
                   2072:          register tree size = size_in_bytes (TREE_TYPE (pval));
                   2073:          /* PUSH_ROUNDING has no effect on us, because
                   2074:             emit_push_insn for BLKmode is careful to avoid it.  */
                   2075:          excess = (arg->size.constant - TREE_INT_CST_LOW (size)
                   2076:                    + partial * UNITS_PER_WORD);
1.1.1.4 ! root     2077:          size_rtx = expand_expr (size, NULL_RTX, VOIDmode, 0);
1.1       root     2078:        }
                   2079: 
                   2080:       emit_push_insn (arg->value, TYPE_MODE (TREE_TYPE (pval)),
                   2081:                      TREE_TYPE (pval), size_rtx,
                   2082:                      TYPE_ALIGN (TREE_TYPE (pval)) / BITS_PER_UNIT, partial,
                   2083:                      reg, excess, argblock, ARGS_SIZE_RTX (arg->offset));
                   2084:     }
                   2085: 
                   2086: 
                   2087:   /* Unless this is a partially-in-register argument, the argument is now
                   2088:      in the stack. 
                   2089: 
                   2090:      ??? Note that this can change arg->value from arg->stack to
                   2091:      arg->stack_slot and it matters when they are not the same.
                   2092:      It isn't totally clear that this is correct in all cases.  */
                   2093:   if (partial == 0)
                   2094:     arg->value = arg->stack_slot;
                   2095: 
                   2096:   /* Once we have pushed something, pops can't safely
                   2097:      be deferred during the rest of the arguments.  */
                   2098:   NO_DEFER_POP;
                   2099: 
                   2100:   /* ANSI doesn't require a sequence point here,
                   2101:      but PCC has one, so this will avoid some problems.  */
                   2102:   emit_queue ();
                   2103: 
                   2104:   /* Free any temporary slots made in processing this argument.  */
                   2105:   free_temp_slots ();
                   2106: 
                   2107: #ifdef ACCUMULATE_OUTGOING_ARGS
                   2108:   /* Now mark the segment we just used.  */
                   2109:   if (argblock && ! variable_size && arg->stack)
                   2110:     for (i = lower_bound; i < upper_bound; i++)
                   2111:       stack_usage_map[i] = 1;
                   2112: #endif
                   2113: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.