Annotation of gcc/expr.c, revision 1.1.1.14

1.1       root        1: /* Convert tree expression to rtl instructions, for GNU compiler.
1.1.1.2   root        2:    Copyright (C) 1988 Free Software Foundation, Inc.
1.1       root        3: 
                      4: This file is part of GNU CC.
                      5: 
                      6: GNU CC is distributed in the hope that it will be useful,
                      7: but WITHOUT ANY WARRANTY.  No author or distributor
                      8: accepts responsibility to anyone for the consequences of using it
                      9: or for whether it serves any particular purpose or works at all,
                     10: unless he says so in writing.  Refer to the GNU CC General Public
                     11: License for full details.
                     12: 
                     13: Everyone is granted permission to copy, modify and redistribute
                     14: GNU CC, but only under the conditions described in the
                     15: GNU CC General Public License.   A copy of this license is
                     16: supposed to have been given to you along with GNU CC so you
                     17: can know your rights and responsibilities.  It should be in a
                     18: file named COPYING.  Among other things, the copyright notice
                     19: and this notice must be preserved on all copies.  */
                     20: 
                     21: 
                     22: #include "config.h"
                     23: #include "rtl.h"
                     24: #include "tree.h"
1.1.1.2   root       25: #include "flags.h"
1.1       root       26: #include "insn-flags.h"
                     27: #include "insn-codes.h"
                     28: #include "expr.h"
1.1.1.2   root       29: #include "insn-config.h"
                     30: #include "recog.h"
                     31: #include "varargs.h"
                     32: 
                     33: /* Decide whether a function's arguments should be processed
                     34:    from first to last or from last to first.  */
                     35: 
                     36: #ifdef STACK_GROWS_DOWNWARD
                     37: #ifdef PUSH_ROUNDING
                     38: #define PUSH_ARGS_REVERSED     /* If it's last to first */
                     39: #endif
                     40: #endif
                     41: 
                     42: /* Like STACK_BOUNDARY but in units of bytes, not bits.  */
                     43: #define STACK_BYTES (STACK_BOUNDARY / BITS_PER_UNIT)
1.1       root       44: 
                     45: /* If this is nonzero, we do not bother generating VOLATILE
                     46:    around volatile memory references, and we are willing to
                     47:    output indirect addresses.  If cse is to follow, we reject
                     48:    indirect addresses so a useful potential cse is generated;
                     49:    if it is used only once, instruction combination will produce
                     50:    the same indirect address eventually.  */
                     51: int cse_not_expected;
                     52: 
                     53: /* Nonzero to generate code for all the subroutines within an
                     54:    expression before generating the upper levels of the expression.
                     55:    Nowadays this is never zero.  */
                     56: int do_preexpand_calls = 1;
                     57: 
                     58: /* Number of units that we should eventually pop off the stack.
                     59:    These are the arguments to function calls that have already returned.  */
                     60: int pending_stack_adjust;
                     61: 
                     62: /* Total size of arguments already pushed for function calls that
1.1.1.6   root       63:    have not happened yet.  When this is nonzero,
1.1       root       64:    args passed to function calls must be popped right away
1.1.1.6   root       65:    to ensure contiguity of argument lists for future calls.
                     66: 
                     67:    This can also be temporarily incremented for various other reasons
                     68:    to inhibit deferring of pops.  */
1.1.1.2   root       69: static int current_args_size;
1.1       root       70: 
1.1.1.6   root       71: #define NO_DEFER_POP current_args_size += 1
                     72: #define OK_DEFER_POP current_args_size -= 1
                     73: 
1.1.1.13  root       74: /* A list of all cleanups which belong to the arguments of
1.1.1.8   root       75:    function calls being expanded by expand_call.  */
                     76: static tree cleanups_of_this_call;
                     77: 
1.1.1.2   root       78: /* Nonzero means current function may call alloca.  */
                     79: int may_call_alloca;
                     80: 
                     81: rtx store_expr ();
                     82: static void store_constructor ();
                     83: static rtx store_field ();
1.1       root       84: static rtx expand_call ();
1.1.1.2   root       85: static void emit_call_1 ();
                     86: static rtx prepare_call_address ();
                     87: static rtx expand_builtin ();
1.1       root       88: static rtx compare ();
1.1.1.2   root       89: static rtx compare_constants ();
1.1       root       90: static rtx compare1 ();
                     91: static rtx do_store_flag ();
                     92: static void preexpand_calls ();
1.1.1.2   root       93: static rtx expand_increment ();
                     94: static void move_by_pieces_1 ();
1.1.1.4   root       95: static int move_by_pieces_ninsns ();
1.1.1.2   root       96: static void init_queue ();
1.1.1.9   root       97: static void store_one_arg ();
                     98: static rtx target_for_arg ();
1.1.1.2   root       99: 
                    100: void do_pending_stack_adjust ();
1.1       root      101: 
                    102: /* MOVE_RATIO is the number of move instructions that is better than
                    103:    a block move.  */
                    104: 
1.1.1.10  root      105: #ifndef MOVE_RATIO
                    106: #if defined (HAVE_movstrqi) || defined (HAVE_movstrhi) || defined (HAVE_movstrsi)
1.1       root      107: #define MOVE_RATIO 2
                    108: #else
1.1.1.10  root      109: /* A value of around 6 would minimize code size; infinity would minimize
                    110:    execution time.  */
                    111: #define MOVE_RATIO 15
                    112: #endif
1.1       root      113: #endif
                    114: 
                    115: /* Table indexed by tree code giving 1 if the code is for a
                    116:    comparison operation, or anything that is most easily
                    117:    computed with a conditional branch.
                    118: 
                    119:    We include tree.def to give it the proper length.
                    120:    The contents thus created are irrelevant.
                    121:    The real contents are initialized in init_comparisons.  */
                    122: 
1.1.1.2   root      123: #define DEFTREECODE(SYM, NAME, TYPE, LENGTH) 0,
1.1       root      124: 
                    125: static char comparison_code[] = {
                    126: #include "tree.def"
                    127: };
                    128: #undef DEFTREECODE
                    129: 
1.1.1.2   root      130: /* This is run once per compilation.  */
                    131: 
                    132: void
1.1       root      133: init_comparisons ()
                    134: {
                    135:   comparison_code[(int) EQ_EXPR] = 1;
                    136:   comparison_code[(int) NE_EXPR] = 1;
                    137:   comparison_code[(int) LT_EXPR] = 1;
                    138:   comparison_code[(int) GT_EXPR] = 1;
                    139:   comparison_code[(int) LE_EXPR] = 1;
                    140:   comparison_code[(int) GE_EXPR] = 1;
                    141: }
1.1.1.2   root      142: 
                    143: /* This is run at the start of compiling a function.  */
                    144: 
                    145: void
                    146: init_expr ()
                    147: {
                    148:   init_queue ();
                    149:   may_call_alloca = 0;
                    150: }
1.1       root      151: 
                    152: /* Manage the queue of increment instructions to be output
                    153:    for POSTINCREMENT_EXPR expressions, etc.  */
                    154: 
                    155: static rtx pending_chain;
                    156: 
                    157: /* Queue up to increment (or change) VAR later.  BODY says how:
                    158:    BODY should be the same thing you would pass to emit_insn
                    159:    to increment right away.  It will go to emit_insn later on.
                    160: 
                    161:    The value is a QUEUED expression to be used in place of VAR
1.1.1.2   root      162:    where you want to guarantee the pre-incrementation value of VAR.  */
1.1       root      163: 
                    164: static rtx
                    165: enqueue_insn (var, body)
                    166:      rtx var, body;
                    167: {
                    168:   pending_chain = gen_rtx (QUEUED, GET_MODE (var),
                    169:                           var, 0, 0, body, pending_chain);
                    170:   return pending_chain;
                    171: }
                    172: 
                    173: /* Use protect_from_queue to convert a QUEUED expression
                    174:    into something that you can put immediately into an instruction.
                    175:    If the queued incrementation has not happened yet,
                    176:    protect_from_queue returns the variable itself.
                    177:    If the incrementation has happened, protect_from_queue returns a temp
                    178:    that contains a copy of the old value of the variable.
                    179: 
                    180:    Any time an rtx which might possibly be a QUEUED is to be put
                    181:    into an instruction, it must be passed through protect_from_queue first.
                    182:    QUEUED expressions are not meaningful in instructions.
                    183: 
                    184:    Do not pass a value through protect_from_queue and then hold
                    185:    on to it for a while before putting it in an instruction!
                    186:    If the queue is flushed in between, incorrect code will result.  */
                    187: 
                    188: rtx
                    189: protect_from_queue (x, modify)
                    190:      register rtx x;
                    191:      int modify;
                    192: {
                    193:   register RTX_CODE code = GET_CODE (x);
                    194:   if (code != QUEUED)
                    195:     {
                    196:       /* A special hack for read access to (MEM (QUEUED ...))
                    197:         to facilitate use of autoincrement.
                    198:         Make a copy of the contents of the memory location
                    199:         rather than a copy of the address.  */
                    200:       if (code == MEM && GET_CODE (XEXP (x, 0)) == QUEUED && !modify)
                    201:        {
                    202:          register rtx y = XEXP (x, 0);
                    203:          XEXP (x, 0) = QUEUED_VAR (y);
                    204:          if (QUEUED_INSN (y))
                    205:            {
                    206:              register rtx temp = gen_reg_rtx (GET_MODE (x));
                    207:              emit_insn_before (gen_move_insn (temp, x),
                    208:                                QUEUED_INSN (y));
                    209:              return temp;
                    210:            }
                    211:          return x;
                    212:        }
                    213:       /* Otherwise, recursively protect the subexpressions of all
                    214:         the kinds of rtx's that can contain a QUEUED.  */
                    215:       if (code == MEM)
                    216:        XEXP (x, 0) = protect_from_queue (XEXP (x, 0), 0);
                    217:       else if (code == PLUS || code == MULT)
                    218:        {
                    219:          XEXP (x, 0) = protect_from_queue (XEXP (x, 0), 0);
                    220:          XEXP (x, 1) = protect_from_queue (XEXP (x, 1), 0);
                    221:        }
                    222:       return x;
                    223:     }
                    224:   /* If the increment has not happened, use the variable itself.  */
                    225:   if (QUEUED_INSN (x) == 0)
                    226:     return QUEUED_VAR (x);
                    227:   /* If the increment has happened and a pre-increment copy exists,
                    228:      use that copy.  */
                    229:   if (QUEUED_COPY (x) != 0)
                    230:     return QUEUED_COPY (x);
                    231:   /* The increment has happened but we haven't set up a pre-increment copy.
                    232:      Set one up now, and use it.  */
                    233:   QUEUED_COPY (x) = gen_reg_rtx (GET_MODE (QUEUED_VAR (x)));
                    234:   emit_insn_before (gen_move_insn (QUEUED_COPY (x), QUEUED_VAR (x)),
                    235:                    QUEUED_INSN (x));
                    236:   return QUEUED_COPY (x);
                    237: }
                    238: 
1.1.1.2   root      239: /* Return nonzero if X contains a QUEUED expression:
                    240:    if it contains anything that will be altered by a queued increment.  */
                    241: 
                    242: static int
                    243: queued_subexp_p (x)
                    244:      rtx x;
                    245: {
                    246:   register enum rtx_code code = GET_CODE (x);
                    247:   switch (code)
                    248:     {
                    249:     case QUEUED:
                    250:       return 1;
                    251:     case MEM:
                    252:       return queued_subexp_p (XEXP (x, 0));
                    253:     case MULT:
                    254:     case PLUS:
                    255:     case MINUS:
                    256:       return queued_subexp_p (XEXP (x, 0))
                    257:        || queued_subexp_p (XEXP (x, 1));
                    258:     }
                    259:   return 0;
                    260: }
                    261: 
                    262: /* Perform all the pending incrementations.  */
1.1       root      263: 
                    264: void
                    265: emit_queue ()
                    266: {
                    267:   register rtx p;
                    268:   while (p = pending_chain)
                    269:     {
                    270:       QUEUED_INSN (p) = emit_insn (QUEUED_BODY (p));
                    271:       pending_chain = QUEUED_NEXT (p);
                    272:     }
                    273: }
                    274: 
1.1.1.2   root      275: static void
1.1       root      276: init_queue ()
                    277: {
                    278:   if (pending_chain)
                    279:     abort ();
                    280: }
                    281: 
                    282: /* Copy data from FROM to TO, where the machine modes are not the same.
                    283:    Both modes may be integer, or both may be floating.
                    284:    UNSIGNEDP should be nonzero if FROM is an unsigned type.
                    285:    This causes zero-extension instead of sign-extension.  */
                    286: 
                    287: void
                    288: convert_move (to, from, unsignedp)
                    289:      register rtx to, from;
                    290:      int unsignedp;
                    291: {
                    292:   enum machine_mode to_mode = GET_MODE (to);
                    293:   enum machine_mode from_mode = GET_MODE (from);
                    294:   int to_real = to_mode == SFmode || to_mode == DFmode;
                    295:   int from_real = from_mode == SFmode || from_mode == DFmode;
                    296:   int extending = (int) to_mode > (int) from_mode;
                    297: 
                    298:   to = protect_from_queue (to, 1);
                    299:   from = protect_from_queue (from, 0);
                    300: 
                    301:   if (to_real != from_real)
                    302:     abort ();
                    303: 
1.1.1.2   root      304:   if (to_mode == from_mode
                    305:       || (from_mode == VOIDmode && CONSTANT_P (from)))
1.1       root      306:     {
                    307:       emit_move_insn (to, from);
                    308:       return;
                    309:     }
                    310: 
                    311:   if (to_real)
                    312:     {
                    313: #ifdef HAVE_extendsfdf2
                    314:       if (HAVE_extendsfdf2 && extending)
                    315:        {
1.1.1.2   root      316:          emit_unop_insn (CODE_FOR_extendsfdf2, to, from, UNKNOWN);
1.1       root      317:          return;
                    318:        }
                    319: #endif
                    320: #ifdef HAVE_truncdfsf2
                    321:       if (HAVE_truncdfsf2 && ! extending)
                    322:        {
1.1.1.2   root      323:          emit_unop_insn (CODE_FOR_truncdfsf2, to, from, UNKNOWN);
1.1       root      324:          return;
                    325:        }
                    326: #endif
                    327:       emit_library_call (gen_rtx (SYMBOL_REF, Pmode, (extending
1.1.1.13  root      328:                                                      ? "__extendsfdf2"
                    329:                                                      : "__truncdfsf2")),
1.1.1.2   root      330:                         GET_MODE (to), 1,
                    331:                         from,  (extending ? SFmode : DFmode));
                    332:       emit_move_insn (to, hard_libcall_value (GET_MODE (to)));
1.1       root      333:       return;
                    334:     }
                    335: 
1.1.1.2   root      336:   /* Now both modes are integers.  */
                    337: 
1.1       root      338:   if (to_mode == DImode)
                    339:     {
                    340:       if (unsignedp)
                    341:        {
1.1.1.14! root      342: #ifdef HAVE_zero_extendsidi2
        !           343:          if (HAVE_zero_extendsidi2 && from_mode == SImode)
        !           344:            emit_unop_insn (CODE_FOR_zero_extendsidi2, to, from, ZERO_EXTEND);
        !           345:          else
        !           346: #endif
        !           347: #ifdef HAVE_zero_extendhidi2
        !           348:          if (HAVE_zero_extendhidi2 && from_mode == HImode)
        !           349:            emit_unop_insn (CODE_FOR_zero_extendhidi2, to, from, ZERO_EXTEND);
        !           350:          else
        !           351: #endif
        !           352: #ifdef HAVE_zero_extendqidi2
        !           353:          if (HAVE_zero_extendqidi2 && from_mode == QImode)
        !           354:            emit_unop_insn (CODE_FOR_zero_extendqidi2, to, from, ZERO_EXTEND);
        !           355:          else
        !           356: #endif
        !           357: #ifdef HAVE_zero_extendsidi2
        !           358:          if (HAVE_zero_extendsidi2)
        !           359:            {
        !           360:              convert_move (gen_lowpart (SImode, to), from, unsignedp);
        !           361:              emit_unop_insn (CODE_FOR_zero_extendsidi2, to, to, ZERO_EXTEND);
        !           362:            }
        !           363:          else
        !           364: #endif
        !           365:            {
        !           366:              emit_insn (gen_rtx (CLOBBER, VOIDmode, to));
        !           367:              convert_move (gen_lowpart (SImode, to), from, unsignedp);
        !           368:              emit_clr_insn (gen_highpart (SImode, to));
        !           369:            }
1.1       root      370:        }
1.1.1.5   root      371: #ifdef HAVE_extendsidi2
1.1.1.14! root      372:       else if (HAVE_extendsidi2 && from_mode == SImode)
        !           373:        emit_unop_insn (CODE_FOR_extendsidi2, to, from, SIGN_EXTEND);
        !           374: #endif
        !           375: #ifdef HAVE_extendhidi2
        !           376:       else if (HAVE_extendhidi2 && from_mode == HImode)
        !           377:        emit_unop_insn (CODE_FOR_extendhidi2, to, from, SIGN_EXTEND);
        !           378: #endif
        !           379: #ifdef HAVE_extendqidi2
        !           380:       else if (HAVE_extendqidi2 && from_mode == QImode)
        !           381:        emit_unop_insn (CODE_FOR_extendqidi2, to, from, SIGN_EXTEND);
        !           382: #endif
        !           383: #ifdef HAVE_extendsidi2
1.1.1.5   root      384:       else if (HAVE_extendsidi2)
1.1.1.14! root      385:        {
        !           386:          convert_move (gen_lowpart (SImode, to), from, unsignedp);
        !           387:          emit_unop_insn (CODE_FOR_extendsidi2, to, to, SIGN_EXTEND);
        !           388:        }
1.1.1.5   root      389: #endif
1.1.1.2   root      390: #ifdef HAVE_slt
                    391:       else if (HAVE_slt && insn_operand_mode[(int) CODE_FOR_slt][0] == SImode)
1.1       root      392:        {
1.1.1.5   root      393:          emit_insn (gen_rtx (CLOBBER, VOIDmode, to));
1.1       root      394:          convert_move (gen_lowpart (SImode, to), from, unsignedp);
1.1.1.2   root      395:          emit_insn (gen_slt (gen_highpart (SImode, to)));
1.1       root      396:        }
                    397: #endif
                    398:       else
                    399:        {
                    400:          register rtx label = gen_label_rtx ();
                    401: 
1.1.1.5   root      402:          emit_insn (gen_rtx (CLOBBER, VOIDmode, to));
1.1       root      403:          emit_clr_insn (gen_highpart (SImode, to));
                    404:          convert_move (gen_lowpart (SImode, to), from, unsignedp);
                    405:          emit_cmp_insn (gen_lowpart (SImode, to),
                    406:                         gen_rtx (CONST_INT, VOIDmode, 0),
1.1.1.14! root      407:                         0, 0, 0);
1.1.1.6   root      408:          NO_DEFER_POP;
1.1       root      409:          emit_jump_insn (gen_bge (label));
                    410:          expand_unop (SImode, one_cmpl_optab,
                    411:                       gen_highpart (SImode, to), gen_highpart (SImode, to),
                    412:                       1);
                    413:          emit_label (label);
1.1.1.6   root      414:          OK_DEFER_POP;
1.1       root      415:        }
                    416:       return;
                    417:     }
                    418: 
                    419:   if (from_mode == DImode)
                    420:     {
                    421:       convert_move (to, gen_lowpart (SImode, from), 0);
                    422:       return;
                    423:     }
                    424: 
                    425:   /* Now follow all the conversions between integers
                    426:      no more than a word long.  */
                    427: 
1.1.1.2   root      428:   /* For truncation, usually we can just refer to FROM in a narrower mode.  */
                    429:   if (GET_MODE_BITSIZE (to_mode) < GET_MODE_BITSIZE (from_mode)
                    430:       && TRULY_NOOP_TRUNCATION (GET_MODE_BITSIZE (to_mode),
                    431:                                GET_MODE_BITSIZE (from_mode))
                    432:       && ((GET_CODE (from) == MEM
                    433:           && ! mode_dependent_address_p (XEXP (from, 0)))
                    434:          || GET_CODE (from) == REG))
                    435:     {
                    436:       emit_move_insn (to, gen_lowpart (to_mode, from));
                    437:       return;
                    438:     }
                    439: 
1.1       root      440:   if (to_mode == SImode && from_mode == HImode)
                    441:     {
                    442:       if (unsignedp)
                    443:        {
                    444: #ifdef HAVE_zero_extendhisi2
                    445:          if (HAVE_zero_extendhisi2)
1.1.1.2   root      446:            emit_unop_insn (CODE_FOR_zero_extendhisi2, to, from, ZERO_EXTEND);
1.1       root      447:          else
                    448: #endif
                    449:            abort ();
                    450:        }
                    451:       else
                    452:        {
                    453: #ifdef HAVE_extendhisi2
                    454:          if (HAVE_extendhisi2)
1.1.1.2   root      455:            emit_unop_insn (CODE_FOR_extendhisi2, to, from, SIGN_EXTEND);
1.1       root      456:          else
                    457: #endif
                    458:            abort ();
                    459:        }
                    460:       return;
                    461:     }
                    462: 
                    463:   if (to_mode == SImode && from_mode == QImode)
                    464:     {
                    465:       if (unsignedp)
                    466:        {
                    467: #ifdef HAVE_zero_extendqisi2
                    468:          if (HAVE_zero_extendqisi2)
                    469:            {
1.1.1.2   root      470:              emit_unop_insn (CODE_FOR_zero_extendqisi2, to, from, ZERO_EXTEND);
1.1       root      471:              return;
                    472:            }
                    473: #endif
                    474: #if defined (HAVE_zero_extendqihi2) && defined (HAVE_extendhisi2)
                    475:          if (HAVE_zero_extendqihi2 && HAVE_extendhisi2)
                    476:            {
                    477:              register rtx temp = gen_reg_rtx (HImode);
1.1.1.2   root      478:              emit_unop_insn (CODE_FOR_zero_extendqihi2, temp, from, ZERO_EXTEND);
                    479:              emit_unop_insn (CODE_FOR_extendhisi2, to, temp, SIGN_EXTEND);
1.1       root      480:              return;
                    481:            }
                    482: #endif
                    483:        }
                    484:       else
                    485:        {
                    486: #ifdef HAVE_extendqisi2
                    487:          if (HAVE_extendqisi2)
                    488:            {
1.1.1.2   root      489:              emit_unop_insn (CODE_FOR_extendqisi2, to, from, SIGN_EXTEND);
1.1       root      490:              return;
                    491:            }
                    492: #endif
                    493: #if defined (HAVE_extendqihi2) && defined (HAVE_extendhisi2)
                    494:          if (HAVE_extendqihi2 && HAVE_extendhisi2)
                    495:            {
                    496:              register rtx temp = gen_reg_rtx (HImode);
1.1.1.2   root      497:              emit_unop_insn (CODE_FOR_extendqihi2, temp, from, SIGN_EXTEND);
                    498:              emit_unop_insn (CODE_FOR_extendhisi2, to, temp, SIGN_EXTEND);
1.1       root      499:              return;
                    500:            }
                    501: #endif
                    502:        }
                    503:       abort ();
                    504:     }
                    505: 
                    506:   if (to_mode == HImode && from_mode == QImode)
                    507:     {
                    508:       if (unsignedp)
                    509:        {
                    510: #ifdef HAVE_zero_extendqihi2
                    511:          if (HAVE_zero_extendqihi2)
                    512:            {
1.1.1.2   root      513:              emit_unop_insn (CODE_FOR_zero_extendqihi2, to, from, ZERO_EXTEND);
1.1       root      514:              return;
                    515:            }
                    516: #endif
                    517:        }
                    518:       else
                    519:        {
                    520: #ifdef HAVE_extendqihi2
                    521:          if (HAVE_extendqihi2)
                    522:            {
1.1.1.2   root      523:              emit_unop_insn (CODE_FOR_extendqihi2, to, from, SIGN_EXTEND);
1.1       root      524:              return;
                    525:            }
                    526: #endif
                    527:        }
                    528:       abort ();
                    529:     }
                    530: 
                    531:   /* Now we are truncating an integer to a smaller one.
                    532:      If the result is a temporary, we might as well just copy it,
                    533:      since only the low-order part of the result needs to be valid
                    534:      and it is valid with no change.  */
                    535: 
                    536:   if (GET_CODE (to) == REG)
                    537:     {
                    538:       if (GET_CODE (from) == REG)
                    539:        {
                    540:          emit_move_insn (to, gen_lowpart (GET_MODE (to), from));
                    541:          return;
                    542:        }
1.1.1.2   root      543:       else if (GET_CODE (from) == SUBREG)
                    544:        {
                    545:          from = copy_rtx (from);
                    546:          /* This is safe since FROM is not more than one word.  */
                    547:          PUT_MODE (from, GET_MODE (to));
                    548:          emit_move_insn (to, from);
                    549:          return;
                    550:        }
1.1       root      551: #ifndef BYTES_BIG_ENDIAN
                    552:       else if (GET_CODE (from) == MEM)
                    553:        {
                    554:          register rtx addr = XEXP (from, 0);
1.1.1.2   root      555:          if (memory_address_p (GET_MODE (to), addr))
1.1       root      556:            {
                    557:              emit_move_insn (to, gen_rtx (MEM, GET_MODE (to), addr));
                    558:              return;
                    559:            }
                    560:        }
                    561: #endif /* not BYTES_BIG_ENDIAN */
                    562:     }
                    563: 
                    564:   if (from_mode == SImode && to_mode == HImode)
                    565:     {
                    566: #ifdef HAVE_truncsihi2
                    567:       if (HAVE_truncsihi2)
                    568:        {
1.1.1.2   root      569:          emit_unop_insn (CODE_FOR_truncsihi2, to, from, UNKNOWN);
1.1       root      570:          return;
                    571:        }
                    572: #endif
                    573:       abort ();
                    574:     }
                    575: 
                    576:   if (from_mode == SImode && to_mode == QImode)
                    577:     {
                    578: #ifdef HAVE_truncsiqi2
                    579:       if (HAVE_truncsiqi2)
                    580:        {
1.1.1.2   root      581:          emit_unop_insn (CODE_FOR_truncsiqi2, to, from, UNKNOWN);
1.1       root      582:          return;
                    583:        }
                    584: #endif
                    585:       abort ();
                    586:     }
                    587: 
                    588:   if (from_mode == HImode && to_mode == QImode)
                    589:     {
                    590: #ifdef HAVE_trunchiqi2
                    591:       if (HAVE_trunchiqi2)
                    592:        {
1.1.1.2   root      593:          emit_unop_insn (CODE_FOR_trunchiqi2, to, from, UNKNOWN);
1.1       root      594:          return;
                    595:        }
                    596: #endif
                    597:       abort ();
                    598:     }
1.1.1.2   root      599: 
                    600:   /* Mode combination is not recognized.  */
                    601:   abort ();
1.1       root      602: }
                    603: 
                    604: /* Return an rtx for a value that would result
                    605:    from converting X to mode MODE.
                    606:    Both X and MODE may be floating, or both integer.
                    607:    UNSIGNEDP is nonzero if X is an unsigned value.
                    608:    This can be done by referring to a part of X in place
                    609:    or by copying to a new temporary with conversion.  */
                    610: 
                    611: rtx
                    612: convert_to_mode (mode, x, unsignedp)
                    613:      enum machine_mode mode;
                    614:      rtx x;
                    615:      int unsignedp;
                    616: {
                    617:   register rtx temp;
                    618:   if (mode == GET_MODE (x))
                    619:     return x;
1.1.1.2   root      620:   if (integer_mode_p (mode)
                    621:       && GET_MODE_SIZE (mode) <= GET_MODE_SIZE (GET_MODE (x)))
1.1       root      622:     return gen_lowpart (mode, x);
                    623:   temp = gen_reg_rtx (mode);
                    624:   convert_move (temp, x, unsignedp);
                    625:   return temp;
                    626: }
1.1.1.2   root      627: 
                    628: int
                    629: integer_mode_p (mode)
                    630:      enum machine_mode mode;
                    631: {
                    632:   return (int) mode > (int) VOIDmode && (int) mode <= (int) TImode;
                    633: }
1.1       root      634: 
                    635: /* Generate several move instructions to copy LEN bytes
1.1.1.2   root      636:    from block FROM to block TO.  (These are MEM rtx's with BLKmode).
                    637:    The caller must pass FROM and TO
1.1       root      638:     through protect_from_queue before calling.
                    639:    ALIGN (in bytes) is maximum alignment we can assume.  */
                    640: 
                    641: struct move_by_pieces
                    642: {
                    643:   rtx to;
1.1.1.2   root      644:   rtx to_addr;
1.1       root      645:   int autinc_to;
                    646:   int explicit_inc_to;
                    647:   rtx from;
1.1.1.2   root      648:   rtx from_addr;
1.1       root      649:   int autinc_from;
                    650:   int explicit_inc_from;
                    651:   int len;
                    652:   int offset;
                    653:   int reverse;
                    654: };
                    655: 
                    656: static void
1.1.1.2   root      657: move_by_pieces (to, from, len, align)
1.1       root      658:      rtx to, from;
                    659:      int len, align;
                    660: {
                    661:   struct move_by_pieces data;
1.1.1.2   root      662:   rtx to_addr = XEXP (to, 0), from_addr = XEXP (from, 0);
1.1       root      663: 
                    664:   data.offset = 0;
1.1.1.2   root      665:   data.to_addr = to_addr;
                    666:   data.from_addr = from_addr;
1.1       root      667:   data.to = to;
                    668:   data.from = from;
1.1.1.2   root      669:   data.autinc_to
                    670:     = (GET_CODE (to_addr) == PRE_INC || GET_CODE (to_addr) == PRE_DEC
                    671:        || GET_CODE (to_addr) == POST_INC || GET_CODE (to_addr) == POST_DEC);
                    672:   data.autinc_from
                    673:     = (GET_CODE (from_addr) == PRE_INC || GET_CODE (from_addr) == PRE_DEC
                    674:        || GET_CODE (from_addr) == POST_INC
                    675:        || GET_CODE (from_addr) == POST_DEC);
1.1       root      676: 
                    677:   data.explicit_inc_from = 0;
                    678:   data.explicit_inc_to = 0;
1.1.1.2   root      679:   data.reverse
                    680:     = (GET_CODE (to_addr) == PRE_DEC || GET_CODE (to_addr) == POST_DEC);
1.1       root      681:   if (data.reverse) data.offset = len;
                    682:   data.len = len;
                    683: 
                    684:   /* If copying requires more than two move insns,
                    685:      copy addresses to registers (to make displacements shorter)
                    686:      and use post-increment if available.  */
                    687:   if (!(data.autinc_from && data.autinc_to)
                    688:       && move_by_pieces_ninsns (len, align) > 2)
                    689:     {
                    690: #ifdef HAVE_PRE_DECREMENT
                    691:       if (data.reverse && ! data.autinc_from)
                    692:        {
1.1.1.2   root      693:          data.from_addr = copy_addr_to_reg (plus_constant (from_addr, len));
1.1       root      694:          data.autinc_from = 1;
                    695:          data.explicit_inc_from = -1;
                    696:        }
                    697: #endif
                    698: #ifdef HAVE_POST_INCREMENT
                    699:       if (! data.autinc_from)
                    700:        {
1.1.1.2   root      701:          data.from_addr = copy_addr_to_reg (from_addr);
1.1       root      702:          data.autinc_from = 1;
                    703:          data.explicit_inc_from = 1;
                    704:        }
                    705: #endif
1.1.1.2   root      706:       if (!data.autinc_from && CONSTANT_P (from_addr))
                    707:        data.from_addr = copy_addr_to_reg (from_addr);
1.1       root      708: #ifdef HAVE_PRE_DECREMENT
                    709:       if (data.reverse && ! data.autinc_to)
                    710:        {
1.1.1.2   root      711:          data.to_addr = copy_addr_to_reg (plus_constant (to_addr, len));
1.1       root      712:          data.autinc_to = 1;
                    713:          data.explicit_inc_to = -1;
                    714:        }
                    715: #endif
                    716: #ifdef HAVE_POST_INCREMENT
                    717:       if (! data.reverse && ! data.autinc_to)
                    718:        {
1.1.1.2   root      719:          data.to_addr = copy_addr_to_reg (to_addr);
1.1       root      720:          data.autinc_to = 1;
                    721:          data.explicit_inc_to = 1;
                    722:        }
                    723: #endif
1.1.1.2   root      724:       if (!data.autinc_to && CONSTANT_P (to_addr))
                    725:        data.to_addr = copy_addr_to_reg (to_addr);
1.1       root      726:     }
                    727: 
                    728: #ifdef STRICT_ALIGNMENT
1.1.1.2   root      729:   if (align > MOVE_MAX || align >= BIGGEST_ALIGNMENT / BITS_PER_UNIT)
1.1       root      730:     align = MOVE_MAX;
                    731: #else
                    732:   align = MOVE_MAX;
                    733: #endif
                    734: 
                    735: #ifdef HAVE_movti
                    736:   if (HAVE_movti && align >= GET_MODE_SIZE (TImode))
                    737:     move_by_pieces_1 (gen_movti, TImode, &data);
                    738: #endif
                    739: #ifdef HAVE_movdi
                    740:   if (HAVE_movdi && align >= GET_MODE_SIZE (DImode))
                    741:     move_by_pieces_1 (gen_movdi, DImode, &data);
                    742: #endif
1.1.1.2   root      743: #ifdef HAVE_movsi
1.1       root      744:   if (align >= GET_MODE_SIZE (SImode))
                    745:     move_by_pieces_1 (gen_movsi, SImode, &data);
1.1.1.2   root      746: #endif
                    747: #ifdef HAVE_movhi
                    748:   if (HAVE_movhi && align >= GET_MODE_SIZE (HImode))
1.1       root      749:     move_by_pieces_1 (gen_movhi, HImode, &data);
1.1.1.2   root      750: #endif
                    751: #ifdef HAVE_movqi
1.1       root      752:   move_by_pieces_1 (gen_movqi, QImode, &data);
1.1.1.2   root      753: #else
                    754:   movqi instruction required in machine description
                    755: #endif
1.1       root      756: }
                    757: 
                    758: /* Return number of insns required to move L bytes by pieces.
                    759:    ALIGN (in bytes) is maximum alignment we can assume.  */
                    760: 
1.1.1.2   root      761: static int
1.1       root      762: move_by_pieces_ninsns (l, align)
                    763:      unsigned int l;
                    764:      int align;
                    765: {
                    766:   register int n_insns = 0;
                    767: 
                    768: #ifdef STRICT_ALIGNMENT
1.1.1.2   root      769:   if (align > MOVE_MAX || align >= BIGGEST_ALIGNMENT / BITS_PER_UNIT)
1.1       root      770:     align = MOVE_MAX;
                    771: #else
                    772:   align = MOVE_MAX;
                    773: #endif
                    774: 
                    775: #ifdef HAVE_movti
                    776:   if (HAVE_movti && align >= GET_MODE_SIZE (TImode))
                    777:     n_insns += l / GET_MODE_SIZE (TImode), l %= GET_MODE_SIZE (TImode);
                    778: #endif
                    779: #ifdef HAVE_movdi
                    780:   if (HAVE_movdi && align >= GET_MODE_SIZE (DImode))
                    781:     n_insns += l / GET_MODE_SIZE (DImode), l %= GET_MODE_SIZE (DImode);
                    782: #endif
1.1.1.2   root      783: #ifdef HAVE_movsi
1.1       root      784:   if (HAVE_movsi && align >= GET_MODE_SIZE (SImode))
                    785:     n_insns += l / GET_MODE_SIZE (SImode), l %= GET_MODE_SIZE (SImode);
1.1.1.2   root      786: #endif
                    787: #ifdef HAVE_movhi
1.1       root      788:   if (HAVE_movhi && align >= GET_MODE_SIZE (HImode))
                    789:     n_insns += l / GET_MODE_SIZE (HImode), l %= GET_MODE_SIZE (HImode);
1.1.1.2   root      790: #endif
1.1       root      791:   n_insns += l;
                    792: 
                    793:   return n_insns;
                    794: }
                    795: 
                    796: /* Subroutine of move_by_pieces.  Move as many bytes as appropriate
                    797:    with move instructions for mode MODE.  GENFUN is the gen_... function
                    798:    to make a move insn for that mode.  DATA has all the other info.  */
                    799: 
1.1.1.2   root      800: static void
1.1       root      801: move_by_pieces_1 (genfun, mode, data)
                    802:      rtx (*genfun) ();
                    803:      enum machine_mode mode;
                    804:      struct move_by_pieces *data;
                    805: {
                    806:   register int size = GET_MODE_SIZE (mode);
                    807:   register rtx to1, from1;
                    808: 
                    809:   while (data->len >= size)
                    810:     {
1.1.1.2   root      811:       if (data->reverse) data->offset -= size;
1.1       root      812: 
1.1.1.13  root      813:       to1 = (data->autinc_to
                    814:             ? gen_rtx (MEM, mode, data->to_addr)
                    815:             : change_address (data->to, mode,
                    816:                               plus_constant (data->to_addr, data->offset)));
                    817:       from1 =
                    818:        (data->autinc_from
                    819:         ? gen_rtx (MEM, mode, data->from_addr)
                    820:         : change_address (data->from, mode,
                    821:                           plus_constant (data->from_addr, data->offset)));
1.1       root      822: 
                    823: #ifdef HAVE_PRE_DECREMENT
                    824:       if (data->explicit_inc_to < 0)
1.1.1.2   root      825:        emit_insn (gen_sub2_insn (data->to_addr,
1.1       root      826:                                  gen_rtx (CONST_INT, VOIDmode, size)));
                    827:       if (data->explicit_inc_from < 0)
1.1.1.2   root      828:        emit_insn (gen_sub2_insn (data->from_addr,
1.1       root      829:                                  gen_rtx (CONST_INT, VOIDmode, size)));
                    830: #endif
                    831: 
1.1.1.5   root      832:       emit_insn ((*genfun) (to1, from1));
1.1       root      833: #ifdef HAVE_POST_INCREMENT
                    834:       if (data->explicit_inc_to > 0)
1.1.1.2   root      835:        emit_insn (gen_add2_insn (data->to_addr,
1.1       root      836:                                  gen_rtx (CONST_INT, VOIDmode, size)));
                    837:       if (data->explicit_inc_from > 0)
1.1.1.2   root      838:        emit_insn (gen_add2_insn (data->from_addr,
1.1       root      839:                                  gen_rtx (CONST_INT, VOIDmode, size)));
                    840: #endif
                    841: 
                    842:       if (! data->reverse) data->offset += size;
1.1.1.2   root      843: 
1.1       root      844:       data->len -= size;
                    845:     }
                    846: }
                    847: 
                    848: /* Emit code to move a block Y to a block X.
                    849:    This may be done with string-move instructions,
                    850:    with multiple scalar move instructions, or with a library call.
                    851: 
                    852:    Both X and Y must be MEM rtx's (perhaps inside VOLATILE)
                    853:    with mode BLKmode.
                    854:    SIZE is an rtx that says how long they are.
                    855:    ALIGN is the maximum alignment we can assume they have,
                    856:    measured in bytes.  */
                    857: 
                    858: static void
                    859: emit_block_move (x, y, size, align)
                    860:      rtx x, y;
                    861:      rtx size;
                    862:      int align;
                    863: {
                    864:   if (GET_MODE (x) != BLKmode)
                    865:     abort ();
                    866: 
                    867:   if (GET_MODE (y) != BLKmode)
                    868:     abort ();
                    869: 
                    870:   x = protect_from_queue (x, 1);
                    871:   y = protect_from_queue (y, 0);
                    872: 
1.1.1.2   root      873:   if (GET_CODE (x) != MEM)
1.1       root      874:     abort ();
1.1.1.2   root      875:   if (GET_CODE (y) != MEM)
1.1       root      876:     abort ();
                    877:   if (size == 0)
                    878:     abort ();
                    879: 
                    880:   if (GET_CODE (size) == CONST_INT
                    881:       && (move_by_pieces_ninsns ((unsigned) INTVAL (size), align)
                    882:          < MOVE_RATIO))
1.1.1.2   root      883:     move_by_pieces (x, y, INTVAL (size), align);
1.1       root      884:   else
                    885:     {
1.1.1.9   root      886:       /* Try the most limited insn first, because there's no point
                    887:         including more than one in the machine description unless
                    888:         the more limited one has some advantage.  */
                    889: #ifdef HAVE_movstrqi
                    890:       if (HAVE_movstrqi
                    891:          && GET_CODE (size) == CONST_INT
                    892:          && ((unsigned) INTVAL (size)
                    893:              < (1 << (GET_MODE_BITSIZE (QImode) - 1))))
1.1       root      894:        {
1.1.1.14! root      895:          emit_insn (gen_movstrqi (x, y, size,
        !           896:                                   gen_rtx (CONST_INT, VOIDmode, align)));
1.1       root      897:          return;
                    898:        }
                    899: #endif
                    900: #ifdef HAVE_movstrhi
                    901:       if (HAVE_movstrhi
                    902:          && GET_CODE (size) == CONST_INT
                    903:          && ((unsigned) INTVAL (size)
1.1.1.5   root      904:              < (1 << (GET_MODE_BITSIZE (HImode) - 1))))
1.1       root      905:        {
1.1.1.14! root      906:          emit_insn (gen_movstrhi (x, y, size,
        !           907:                                   gen_rtx (CONST_INT, VOIDmode, align)));
1.1       root      908:          return;
                    909:        }
                    910: #endif
1.1.1.9   root      911: #ifdef HAVE_movstrsi
                    912:       if (HAVE_movstrsi)
1.1.1.5   root      913:        {
1.1.1.14! root      914:          emit_insn (gen_movstrsi (x, y, size,
        !           915:                                   gen_rtx (CONST_INT, VOIDmode, align)));
1.1.1.5   root      916:          return;
                    917:        }
                    918: #endif
1.1.1.2   root      919: 
                    920: #ifdef TARGET_MEM_FUNCTIONS
                    921:       emit_library_call (gen_rtx (SYMBOL_REF, Pmode, "memcpy"),
                    922:                         VOIDmode, 3, XEXP (x, 0), Pmode,
                    923:                         XEXP (y, 0), Pmode,
                    924:                         size, Pmode);
                    925: #else
1.1       root      926:       emit_library_call (gen_rtx (SYMBOL_REF, Pmode, "bcopy"),
1.1.1.2   root      927:                         VOIDmode, 3, XEXP (y, 0), Pmode,
                    928:                         XEXP (x, 0), Pmode,
1.1       root      929:                         size, Pmode);
1.1.1.2   root      930: #endif
                    931:     }
                    932: }
                    933: 
                    934: /* Copy all or part of a BLKmode value X into registers starting at REGNO.
                    935:    The number of registers to be filled is NREGS.  */
                    936: 
                    937: static void
                    938: move_block_to_reg (regno, x, nregs)
                    939:      int regno;
                    940:      rtx x;
                    941:      int nregs;
                    942: {
                    943:   int i;
                    944:   if (GET_CODE (x) == CONST_DOUBLE && x != dconst0_rtx)
                    945:     x = force_const_double_mem (x);
                    946:   for (i = 0; i < nregs; i++)
                    947:     {
                    948:       if (GET_CODE (x) == REG)
                    949:        emit_move_insn (gen_rtx (REG, SImode, regno + i),
                    950:                        gen_rtx (SUBREG, SImode, x, i));
                    951:       else if (x == dconst0_rtx)
                    952:        emit_move_insn (gen_rtx (REG, SImode, regno + i),
                    953:                        const0_rtx);
                    954:       else
                    955:        emit_move_insn (gen_rtx (REG, SImode, regno + i),
                    956:                        gen_rtx (MEM, SImode,
1.1.1.10  root      957:                                 memory_address (SImode,
                    958:                                                 plus_constant (XEXP (x, 0),
                    959:                                                                i * GET_MODE_SIZE (SImode)))));
1.1.1.2   root      960:     }
                    961: }
                    962: 
                    963: /* Copy all or part of a BLKmode value X out of registers starting at REGNO.
                    964:    The number of registers to be filled is NREGS.  */
                    965: 
                    966: void
                    967: move_block_from_reg (regno, x, nregs)
                    968:      int regno;
                    969:      rtx x;
                    970:      int nregs;
                    971: {
                    972:   int i;
                    973:   for (i = 0; i < nregs; i++)
                    974:     {
                    975:       if (GET_CODE (x) == REG)
                    976:        emit_move_insn (gen_rtx (SUBREG, SImode, x, i),
                    977:                        gen_rtx (REG, SImode, regno + i));
                    978:       else
                    979:        emit_move_insn (gen_rtx (MEM, SImode,
1.1.1.10  root      980:                                 memory_address (SImode,
                    981:                                                 plus_constant (XEXP (x, 0),
                    982:                                                                i * GET_MODE_SIZE (SImode)))),
1.1.1.2   root      983:                        gen_rtx (REG, SImode, regno + i));
1.1       root      984:     }
                    985: }
1.1.1.2   root      986: 
                    987: /* Mark NREGS consecutive regs, starting at REGNO, as being live now.  */
                    988: 
                    989: static void
                    990: use_regs (regno, nregs)
                    991:      int regno;
                    992:      int nregs;
                    993: {
                    994:   int i;
                    995:   for (i = 0; i < nregs; i++)
                    996:     emit_insn (gen_rtx (USE, VOIDmode, gen_rtx (REG, SImode, regno + i)));
                    997: }
1.1       root      998: 
1.1.1.2   root      999: /* Write zeros through the storage of OBJECT.
                   1000:    If OBJECT has BLKmode, SIZE is its length in bytes.  */
                   1001: 
                   1002: void
                   1003: clear_storage (object, size)
                   1004:      rtx object;
                   1005:      int size;
                   1006: {
                   1007:   if (GET_MODE (object) == BLKmode)
                   1008:     {
                   1009: #ifdef TARGET_MEM_FUNCTIONS
                   1010:       emit_library_call (gen_rtx (SYMBOL_REF, Pmode, "memset"),
                   1011:                         VOIDmode, 3,
                   1012:                         XEXP (object, 0), Pmode, const0_rtx, Pmode,
                   1013:                         gen_rtx (CONST_INT, VOIDmode, size), Pmode);
                   1014: #else
                   1015:       emit_library_call (gen_rtx (SYMBOL_REF, Pmode, "bzero"),
                   1016:                         VOIDmode, 2,
                   1017:                         XEXP (object, 0), Pmode,
                   1018:                         gen_rtx (CONST_INT, VOIDmode, size), Pmode);
                   1019: #endif
                   1020:     }
                   1021:   else
1.1.1.13  root     1022:     emit_move_insn (object, const0_rtx);
1.1.1.2   root     1023: }
                   1024: 
1.1       root     1025: /* Generate code to copy Y into X.
                   1026:    Both Y and X must have the same mode, except that
                   1027:    Y can be a constant with VOIDmode.
1.1.1.2   root     1028:    This mode cannot be BLKmode; use emit_block_move for that.
1.1       root     1029: 
1.1.1.2   root     1030:    Return the last instruction emitted.  */
                   1031: 
                   1032: rtx
1.1       root     1033: emit_move_insn (x, y)
                   1034:      rtx x, y;
                   1035: {
                   1036:   enum machine_mode mode = GET_MODE (x);
                   1037:   x = protect_from_queue (x, 1);
                   1038:   y = protect_from_queue (y, 0);
                   1039: 
1.1.1.3   root     1040:   if ((CONSTANT_P (y) || GET_CODE (y) == CONST_DOUBLE)
                   1041:       && ! LEGITIMATE_CONSTANT_P (y))
1.1.1.10  root     1042:     {
                   1043:       y = force_const_mem (mode, y);
                   1044:       if (! memory_address_p (mode, y))
                   1045:        y = gen_rtx (MEM, mode, memory_address (mode, XEXP (y, 0)));
                   1046:     }
1.1.1.2   root     1047: 
1.1       root     1048:   if (mode == BLKmode)
                   1049:     abort ();
1.1.1.2   root     1050:   if (mov_optab->handlers[(int) mode].insn_code != CODE_FOR_nothing)
1.1.1.6   root     1051:     return
1.1.1.2   root     1052:       emit_insn (GEN_FCN (mov_optab->handlers[(int) mode].insn_code) (x, y));
                   1053: #if 0
                   1054:   /* It turns out you get much better optimization (in cse and flow)
                   1055:      if you define movdi and movdf instruction patterns
                   1056:      even if they must turn into multiple assembler instructions.  */
1.1       root     1057:   else if (GET_MODE_SIZE (mode) >= GET_MODE_SIZE (SImode))
                   1058:     {
                   1059:       register int count = GET_MODE_SIZE (mode) / GET_MODE_SIZE (SImode);
                   1060:       register int i;
1.1.1.2   root     1061:       if (GET_CODE (y) == CONST_DOUBLE && y != dconst0_rtx)
                   1062:        y = force_const_double_mem (y);
1.1       root     1063:       for (i = 0; i < count; i++)
                   1064:        {
                   1065:          rtx x1, y1;
                   1066:          if (GET_CODE (x) == REG)
                   1067:            x1 = gen_rtx (SUBREG, SImode, x, i);
                   1068:          else
                   1069:            x1 = gen_rtx (MEM, SImode,
                   1070:                          memory_address (SImode,
                   1071:                                          plus_constant (XEXP (x, 0),
                   1072:                                                         i * GET_MODE_SIZE (SImode))));
                   1073:          if (GET_CODE (y) == REG)
                   1074:            y1 = gen_rtx (SUBREG, SImode, y, i);
1.1.1.2   root     1075:          else if (y == dconst0_rtx)
                   1076:            y1 = const0_rtx;
1.1       root     1077:          else
                   1078:            y1 = gen_rtx (MEM, SImode,
                   1079:                          memory_address (SImode,
                   1080:                                          plus_constant (XEXP (y, 0),
                   1081:                                                         i * GET_MODE_SIZE (SImode))));
                   1082:          emit_insn (gen_movsi (protect_from_queue (x1, 1), protect_from_queue (y1, 0)));
                   1083:        }
                   1084:     }
1.1.1.2   root     1085: #endif
1.1       root     1086:   else
                   1087:     abort ();
                   1088: }
                   1089: 
                   1090: /* Pushing data onto the stack.  */
                   1091: 
                   1092: /* Push a block of length SIZE (perhaps variable)
                   1093:    and return an rtx to address the beginning of the block.
1.1.1.4   root     1094:    Note that it is not possible for the value returned to be a QUEUED.
                   1095:    The value may be stack_pointer_rtx.
                   1096: 
1.1.1.7   root     1097:    The value we return does take account of STACK_POINTER_OFFSET.  */
1.1       root     1098: 
1.1.1.7   root     1099: rtx
1.1       root     1100: push_block (size)
                   1101:      rtx size;
                   1102: {
                   1103:   register rtx temp;
1.1.1.2   root     1104:   if (CONSTANT_P (size) || GET_CODE (size) == REG)
                   1105:     anti_adjust_stack (size);
                   1106:   else
                   1107:     anti_adjust_stack (copy_to_mode_reg (Pmode, size));
1.1.1.6   root     1108: 
1.1       root     1109: #ifdef STACK_GROWS_DOWNWARD
1.1.1.2   root     1110:   temp = stack_pointer_rtx;
1.1       root     1111: #else
                   1112:   temp = gen_rtx (PLUS, Pmode,
1.1.1.2   root     1113:                  stack_pointer_rtx,
1.1.1.11  root     1114:                  negate_rtx (Pmode, size));
1.1       root     1115:   if (GET_CODE (size) != CONST_INT)
                   1116:     temp = force_operand (temp, 0);
                   1117: #endif
1.1.1.7   root     1118: 
                   1119: #ifdef STACK_POINTER_OFFSET
                   1120:   temp = plus_constant (temp, STACK_POINTER_OFFSET);
                   1121: #endif /* STACK_POINTER_OFFSET */
                   1122: 
1.1       root     1123:   return memory_address (QImode, temp);
                   1124: }
                   1125: 
                   1126: static rtx
                   1127: gen_push_operand ()
                   1128: {
                   1129:   return gen_rtx (
                   1130: #ifdef STACK_GROWS_DOWNWARD
                   1131:                  PRE_DEC,
                   1132: #else
                   1133:                  PRE_INC,
                   1134: #endif
                   1135:                  Pmode,
1.1.1.2   root     1136:                  stack_pointer_rtx);
1.1       root     1137: }
                   1138: 
                   1139: /* Generate code to push X onto the stack, assuming it has mode MODE.
                   1140:    MODE is redundant except when X is a CONST_INT (since they don't
                   1141:    carry mode info).
                   1142:    SIZE is an rtx for the size of data to be copied (in bytes),
                   1143:    needed only if X is BLKmode.
1.1.1.13  root     1144: 
                   1145: 
                   1146: 
                   1147: 
                   1148: 
1.1.1.2   root     1149:    ALIGN (in bytes) is maximum alignment we can assume.
                   1150: 
                   1151:    If PARTIAL is nonzero, then copy that many of the first words
                   1152:    of X into registers starting with REG, and push the rest of X.
                   1153:    The amount of space pushed is decreased by PARTIAL words,
                   1154:    rounded *down* to a multiple of PARM_BOUNDARY.
                   1155:    REG must be a hard register in this case.
                   1156: 
                   1157:    EXTRA is the amount in bytes of extra space to leave next to this arg.
                   1158: 
                   1159:    On a machine that lacks real push insns, ARGS_ADDR is the address of
                   1160:    the bottom of the argument block for this call.  We use indexing off there
                   1161:    to store the arg.  On machines with push insns, ARGS_ADDR is 0.
                   1162: 
                   1163:    ARGS_SO_FAR is the size of args previously pushed for this call.  */
1.1       root     1164: 
                   1165: static void
1.1.1.2   root     1166: emit_push_insn (x, mode, size, align, partial, reg, extra, args_addr, args_so_far)
1.1       root     1167:      register rtx x;
                   1168:      enum machine_mode mode;
                   1169:      rtx size;
                   1170:      int align;
1.1.1.2   root     1171:      int partial;
                   1172:      rtx reg;
                   1173:      int extra;
                   1174:      rtx args_addr;
                   1175:      rtx args_so_far;
1.1       root     1176: {
                   1177:   rtx xinner;
1.1.1.6   root     1178:   enum direction stack_direction
                   1179: #ifdef STACK_GROWS_DOWNWARD
                   1180:     = downward;
                   1181: #else
                   1182:     = upward;
                   1183: #endif
                   1184: 
                   1185:   /* Decide where to pad the argument: `downward' for below,
                   1186:      `upward' for above, or `none' for don't pad it.
                   1187:      Default is below for small data on big-endian machines; else above.  */
                   1188:   enum direction where_pad = FUNCTION_ARG_PADDING (mode, size);
1.1       root     1189: 
                   1190:   xinner = x = protect_from_queue (x, 0);
                   1191: 
1.1.1.2   root     1192:   /* If part should go in registers, copy that part
                   1193:      into the appropriate registers.  */
                   1194:   if (partial > 0)
                   1195:     move_block_to_reg (REGNO (reg), x, partial);
                   1196: 
1.1.1.6   root     1197:   if (extra)
                   1198:     {
                   1199:       if (args_addr == 0)
                   1200:        {
                   1201:          /* Push padding now if padding above and stack grows down,
                   1202:             or if padding below and stack grows up.  */
                   1203:          if (where_pad != none && where_pad != stack_direction)
                   1204:            anti_adjust_stack (gen_rtx (CONST_INT, VOIDmode, extra));
                   1205:        }
                   1206:       else
                   1207:        {
                   1208:          /* If space already allocated, just adjust the address we use.  */
                   1209:          if (where_pad == downward)
                   1210:            args_so_far = plus_constant (args_so_far, extra);
                   1211:        }
                   1212:     }
1.1       root     1213: 
                   1214:   if (mode == BLKmode)
                   1215:     {
                   1216:       register rtx temp;
1.1.1.2   root     1217:       int used = partial * UNITS_PER_WORD;
                   1218:       int offset = used % (PARM_BOUNDARY / BITS_PER_UNIT);
                   1219: 
1.1.1.13  root     1220:       used -= offset;
1.1.1.2   root     1221: 
1.1       root     1222:       if (size == 0)
                   1223:        abort ();
                   1224: 
1.1.1.2   root     1225:       if (partial != 0)
                   1226:        xinner = change_address (xinner, BLKmode,
                   1227:                                 plus_constant (XEXP (xinner, 0), used));
                   1228: 
                   1229: #ifdef PUSH_ROUNDING
                   1230:       /* Do it with several push insns if that doesn't take lots of insns
                   1231:         and if there is no difficulty with push insns that skip bytes
                   1232:         on the stack for alignment purposes.  */
                   1233:       if (args_addr == 0
                   1234:          && GET_CODE (size) == CONST_INT
                   1235:          && args_addr == 0
                   1236:          && (move_by_pieces_ninsns ((unsigned) INTVAL (size) - used, align)
                   1237:              < MOVE_RATIO)
                   1238:          && PUSH_ROUNDING (INTVAL (size)) == INTVAL (size))
                   1239:        move_by_pieces (gen_rtx (MEM, BLKmode, gen_push_operand ()), xinner,
                   1240:                        INTVAL (size) - used, align);
1.1       root     1241:       else
1.1.1.2   root     1242: #endif /* PUSH_ROUNDING */
1.1       root     1243:        {
1.1.1.2   root     1244:          /* Otherwise make space on the stack and copy the data
                   1245:             to the address of that space.  */
                   1246: 
                   1247:          /* First deduct part put into registers from the size we need.  */
                   1248:          if (partial != 0)
                   1249:            {
                   1250:              if (GET_CODE (size) == CONST_INT)
                   1251:                size = gen_rtx (CONST_INT, VOIDmode, INTVAL (size) - used);
                   1252:              else
                   1253:                size = expand_binop (GET_MODE (size), sub_optab, size,
                   1254:                                     gen_rtx (CONST_INT, VOIDmode, used),
                   1255:                                     0, 0, OPTAB_LIB_WIDEN);
                   1256:            }
                   1257: 
                   1258:          /* Get the address of the stack space.  */
                   1259:          if (! args_addr)
                   1260:            temp = push_block (size);
                   1261:          else if (GET_CODE (args_so_far) == CONST_INT)
                   1262:            temp = memory_address (BLKmode,
                   1263:                                   plus_constant (args_addr,
1.1.1.13  root     1264:                                                  used + INTVAL (args_so_far)));
1.1.1.2   root     1265:          else
                   1266:            temp = memory_address (BLKmode,
                   1267:                                   plus_constant (gen_rtx (PLUS, Pmode,
                   1268:                                                           args_addr, args_so_far),
1.1.1.13  root     1269:                                                  used));
1.1.1.2   root     1270: 
                   1271: 
                   1272:          /* TEMP is the address of the block.  Copy the data there.  */
                   1273:          if (GET_CODE (size) == CONST_INT
                   1274:              && (move_by_pieces_ninsns ((unsigned) INTVAL (size), align)
                   1275:                  < MOVE_RATIO))
                   1276:            {
                   1277:              move_by_pieces (gen_rtx (MEM, BLKmode, temp), xinner,
                   1278:                              INTVAL (size), align);
                   1279:              return;
                   1280:            }
1.1.1.13  root     1281:          /* Try the most limited insn first, because there's no point
                   1282:             including more than one in the machine description unless
                   1283:             the more limited one has some advantage.  */
1.1.1.9   root     1284: #ifdef HAVE_movstrqi
                   1285:          if (HAVE_movstrqi
                   1286:              && GET_CODE (size) == CONST_INT
                   1287:              && ((unsigned) INTVAL (size)
                   1288:                  < (1 << (GET_MODE_BITSIZE (QImode) - 1))))
1.1       root     1289:            {
1.1.1.9   root     1290:              emit_insn (gen_movstrqi (gen_rtx (MEM, BLKmode, temp),
1.1.1.14! root     1291:                                       xinner, size,
        !          1292:                                       gen_rtx (CONST_INT, VOIDmode, align)));
1.1       root     1293:              return;
                   1294:            }
                   1295: #endif
                   1296: #ifdef HAVE_movstrhi
                   1297:          if (HAVE_movstrhi
                   1298:              && GET_CODE (size) == CONST_INT
                   1299:              && ((unsigned) INTVAL (size)
1.1.1.5   root     1300:                  < (1 << (GET_MODE_BITSIZE (HImode) - 1))))
1.1       root     1301:            {
                   1302:              emit_insn (gen_movstrhi (gen_rtx (MEM, BLKmode, temp),
1.1.1.14! root     1303:                                       xinner, size,
        !          1304:                                       gen_rtx (CONST_INT, VOIDmode, align)));
1.1       root     1305:              return;
                   1306:            }
                   1307: #endif
1.1.1.9   root     1308: #ifdef HAVE_movstrsi
                   1309:          if (HAVE_movstrsi)
1.1.1.5   root     1310:            {
1.1.1.14! root     1311:              emit_insn (gen_movstrsi (gen_rtx (MEM, BLKmode, temp),
        !          1312:                                       xinner, size,
        !          1313:                                       gen_rtx (CONST_INT, VOIDmode, align)));
1.1.1.5   root     1314:              return;
                   1315:            }
                   1316: #endif
1.1.1.2   root     1317: 
                   1318:          if (reg_mentioned_p (stack_pointer_rtx, temp))
                   1319:            {
                   1320:              /* Correct TEMP so it holds what will be a description of
                   1321:                 the address to copy to, valid after one arg is pushed.  */
1.1.1.5   root     1322:              int xsize = GET_MODE_SIZE (Pmode);
                   1323: #ifdef PUSH_ROUNDING
                   1324:              xsize = PUSH_ROUNDING (xsize);
                   1325: #endif
                   1326:              xsize = ((xsize + PARM_BOUNDARY / BITS_PER_UNIT - 1)
                   1327:                       / (PARM_BOUNDARY / BITS_PER_UNIT)
                   1328:                       * (PARM_BOUNDARY / BITS_PER_UNIT));
1.1.1.8   root     1329: #ifdef TARGET_MEM_FUNCTIONS
                   1330:              /* If we are calling bcopy, we push one arg before TEMP.
                   1331:                 If calling memcpy, we push two.  */
                   1332:              xsize *= 2;
                   1333: #endif
1.1       root     1334: #ifdef STACK_GROWS_DOWNWARD
1.1.1.4   root     1335:              temp = plus_constant (temp, xsize);
1.1       root     1336: #else
1.1.1.6   root     1337:              temp = plus_constant (temp, -xsize);
1.1       root     1338: #endif
1.1.1.2   root     1339:            }
                   1340: 
                   1341:          /* Make current_args_size nonzero around the library call
                   1342:             to force it to pop the bcopy-arguments right away.  */
1.1.1.9   root     1343:          NO_DEFER_POP;
1.1.1.2   root     1344: #ifdef TARGET_MEM_FUNCTIONS
                   1345:          emit_library_call (gen_rtx (SYMBOL_REF, Pmode, "memcpy"),
                   1346:                             VOIDmode, 3, temp, Pmode, XEXP (xinner, 0), Pmode,
                   1347:                             size, Pmode);
                   1348: #else
1.1       root     1349:          emit_library_call (gen_rtx (SYMBOL_REF, Pmode, "bcopy"),
1.1.1.2   root     1350:                             VOIDmode, 3, XEXP (xinner, 0), Pmode, temp, Pmode,
1.1       root     1351:                             size, Pmode);
1.1.1.2   root     1352: #endif
1.1.1.9   root     1353:          OK_DEFER_POP;
1.1       root     1354:        }
                   1355:     }
1.1.1.2   root     1356:   else if (partial > 0)
1.1       root     1357:     {
1.1.1.14! root     1358:       /* Scalar partly in registers.  */
        !          1359: 
1.1.1.2   root     1360:       int size = GET_MODE_SIZE (mode) / UNITS_PER_WORD;
                   1361:       int i;
1.1.1.13  root     1362:       int not_stack;
1.1.1.6   root     1363:       /* # words of start of argument
1.1.1.2   root     1364:         that we must make space for but need not store.  */
                   1365:       int skip = partial % (PARM_BOUNDARY / BITS_PER_WORD);
                   1366:       int args_offset = INTVAL (args_so_far);
                   1367: 
                   1368:       /* If we make space by pushing it, we might as well push
                   1369:         the real data.  Otherwise, we can leave SKIP nonzero
                   1370:         and leave the space uninitialized.  */
                   1371:       if (args_addr == 0)
                   1372:        skip = 0;
                   1373: 
1.1.1.13  root     1374:       /* Now NOT_STACK gets the number of units that we don't need to
                   1375:         allocate on the stack.  */
                   1376:       not_stack = partial - skip;
1.1.1.2   root     1377: 
                   1378:       if (GET_CODE (x) == CONST_DOUBLE && x != dconst0_rtx)
                   1379:        x = force_const_double_mem (x);
                   1380: 
1.1.1.13  root     1381:       /* Loop over all the words allocated on the stack for this arg.  */
1.1.1.14! root     1382:       /* We can do it by words, because any scalar bigger than a word
        !          1383:         has a size a multiple of a word.  */
1.1.1.2   root     1384: #ifndef PUSH_ARGS_REVERSED
1.1.1.13  root     1385:       for (i = not_stack; i < size; i++)
1.1.1.2   root     1386: #else
1.1.1.13  root     1387:       for (i = size - 1; i >= not_stack; i--)
1.1.1.2   root     1388: #endif
1.1.1.13  root     1389:        if (i >= not_stack + skip)
                   1390:          {
1.1.1.14! root     1391:            rtx wd;
        !          1392:            rtx addr;
        !          1393:            /* Get the next word of the value in WD.  */
1.1.1.13  root     1394:            if (GET_CODE (x) == MEM)
1.1.1.14! root     1395:              {
        !          1396:                rtx addr = memory_address (SImode,
        !          1397:                                           plus_constant (XEXP (x, 0),
        !          1398:                                                          i * UNITS_PER_WORD));
        !          1399:                /* Copy to a reg, since machine may lack
        !          1400:                   memory-to-memory move insns.  */
        !          1401:                wd = copy_to_reg (gen_rtx (MEM, SImode, addr));
        !          1402:              }
1.1.1.13  root     1403:            else if (GET_CODE (x) == REG)
1.1.1.14! root     1404:              wd = gen_rtx (SUBREG, SImode, x, i);
1.1.1.13  root     1405:            else if (x == dconst0_rtx)
1.1.1.14! root     1406:              wd = const0_rtx;
1.1.1.13  root     1407:            else
                   1408:              abort ();
1.1.1.14! root     1409: 
        !          1410:            emit_push_insn (wd,
        !          1411:                            SImode, 0, align, 0, 0, 0, args_addr,
        !          1412:                            gen_rtx (CONST_INT, VOIDmode,
        !          1413:                                     args_offset + i * UNITS_PER_WORD));
        !          1414: 
        !          1415: 
1.1.1.13  root     1416:          }
1.1       root     1417:     }
                   1418:   else
1.1.1.2   root     1419:     {
                   1420:       rtx addr;
                   1421: #ifdef PUSH_ROUNDING
                   1422:       if (args_addr == 0)
                   1423:        addr = gen_push_operand ();
                   1424:       else
                   1425: #endif
                   1426:        if (GET_CODE (args_so_far) == CONST_INT)
                   1427:          addr
                   1428:            = memory_address (mode,
                   1429:                              plus_constant (args_addr, INTVAL (args_so_far)));
                   1430:       else
                   1431:        addr = memory_address (mode, gen_rtx (PLUS, Pmode, args_addr,
                   1432:                                              args_so_far));
                   1433: 
                   1434:       emit_move_insn (gen_rtx (MEM, mode, addr), x);
                   1435:     }
                   1436: 
1.1.1.6   root     1437:   if (extra && args_addr == 0 && where_pad == stack_direction)
1.1.1.2   root     1438:     anti_adjust_stack (gen_rtx (CONST_INT, VOIDmode, extra));
1.1       root     1439: }
                   1440: 
                   1441: /* Output a library call to function FUN (a SYMBOL_REF rtx)
1.1.1.2   root     1442:    for a value of mode OUTMODE
1.1       root     1443:    with NARGS different arguments, passed as alternating rtx values
                   1444:    and machine_modes to convert them to.
                   1445:    The rtx values should have been passed through protect_from_queue already.  */
                   1446: 
                   1447: void
1.1.1.2   root     1448: emit_library_call (va_alist)
                   1449:      va_dcl
1.1       root     1450: {
1.1.1.2   root     1451:   register va_list p;
1.1       root     1452:   register int args_size = 0;
                   1453:   register int argnum;
1.1.1.2   root     1454:   enum machine_mode outmode;
                   1455:   int nargs;
                   1456:   rtx fun;
                   1457:   rtx orgfun;
                   1458:   int inc;
                   1459:   int count;
                   1460:   rtx *regvec;
                   1461:   rtx argblock = 0;
                   1462:   CUMULATIVE_ARGS args_so_far;
                   1463:   struct arg { rtx value; enum machine_mode mode; };
                   1464:   struct arg *argvec;
                   1465:   int old_args_size = current_args_size;
                   1466: 
                   1467:   va_start (p);
                   1468:   orgfun = fun = va_arg (p, rtx);
                   1469:   outmode = va_arg (p, enum machine_mode);
                   1470:   nargs = va_arg (p, int);
                   1471: 
                   1472:   regvec = (rtx *) alloca (nargs * sizeof (rtx));
                   1473: 
                   1474:   /* Copy all the libcall-arguments out of the varargs data
                   1475:      and into a vector ARGVEC.  */
                   1476:   argvec = (struct arg *) alloca (nargs * sizeof (struct arg));
                   1477:   for (count = 0; count < nargs; count++)
                   1478:     {
1.1.1.14! root     1479:       rtx val = va_arg (p, rtx);
        !          1480:       enum machine_mode mode = va_arg (p, enum machine_mode);
        !          1481: 
        !          1482:       argvec[count].value = val;
        !          1483: 
        !          1484:       /* Convert the arg value to the mode the library wants.
        !          1485:         Also make sure it is a reasonable operand
        !          1486:         for a move or push insn.  */
        !          1487:       /* ??? It is wrong to do it here; must do it earlier
        !          1488:         where we know the signedness of the arg.  */
        !          1489:       if (GET_MODE (val) != mode && GET_MODE (val) != VOIDmode)
        !          1490:        {
        !          1491:          val = gen_reg_rtx (mode);
        !          1492:          convert_move (val, argvec[argnum].value, 0);
        !          1493:        }
        !          1494:       else if (GET_CODE (val) != REG && GET_CODE (val) != MEM
        !          1495:               
        !          1496:               && ! ((CONSTANT_P (val) || GET_CODE (val) == CONST_DOUBLE)
        !          1497:                     && LEGITIMATE_CONSTANT_P (val)))
        !          1498:        val = force_operand (val, 0);
        !          1499: 
        !          1500:       argvec[count].value = val;
        !          1501:       argvec[count].mode = mode;
1.1.1.2   root     1502:     }
                   1503:   va_end (p);
                   1504: 
                   1505:   /* If we have no actual push instructions, make space for all the args
                   1506:      right now.  */
                   1507: #ifndef PUSH_ROUNDING
                   1508:   INIT_CUMULATIVE_ARGS (args_so_far, (tree)0);
                   1509:   for (count = 0; count < nargs; count++)
                   1510:     {
                   1511:       register enum machine_mode mode = argvec[count].mode;
                   1512:       register rtx reg;
                   1513:       register int partial;
                   1514: 
                   1515:       reg = FUNCTION_ARG (args_so_far, mode, 0, 1);
                   1516: #ifdef FUNCTION_ARG_PARTIAL_NREGS
                   1517:       partial = FUNCTION_ARG_PARTIAL_NREGS (args_so_far, mode, 0, 1);
                   1518: #else
                   1519:       partial = 0;
                   1520: #endif
                   1521:       if (reg == 0 || partial != 0)
                   1522:        args_size += GET_MODE_SIZE (mode);
                   1523:       if (partial != 0)
                   1524:        args_size -= partial * GET_MODE_SIZE (SImode);
                   1525:       FUNCTION_ARG_ADVANCE (args_so_far, mode, 0, 1);
                   1526:     }
                   1527: 
                   1528:   if (args_size != 0)
                   1529:     argblock
                   1530:       = push_block (round_push (gen_rtx (CONST_INT, VOIDmode, args_size)));
                   1531: #endif
                   1532: 
                   1533:   INIT_CUMULATIVE_ARGS (args_so_far, (tree)0);
                   1534: 
                   1535: #ifdef PUSH_ARGS_REVERSED
                   1536:   inc = -1;
                   1537:   argnum = nargs - 1;
1.1       root     1538: #else
1.1.1.2   root     1539:   inc = 1;
                   1540:   argnum = 0;
1.1       root     1541: #endif
1.1.1.2   root     1542:   args_size = 0;
                   1543: 
                   1544:   for (count = 0; count < nargs; count++, argnum += inc)
1.1       root     1545:     {
1.1.1.2   root     1546:       register enum machine_mode mode = argvec[argnum].mode;
                   1547:       register rtx val = argvec[argnum].value;
                   1548:       rtx reg;
                   1549:       int partial;
                   1550:       int arg_size;
                   1551: 
                   1552:       reg = FUNCTION_ARG (args_so_far, mode, 0, 1);
                   1553:       regvec[argnum] = reg;
                   1554: #ifdef FUNCTION_ARG_PARTIAL_NREGS
                   1555:       partial = FUNCTION_ARG_PARTIAL_NREGS (args_so_far, mode, 0, 1);
                   1556: #else
                   1557:       partial = 0;
                   1558: #endif
                   1559: 
                   1560:       if (reg != 0 && partial == 0)
                   1561:        emit_move_insn (reg, val);
                   1562:       else
                   1563:        emit_push_insn (val, mode, 0, 0, partial, reg, 0, argblock,
                   1564:                        gen_rtx (CONST_INT, VOIDmode, args_size));
                   1565: 
                   1566:       /* Compute size of stack space used by this argument.  */
                   1567:       if (reg == 0 || partial != 0)
                   1568:        arg_size = GET_MODE_SIZE (mode);
                   1569:       else
                   1570:        arg_size = 0;
                   1571:       if (partial != 0)
                   1572:        arg_size
                   1573:          -= ((partial * UNITS_PER_WORD)
                   1574:              / (PARM_BOUNDARY / BITS_PER_UNIT)
                   1575:              * (PARM_BOUNDARY / BITS_PER_UNIT));
                   1576: 
                   1577:       args_size += arg_size;
1.1.1.9   root     1578:       NO_DEFER_POP;
1.1.1.2   root     1579:       FUNCTION_ARG_ADVANCE (args_so_far, mode, 0, 1);
1.1       root     1580:     }
                   1581: 
                   1582:   emit_queue ();
1.1.1.2   root     1583: 
                   1584:   fun = prepare_call_address (fun, 0);
                   1585: 
                   1586:   /* Any regs containing parms remain in use through the call.
                   1587:      ??? This is not quite correct, since it doesn't indicate
                   1588:      that they are in use immediately before the call insn.
                   1589:      Currently that doesn't matter since explicitly-used regs
                   1590:      won't be used for reloading.  But if the reloader becomes smarter,
                   1591:      this will have to change somehow.  */
                   1592:   for (count = 0; count < nargs; count++)
                   1593:     if (regvec[count] != 0)
                   1594:       emit_insn (gen_rtx (USE, VOIDmode, regvec[count]));
                   1595: 
                   1596: #ifdef STACK_BOUNDARY
                   1597:   args_size = (args_size + STACK_BYTES - 1) / STACK_BYTES * STACK_BYTES;
                   1598: #endif
                   1599: 
1.1.1.3   root     1600:   /* Don't allow popping to be deferred, since then
                   1601:      cse'ing of library calls could delete a call and leave the pop.  */
1.1.1.9   root     1602:   NO_DEFER_POP;
1.1.1.2   root     1603:   emit_call_1 (fun, get_identifier (XSTR (orgfun, 0)), args_size,
                   1604:               FUNCTION_ARG (args_so_far, VOIDmode, void_type_node, 1),
                   1605:               outmode != VOIDmode ? hard_libcall_value (outmode) : 0,
1.1.1.3   root     1606:               old_args_size + 1);
1.1.1.9   root     1607:   OK_DEFER_POP;
1.1       root     1608: }
                   1609: 
                   1610: /* Expand an assignment that stores the value of FROM into TO.
1.1.1.2   root     1611:    If WANT_VALUE is nonzero, return an rtx for the value of TO.
                   1612:    (This may contain a QUEUED rtx.)
                   1613:    Otherwise, the returned value is not meaningful.
                   1614: 
                   1615:    SUGGEST_REG is no longer actually used.
                   1616:    It used to mean, copy the value through a register
                   1617:    and return that register, if that is possible.
                   1618:    But now we do this if WANT_VALUE.
                   1619: 
                   1620:    If the value stored is a constant, we return the constant.  */
1.1       root     1621: 
                   1622: rtx
1.1.1.2   root     1623: expand_assignment (to, from, want_value, suggest_reg)
1.1       root     1624:      tree to, from;
1.1.1.2   root     1625:      int want_value;
                   1626:      int suggest_reg;
1.1       root     1627: {
                   1628:   register rtx to_rtx = 0;
                   1629: 
                   1630:   /* Don't crash if the lhs of the assignment was erroneous.  */
                   1631: 
                   1632:   if (TREE_CODE (to) == ERROR_MARK)
                   1633:     return expand_expr (from, 0, VOIDmode, 0);
                   1634: 
                   1635:   /* Assignment of a structure component needs special treatment
1.1.1.2   root     1636:      if the structure component's rtx is not simply a MEM.
                   1637:      Assignment of an array element at a constant index
                   1638:      has the same problem.  */
                   1639: 
                   1640:   if (TREE_CODE (to) == COMPONENT_REF
                   1641:       || (TREE_CODE (to) == ARRAY_REF
                   1642:          && TREE_CODE (TREE_OPERAND (to, 1)) == INTEGER_CST
                   1643:          && TREE_CODE (TYPE_SIZE (TREE_TYPE (to))) == INTEGER_CST))
1.1       root     1644:     {
1.1.1.2   root     1645:       register enum machine_mode mode1;
                   1646:       int bitsize;
1.1       root     1647:       int volstruct = 0;
1.1.1.2   root     1648:       tree tem = to;
                   1649:       int bitpos = 0;
                   1650:       int unsignedp;
1.1       root     1651: 
1.1.1.2   root     1652:       if (TREE_CODE (to) == COMPONENT_REF)
1.1       root     1653:        {
                   1654:          tree field = TREE_OPERAND (to, 1);
1.1.1.2   root     1655:          bitsize = TREE_INT_CST_LOW (DECL_SIZE (field)) * DECL_SIZE_UNIT (field);
                   1656:          mode1 = DECL_MODE (TREE_OPERAND (to, 1));
                   1657:          unsignedp = TREE_UNSIGNED (field);
1.1       root     1658:        }
1.1.1.2   root     1659:       else
1.1       root     1660:        {
1.1.1.2   root     1661:          mode1 = TYPE_MODE (TREE_TYPE (to));
                   1662:          bitsize = GET_MODE_BITSIZE (mode1);
                   1663:          unsignedp = TREE_UNSIGNED (TREE_TYPE (to));
1.1       root     1664:        }
                   1665: 
1.1.1.2   root     1666:       /* Compute cumulative bit-offset for nested component-refs
                   1667:         and array-refs, and find the ultimate containing object.  */
1.1       root     1668: 
1.1.1.2   root     1669:       while (1)
1.1       root     1670:        {
1.1.1.2   root     1671:          if (TREE_CODE (tem) == COMPONENT_REF)
                   1672:            {
                   1673:              bitpos += DECL_OFFSET (TREE_OPERAND (tem, 1));
                   1674:              if (TREE_THIS_VOLATILE (tem))
                   1675:                volstruct = 1;
                   1676:            }
                   1677:          else if (TREE_CODE (tem) == ARRAY_REF
                   1678:                   && TREE_CODE (TREE_OPERAND (tem, 1)) == INTEGER_CST
                   1679:                   && TREE_CODE (TYPE_SIZE (TREE_TYPE (tem))) == INTEGER_CST)
                   1680:            {
                   1681:              bitpos += (TREE_INT_CST_LOW (TREE_OPERAND (tem, 1))
                   1682:                         * TREE_INT_CST_LOW (TYPE_SIZE (TREE_TYPE (tem)))
                   1683:                         * TYPE_SIZE_UNIT (TREE_TYPE (tem)));
                   1684:            }
                   1685:          else
                   1686:            break;
                   1687:          tem = TREE_OPERAND (tem, 0);
1.1       root     1688:        }
                   1689: 
1.1.1.2   root     1690:       /* If we are going to use store_bit_field and extract_bit_field,
                   1691:         make sure to_rtx will be safe for multiple use.  */
                   1692:       if (mode1 == BImode && want_value)
                   1693:        tem = stabilize_reference (tem);
1.1       root     1694: 
1.1.1.2   root     1695:       to_rtx = expand_expr (tem, 0, VOIDmode, 0);
                   1696: 
                   1697:       return store_field (to_rtx, bitsize, bitpos, mode1, from,
1.1.1.10  root     1698:                          (want_value
                   1699:                           /* Spurious cast makes HPUX compiler happy.  */
                   1700:                           ? (enum machine_mode) TYPE_MODE (TREE_TYPE (to))
                   1701:                           : VOIDmode),
1.1.1.14! root     1702:                          unsignedp,
        !          1703:                          TYPE_ALIGN (TREE_TYPE (to)));
1.1       root     1704:     }
                   1705: 
                   1706:   /* Ordinary treatment.  Expand TO to get a REG or MEM rtx.
                   1707:      Don't re-expand if it was expanded already (in COMPONENT_REF case).  */
                   1708: 
                   1709:   if (to_rtx == 0)
                   1710:     to_rtx = expand_expr (to, 0, VOIDmode, 0);
                   1711: 
                   1712:   /* Compute FROM and store the value in the rtx we got.  */
                   1713: 
1.1.1.2   root     1714:   return store_expr (from, to_rtx, want_value);
1.1       root     1715: }
                   1716: 
                   1717: /* Generate code for computing expression EXP,
1.1.1.2   root     1718:    and storing the value into TARGET.
                   1719:    Returns TARGET or an equivalent value.
                   1720:    TARGET may contain a QUEUED rtx.
1.1       root     1721: 
1.1.1.2   root     1722:    If SUGGEST_REG is nonzero, copy the value through a register
                   1723:    and return that register, if that is possible.
                   1724: 
                   1725:    If the value stored is a constant, we return the constant.  */
                   1726: 
                   1727: rtx
                   1728: store_expr (exp, target, suggest_reg)
1.1       root     1729:      register tree exp;
                   1730:      register rtx target;
1.1.1.2   root     1731:      int suggest_reg;
1.1       root     1732: {
1.1.1.2   root     1733:   register rtx temp;
                   1734:   int dont_return_target = 0;
                   1735: 
                   1736:   /* Copying a non-constant CONSTRUCTOR needs special treatment.  */
                   1737: 
                   1738:   if (TREE_CODE (exp) == CONSTRUCTOR && ! TREE_LITERAL (exp))
                   1739:     {
                   1740:       store_constructor (exp, target);
                   1741:       return target;
                   1742:     }
                   1743: 
                   1744:   if (suggest_reg && GET_CODE (target) == MEM && GET_MODE (target) != BLKmode)
                   1745:     /* If target is in memory and caller wants value in a register instead,
                   1746:        arrange that.  Pass TARGET as target for expand_expr so that,
                   1747:        if EXP is another assignment, SUGGEST_REG will be nonzero for it.
                   1748:        We know expand_expr will not use the target in that case.  */
                   1749:     {
                   1750:       temp = expand_expr (exp, cse_not_expected ? 0 : target,
                   1751:                          GET_MODE (target), 0);
                   1752:       if (GET_MODE (temp) != BLKmode && GET_MODE (temp) != VOIDmode)
                   1753:        temp = copy_to_reg (temp);
                   1754:       dont_return_target = 1;
                   1755:     }
                   1756:   else if (queued_subexp_p (target))
                   1757:     /* If target contains a postincrement, it is not safe
                   1758:        to use as the returned value.  It would access the wrong
                   1759:        place by the time the queued increment gets output.
                   1760:        So copy the value through a temporary and use that temp
                   1761:        as the result.  */
                   1762:     {
                   1763:       temp = expand_expr (exp, 0, GET_MODE (target), 0);
                   1764:       if (GET_MODE (temp) != BLKmode && GET_MODE (temp) != VOIDmode)
                   1765:        temp = copy_to_reg (temp);
                   1766:       dont_return_target = 1;
                   1767:     }
                   1768:   else
                   1769:     {
                   1770:       temp = expand_expr (exp, target, GET_MODE (target), 0);
                   1771:       /* DO return TARGET if it's a specified hardware register.
                   1772:         expand_return relies on this.  */
                   1773:       if (!(target && GET_CODE (target) == REG
                   1774:            && REGNO (target) < FIRST_PSEUDO_REGISTER)
                   1775:          && (CONSTANT_P (temp) || GET_CODE (temp) == CONST_DOUBLE))
                   1776:        dont_return_target = 1;
                   1777:     }
                   1778: 
1.1.1.12  root     1779:   /* If value was not generated in the target, store it there.
                   1780:      Convert the value to TARGET's type first if nec.  */
1.1.1.2   root     1781: 
1.1       root     1782:   if (temp != target && TREE_CODE (exp) != ERROR_MARK)
                   1783:     {
                   1784:       target = protect_from_queue (target, 1);
                   1785:       if (GET_MODE (temp) != GET_MODE (target)
                   1786:          && GET_MODE (temp) != VOIDmode)
1.1.1.2   root     1787:        {
                   1788:          int unsignedp = TREE_UNSIGNED (TREE_TYPE (exp));
                   1789:          if (dont_return_target)
1.1.1.12  root     1790:            {
                   1791:              /* In this case, we will return TEMP,
                   1792:                 so make sure it has the proper mode.
                   1793:                 But don't forget to store the value into TARGET.  */
                   1794:              temp = convert_to_mode (GET_MODE (target), temp, unsignedp);
                   1795:              emit_move_insn (target, temp);
                   1796:            }
1.1.1.2   root     1797:          else
                   1798:            convert_move (target, temp, unsignedp);
                   1799:        }
                   1800: 
1.1       root     1801:       else if (GET_MODE (temp) == BLKmode)
                   1802:        emit_block_move (target, temp, expr_size (exp),
                   1803:                         TYPE_ALIGN (TREE_TYPE (exp)) / BITS_PER_UNIT);
                   1804:       else
                   1805:        emit_move_insn (target, temp);
                   1806:     }
1.1.1.2   root     1807:   if (dont_return_target)
                   1808:     return temp;
1.1       root     1809:   return target;
                   1810: }
                   1811: 
1.1.1.2   root     1812: /* Store the value of constructor EXP into the rtx TARGET.
                   1813:    TARGET is either a REG or a MEM.  */
1.1       root     1814: 
1.1.1.2   root     1815: static void
                   1816: store_constructor (exp, target)
                   1817:      tree exp;
                   1818:      rtx target;
1.1       root     1819: {
1.1.1.7   root     1820:   /* Don't try copying piece by piece into a hard register
                   1821:      since that is vulnerable to being clobbered by EXP.
                   1822:      Instead, construct in a pseudo register and then copy it all.  */
                   1823:   if (GET_CODE (target) == REG && REGNO (target) < FIRST_PSEUDO_REGISTER)
                   1824:     {
                   1825:       rtx temp = gen_reg_rtx (GET_MODE (target));
                   1826:       store_constructor (exp, temp);
                   1827:       emit_move_insn (target, temp);
                   1828:       return;
                   1829:     }
                   1830: 
1.1.1.2   root     1831:   if (TREE_CODE (TREE_TYPE (exp)) == RECORD_TYPE)
1.1       root     1832:     {
1.1.1.2   root     1833:       register tree elt;
1.1       root     1834: 
1.1.1.2   root     1835:       /* If the constructor has fewer fields than the structure,
                   1836:         clear the whole structure first.  */
1.1       root     1837: 
1.1.1.2   root     1838:       if (list_length (CONSTRUCTOR_ELTS (exp))
                   1839:          != list_length (TYPE_FIELDS (TREE_TYPE (exp))))
                   1840:        clear_storage (target, int_size_in_bytes (TREE_TYPE (exp)));
                   1841:       else
                   1842:        /* Inform later passes that the old value is dead.  */
                   1843:        emit_insn (gen_rtx (CLOBBER, VOIDmode, target));
                   1844: 
                   1845:       /* Store each element of the constructor into
                   1846:         the corresponding field of TARGET.  */
                   1847: 
                   1848:       for (elt = CONSTRUCTOR_ELTS (exp); elt; elt = TREE_CHAIN (elt))
                   1849:        {
                   1850:          register tree field = TREE_PURPOSE (elt);
                   1851:          register enum machine_mode mode;
                   1852:          int bitsize;
                   1853:          int bitpos;
                   1854:          int unsignedp;
                   1855: 
                   1856:          bitsize = TREE_INT_CST_LOW (DECL_SIZE (field)) * DECL_SIZE_UNIT (field);
                   1857:          mode = DECL_MODE (field);
                   1858:          unsignedp = TREE_UNSIGNED (field);
                   1859: 
                   1860:          bitpos = DECL_OFFSET (field);
                   1861: 
                   1862:          store_field (target, bitsize, bitpos, mode, TREE_VALUE (elt),
1.1.1.14! root     1863:                       VOIDmode, 0, TYPE_ALIGN (TREE_TYPE (elt)));
1.1.1.2   root     1864:        }
                   1865:     }
                   1866:   else if (TREE_CODE (TREE_TYPE (exp)) == ARRAY_TYPE)
                   1867:     {
                   1868:       register tree elt;
                   1869:       register int i;
                   1870:       tree domain = TYPE_DOMAIN (TREE_TYPE (exp));
                   1871:       int minelt = TREE_INT_CST_LOW (TYPE_MIN_VALUE (domain));
                   1872:       int maxelt = TREE_INT_CST_LOW (TYPE_MAX_VALUE (domain));
                   1873:       tree elttype = TREE_TYPE (TREE_TYPE (exp));
                   1874: 
                   1875:       /* If the constructor has fewer fields than the structure,
                   1876:         clear the whole structure first.  */
                   1877: 
                   1878:       if (list_length (CONSTRUCTOR_ELTS (exp)) < maxelt - minelt + 1)
                   1879:        clear_storage (target, maxelt - minelt + 1);
                   1880:       else
                   1881:        /* Inform later passes that the old value is dead.  */
                   1882:        emit_insn (gen_rtx (CLOBBER, VOIDmode, target));
                   1883: 
                   1884:       /* Store each element of the constructor into
                   1885:         the corresponding element of TARGET, determined
                   1886:         by counting the elements.  */
                   1887:       for (elt = CONSTRUCTOR_ELTS (exp), i = 0;
                   1888:           elt;
                   1889:           elt = TREE_CHAIN (elt), i++)
                   1890:        {
                   1891:          register enum machine_mode mode;
                   1892:          int bitsize;
                   1893:          int bitpos;
                   1894:          int unsignedp;
                   1895: 
                   1896:          mode = TYPE_MODE (elttype);
                   1897:          bitsize = GET_MODE_BITSIZE (mode);
                   1898:          unsignedp = TREE_UNSIGNED (elttype);
                   1899: 
                   1900:          bitpos = (i * TREE_INT_CST_LOW (TYPE_SIZE (elttype))
                   1901:                    * TYPE_SIZE_UNIT (elttype));
                   1902: 
                   1903:          store_field (target, bitsize, bitpos, mode, TREE_VALUE (elt),
                   1904:                       VOIDmode, 0);
                   1905:        }
                   1906:     }
                   1907: }
                   1908: 
                   1909: /* Store the value of EXP (an expression tree)
                   1910:    into a subfield of TARGET which has mode MODE and occupies
                   1911:    BITSIZE bits, starting BITPOS bits from the start of TARGET.
                   1912: 
                   1913:    If VALUE_MODE is VOIDmode, return nothing in particular.
                   1914:    UNSIGNEDP is not used in this case.
                   1915: 
                   1916:    Otherwise, return an rtx for the value stored.  This rtx
                   1917:    has mode VALUE_MODE if that is convenient to do.
1.1.1.14! root     1918:    In this case, UNSIGNEDP must be nonzero if the value is an unsigned type.
        !          1919: 
        !          1920:    ALIGN is the alignment that TARGET is known to have, measured in bytes.  */
1.1.1.2   root     1921: 
                   1922: static rtx
1.1.1.14! root     1923: store_field (target, bitsize, bitpos, mode, exp, value_mode, unsignedp, align)
1.1.1.2   root     1924:      rtx target;
                   1925:      int bitsize, bitpos;
                   1926:      enum machine_mode mode;
                   1927:      tree exp;
                   1928:      enum machine_mode value_mode;
                   1929:      int unsignedp;
1.1.1.14! root     1930:      int align;
1.1.1.2   root     1931: {
                   1932:   /* If the structure is in a register or if the component
                   1933:      is a bit field, we cannot use addressing to access it.
                   1934:      Use bit-field techniques or SUBREG to store in it.  */
                   1935: 
                   1936:   if (mode == BImode || GET_CODE (target) == REG
                   1937:       || GET_CODE (target) == SUBREG)
                   1938:     {
                   1939:       store_bit_field (target, bitsize, bitpos,
                   1940:                       mode,
1.1.1.14! root     1941:                       expand_expr (exp, 0, VOIDmode, 0),
        !          1942:                       align);
1.1.1.2   root     1943:       if (value_mode != VOIDmode)
                   1944:        return extract_bit_field (target, bitsize, bitpos, unsignedp,
1.1.1.14! root     1945:                                  0, value_mode, 0, align);
1.1.1.2   root     1946:       return const0_rtx;
                   1947:     }
                   1948:   else
                   1949:     {
                   1950:       rtx addr = XEXP (target, 0);
                   1951:       rtx to_rtx;
                   1952: 
                   1953:       /* If a value is wanted, it must be the lhs;
                   1954:         so make the address stable for multiple use.  */
                   1955: 
                   1956:       if (value_mode != VOIDmode && GET_CODE (addr) != REG
                   1957:          && ! CONSTANT_ADDRESS_P (addr))
                   1958:        addr = copy_to_reg (addr);
                   1959: 
                   1960:       /* Now build a reference to just the desired component.  */
                   1961: 
                   1962:       to_rtx = change_address (target, mode,
                   1963:                               plus_constant (addr,
                   1964:                                              (bitpos / BITS_PER_UNIT)));
1.1.1.10  root     1965:       MEM_IN_STRUCT_P (to_rtx) = 1;
1.1.1.2   root     1966: 
                   1967:       return store_expr (exp, to_rtx, value_mode != VOIDmode);
                   1968:     }
                   1969: }
                   1970: 
                   1971: /* Given an rtx VALUE that may contain additions and multiplications,
                   1972:    return an equivalent value that just refers to a register or memory.
                   1973:    This is done by generating instructions to perform the arithmetic
                   1974:    and returning a pseudo-register containing the value.  */
                   1975: 
                   1976: rtx
                   1977: force_operand (value, target)
                   1978:      rtx value, target;
                   1979: {
                   1980:   register optab binoptab = 0;
                   1981:   register rtx op2;
                   1982:   /* Use subtarget as the target for operand 0 of a binary operation.  */
                   1983:   register rtx subtarget = (target != 0 && GET_CODE (target) == REG ? target : 0);
                   1984: 
                   1985:   if (GET_CODE (value) == PLUS)
                   1986:     binoptab = add_optab;
                   1987:   else if (GET_CODE (value) == MINUS)
                   1988:     binoptab = sub_optab;
                   1989:   else if (GET_CODE (value) == MULT)
                   1990:     {
                   1991:       op2 = XEXP (value, 1);
                   1992:       if (!CONSTANT_P (op2)
                   1993:          && !(GET_CODE (op2) == REG && op2 != subtarget))
                   1994:        subtarget = 0;
                   1995:       return expand_mult (GET_MODE (value),
                   1996:                          force_operand (XEXP (value, 0), subtarget),
                   1997:                          force_operand (op2, 0),
                   1998:                          target, 0);
                   1999:     }
                   2000: 
                   2001:   if (binoptab)
                   2002:     {
                   2003:       op2 = XEXP (value, 1);
                   2004:       if (!CONSTANT_P (op2)
                   2005:          && !(GET_CODE (op2) == REG && op2 != subtarget))
                   2006:        subtarget = 0;
                   2007:       if (binoptab == sub_optab
                   2008:          && GET_CODE (op2) == CONST_INT && INTVAL (op2) < 0)
                   2009:        {
                   2010:          binoptab = add_optab;
                   2011:          op2 = gen_rtx (CONST_INT, VOIDmode, - INTVAL (op2));
                   2012:        }
                   2013:       return expand_binop (GET_MODE (value), binoptab,
                   2014:                           force_operand (XEXP (value, 0), subtarget),
                   2015:                           force_operand (op2, 0),
                   2016:                           target, 0, OPTAB_LIB_WIDEN);
                   2017:       /* We give UNSIGNEP = 0 to expand_binop
                   2018:         because the only operations we are expanding here are signed ones.  */
                   2019:     }
                   2020:   return value;
                   2021: }
                   2022: 
                   2023: /* expand_expr: generate code for computing expression EXP.
1.1.1.14! root     2024:    An rtx for the computed value is returned.  The value is never null.
        !          2025:    In the case of a void EXP, const0_rtx is returned.
1.1.1.2   root     2026: 
                   2027:    The value may be stored in TARGET if TARGET is nonzero.
1.1       root     2028:    TARGET is just a suggestion; callers must assume that
                   2029:    the rtx returned may not be the same as TARGET.
                   2030: 
1.1.1.2   root     2031:    If TARGET is CONST0_RTX, it means that the value will be ignored.
                   2032: 
1.1       root     2033:    If TMODE is not VOIDmode, it suggests generating the
                   2034:    result in mode TMODE.  But this is done only when convenient.
                   2035:    Otherwise, TMODE is ignored and the value generated in its natural mode.
                   2036:    TMODE is just a suggestion; callers must assume that
                   2037:    the rtx returned may not have mode TMODE.
                   2038: 
1.1.1.2   root     2039:    If MODIFIER is EXPAND_SUM then when EXP is an addition
1.1       root     2040:    we can return an rtx of the form (MULT (REG ...) (CONST_INT ...))
                   2041:    or a nest of (PLUS ...) and (MINUS ...) where the terms are
                   2042:    products as above, or REG or MEM, or constant.
1.1.1.2   root     2043:    Ordinarily in such cases we would output mul or add instructions
                   2044:    and then return a pseudo reg containing the sum.
                   2045: 
                   2046:    If MODIFIER is EXPAND_CONST_ADDRESS then it is ok to return
                   2047:    a MEM rtx whose address is a constant that isn't a legitimate address.  */
1.1       root     2048: 
                   2049: /* Subroutine of expand_expr:
1.1.1.13  root     2050:    save the non-copied parts (LIST) of an expr (LHS), and return a list
                   2051:    which can restore these values to their previous values,
                   2052:    should something modify their storage.  */
                   2053: static tree
                   2054: save_noncopied_parts (lhs, list)
                   2055:      tree lhs;
                   2056:      tree list;
                   2057: {
                   2058:   tree tail;
                   2059:   tree parts = 0;
                   2060: 
                   2061:   for (tail = list; tail; tail = TREE_CHAIN (tail))
                   2062:     if (TREE_CODE (TREE_VALUE (tail)) == TREE_LIST)
                   2063:       parts = chainon (parts, save_noncopied_parts (TREE_VALUE (tail)));
                   2064:     else
                   2065:       {
                   2066:        tree part = TREE_VALUE (tail);
                   2067:        tree part_type = TREE_TYPE (part);
                   2068:        parts = tree_cons (save_expr (build_component_ref (lhs, part, parts, 0)),
                   2069:                           build_nt (RTL_EXPR, 0, (tree) assign_stack_local (TYPE_MODE (part_type), int_size_in_bytes (part_type))),
                   2070:                           parts);
                   2071:        store_expr (TREE_PURPOSE (parts), RTL_EXPR_RTL (TREE_VALUE (parts)), 0);
                   2072:       }
                   2073:   return parts;
                   2074: }
                   2075: 
                   2076: /* Subroutine of expand_expr:
1.1       root     2077:    return the target to use when recursively expanding
                   2078:    the first operand of an arithmetic operation.  */
                   2079: 
                   2080: static rtx
                   2081: validate_subtarget (subtarget, otherop)
                   2082:      rtx subtarget;
                   2083:      tree otherop;
                   2084: {
                   2085:   if (TREE_LITERAL (otherop))
                   2086:     return subtarget;
                   2087:   if (TREE_CODE (otherop) == VAR_DECL
                   2088:       && DECL_RTL (otherop) != subtarget)
                   2089:     return subtarget;
                   2090:   return 0;
                   2091: }
                   2092: 
                   2093: rtx
1.1.1.2   root     2094: expand_expr (exp, target, tmode, modifier)
1.1       root     2095:      register tree exp;
                   2096:      rtx target;
                   2097:      enum machine_mode tmode;
1.1.1.2   root     2098:      enum expand_modifier modifier;
1.1       root     2099: {
                   2100:   register rtx op0, op1, temp;
                   2101:   tree type = TREE_TYPE (exp);
                   2102:   register enum machine_mode mode = TYPE_MODE (type);
                   2103:   register enum tree_code code = TREE_CODE (exp);
1.1.1.2   root     2104:   optab this_optab;
1.1       root     2105:   int negate_1;
                   2106:   /* Use subtarget as the target for operand 0 of a binary operation.  */
                   2107:   rtx subtarget = (target != 0 && GET_CODE (target) == REG ? target : 0);
1.1.1.2   root     2108:   rtx original_target = target;
                   2109:   int ignore = target == const0_rtx;
                   2110: 
1.1.1.7   root     2111:   /* Don't use hard regs as subtargets, because the combiner
                   2112:      can only handle pseudo regs.  */
                   2113:   if (subtarget && REGNO (subtarget) < FIRST_PSEUDO_REGISTER)
                   2114:     subtarget = 0;
                   2115: 
1.1.1.2   root     2116:   if (ignore) target = 0, original_target = 0;
1.1       root     2117: 
                   2118:   /* If will do cse, generate all results into registers
                   2119:      since 1) that allows cse to find more things
                   2120:      and 2) otherwise cse could produce an insn the machine
                   2121:      cannot support.  */
                   2122: 
                   2123:   if (! cse_not_expected && mode != BLKmode)
                   2124:     target = subtarget;
                   2125: 
1.1.1.2   root     2126:   /* No sense saving up arithmetic to be done
                   2127:      if it's all in the wrong mode to form part of an address.
                   2128:      And force_operand won't know whether to sign-extend or zero-extend.  */
                   2129: 
                   2130:   if (mode != Pmode && modifier == EXPAND_SUM)
1.1.1.6   root     2131:     modifier = EXPAND_NORMAL;
1.1.1.2   root     2132: 
1.1       root     2133:   switch (code)
                   2134:     {
1.1.1.4   root     2135:     case PARM_DECL:
                   2136:       if (DECL_RTL (exp) == 0)
                   2137:        {
                   2138:          error_with_decl (exp, "prior parameter's size depends on `%s'");
                   2139:          return const0_rtx;
                   2140:        }
                   2141: 
1.1       root     2142:     case FUNCTION_DECL:
                   2143:     case VAR_DECL:
                   2144:     case RESULT_DECL:
                   2145:       if (DECL_RTL (exp) == 0)
                   2146:        abort ();
1.1.1.14! root     2147:       /* This is the case of an array whose size is to be determined
        !          2148:         from its initializer, while the initializer is still being parsed.
        !          2149:         See expand_decl.  */
        !          2150:       if (GET_CODE (DECL_RTL (exp)) == MEM
        !          2151:          && GET_CODE (XEXP (DECL_RTL (exp), 0)) == REG)
        !          2152:        return change_address (DECL_RTL (exp), BLKmode,
        !          2153:                               XEXP (DECL_RTL (exp), 0));
1.1.1.2   root     2154:       if (GET_CODE (DECL_RTL (exp)) == MEM
                   2155:          && modifier != EXPAND_CONST_ADDRESS)
                   2156:        {
                   2157:          /* DECL_RTL probably contains a constant address.
                   2158:             On RISC machines where a constant address isn't valid,
                   2159:             make some insns to get that address into a register.  */
1.1.1.7   root     2160:          if (!memory_address_p (DECL_MODE (exp), XEXP (DECL_RTL (exp), 0))
                   2161:              || (flag_force_addr
                   2162:                  && CONSTANT_ADDRESS_P (XEXP (DECL_RTL (exp), 0))))
1.1.1.2   root     2163:            return change_address (DECL_RTL (exp), VOIDmode,
                   2164:                                   copy_rtx (XEXP (DECL_RTL (exp), 0)));
                   2165:        }
1.1       root     2166:       return DECL_RTL (exp);
                   2167: 
                   2168:     case INTEGER_CST:
1.1.1.7   root     2169:       if (GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_INT)
                   2170:        return gen_rtx (CONST_INT, VOIDmode, TREE_INT_CST_LOW (exp));
1.1.1.8   root     2171:       /* Generate immediate CONST_DOUBLE
1.1.1.7   root     2172:         which will be turned into memory by reload if necessary.  */
1.1.1.8   root     2173: #ifdef WORDS_BIG_ENDIAN
                   2174:       return immed_double_const (TREE_INT_CST_HIGH (exp),
                   2175:                                 TREE_INT_CST_LOW (exp),
                   2176:                                 mode);
                   2177: #else
                   2178:       return immed_double_const (TREE_INT_CST_LOW (exp),
                   2179:                                 TREE_INT_CST_HIGH (exp),
                   2180:                                 mode);
                   2181: #endif
1.1       root     2182: 
                   2183:     case CONST_DECL:
                   2184:       return expand_expr (DECL_INITIAL (exp), target, VOIDmode, 0);
                   2185: 
                   2186:     case REAL_CST:
1.1.1.7   root     2187:       /* If optimized, generate immediate CONST_DOUBLE
                   2188:         which will be turned into memory by reload if necessary.  */
1.1       root     2189:       if (!cse_not_expected)
                   2190:        return immed_real_const (exp);
                   2191:     case COMPLEX_CST:
                   2192:     case STRING_CST:
1.1.1.8   root     2193:       if (! TREE_CST_RTL (exp))
                   2194:        output_constant_def (exp);
                   2195: 
                   2196:       /* TREE_CST_RTL probably contains a constant address.
                   2197:         On RISC machines where a constant address isn't valid,
                   2198:         make some insns to get that address into a register.  */
                   2199:       if (GET_CODE (TREE_CST_RTL (exp)) == MEM
                   2200:          && modifier != EXPAND_CONST_ADDRESS
                   2201:          && !memory_address_p (mode, XEXP (TREE_CST_RTL (exp), 0)))
                   2202:        return change_address (TREE_CST_RTL (exp), VOIDmode,
                   2203:                               copy_rtx (XEXP (TREE_CST_RTL (exp), 0)));
1.1       root     2204:       return TREE_CST_RTL (exp);
                   2205: 
                   2206:     case SAVE_EXPR:
                   2207:       if (SAVE_EXPR_RTL (exp) == 0)
                   2208:        {
1.1.1.5   root     2209:          rtx reg = gen_reg_rtx (mode);
                   2210:          SAVE_EXPR_RTL (exp) = reg;
                   2211:          store_expr (TREE_OPERAND (exp, 0), reg, 0);
                   2212:          if (!optimize)
                   2213:            save_expr_regs = gen_rtx (EXPR_LIST, VOIDmode, reg,
                   2214:                                      save_expr_regs);
1.1       root     2215:        }
1.1.1.2   root     2216:       /* Don't let the same rtl node appear in two places.  */
1.1       root     2217:       return SAVE_EXPR_RTL (exp);
                   2218: 
1.1.1.2   root     2219:     case RTL_EXPR:
1.1.1.10  root     2220:       if (RTL_EXPR_SEQUENCE (exp) == const0_rtx)
                   2221:        abort ();
                   2222:       emit_insns (RTL_EXPR_SEQUENCE (exp));
                   2223:       RTL_EXPR_SEQUENCE (exp) = const0_rtx;
1.1.1.2   root     2224:       return RTL_EXPR_RTL (exp);
                   2225: 
                   2226:     case CONSTRUCTOR:
                   2227:       /* All elts simple constants => refer to a constant in memory.  */
                   2228:       if (TREE_STATIC (exp))
                   2229:        /* For aggregate types with non-BLKmode modes,
                   2230:           this should ideally construct a CONST_INT.  */
1.1.1.14! root     2231:        {
        !          2232:          rtx constructor = output_constant_def (exp);
        !          2233:          if (! memory_address_p (GET_MODE (constructor),
        !          2234:                                  XEXP (constructor, 0)))
        !          2235:            constructor = change_address (constructor, VOIDmode,
        !          2236:                                          XEXP (constructor, 0));
        !          2237:          return constructor;
        !          2238:        }
1.1.1.2   root     2239: 
                   2240:       if (ignore)
                   2241:        {
                   2242:          tree elt;
                   2243:          for (elt = CONSTRUCTOR_ELTS (exp); elt; elt = TREE_CHAIN (elt))
                   2244:            expand_expr (TREE_VALUE (elt), const0_rtx, VOIDmode, 0);
                   2245:          return const0_rtx;
                   2246:        }
                   2247:       else
                   2248:        {
                   2249:          if (target == 0)
                   2250:            target = gen_rtx (MEM, TYPE_MODE (TREE_TYPE (exp)),
                   2251:                              get_structure_value_addr (expr_size (exp)));
                   2252:          store_expr (exp, target, 0);
                   2253:          return target;
                   2254:        }
                   2255: 
1.1       root     2256:     case INDIRECT_REF:
                   2257:       {
                   2258:        tree exp1 = TREE_OPERAND (exp, 0);
                   2259:        tree exp2;
                   2260: 
                   2261:        /* A SAVE_EXPR as the address in an INDIRECT_EXPR is generated
                   2262:           for  *PTR += ANYTHING  where PTR is put inside the SAVE_EXPR.
                   2263:           This code has the same general effect as simply doing
                   2264:           expand_expr on the save expr, except that the expression PTR
                   2265:           is computed for use as a memory address.  This means different
                   2266:           code, suitable for indexing, may be generated.  */
                   2267:        if (TREE_CODE (exp1) == SAVE_EXPR
                   2268:            && SAVE_EXPR_RTL (exp1) == 0
                   2269:            && TREE_CODE (exp2 = TREE_OPERAND (exp1, 0)) != ERROR_MARK
                   2270:            && TYPE_MODE (TREE_TYPE (exp1)) == Pmode
                   2271:            && TYPE_MODE (TREE_TYPE (exp2)) == Pmode)
                   2272:          {
1.1.1.2   root     2273:            temp = expand_expr (TREE_OPERAND (exp1, 0), 0, VOIDmode, EXPAND_SUM);
1.1       root     2274:            op0 = memory_address (mode, temp);
                   2275:            op0 = copy_all_regs (op0);
                   2276:            SAVE_EXPR_RTL (exp1) = op0;
                   2277:          }
                   2278:        else
                   2279:          {
1.1.1.2   root     2280:            op0 = expand_expr (TREE_OPERAND (exp, 0), 0, VOIDmode, EXPAND_SUM);
1.1       root     2281:            op0 = memory_address (mode, op0);
                   2282:          }
                   2283:       }
                   2284:       temp = gen_rtx (MEM, mode, op0);
1.1.1.2   root     2285:       /* If address was computed by addition,
                   2286:         mark this as an element of an aggregate.  */
                   2287:       if (TREE_CODE (TREE_OPERAND (exp, 0)) == PLUS_EXPR
                   2288:          || (TREE_CODE (TREE_OPERAND (exp, 0)) == SAVE_EXPR
                   2289:              && TREE_CODE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0)) == PLUS_EXPR))
1.1.1.10  root     2290:        MEM_IN_STRUCT_P (temp) = 1;
1.1.1.13  root     2291:       MEM_VOLATILE_P (temp) = TREE_THIS_VOLATILE (exp) || flag_volatile;
1.1.1.10  root     2292:       RTX_UNCHANGING_P (temp) = TREE_READONLY (exp);
1.1.1.2   root     2293:       return temp;
                   2294: 
                   2295:     case ARRAY_REF:
                   2296:       if (TREE_CODE (TREE_OPERAND (exp, 1)) != INTEGER_CST
                   2297:          || TREE_CODE (TYPE_SIZE (TREE_TYPE (exp))) != INTEGER_CST)
                   2298:        {
                   2299:          /* Nonconstant array index or nonconstant element size.
                   2300:             Generate the tree for *(&array+index) and expand that,
                   2301:             except do it in a language-independent way
                   2302:             and don't complain about non-lvalue arrays.
                   2303:             `mark_addressable' should already have been called
                   2304:             for any array for which this case will be reached.  */
                   2305: 
                   2306:          tree array_adr = build (ADDR_EXPR, TYPE_POINTER_TO (type),
                   2307:                                  TREE_OPERAND (exp, 0));
                   2308:          tree index = TREE_OPERAND (exp, 1);
                   2309:          tree elt;
                   2310: 
                   2311:          /* Convert the integer argument to a type the same size as a pointer
                   2312:             so the multiply won't overflow spuriously.  */
                   2313:          if (TYPE_PRECISION (TREE_TYPE (index)) != POINTER_SIZE)
                   2314:            index = convert (type_for_size (POINTER_SIZE, 0), index);
                   2315: 
                   2316:          /* The array address isn't volatile even if the array is.  */
                   2317:          TREE_VOLATILE (array_adr) = 0;
                   2318: 
                   2319:          elt = build (INDIRECT_REF, type,
                   2320:                       fold (build (PLUS_EXPR, TYPE_POINTER_TO (type),
                   2321:                                    array_adr,
                   2322:                                    fold (build (MULT_EXPR,
                   2323:                                                 TYPE_POINTER_TO (type),
                   2324:                                                 index, size_in_bytes (type))))));
                   2325: 
                   2326:          return expand_expr (elt, target, tmode, modifier);
                   2327:        }
1.1.1.13  root     2328: 
                   2329:       /* If this is a constant index into a constant array,
                   2330:         just get the value from the array.  */
                   2331:       if (TREE_READONLY (TREE_OPERAND (exp, 0))
                   2332:          && ! TREE_VOLATILE (TREE_OPERAND (exp, 0))
                   2333:          && TREE_CODE (TREE_TYPE (TREE_OPERAND (exp, 0))) == ARRAY_TYPE
                   2334:          && TREE_LITERAL (TREE_OPERAND (exp, 1))
                   2335:          && TREE_CODE (TREE_OPERAND (exp, 0)) == VAR_DECL
                   2336:          && DECL_INITIAL (TREE_OPERAND (exp, 0)))
                   2337:        {
                   2338:          tree index = fold (TREE_OPERAND (exp, 1));
                   2339:          if (TREE_CODE (index) == INTEGER_CST)
                   2340:            {
                   2341:              int i = TREE_INT_CST_LOW (index);
                   2342:              tree init = CONSTRUCTOR_ELTS (DECL_INITIAL (TREE_OPERAND (exp, 0)));
                   2343: 
                   2344:              while (init && i--)
                   2345:                init = TREE_CHAIN (init);
                   2346:              if (init)
                   2347:                return expand_expr (fold (TREE_VALUE (init)), target, tmode, modifier);
                   2348:            }
                   2349:        }
1.1.1.2   root     2350:       /* Treat array-ref with constant index as a component-ref.  */
1.1       root     2351: 
                   2352:     case COMPONENT_REF:
                   2353:       {
1.1.1.2   root     2354:        register enum machine_mode mode1;
1.1       root     2355:        int volstruct = 0;
1.1.1.2   root     2356:        int bitsize;
                   2357:        tree tem = exp;
                   2358:        int bitpos = 0;
                   2359:        int unsignedp;
1.1       root     2360: 
1.1.1.2   root     2361:        if (TREE_CODE (exp) == COMPONENT_REF)
1.1       root     2362:          {
                   2363:            tree field = TREE_OPERAND (exp, 1);
1.1.1.2   root     2364:            bitsize = TREE_INT_CST_LOW (DECL_SIZE (field)) * DECL_SIZE_UNIT (field);
                   2365:            mode1 = DECL_MODE (TREE_OPERAND (exp, 1));
                   2366:            unsignedp = TREE_UNSIGNED (field);
1.1       root     2367:          }
1.1.1.2   root     2368:        else
1.1       root     2369:          {
1.1.1.2   root     2370:            mode1 = TYPE_MODE (TREE_TYPE (exp));
                   2371:            bitsize = GET_MODE_BITSIZE (mode1);
                   2372:            unsignedp = TREE_UNSIGNED (TREE_TYPE (exp));
1.1       root     2373:          }
                   2374: 
1.1.1.2   root     2375:        /* Compute cumulative bit-offset for nested component-refs
                   2376:           and array-refs, and find the ultimate containing object.  */
                   2377: 
                   2378:        while (1)
1.1       root     2379:          {
1.1.1.2   root     2380:            if (TREE_CODE (tem) == COMPONENT_REF)
                   2381:              {
                   2382:                bitpos += DECL_OFFSET (TREE_OPERAND (tem, 1));
                   2383:                if (TREE_THIS_VOLATILE (tem))
                   2384:                  volstruct = 1;
                   2385:              }
                   2386:            else if (TREE_CODE (tem) == ARRAY_REF
                   2387:                     && TREE_CODE (TREE_OPERAND (tem, 1)) == INTEGER_CST
                   2388:                     && TREE_CODE (TYPE_SIZE (TREE_TYPE (tem))) == INTEGER_CST)
                   2389:              {
                   2390:                bitpos += (TREE_INT_CST_LOW (TREE_OPERAND (tem, 1))
                   2391:                           * TREE_INT_CST_LOW (TYPE_SIZE (TREE_TYPE (tem)))
                   2392:                           * TYPE_SIZE_UNIT (TREE_TYPE (tem)));
                   2393:              }
                   2394:            else
                   2395:              break;
                   2396:            tem = TREE_OPERAND (tem, 0);
1.1       root     2397:          }
                   2398: 
1.1.1.2   root     2399:        op0 = expand_expr (tem, 0, VOIDmode,
                   2400:                           (modifier == EXPAND_CONST_ADDRESS
                   2401:                            ? modifier : EXPAND_NORMAL));
1.1       root     2402: 
1.1.1.2   root     2403:        if (mode1 == BImode || GET_CODE (op0) == REG
                   2404:            || GET_CODE (op0) == SUBREG)
                   2405:          {
                   2406:            return extract_bit_field (op0, bitsize, bitpos, unsignedp,
1.1.1.14! root     2407:                                      target, mode, tmode,
        !          2408:                                      TYPE_ALIGN (TREE_TYPE (tem)));
1.1.1.2   root     2409:          }
                   2410:        /* Get a reference to just this component.  */
                   2411:        if (modifier == EXPAND_CONST_ADDRESS)
                   2412:          op0 = gen_rtx (MEM, mode1, plus_constant (XEXP (op0, 0),
                   2413:                                                    (bitpos / BITS_PER_UNIT)));
                   2414:        else
                   2415:          op0 = change_address (op0, mode1,
                   2416:                                plus_constant (XEXP (op0, 0),
                   2417:                                               (bitpos / BITS_PER_UNIT)));
1.1.1.10  root     2418:        MEM_IN_STRUCT_P (op0) = 1;
                   2419:        MEM_VOLATILE_P (op0) = volstruct;
1.1.1.2   root     2420:        /* If OP0 is in the shared structure-value stack slot,
                   2421:           and it is not BLKmode, copy it into a register.
                   2422:           The shared slot may be clobbered at any time by another call.
                   2423:           BLKmode is safe because our caller will either copy the value away
                   2424:           or take another component and come back here.  */
                   2425:        if (mode != BLKmode
                   2426:            && TREE_CODE (TREE_OPERAND (exp, 0)) == CALL_EXPR
                   2427:            && TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0))) == BLKmode)
                   2428:          op0 = copy_to_reg (op0);
                   2429:        if (mode == mode1 || mode1 == BLKmode || mode1 == tmode)
                   2430:          return op0;
                   2431:        if (target == 0)
                   2432:          target = gen_reg_rtx (tmode != VOIDmode ? tmode : mode);
                   2433:        convert_move (target, op0, unsignedp);
                   2434:        return target;
1.1       root     2435:       }
                   2436: 
                   2437:       /* Intended for a reference to a buffer of a file-object in Pascal.
                   2438:         But it's not certain that a special tree code will really be
                   2439:         necessary for these.  INDIRECT_REF might work for them.  */
                   2440:     case BUFFER_REF:
                   2441:       abort ();
                   2442: 
1.1.1.13  root     2443:     case WITH_CLEANUP_EXPR:
                   2444:       RTL_EXPR_RTL (TREE_OPERAND (exp, 1))
                   2445:        = expand_expr (TREE_OPERAND (exp, 0), target, tmode, modifier);
                   2446:       cleanups_of_this_call = tree_cons (0, TREE_OPERAND (exp, 2), cleanups_of_this_call);
                   2447:       return RTL_EXPR_RTL (TREE_OPERAND (exp, 1));
                   2448: 
1.1       root     2449:     case CALL_EXPR:
1.1.1.2   root     2450:       /* Check for a built-in function.  */
                   2451:       if (TREE_CODE (TREE_OPERAND (exp, 0)) == ADDR_EXPR
                   2452:          && TREE_CODE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0)) == FUNCTION_DECL
1.1.1.5   root     2453:          && (DECL_FUNCTION_CODE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0))
                   2454:              != NOT_BUILT_IN))
1.1.1.2   root     2455:        return expand_builtin (exp, target, subtarget, tmode);
1.1       root     2456:       /* If this call was expanded already by preexpand_calls,
                   2457:         just return the result we got.  */
                   2458:       if (CALL_EXPR_RTL (exp) != 0)
                   2459:        return CALL_EXPR_RTL (exp);
1.1.1.2   root     2460:       return expand_call (exp, target, ignore);
1.1       root     2461: 
                   2462:     case NOP_EXPR:
                   2463:     case CONVERT_EXPR:
1.1.1.7   root     2464:     case REFERENCE_EXPR:
1.1.1.2   root     2465:       if (TREE_CODE (type) == VOID_TYPE || ignore)
1.1       root     2466:        {
1.1.1.2   root     2467:          expand_expr (TREE_OPERAND (exp, 0), const0_rtx, VOIDmode, modifier);
1.1       root     2468:          return const0_rtx;
                   2469:        }
                   2470:       if (mode == TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0))))
1.1.1.2   root     2471:        return expand_expr (TREE_OPERAND (exp, 0), target, VOIDmode, modifier);
1.1       root     2472:       op0 = expand_expr (TREE_OPERAND (exp, 0), 0, mode, 0);
1.1.1.2   root     2473:       if (GET_MODE (op0) == mode || GET_MODE (op0) == VOIDmode)
1.1       root     2474:        return op0;
1.1.1.2   root     2475:       if (flag_force_mem && GET_CODE (op0) == MEM)
                   2476:        op0 = copy_to_reg (op0);
1.1       root     2477:       if (target == 0)
                   2478:        target = gen_reg_rtx (mode);
1.1.1.2   root     2479:       convert_move (target, op0, TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (exp, 0))));
1.1       root     2480:       return target;
                   2481: 
                   2482:     case PLUS_EXPR:
                   2483:       preexpand_calls (exp);
1.1.1.2   root     2484:       if (TREE_CODE (TREE_OPERAND (exp, 0)) == INTEGER_CST
                   2485:          && modifier == EXPAND_SUM)
1.1       root     2486:        {
1.1.1.2   root     2487:          op1 = expand_expr (TREE_OPERAND (exp, 1), subtarget, VOIDmode, EXPAND_SUM);
1.1       root     2488:          op1 = plus_constant (op1, TREE_INT_CST_LOW (TREE_OPERAND (exp, 0)));
1.1.1.2   root     2489:          return op1;
1.1       root     2490:        }
                   2491:       negate_1 = 1;
                   2492:     plus_minus:
1.1.1.2   root     2493:       if (TREE_CODE (TREE_OPERAND (exp, 1)) == INTEGER_CST
                   2494:          && modifier == EXPAND_SUM)
1.1       root     2495:        {
1.1.1.2   root     2496:          op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, EXPAND_SUM);
1.1       root     2497:          op0 = plus_constant (op0,
                   2498:                               negate_1 * TREE_INT_CST_LOW (TREE_OPERAND (exp, 1)));
1.1.1.2   root     2499:          return op0;
1.1       root     2500:        }
                   2501:       this_optab = add_optab;
1.1.1.2   root     2502:       if (modifier != EXPAND_SUM) goto binop;
1.1       root     2503:       subtarget = validate_subtarget (subtarget, TREE_OPERAND (exp, 1));
1.1.1.2   root     2504:       op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, EXPAND_SUM);
                   2505:       op1 = expand_expr (TREE_OPERAND (exp, 1), 0, VOIDmode, EXPAND_SUM);
1.1       root     2506:       /* Put a sum last, to simplify what follows.  */
                   2507: #ifdef OLD_INDEXING
                   2508:       if (GET_CODE (op1) == MULT)
                   2509:        {
                   2510:          temp = op0;
                   2511:          op0 = op1;
                   2512:          op1 = temp;
                   2513:        }
                   2514: #endif
                   2515: #ifndef OLD_INDEXING
                   2516:       /* Make sure any term that's a sum with a constant comes last.  */
                   2517:       if (GET_CODE (op0) == PLUS
1.1.1.2   root     2518:          && CONSTANT_P (XEXP (op0, 1)))
1.1       root     2519:        {
                   2520:          temp = op0;
                   2521:          op0 = op1;
                   2522:          op1 = temp;
                   2523:        }
                   2524:       /* If adding to a sum including a constant,
                   2525:         associate it to put the constant outside.  */
                   2526:       if (GET_CODE (op1) == PLUS
1.1.1.2   root     2527:          && CONSTANT_P (XEXP (op1, 1)))
1.1       root     2528:        {
                   2529:          op0 = gen_rtx (PLUS, mode, XEXP (op1, 0), op0);
                   2530:          if (GET_CODE (XEXP (op1, 1)) == CONST_INT)
                   2531:            return plus_constant (op0, INTVAL (XEXP (op1, 1)));
                   2532:          else
                   2533:            return gen_rtx (PLUS, mode, op0, XEXP (op1, 1));
                   2534:        }
                   2535: #endif
                   2536:       return gen_rtx (PLUS, mode, op0, op1);
                   2537: 
                   2538:     case MINUS_EXPR:
                   2539:       preexpand_calls (exp);
                   2540:       if (TREE_CODE (TREE_OPERAND (exp, 1)) == INTEGER_CST)
                   2541:        {
1.1.1.10  root     2542:          int negated;
1.1.1.2   root     2543:          if (modifier == EXPAND_SUM)
                   2544:            {
                   2545:              negate_1 = -1;
                   2546:              goto plus_minus;
                   2547:            }
                   2548:          subtarget = validate_subtarget (subtarget, TREE_OPERAND (exp, 1));
                   2549:          op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, 0);
1.1.1.10  root     2550:          negated = - TREE_INT_CST_LOW (TREE_OPERAND (exp, 1));
                   2551:          if (GET_MODE_BITSIZE (mode) < HOST_BITS_PER_INT)
                   2552:            negated &= (1 << GET_MODE_BITSIZE (mode)) - 1;
                   2553:          op1 = gen_rtx (CONST_INT, VOIDmode, negated);
1.1.1.2   root     2554:          this_optab = add_optab;
                   2555:          goto binop2;
1.1       root     2556:        }
                   2557:       this_optab = sub_optab;
                   2558:       goto binop;
                   2559: 
                   2560:     case MULT_EXPR:
                   2561:       preexpand_calls (exp);
                   2562:       /* If first operand is constant, swap them.
                   2563:         Thus the following special case checks need only
                   2564:         check the second operand.  */
                   2565:       if (TREE_CODE (TREE_OPERAND (exp, 0)) == INTEGER_CST)
                   2566:        {
                   2567:          register tree t1 = TREE_OPERAND (exp, 0);
                   2568:          TREE_OPERAND (exp, 0) = TREE_OPERAND (exp, 1);
                   2569:          TREE_OPERAND (exp, 1) = t1;
                   2570:        }
                   2571: 
                   2572:       /* Attempt to return something suitable for generating an
                   2573:         indexed address, for machines that support that.  */
                   2574: 
1.1.1.2   root     2575:       if (modifier == EXPAND_SUM
1.1.1.6   root     2576:          && TREE_CODE (TREE_OPERAND (exp, 1)) == INTEGER_CST)
1.1       root     2577:        {
1.1.1.2   root     2578:          op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, EXPAND_SUM);
                   2579: 
                   2580:          /* Apply distributive law if OP0 is x+c.  */
                   2581:          if (GET_CODE (op0) == PLUS
                   2582:              && GET_CODE (XEXP (op0, 1)) == CONST_INT)
                   2583:            return gen_rtx (PLUS, mode,
                   2584:                            gen_rtx (MULT, mode, XEXP (op0, 0),
                   2585:                                     gen_rtx (CONST_INT, VOIDmode,
                   2586:                                              TREE_INT_CST_LOW (TREE_OPERAND (exp, 1)))),
                   2587:                            gen_rtx (CONST_INT, VOIDmode,
                   2588:                                     (TREE_INT_CST_LOW (TREE_OPERAND (exp, 1))
                   2589:                                      * INTVAL (XEXP (op0, 1)))));
                   2590: 
1.1       root     2591:          if (GET_CODE (op0) != REG)
1.1.1.2   root     2592:            op0 = force_operand (op0, 0);
                   2593:          if (GET_CODE (op0) != REG)
                   2594:            op0 = copy_to_mode_reg (mode, op0);
                   2595: 
1.1.1.6   root     2596:          return gen_rtx (MULT, mode, op0,
1.1       root     2597:                          gen_rtx (CONST_INT, VOIDmode,
                   2598:                                   TREE_INT_CST_LOW (TREE_OPERAND (exp, 1))));
                   2599:        }
                   2600:       subtarget = validate_subtarget (subtarget, TREE_OPERAND (exp, 1));
                   2601:       /* Check for multiplying things that have been extended
                   2602:         from a narrower type.  If this machine supports multiplying
                   2603:         in that narrower type with a result in the desired type,
                   2604:         do it that way, and avoid the explicit type-conversion.  */
                   2605:       if (TREE_CODE (TREE_OPERAND (exp, 0)) == NOP_EXPR
                   2606:          && TREE_CODE (TREE_TYPE (exp)) == INTEGER_TYPE
                   2607:          && (TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0)))
                   2608:              < TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (exp, 0))))
                   2609:          && ((TREE_CODE (TREE_OPERAND (exp, 1)) == INTEGER_CST
                   2610:               && int_fits_type_p (TREE_OPERAND (exp, 1),
1.1.1.2   root     2611:                                   TREE_TYPE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0)))
                   2612:               /* Don't use a widening multiply if a shift will do.  */
                   2613:               && exact_log2 (TREE_INT_CST_LOW (TREE_OPERAND (exp, 1))) < 0)
1.1       root     2614:              ||
                   2615:              (TREE_CODE (TREE_OPERAND (exp, 1)) == NOP_EXPR
                   2616:               && (TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (exp, 1), 0)))
                   2617:                   ==
1.1.1.2   root     2618:                   TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0))))
                   2619:               /* If both operands are extended, they must either both
                   2620:                  be zero-extended or both be sign-extended.  */
                   2621:               && (TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (exp, 1), 0)))
                   2622:                   ==
                   2623:                   TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0)))))))
1.1       root     2624:        {
                   2625:          enum machine_mode innermode
                   2626:            = TYPE_MODE (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0)));
1.1.1.2   root     2627:          this_optab = (TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0)))
1.1       root     2628:                        ? umul_widen_optab : smul_widen_optab);
                   2629:          if ((int) innermode + 1 == (int) mode
1.1.1.2   root     2630:              && this_optab->handlers[(int) mode].insn_code != CODE_FOR_nothing)
1.1       root     2631:            {
                   2632:              op0 = expand_expr (TREE_OPERAND (TREE_OPERAND (exp, 0), 0),
                   2633:                                 0, VOIDmode, 0);
                   2634:              if (TREE_CODE (TREE_OPERAND (exp, 1)) == INTEGER_CST)
                   2635:                op1 = expand_expr (TREE_OPERAND (exp, 1), 0, VOIDmode, 0);
                   2636:              else
                   2637:                op1 = expand_expr (TREE_OPERAND (TREE_OPERAND (exp, 1), 0),
                   2638:                                   0, VOIDmode, 0);
                   2639:              goto binop2;
                   2640:            }
                   2641:        }
                   2642:       op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, 0);
                   2643:       op1 = expand_expr (TREE_OPERAND (exp, 1), 0, VOIDmode, 0);
1.1.1.2   root     2644:       return expand_mult (mode, op0, op1, target, TREE_UNSIGNED (type));
1.1       root     2645: 
                   2646:     case TRUNC_DIV_EXPR:
                   2647:     case FLOOR_DIV_EXPR:
                   2648:     case CEIL_DIV_EXPR:
                   2649:     case ROUND_DIV_EXPR:
                   2650:       preexpand_calls (exp);
                   2651:       subtarget = validate_subtarget (subtarget, TREE_OPERAND (exp, 1));
1.1.1.2   root     2652:       /* Possible optimization: compute the dividend with EXPAND_SUM
1.1       root     2653:         then if the divisor is constant can optimize the case
                   2654:         where some terms of the dividend have coeffs divisible by it.  */
                   2655:       op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, 0);
                   2656:       op1 = expand_expr (TREE_OPERAND (exp, 1), 0, VOIDmode, 0);
                   2657:       return expand_divmod (0, code, mode, op0, op1, target,
1.1.1.2   root     2658:                            TREE_UNSIGNED (type));
1.1       root     2659: 
                   2660:     case RDIV_EXPR:
                   2661:       preexpand_calls (exp);
                   2662:       this_optab = flodiv_optab;
                   2663:       goto binop;
                   2664: 
                   2665:     case TRUNC_MOD_EXPR:
                   2666:     case FLOOR_MOD_EXPR:
                   2667:     case CEIL_MOD_EXPR:
                   2668:     case ROUND_MOD_EXPR:
                   2669:       preexpand_calls (exp);
                   2670:       subtarget = validate_subtarget (subtarget, TREE_OPERAND (exp, 1));
                   2671:       op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, 0);
                   2672:       op1 = expand_expr (TREE_OPERAND (exp, 1), 0, VOIDmode, 0);
                   2673:       return expand_divmod (1, code, mode, op0, op1, target,
1.1.1.2   root     2674:                            TREE_UNSIGNED (type));
1.1       root     2675: #if 0
                   2676: #ifdef HAVE_divmoddisi4
                   2677:       if (GET_MODE (op0) != DImode)
                   2678:        {
                   2679:          temp = gen_reg_rtx (DImode);
                   2680:          convert_move (temp, op0, 0);
                   2681:          op0 = temp;
                   2682:          if (GET_MODE (op1) != SImode && GET_CODE (op1) != CONST_INT)
                   2683:            {
                   2684:              temp = gen_reg_rtx (SImode);
                   2685:              convert_move (temp, op1, 0);
                   2686:              op1 = temp;
                   2687:            }
                   2688:          temp = gen_reg_rtx (SImode);
                   2689:          if (target == 0)
                   2690:            target = gen_reg_rtx (SImode);
                   2691:          emit_insn (gen_divmoddisi4 (temp, protect_from_queue (op0, 0),
                   2692:                                      protect_from_queue (op1, 0),
                   2693:                                      protect_from_queue (target, 1)));
                   2694:          return target;
                   2695:        }
                   2696: #endif
                   2697: #endif
                   2698: 
                   2699:     case FIX_ROUND_EXPR:
                   2700:     case FIX_FLOOR_EXPR:
                   2701:     case FIX_CEIL_EXPR:
                   2702:       abort ();                        /* Not used for C.  */
                   2703: 
                   2704:     case FIX_TRUNC_EXPR:
                   2705:       op0 = expand_expr (TREE_OPERAND (exp, 0), 0, VOIDmode, 0);
                   2706:       if (target == 0)
                   2707:        target = gen_reg_rtx (mode);
1.1.1.2   root     2708:       {
                   2709:        int unsignedp = TREE_UNSIGNED (TREE_TYPE (exp));
                   2710:        if (mode == HImode || mode == QImode)
                   2711:          {
                   2712:            register rtx temp = gen_reg_rtx (SImode);
1.1.1.6   root     2713:            expand_fix (temp, op0, 0);
                   2714:            convert_move (target, temp, 0);
1.1.1.2   root     2715:          }
                   2716:        else
                   2717:          expand_fix (target, op0, unsignedp);
                   2718:       }
1.1       root     2719:       return target;
                   2720: 
                   2721:     case FLOAT_EXPR:
                   2722:       op0 = expand_expr (TREE_OPERAND (exp, 0), 0, VOIDmode, 0);
                   2723:       if (target == 0)
                   2724:        target = gen_reg_rtx (mode);
1.1.1.2   root     2725:       {
                   2726:        int unsignedp = TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (exp, 0)));
                   2727:        if (GET_MODE (op0) == HImode
                   2728:            || GET_MODE (op0) == QImode)
                   2729:          {
                   2730:            register rtx temp = gen_reg_rtx (SImode);
                   2731:            convert_move (temp, op0, unsignedp);
                   2732:            expand_float (target, temp, 0);
                   2733:          }
                   2734:        else
                   2735:          expand_float (target, op0, unsignedp);
                   2736:       }
1.1       root     2737:       return target;
                   2738: 
                   2739:     case NEGATE_EXPR:
                   2740:       op0 = expand_expr (TREE_OPERAND (exp, 0), target, VOIDmode, 0);
                   2741:       temp = expand_unop (mode, neg_optab, op0, target, 0);
                   2742:       if (temp == 0)
                   2743:        abort ();
                   2744:       return temp;
                   2745: 
                   2746:     case ABS_EXPR:
                   2747:       /* First try to do it with a special abs instruction.
                   2748:         If that does not win, use conditional jump and negate.  */
1.1.1.2   root     2749:       op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, 0);
1.1       root     2750:       temp = expand_unop (mode, abs_optab, op0, target, 0);
                   2751:       if (temp != 0)
                   2752:        return temp;
                   2753:       temp = gen_label_rtx ();
                   2754:       if (target == 0 || GET_CODE (target) != REG)
1.1.1.2   root     2755:        target = gen_reg_rtx (mode);
1.1       root     2756:       emit_move_insn (target, op0);
1.1.1.2   root     2757:       emit_cmp_insn (target,
                   2758:                     expand_expr (convert (TREE_TYPE (exp), integer_zero_node),
                   2759:                                  0, VOIDmode, 0),
1.1.1.14! root     2760:                     0, 0, 0);
1.1.1.6   root     2761:       NO_DEFER_POP;
1.1       root     2762:       emit_jump_insn (gen_bge (temp));
                   2763:       op0 = expand_unop (mode, neg_optab, target, target, 0);
                   2764:       if (op0 != target)
                   2765:        emit_move_insn (target, op0);
                   2766:       emit_label (temp);
1.1.1.6   root     2767:       OK_DEFER_POP;
1.1       root     2768:       return target;
                   2769: 
                   2770:     case MAX_EXPR:
                   2771:     case MIN_EXPR:
1.1.1.8   root     2772:       mode = TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 1)));
1.1       root     2773:       op1 = expand_expr (TREE_OPERAND (exp, 1), 0, VOIDmode, 0);
                   2774:       if (target == 0 || GET_CODE (target) != REG || target == op1)
1.1.1.2   root     2775:        target = gen_reg_rtx (mode);
1.1       root     2776:       op0 = expand_expr (TREE_OPERAND (exp, 0), target, VOIDmode, 0);
                   2777:       if (target != op0)
                   2778:        emit_move_insn (target, op0);
                   2779:       op0 = gen_label_rtx ();
                   2780:       if (code == MAX_EXPR)
1.1.1.2   root     2781:        temp = (TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (exp, 1)))
                   2782:                ? compare1 (target, op1, GEU, LEU, 1, mode)
                   2783:                : compare1 (target, op1, GE, LE, 0, mode));
                   2784:       else
                   2785:        temp = (TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (exp, 1)))
                   2786:                ? compare1 (target, op1, LEU, GEU, 1, mode)
                   2787:                : compare1 (target, op1, LE, GE, 0, mode));
                   2788:       if (temp == const0_rtx)
                   2789:        emit_move_insn (target, op1);
                   2790:       else if (temp != const1_rtx)
                   2791:        {
1.1.1.13  root     2792:          if (bcc_gen_fctn[(int) GET_CODE (temp)] != 0)
                   2793:            emit_jump_insn ((*bcc_gen_fctn[(int) GET_CODE (temp)]) (op0));
                   2794:          else
                   2795:            abort ();
1.1.1.2   root     2796:          emit_move_insn (target, op1);
                   2797:        }
                   2798:       emit_label (op0);
1.1       root     2799:       return target;
                   2800: 
                   2801: /* ??? Can optimize when the operand of this is a bitwise operation,
                   2802:    by using a different bitwise operation.  */
                   2803:     case BIT_NOT_EXPR:
                   2804:       op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, 0);
                   2805:       temp = expand_unop (mode, one_cmpl_optab, op0, target, 1);
                   2806:       if (temp == 0)
                   2807:        abort ();
                   2808:       return temp;
                   2809: 
1.1.1.2   root     2810:     case FFS_EXPR:
                   2811:       op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, 0);
                   2812:       temp = expand_unop (mode, ffs_optab, op0, target, 1);
                   2813:       if (temp == 0)
                   2814:        abort ();
                   2815:       return temp;
                   2816: 
1.1       root     2817: /* ??? Can optimize bitwise operations with one arg constant.
                   2818:    Pastel optimizes (a bitwise1 n) bitwise2 (a bitwise3 b)
                   2819:    and (a bitwise1 b) bitwise2 b (etc)
                   2820:    but that is probably not worth while.  */
                   2821: 
1.1.1.2   root     2822: /* BIT_AND_EXPR is for bitwise anding.
1.1       root     2823:    TRUTH_AND_EXPR is for anding two boolean values
                   2824:    when we want in all cases to compute both of them.
                   2825:    In general it is fastest to do TRUTH_AND_EXPR by
                   2826:    computing both operands as actual zero-or-1 values
                   2827:    and then bitwise anding.  In cases where there cannot
                   2828:    be any side effects, better code would be made by
                   2829:    treating TRUTH_AND_EXPR like TRUTH_ANDIF_EXPR;
                   2830:    but the question is how to recognize those cases.  */
                   2831: 
                   2832:     case TRUTH_AND_EXPR:
                   2833:     case BIT_AND_EXPR:
                   2834:       preexpand_calls (exp);
                   2835:       subtarget = validate_subtarget (subtarget, TREE_OPERAND (exp, 1));
                   2836:       op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, 0);
                   2837:       op1 = expand_expr (TREE_OPERAND (exp, 1), 0, VOIDmode, 0);
                   2838:       return expand_bit_and (mode, op0, op1, target);
                   2839: 
                   2840: /* See comment above about TRUTH_AND_EXPR; it applies here too.  */
                   2841:     case TRUTH_OR_EXPR:
                   2842:     case BIT_IOR_EXPR:
                   2843:       preexpand_calls (exp);
                   2844:       this_optab = ior_optab;
                   2845:       goto binop;
                   2846: 
                   2847:     case BIT_XOR_EXPR:
                   2848:       preexpand_calls (exp);
                   2849:       this_optab = xor_optab;
                   2850:       goto binop;
                   2851: 
                   2852:     case LSHIFT_EXPR:
                   2853:     case RSHIFT_EXPR:
                   2854:     case LROTATE_EXPR:
                   2855:     case RROTATE_EXPR:
                   2856:       preexpand_calls (exp);
                   2857:       subtarget = validate_subtarget (subtarget, TREE_OPERAND (exp, 1));
                   2858:       op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, 0);
                   2859:       return expand_shift (code, mode, op0, TREE_OPERAND (exp, 1), target,
1.1.1.2   root     2860:                           TREE_UNSIGNED (type));
1.1       root     2861: 
                   2862: /* ??? cv's were used to effect here to combine additive constants
                   2863:    and to determine the answer when only additive constants differ.
                   2864:    Also, the addition of one can be handled by changing the condition.  */
                   2865:     case LT_EXPR:
                   2866:     case LE_EXPR:
                   2867:     case GT_EXPR:
                   2868:     case GE_EXPR:
                   2869:     case EQ_EXPR:
                   2870:     case NE_EXPR:
                   2871:       preexpand_calls (exp);
1.1.1.2   root     2872:       temp = do_store_flag (exp, target, mode);
1.1       root     2873:       if (temp != 0)
                   2874:        return temp;
1.1.1.2   root     2875:       /* For foo != 0, load foo, and if it is nonzero load 1 instead. */
                   2876:       if (code == NE_EXPR && integer_zerop (TREE_OPERAND (exp, 1))
                   2877:          && subtarget
                   2878:          && (GET_MODE (subtarget)
                   2879:              == TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0)))))
1.1       root     2880:        {
                   2881:          temp = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, 0);
                   2882:          if (temp != subtarget)
                   2883:            temp = copy_to_reg (temp);
                   2884:          op1 = gen_label_rtx ();
1.1.1.14! root     2885:          emit_cmp_insn (temp, const0_rtx, 0, TREE_UNSIGNED (type), 0);
1.1       root     2886:          emit_jump_insn (gen_beq (op1));
                   2887:          emit_move_insn (temp, const1_rtx);
                   2888:          emit_label (op1);
                   2889:          return temp;
                   2890:        }
                   2891:       /* If no set-flag instruction, must generate a conditional
                   2892:         store into a temporary variable.  Drop through
                   2893:         and handle this like && and ||.  */
                   2894: 
                   2895:     case TRUTH_ANDIF_EXPR:
                   2896:     case TRUTH_ORIF_EXPR:
                   2897:       temp = gen_reg_rtx (mode);
                   2898:       emit_clr_insn (temp);
                   2899:       op1 = gen_label_rtx ();
                   2900:       jumpifnot (exp, op1);
                   2901:       emit_0_to_1_insn (temp);
                   2902:       emit_label (op1);
                   2903:       return temp;
                   2904: 
                   2905:     case TRUTH_NOT_EXPR:
                   2906:       op0 = expand_expr (TREE_OPERAND (exp, 0), target, VOIDmode, 0);
                   2907:       /* The parser is careful to generate TRUTH_NOT_EXPR
                   2908:         only with operands that are always zero or one.  */
                   2909:       temp = expand_binop (mode, xor_optab, op0,
                   2910:                           gen_rtx (CONST_INT, mode, 1),
                   2911:                           target, 1, OPTAB_LIB_WIDEN);
                   2912:       if (temp == 0)
                   2913:        abort ();
                   2914:       return temp;
                   2915: 
                   2916:     case COMPOUND_EXPR:
1.1.1.2   root     2917:       expand_expr (TREE_OPERAND (exp, 0), const0_rtx, VOIDmode, 0);
1.1       root     2918:       emit_queue ();
                   2919:       return expand_expr (TREE_OPERAND (exp, 1), target, VOIDmode, 0);
                   2920: 
                   2921:     case COND_EXPR:
                   2922:       /* Note that COND_EXPRs whose type is a structure or union
                   2923:         are required to be constructed to contain assignments of
                   2924:         a temporary variable, so that we can evaluate them here
                   2925:         for side effect only.  If type is void, we must do likewise.  */
                   2926:       op0 = gen_label_rtx ();
                   2927:       op1 = gen_label_rtx ();
                   2928: 
1.1.1.2   root     2929:       if (mode == VOIDmode || ignore)
1.1       root     2930:        temp = 0;
                   2931:       else if (target)
                   2932:        temp = target;
1.1.1.2   root     2933:       else if (mode == BLKmode)
                   2934:        {
                   2935:          if (TYPE_SIZE (type) == 0 || ! TREE_LITERAL (TYPE_SIZE (type)))
                   2936:            abort ();
                   2937:          temp = assign_stack_local (BLKmode,
                   2938:                                     (TREE_INT_CST_LOW (TYPE_SIZE (type))
                   2939:                                      * TYPE_SIZE_UNIT (type)
                   2940:                                      + BITS_PER_UNIT - 1)
                   2941:                                     / BITS_PER_UNIT);
                   2942:        }
1.1       root     2943:       else
                   2944:        temp = gen_reg_rtx (mode);
                   2945: 
                   2946:       jumpifnot (TREE_OPERAND (exp, 0), op0);
1.1.1.6   root     2947:       NO_DEFER_POP;
1.1       root     2948:       if (temp != 0)
1.1.1.2   root     2949:        store_expr (TREE_OPERAND (exp, 1), temp, 0);
1.1       root     2950:       else
1.1.1.2   root     2951:        expand_expr (TREE_OPERAND (exp, 1), ignore ? const0_rtx : 0,
                   2952:                     VOIDmode, 0);
1.1       root     2953:       emit_queue ();
                   2954:       emit_jump_insn (gen_jump (op1));
                   2955:       emit_barrier ();
                   2956:       emit_label (op0);
                   2957:       if (temp != 0)
1.1.1.2   root     2958:        store_expr (TREE_OPERAND (exp, 2), temp, 0);
1.1       root     2959:       else
1.1.1.2   root     2960:        expand_expr (TREE_OPERAND (exp, 2), ignore ? const0_rtx : 0,
                   2961:                     VOIDmode, 0);
1.1       root     2962:       emit_queue ();
                   2963:       emit_label (op1);
1.1.1.6   root     2964:       OK_DEFER_POP;
1.1       root     2965:       return temp;
                   2966: 
                   2967:     case MODIFY_EXPR:
1.1.1.7   root     2968:       {
                   2969:        /* If lhs is complex, expand calls in rhs before computing it.
                   2970:           That's so we don't compute a pointer and save it over a call.
                   2971:           If lhs is simple, compute it first so we can give it as a
                   2972:           target if the rhs is just a call.  This avoids an extra temp and copy
                   2973:           and that prevents a partial-subsumption which makes bad code.
                   2974:           Actually we could treat component_ref's of vars like vars.  */
                   2975: 
                   2976:        tree lhs = TREE_OPERAND (exp, 0);
                   2977:        tree rhs = TREE_OPERAND (exp, 1);
1.1.1.13  root     2978:        tree noncopied_parts;
1.1.1.7   root     2979: 
                   2980:        if (TREE_CODE (lhs) != VAR_DECL
                   2981:            && TREE_CODE (lhs) != RESULT_DECL
                   2982:            && TREE_CODE (lhs) != PARM_DECL)
                   2983:          preexpand_calls (exp);
                   2984: 
1.1.1.13  root     2985:        noncopied_parts = save_noncopied_parts (lhs, TYPE_NONCOPIED_PARTS (TREE_TYPE (lhs)));
                   2986:        temp = expand_assignment (lhs, rhs, ! ignore, original_target != 0);
                   2987:        while (noncopied_parts != 0)
1.1.1.7   root     2988:          {
1.1.1.13  root     2989:            store_expr (TREE_VALUE (noncopied_parts),
                   2990:                        SAVE_EXPR_RTL (TREE_PURPOSE (noncopied_parts)), 0);
                   2991:            noncopied_parts = TREE_CHAIN (noncopied_parts);
1.1.1.7   root     2992:          }
1.1.1.13  root     2993:        return temp;
                   2994:       }
1.1       root     2995: 
                   2996:     case PREINCREMENT_EXPR:
                   2997:     case PREDECREMENT_EXPR:
1.1.1.2   root     2998:       return expand_increment (exp, 0);
1.1       root     2999: 
                   3000:     case POSTINCREMENT_EXPR:
                   3001:     case POSTDECREMENT_EXPR:
1.1.1.2   root     3002:       return expand_increment (exp, 1);
1.1       root     3003: 
                   3004:     case ADDR_EXPR:
1.1.1.2   root     3005:       op0 = expand_expr (TREE_OPERAND (exp, 0), 0, VOIDmode,
                   3006:                         EXPAND_CONST_ADDRESS);
1.1       root     3007:       if (GET_CODE (op0) != MEM)
                   3008:        abort ();
1.1.1.2   root     3009:       if (modifier == EXPAND_SUM)
1.1       root     3010:        return XEXP (op0, 0);
1.1.1.2   root     3011:       op0 = force_operand (XEXP (op0, 0), target);
                   3012:       if (flag_force_addr && GET_CODE (op0) != REG)
                   3013:        return force_reg (Pmode, op0);
                   3014:       return op0;
1.1       root     3015: 
                   3016:     case ENTRY_VALUE_EXPR:
                   3017:       abort ();
                   3018: 
                   3019:     case ERROR_MARK:
1.1.1.2   root     3020:       return const0_rtx;
1.1       root     3021: 
                   3022:     default:
                   3023:       abort ();
                   3024:     }
                   3025: 
                   3026:   /* Here to do an ordinary binary operator, generating an instruction
                   3027:      from the optab already placed in `this_optab'.  */
                   3028:  binop:
                   3029:   /* Detect things like x = y | (a == b)
                   3030:      and do them as (x = y), (a == b ? x |= 1 : 0), x.  */
                   3031:   /* First, get the comparison or conditional into the second arg.  */
                   3032:   if (comparison_code[(int) TREE_CODE (TREE_OPERAND (exp, 0))]
                   3033:       || (TREE_CODE (TREE_OPERAND (exp, 0)) == COND_EXPR
                   3034:          && (integer_zerop (TREE_OPERAND (TREE_OPERAND (exp, 0), 1))
                   3035:              || integer_zerop (TREE_OPERAND (TREE_OPERAND (exp, 0), 2)))))
                   3036:     {
                   3037:       if (this_optab == ior_optab || this_optab == add_optab
                   3038:          || this_optab == xor_optab)
                   3039:        {
                   3040:          tree exch = TREE_OPERAND (exp, 1);
                   3041:          TREE_OPERAND (exp, 1) = TREE_OPERAND (exp, 0);
                   3042:          TREE_OPERAND (exp, 0) = exch;
                   3043:        }
                   3044:     }
1.1.1.3   root     3045:   /* Optimize X + (Y ? Z : 0) by computing X and maybe adding Z.  */
1.1       root     3046:   if (comparison_code[(int) TREE_CODE (TREE_OPERAND (exp, 1))]
                   3047:       || (TREE_CODE (TREE_OPERAND (exp, 1)) == COND_EXPR
                   3048:          && (integer_zerop (TREE_OPERAND (TREE_OPERAND (exp, 1), 1))
                   3049:              || integer_zerop (TREE_OPERAND (TREE_OPERAND (exp, 1), 2)))))
                   3050:     {
                   3051:       if (this_optab == ior_optab || this_optab == add_optab
                   3052:          || this_optab == xor_optab || this_optab == sub_optab
                   3053:          || this_optab == lshl_optab || this_optab == ashl_optab
                   3054:          || this_optab == lshr_optab || this_optab == ashr_optab
                   3055:          || this_optab == rotl_optab || this_optab == rotr_optab)
                   3056:        {
1.1.1.2   root     3057:          tree thenexp;
1.1       root     3058:          rtx thenv = 0;
                   3059: 
1.1.1.8   root     3060:          /* TARGET gets a reg in which we can perform the computation.
                   3061:             Use the specified target if it's a pseudo reg and safe.  */
                   3062:          target = validate_subtarget (subtarget, TREE_OPERAND (exp, 1));
1.1       root     3063:          if (target == 0) target = gen_reg_rtx (mode);
1.1.1.3   root     3064: 
                   3065:          /* Compute X into the target.  */
1.1.1.2   root     3066:          store_expr (TREE_OPERAND (exp, 0), target, 0);
1.1       root     3067:          op0 = gen_label_rtx ();
                   3068: 
1.1.1.3   root     3069:          /* If other operand is a comparison COMP, treat it as COMP ? 1 : 0 */
1.1       root     3070:          if (TREE_CODE (TREE_OPERAND (exp, 1)) != COND_EXPR)
                   3071:            {
                   3072:              do_jump (TREE_OPERAND (exp, 1), op0, 0);
                   3073:              thenv = const1_rtx;
                   3074:            }
                   3075:          else if (integer_zerop (TREE_OPERAND (TREE_OPERAND (exp, 1), 2)))
                   3076:            {
                   3077:              do_jump (TREE_OPERAND (TREE_OPERAND (exp, 1), 0), op0, 0);
                   3078:              thenexp = TREE_OPERAND (TREE_OPERAND (exp, 1), 1);
                   3079:            }
                   3080:          else
                   3081:            {
                   3082:              do_jump (TREE_OPERAND (TREE_OPERAND (exp, 1), 0), 0, op0);
                   3083:              thenexp = TREE_OPERAND (TREE_OPERAND (exp, 1), 2);
                   3084:            }
                   3085: 
                   3086:          if (thenv == 0)
                   3087:            thenv = expand_expr (thenexp, 0, VOIDmode, 0);
                   3088: 
1.1.1.3   root     3089:          /* THENV is now Z, the value to operate on, as an rtx.
                   3090:             We have already tested that Y isn't zero, so do the operation.  */
                   3091: 
1.1       root     3092:          if (this_optab == rotl_optab || this_optab == rotr_optab)
                   3093:            temp = expand_binop (mode, this_optab, target, thenv, target,
                   3094:                                 -1, OPTAB_LIB);
                   3095:          else if (this_optab == lshl_optab || this_optab == lshr_optab)
                   3096:            temp = expand_binop (mode, this_optab, target, thenv, target,
                   3097:                                 1, OPTAB_LIB_WIDEN);
                   3098:          else
                   3099:            temp = expand_binop (mode, this_optab, target, thenv, target,
                   3100:                                 0, OPTAB_LIB_WIDEN);
                   3101:          if (target != temp)
                   3102:            emit_move_insn (target, temp);
                   3103: 
1.1.1.6   root     3104:          do_pending_stack_adjust ();
1.1       root     3105:          emit_label (op0);
                   3106:          return target;
                   3107:        }
                   3108:     }
                   3109:   subtarget = validate_subtarget (subtarget, TREE_OPERAND (exp, 1));
                   3110:   op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, 0);
                   3111:   op1 = expand_expr (TREE_OPERAND (exp, 1), 0, VOIDmode, 0);
                   3112:  binop2:
                   3113:   temp = expand_binop (mode, this_optab, op0, op1, target,
1.1.1.2   root     3114:                       TREE_UNSIGNED (TREE_TYPE (exp)), OPTAB_LIB_WIDEN);
1.1       root     3115:  binop1:
                   3116:   if (temp == 0)
                   3117:     abort ();
                   3118:   return temp;
                   3119: }
                   3120: 
1.1.1.2   root     3121: /* Expand an expression EXP that calls a built-in function,
                   3122:    with result going to TARGET if that's convenient
                   3123:    (and in mode MODE if that's convenient).
                   3124:    SUBTARGET may be used as the target for computing one of EXP's operands.  */
                   3125: 
                   3126: static rtx
                   3127: expand_builtin (exp, target, subtarget, mode)
                   3128:      tree exp;
                   3129:      rtx target;
                   3130:      rtx subtarget;
                   3131:      enum machine_mode mode;
                   3132: {
                   3133:   tree fndecl = TREE_OPERAND (TREE_OPERAND (exp, 0), 0);
                   3134:   tree arglist = TREE_OPERAND (exp, 1);
                   3135:   rtx op0;
                   3136: 
                   3137:   switch (DECL_FUNCTION_CODE (fndecl))
                   3138:     {
                   3139:     case BUILT_IN_ABS:
                   3140:     case BUILT_IN_LABS:
                   3141:     case BUILT_IN_FABS:
                   3142:       /* build_function_call changes these into ABS_EXPR.  */
                   3143:       abort ();
                   3144: 
1.1.1.14! root     3145:     case BUILT_IN_SAVEREGS:
        !          3146:       {
        !          3147:        /* When this function is called, it means that registers must be
        !          3148:           saved on entry to this function.  So we migrate the
        !          3149:           call to the first insn of this function.  */
        !          3150:        rtx last = get_last_insn ();
        !          3151:        /* Now really call the function.  `expand_call' does not call
        !          3152:           expand_builtin, so there is no danger of infinite recursion here.  */
        !          3153:        expand_call (exp, target, 1);
        !          3154:        reorder_insns (last, get_last_insn (), get_insns ());
        !          3155:       }
        !          3156:       
1.1.1.2   root     3157:     case BUILT_IN_ALLOCA:
1.1.1.10  root     3158:       if (arglist == 0
                   3159:          /* Arg could be non-integer if user redeclared this fcn wrong.  */
                   3160:          || TREE_CODE (TREE_TYPE (TREE_VALUE (arglist))) != INTEGER_TYPE)
1.1.1.2   root     3161:        return const0_rtx;
                   3162:       frame_pointer_needed = 1;
                   3163:       /* Compute the argument.  */
                   3164:       op0 = expand_expr (TREE_VALUE (arglist), 0, VOIDmode, 0);
                   3165:       if (! CONSTANT_P (op0))
                   3166:        {
                   3167:          op0 = force_reg (GET_MODE (op0), op0);
                   3168:          if (GET_MODE (op0) != Pmode)
1.1.1.12  root     3169:            op0 = convert_to_mode (Pmode, op0, 1);
1.1.1.2   root     3170:        }
                   3171:       /* Push that much space (rounding it up).  */
1.1.1.3   root     3172:       do_pending_stack_adjust ();
1.1.1.8   root     3173: 
                   3174: #ifdef STACK_POINTER_OFFSET
1.1.1.9   root     3175:       /* If we will have to round the result down (which is up
                   3176:         if stack grows down), make sure we have extra space so the
                   3177:         user still gets at least as much space as he asked for.  */
1.1.1.8   root     3178:       if ((STACK_POINTER_OFFSET + STACK_BYTES - 1) / STACK_BYTES
                   3179:          != STACK_POINTER_OFFSET / STACK_BYTES)
                   3180:        op0 = plus_constant (op0, STACK_BYTES);
                   3181: #endif
                   3182: 
1.1.1.4   root     3183: #ifdef STACK_GROWS_DOWNWARD
1.1.1.2   root     3184:       anti_adjust_stack (round_push (op0));
1.1.1.4   root     3185: #endif
1.1.1.2   root     3186:       /* Return a copy of current stack ptr, in TARGET if possible.  */
                   3187:       if (target)
                   3188:        emit_move_insn (target, stack_pointer_rtx);
                   3189:       else
                   3190:        target = copy_to_reg (stack_pointer_rtx);
1.1.1.4   root     3191: #ifdef STACK_POINTER_OFFSET
                   3192:       /* If the contents of the stack pointer reg are offset from the
                   3193:         actual top-of-stack address, add the offset here.  */
1.1.1.6   root     3194:       if (GET_CODE (target) == REG)
1.1.1.8   root     3195:        emit_insn (gen_add2_insn (target,
                   3196:                                  gen_rtx (CONST_INT, VOIDmode,
                   3197:                                           (STACK_POINTER_OFFSET + STACK_BYTES - 1) / STACK_BYTES * STACK_BYTES)));
1.1.1.6   root     3198:       else
                   3199:        {
                   3200:          rtx temp =
                   3201:            expand_binop (GET_MODE (target), add_optab, target,
1.1.1.8   root     3202:                          gen_rtx (CONST_INT, VOIDmode,
                   3203:                                   (STACK_POINTER_OFFSET + STACK_BYTES - 1) / STACK_BYTES * STACK_BYTES),
1.1.1.6   root     3204:                          target,
                   3205:                          1, OPTAB_DIRECT);
                   3206:          if (temp == 0) abort ();
                   3207:          if (temp != target)
                   3208:            emit_move_insn (target, temp);
                   3209:        }
1.1.1.4   root     3210: #endif
                   3211: #ifndef STACK_GROWS_DOWNWARD
                   3212:       anti_adjust_stack (round_push (op0));
                   3213: #endif
1.1.1.2   root     3214:       return target;
                   3215: 
                   3216:     case BUILT_IN_FFS:
1.1.1.10  root     3217:       if (arglist == 0
                   3218:          /* Arg could be non-integer if user redeclared this fcn wrong.  */
                   3219:          || TREE_CODE (TREE_TYPE (TREE_VALUE (arglist))) != INTEGER_TYPE)
1.1.1.2   root     3220:        return const0_rtx;
                   3221: 
                   3222:       /* Compute the argument.  */
                   3223:       op0 = expand_expr (TREE_VALUE (arglist), subtarget, VOIDmode, 0);
                   3224:       /* Compute ffs, into TARGET if possible.
                   3225:         Set TARGET to wherever the result comes back.  */
                   3226:       target = expand_unop (mode, ffs_optab, op0, target, 1);
                   3227:       if (target == 0)
                   3228:        abort ();
                   3229:       return target;
                   3230: 
                   3231:     default:
                   3232:       abort ();
                   3233:     }
                   3234: }
                   3235: 
                   3236: /* Expand code for a post- or pre- increment or decrement
                   3237:    and return the RTX for the result.
                   3238:    POST is 1 for postinc/decrements and 0 for preinc/decrements.  */
                   3239: 
                   3240: static rtx
                   3241: expand_increment (exp, post)
                   3242:      register tree exp;
                   3243:      int post;
                   3244: {
                   3245:   register rtx op0, op1;
                   3246:   register rtx temp;
                   3247:   register tree incremented = TREE_OPERAND (exp, 0);
                   3248:   optab this_optab = add_optab;
                   3249:   int icode;
                   3250:   enum machine_mode mode = TYPE_MODE (TREE_TYPE (exp));
                   3251:   int op0_is_copy = 0;
                   3252: 
                   3253:   /* Stabilize any component ref that might need to be
                   3254:      evaluated more than once below.  */
                   3255:   if (TREE_CODE (incremented) == COMPONENT_REF
                   3256:       && (TREE_CODE (TREE_OPERAND (incremented, 0)) != INDIRECT_REF
                   3257:          || DECL_MODE (TREE_OPERAND (exp, 1)) == BImode))
                   3258:     incremented = stabilize_reference (incremented);
                   3259: 
                   3260:   /* Compute the operands as RTX.
                   3261:      Note whether OP0 is the actual lvalue or a copy of it:
                   3262:      I believe it is a copy iff it is a register and insns were
                   3263:      generated in computing it.  */
                   3264:   temp = get_last_insn ();
                   3265:   op0 = expand_expr (incremented, 0, VOIDmode, 0);
                   3266:   if (temp != get_last_insn ())
                   3267:     op0_is_copy = (GET_CODE (op0) == REG || GET_CODE (op0) == SUBREG);
                   3268:   op1 = expand_expr (TREE_OPERAND (exp, 1), 0, VOIDmode, 0);
                   3269: 
                   3270:   /* Decide whether incrementing or decrementing.  */
                   3271:   if (TREE_CODE (exp) == POSTDECREMENT_EXPR
                   3272:       || TREE_CODE (exp) == PREDECREMENT_EXPR)
                   3273:     this_optab = sub_optab;
                   3274: 
                   3275:   /* If OP0 is not the actual lvalue, but rather a copy in a register,
                   3276:      then we cannot just increment OP0.  We must
                   3277:      therefore contrive to increment the original value.
                   3278:      Then we can return OP0 since it is a copy of the old value.  */
                   3279:   if (op0_is_copy)
                   3280:     {
                   3281:       /* This is the easiest way to increment the value wherever it is.
                   3282:         Problems with multiple evaluation of INCREMENTED
                   3283:         are prevented because either (1) it is a component_ref,
                   3284:         in which case it was stabilized above, or (2) it is an array_ref
                   3285:         with constant index in an array in a register, which is
                   3286:         safe to reevaluate.  */
                   3287:       tree newexp = build ((this_optab == add_optab
                   3288:                            ? PLUS_EXPR : MINUS_EXPR),
                   3289:                           TREE_TYPE (exp),
                   3290:                           incremented,
                   3291:                           TREE_OPERAND (exp, 1));
                   3292:       temp = expand_assignment (incremented, newexp, ! post, 0);
                   3293:       return post ? op0 : temp;
                   3294:     }
                   3295: 
                   3296:   /* Convert decrement by a constant into a negative increment.  */
                   3297:   if (this_optab == sub_optab
                   3298:       && GET_CODE (op1) == CONST_INT)
                   3299:     {
                   3300:       op1 = gen_rtx (CONST_INT, VOIDmode, - INTVAL (op1));
                   3301:       this_optab = add_optab;
                   3302:     }
                   3303: 
                   3304:   if (post)
                   3305:     {
                   3306:       /* We have a true reference to the value in OP0.
                   3307:         If there is an insn to add or subtract in this mode, queue it.  */
                   3308: 
                   3309:       /* I'm not sure this is still necessary.  */
                   3310:       op0 = stabilize (op0);
                   3311: 
                   3312:       icode = (int) this_optab->handlers[(int) mode].insn_code;
                   3313:       if (icode != (int) CODE_FOR_nothing
                   3314:          /* Make sure that OP0 is valid for operands 0 and 1
                   3315:             of the insn we want to queue.  */
                   3316:          && (*insn_operand_predicate[icode][0]) (op0, mode)
                   3317:          && (*insn_operand_predicate[icode][1]) (op0, mode))
                   3318:        {
                   3319:          if (! (*insn_operand_predicate[icode][2]) (op1, mode))
                   3320:            op1 = force_reg (mode, op1);
                   3321: 
                   3322:          return enqueue_insn (op0, GEN_FCN (icode) (op0, op0, op1));
                   3323:        }
                   3324:     }
                   3325: 
                   3326:   /* Preincrement, or we can't increment with one simple insn.  */
                   3327:   if (post)
                   3328:     /* Save a copy of the value before inc or dec, to return it later.  */
                   3329:     temp = copy_to_reg (op0);
                   3330:   else
                   3331:     /* Arrange to return the incremented value.  */
                   3332:     temp = op0;
                   3333: 
                   3334:   /* Increment however we can.  */
                   3335:   op1 = expand_binop (mode, this_optab, op0, op1, op0,
                   3336:                      0, OPTAB_LIB_WIDEN);
                   3337:   /* Make sure the value is stored into OP0.  */
                   3338:   if (op1 != op0)
                   3339:     emit_move_insn (op0, op1);
                   3340: 
                   3341:   return temp;
                   3342: }
                   3343: 
1.1       root     3344: /* Expand all function calls contained within EXP, innermost ones first.
                   3345:    But don't look within expressions that have sequence points.
                   3346:    For each CALL_EXPR, record the rtx for its value
1.1.1.2   root     3347:    in the CALL_EXPR_RTL field.
                   3348: 
                   3349:    Calls that return large structures for which a structure return
                   3350:    stack slot is needed are not preexpanded.  Preexpanding them loses
                   3351:    because if more than one were preexpanded they would try to use the
                   3352:    same stack slot.  */
1.1       root     3353: 
                   3354: static void
                   3355: preexpand_calls (exp)
                   3356:      tree exp;
                   3357: {
                   3358:   register int nops, i;
                   3359: 
                   3360:   if (! do_preexpand_calls)
                   3361:     return;
                   3362: 
1.1.1.2   root     3363:   /* Only expressions and references can contain calls.  */
                   3364: 
                   3365:   if (tree_code_type[(int) TREE_CODE (exp)][0] != 'e'
                   3366:       && tree_code_type[(int) TREE_CODE (exp)][0] != 'r')
                   3367:     return;
                   3368: 
1.1       root     3369:   switch (TREE_CODE (exp))
                   3370:     {
                   3371:     case CALL_EXPR:
1.1.1.2   root     3372:       /* Do nothing to built-in functions.  */
                   3373:       if (TREE_CODE (TREE_OPERAND (exp, 0)) == ADDR_EXPR
                   3374:          && TREE_CODE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0)) == FUNCTION_DECL
1.1.1.5   root     3375:          && (DECL_FUNCTION_CODE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0))
                   3376:              != NOT_BUILT_IN))
1.1.1.2   root     3377:        return;
                   3378:       if (CALL_EXPR_RTL (exp) == 0
                   3379:          && TYPE_MODE (TREE_TYPE (exp)) != BLKmode)
                   3380:        CALL_EXPR_RTL (exp) = expand_call (exp, 0, 0);
1.1       root     3381:       return;
                   3382: 
                   3383:     case COMPOUND_EXPR:
                   3384:     case COND_EXPR:
                   3385:     case TRUTH_ANDIF_EXPR:
                   3386:     case TRUTH_ORIF_EXPR:
                   3387:       /* If we find one of these, then we can be sure
                   3388:         the adjust will be done for it (since it makes jumps).
                   3389:         Do it now, so that if this is inside an argument
                   3390:         of a function, we don't get the stack adjustment
                   3391:         after some other args have already been pushed.  */
                   3392:       do_pending_stack_adjust ();
                   3393:       return;
                   3394: 
1.1.1.2   root     3395:     case RTL_EXPR:
                   3396:       return;
                   3397: 
1.1       root     3398:     case SAVE_EXPR:
                   3399:       if (SAVE_EXPR_RTL (exp) != 0)
                   3400:        return;
                   3401:     }
                   3402: 
                   3403:   nops = tree_code_length[(int) TREE_CODE (exp)];
                   3404:   for (i = 0; i < nops; i++)
                   3405:     if (TREE_OPERAND (exp, i) != 0)
                   3406:       {
                   3407:        register int type = *tree_code_type[(int) TREE_CODE (TREE_OPERAND (exp, i))];
                   3408:        if (type == 'e' || type == 'r')
                   3409:          preexpand_calls (TREE_OPERAND (exp, i));
                   3410:       }
                   3411: }
                   3412: 
1.1.1.2   root     3413: /* Force FUNEXP into a form suitable for the address of a CALL,
                   3414:    and return that as an rtx.  Also load the static chain register
                   3415:    from either FUNEXP or CONTEXT.  */
1.1       root     3416: 
1.1.1.2   root     3417: static rtx
                   3418: prepare_call_address (funexp, context)
1.1       root     3419:      rtx funexp;
                   3420:      rtx context;
                   3421: {
                   3422:   funexp = protect_from_queue (funexp, 0);
1.1.1.2   root     3423:   if (context != 0)
1.1       root     3424:     context = protect_from_queue (context, 0);
                   3425: 
                   3426:   /* Function variable in language with nested functions.  */
                   3427:   if (GET_MODE (funexp) == EPmode)
                   3428:     {
1.1.1.2   root     3429:       emit_move_insn (static_chain_rtx, gen_highpart (Pmode, funexp));
                   3430:       funexp = memory_address (FUNCTION_MODE, gen_lowpart (Pmode, funexp));
                   3431:       emit_insn (gen_rtx (USE, VOIDmode, static_chain_rtx));
1.1       root     3432:     }
                   3433:   else
                   3434:     {
                   3435:       if (context != 0)
1.1.1.2   root     3436:        /* Unless function variable in C, or top level function constant */
                   3437:        emit_move_insn (static_chain_rtx, lookup_static_chain (context));
                   3438: 
                   3439:       /* Make a valid memory address and copy constants thru pseudo-regs,
                   3440:         but not for a constant address if -fno-function-cse.  */
                   3441:       if (GET_CODE (funexp) != SYMBOL_REF)
                   3442:        funexp = memory_address (FUNCTION_MODE, funexp);
                   3443:       else
1.1       root     3444:        {
1.1.1.2   root     3445: #ifndef NO_FUNCTION_CSE
1.1.1.6   root     3446:          if (optimize && ! flag_no_function_cse)
                   3447:            funexp = force_reg (Pmode, funexp);
1.1.1.2   root     3448: #endif
                   3449:        }
                   3450: 
                   3451:       if (context != 0)
                   3452:        emit_insn (gen_rtx (USE, VOIDmode, static_chain_rtx));
1.1       root     3453:     }
1.1.1.2   root     3454:   return funexp;
                   3455: }
                   3456: 
                   3457: /* Generate instructions to call function FUNEXP,
                   3458:    and optionally pop the results.
                   3459:    The CALL_INSN is the first insn generated.
                   3460: 
                   3461:    FUNTYPE is the data type of the function, or, for a library call,
                   3462:    the identifier for the name of the call.  This is given to the
                   3463:    macro RETURN_POPS_ARGS to determine whether this function pops its own args.
                   3464: 
1.1.1.6   root     3465:    STACK_SIZE is the number of bytes of arguments on the stack,
1.1.1.2   root     3466:    rounded up to STACK_BOUNDARY; zero if the size is variable.
                   3467:    This is both to put into the call insn and
                   3468:    to generate explicit popping code if necessary.
                   3469: 
                   3470:    NEXT_ARG_REG is the rtx that results from executing
                   3471:      FUNCTION_ARG (args_so_far, VOIDmode, void_type_node, 1)
                   3472:    just after all the args have had their registers assigned.
                   3473:    This could be whatever you like, but normally it is the first
                   3474:    arg-register beyond those used for args in this call,
                   3475:    or 0 if all the arg-registers are used in this call.
                   3476:    It is passed on to `gen_call' so you can put this info in the call insn.
                   3477: 
                   3478:    VALREG is a hard register in which a value is returned,
                   3479:    or 0 if the call does not return a value.
                   3480: 
                   3481:    OLD_ARGS_SIZE is the value that `current_args_size' had before
                   3482:    the args to this call were processed.
                   3483:    We restore `current_args_size' to that value.  */
                   3484: 
                   3485: static void
                   3486: emit_call_1 (funexp, funtype, stack_size, next_arg_reg, valreg, old_args_size)
                   3487:      rtx funexp;
                   3488:      tree funtype;
                   3489:      int stack_size;
                   3490:      rtx next_arg_reg;
                   3491:      rtx valreg;
                   3492:      int old_args_size;
                   3493: {
                   3494:   rtx stack_size_rtx = gen_rtx (CONST_INT, VOIDmode, stack_size);
                   3495: 
                   3496:   if (valreg)
                   3497:     emit_call_insn (gen_call_value (valreg,
                   3498:                                    gen_rtx (MEM, FUNCTION_MODE, funexp),
                   3499:                                    stack_size_rtx, next_arg_reg));
                   3500:   else
                   3501:     emit_call_insn (gen_call (gen_rtx (MEM, FUNCTION_MODE, funexp),
                   3502:                              stack_size_rtx, next_arg_reg));
                   3503: 
                   3504:   current_args_size = old_args_size;
                   3505: 
1.1       root     3506:   /* If returning from the subroutine does not automatically pop the args,
                   3507:      we need an instruction to pop them sooner or later.
                   3508:      Perhaps do it now; perhaps just record how much space to pop later.  */
1.1.1.2   root     3509: 
                   3510:   if (! RETURN_POPS_ARGS (TREE_TYPE (funtype))
                   3511:       && stack_size != 0)
1.1       root     3512:     {
1.1.1.2   root     3513:       if (flag_defer_pop && current_args_size == 0)
                   3514:        pending_stack_adjust += stack_size;
1.1       root     3515:       else
1.1.1.3   root     3516:        adjust_stack (stack_size_rtx);
1.1       root     3517:     }
                   3518: }
                   3519: 
                   3520: /* At the start of a function, record that we have no previously-pushed
                   3521:    arguments waiting to be popped.  */
                   3522: 
1.1.1.2   root     3523: void
                   3524: init_pending_stack_adjust ()
1.1       root     3525: {
                   3526:   pending_stack_adjust = 0;
                   3527: }
                   3528: 
1.1.1.2   root     3529: /* When exiting from function, if safe, clear out any pending stack adjust
                   3530:    so the adjustment won't get done.  */
                   3531: 
                   3532: void
                   3533: clear_pending_stack_adjust ()
                   3534: {
                   3535: #ifdef EXIT_IGNORE_STACK
1.1.1.4   root     3536:   if (!flag_omit_frame_pointer && EXIT_IGNORE_STACK
1.1.1.10  root     3537:       && ! TREE_INLINE (current_function_decl)
                   3538:       && ! flag_inline_functions)
1.1.1.2   root     3539:     pending_stack_adjust = 0;
                   3540: #endif
                   3541: }
                   3542: 
1.1       root     3543: /* At start of function, initialize.  */
1.1.1.2   root     3544: void
1.1       root     3545: clear_current_args_size ()
                   3546: {
                   3547:   current_args_size = 0;
                   3548: }
                   3549: 
                   3550: /* Pop any previously-pushed arguments that have not been popped yet.  */
                   3551: 
1.1.1.2   root     3552: void
1.1       root     3553: do_pending_stack_adjust ()
                   3554: {
                   3555:   if (current_args_size == 0)
                   3556:     {
                   3557:       if (pending_stack_adjust != 0)
                   3558:        adjust_stack (gen_rtx (CONST_INT, VOIDmode, pending_stack_adjust));
                   3559:       pending_stack_adjust = 0;
                   3560:     }
                   3561: }
                   3562: 
                   3563: /* Generate all the code for a function call
                   3564:    and return an rtx for its value.
                   3565:    Store the value in TARGET (specified as an rtx) if convenient.
1.1.1.2   root     3566:    If the value is stored in TARGET then TARGET is returned.
                   3567:    If IGNORE is nonzero, then we ignore the value of the function call.  */
1.1       root     3568: 
1.1.1.9   root     3569: struct arg_data
                   3570: {
                   3571:   /* Tree node for this argument.  */
                   3572:   tree tree_value;
                   3573:   /* Precomputed RTL value, or 0 if it isn't precomputed.  */
                   3574:   rtx value;
                   3575:   /* Register to pass this argument in, or 0 if passed on stack.  */
                   3576:   rtx reg;
                   3577:   /* Number of registers to use.  0 means put the whole arg in registers.
                   3578:      Also 0 if not passed in registers.  */
                   3579:   int partial;
                   3580:   /* Offset of this argument from beginning of stack-args.  */
                   3581:   struct args_size offset;
                   3582:   /* Size of this argument on the stack, rounded up for any padding it gets,
                   3583:      parts of the argument passed in registers do not count.
                   3584:      If the FIRST_PARM_CALLER_OFFSET is negative, then register parms
                   3585:      are counted here as well.  */
                   3586:   struct args_size size;
                   3587:   /* Nonzero if this arg has already been stored.  */
                   3588:   int stored;
                   3589:   /* const0_rtx means should preallocate stack space for this arg.
                   3590:      Other non0 value is the stack slot, preallocated.
                   3591:      Used only for BLKmode.  */
                   3592:   rtx stack;
                   3593: };
                   3594: 
1.1       root     3595: static rtx
1.1.1.2   root     3596: expand_call (exp, target, ignore)
1.1       root     3597:      tree exp;
                   3598:      rtx target;
1.1.1.2   root     3599:      int ignore;
1.1       root     3600: {
1.1.1.8   root     3601:   /* List of actual parameters.  */
1.1       root     3602:   tree actparms = TREE_OPERAND (exp, 1);
1.1.1.8   root     3603:   /* RTX for the function to be called.  */
1.1.1.2   root     3604:   rtx funexp;
1.1.1.8   root     3605:   /* Data type of the function.  */
                   3606:   tree funtype;
                   3607:   /* Declaration of the function being called,
                   3608:      or 0 if the function is computed (not known by name).  */
                   3609:   tree fndecl = 0;
                   3610: 
                   3611:   /* Register in which non-BLKmode value will be returned,
                   3612:      or 0 if no value or if value is BLKmode.  */
                   3613:   rtx valreg;
                   3614:   /* Address where we should return a BLKmode value;
                   3615:      0 if value not BLKmode.  */
                   3616:   rtx structure_value_addr = 0;
                   3617:   /* Nonzero if that address is being passed by treating it as
                   3618:      an extra, implicit first parameter.  Otherwise,
                   3619:      it is passed by being copied directly into struct_value_rtx.  */
                   3620:   int structure_value_addr_parm = 0;
                   3621: 
                   3622:   /* Number of actual parameters in this call, including struct value addr.  */
                   3623:   int num_actuals;
                   3624:   /* Number of named args.  Args after this are anonymous ones
                   3625:      and they must all go on the stack.  */
                   3626:   int n_named_args;
                   3627: 
1.1.1.9   root     3628:   /* Vector of information about each argument.
                   3629:      Arguments are numbered in the order they will be pushed,
1.1.1.8   root     3630:      not the order they are written.  */
1.1.1.9   root     3631:   struct arg_data *args;
1.1.1.8   root     3632: 
                   3633:   /* Total size in bytes of all the stack-parms scanned so far.  */
                   3634:   struct args_size args_size;
1.1.1.9   root     3635:   /* Remember initial value of args_size.constant.  */
                   3636:   int starting_args_size;
                   3637:   /* Nonzero means count reg-parms' size in ARGS_SIZE.  */
                   3638:   int stack_count_regparms = 0;
1.1.1.8   root     3639:   /* Data on reg parms scanned so far.  */
                   3640:   CUMULATIVE_ARGS args_so_far;
                   3641:   /* Nonzero if a reg parm has been scanned.  */
1.1.1.9   root     3642:   int reg_parm_seen;
                   3643:   /* Nonzero if we must avoid push-insns in the args for this call.  */
                   3644:   int must_preallocate;
1.1.1.8   root     3645:   /* 1 if scanning parms front to back, -1 if scanning back to front.  */
1.1.1.2   root     3646:   int inc;
1.1.1.8   root     3647:   /* Address of space preallocated for stack parms
                   3648:      (on machines that lack push insns), or 0 if space not preallocated.  */
                   3649:   rtx argblock = 0;
                   3650: 
                   3651:   /* Nonzero if it is plausible that this is a call to alloca.  */
                   3652:   int may_be_alloca;
                   3653:   /* Nonzero if this is a call to setjmp or a related function.  */
1.1.1.2   root     3654:   int is_setjmp;
1.1.1.8   root     3655:   /* Nonzero if this is a call to an inline function.  */
1.1.1.2   root     3656:   int is_integrable = 0;
1.1.1.8   root     3657:   /* Nonzero if this is a call to __builtin_new.  */
                   3658:   int is_builtin_new;
1.1.1.14! root     3659:   /* Nonzero if this is a call to a `const' function.  */
        !          3660:   int is_const = 0;
1.1.1.8   root     3661: 
1.1.1.9   root     3662:   /* Nonzero if there are BLKmode args whose data types require them
                   3663:      to be passed in memory, not (even partially) in registers.  */
                   3664:   int BLKmode_parms_forced = 0;
                   3665:   /* The offset of the first BLKmode parameter which 
                   3666:      *must* be passed in memory.  */
                   3667:   int BLKmode_parms_first_offset = 0;
                   3668:   /* Total size of BLKmode parms which could usefully be preallocated.  */
                   3669:   int BLKmode_parms_sizes = 0;
                   3670: 
                   3671:   /* Amount stack was adjusted to protect BLKmode parameters
                   3672:      which are below the nominal "stack address" value.  */
                   3673:   rtx protected_stack = 0;
                   3674: 
1.1.1.14! root     3675:   /* The last insn before the things that are intrinsically part of the call.
        !          3676:      The beginning reg-note goes on the insn after this one.  */
        !          3677:   rtx insn_before;
        !          3678: 
1.1.1.9   root     3679:   rtx old_stack_level = 0;
1.1.1.2   root     3680:   int old_pending_adj;
                   3681:   int old_current_args_size = current_args_size;
1.1.1.8   root     3682:   tree old_cleanups = cleanups_of_this_call;
1.1.1.2   root     3683: 
1.1.1.8   root     3684:   register tree p;
                   3685:   register int i;
1.1.1.2   root     3686: 
                   3687:   /* See if we can find a DECL-node for the actual function.
                   3688:      As a result, decide whether this is a call to an integrable function.  */
                   3689: 
1.1.1.8   root     3690:   p = TREE_OPERAND (exp, 0);
1.1.1.2   root     3691:   if (TREE_CODE (p) == ADDR_EXPR)
                   3692:     {
                   3693:       fndecl = TREE_OPERAND (p, 0);
                   3694:       if (TREE_CODE (fndecl) != FUNCTION_DECL)
                   3695:        fndecl = 0;
                   3696:       else
                   3697:        {
                   3698:          extern tree current_function_decl;
1.1       root     3699: 
1.1.1.2   root     3700:          if (fndecl != current_function_decl
                   3701:              && DECL_SAVED_INSNS (fndecl))
                   3702:            is_integrable = 1;
                   3703:          else
1.1.1.4   root     3704:            {
                   3705:              /* In case this function later becomes inlineable,
                   3706:                 record that there was already a non-inline call to it.  */
                   3707:              TREE_ADDRESSABLE (fndecl) = 1;
                   3708:              TREE_ADDRESSABLE (DECL_NAME (fndecl)) = 1;
                   3709:            }
1.1.1.14! root     3710: 
        !          3711:          if (TREE_READONLY (fndecl) && ! TREE_THIS_VOLATILE (fndecl))
        !          3712:            is_const = 1;
1.1.1.2   root     3713:        }
                   3714:     }
1.1       root     3715: 
1.1.1.2   root     3716:   /* Set up a place to return a structure.  */
1.1       root     3717: 
                   3718:   if (TYPE_MODE (TREE_TYPE (exp)) == BLKmode)
                   3719:     {
                   3720:       /* This call returns a big structure.  */
                   3721:       if (target)
1.1.1.9   root     3722:        {
                   3723:          structure_value_addr = XEXP (target, 0);
                   3724:          if (reg_mentioned_p (stack_pointer_rtx, structure_value_addr))
                   3725:            structure_value_addr = copy_to_reg (structure_value_addr);
                   3726:        }
1.1       root     3727:       else
                   3728:        /* Make room on the stack to hold the value.  */
                   3729:        structure_value_addr = get_structure_value_addr (expr_size (exp));
                   3730:     }
                   3731: 
1.1.1.2   root     3732:   if (is_integrable)
                   3733:     {
                   3734:       extern rtx expand_inline_function ();
                   3735:       rtx temp;
                   3736: 
                   3737:       temp = expand_inline_function (fndecl, actparms, target,
                   3738:                                     ignore, TREE_TYPE (exp),
                   3739:                                     structure_value_addr);
                   3740: 
1.1.1.8   root     3741:       /* If inlining succeeded, return.  */
                   3742:       if ((int) temp != -1)
1.1.1.2   root     3743:        return temp;
1.1.1.8   root     3744: 
                   3745:       /* If inlining failed, mark FNDECL as needing to be compiled
                   3746:         separately after all.  */
                   3747:       TREE_ADDRESSABLE (fndecl) = 1;
                   3748:       TREE_ADDRESSABLE (DECL_NAME (fndecl)) = 1;
1.1.1.2   root     3749:     }
                   3750: 
                   3751: #if 0
                   3752:   /* Unless it's a call to a specific function that isn't alloca,
                   3753:      if it has one argument, we must assume it might be alloca.  */
                   3754: 
                   3755:   may_be_alloca =
                   3756:     (!(fndecl != 0
                   3757:        && strcmp (IDENTIFIER_POINTER (DECL_NAME (fndecl)),
                   3758:                  "alloca"))
                   3759:      && actparms != 0
                   3760:      && TREE_CHAIN (actparms) == 0);
                   3761: #else
                   3762:   /* We assume that alloca will always be called by name.  It
                   3763:      makes no sense to pass it as a pointer-to-function to
                   3764:      anything that does not understand its behavior.  */
                   3765:   may_be_alloca =
1.1.1.9   root     3766:     (fndecl && (! strcmp (IDENTIFIER_POINTER (DECL_NAME (fndecl)), "alloca")
                   3767:                || ! strcmp (IDENTIFIER_POINTER (DECL_NAME (fndecl)),
                   3768:                             "__builtin_alloca")));
1.1.1.2   root     3769: #endif
                   3770: 
                   3771:   /* See if this is a call to a function that can return more than once.  */
                   3772: 
                   3773:   is_setjmp
                   3774:     = (fndecl != 0
                   3775:        && (!strcmp (IDENTIFIER_POINTER (DECL_NAME (fndecl)), "setjmp")
                   3776:           || !strcmp (IDENTIFIER_POINTER (DECL_NAME (fndecl)), "_setjmp")));
                   3777: 
1.1.1.8   root     3778:   is_builtin_new
                   3779:     = (fndecl != 0
                   3780:        && (!strcmp (IDENTIFIER_POINTER (DECL_NAME (fndecl)), "__builtin_new")));
                   3781: 
1.1.1.2   root     3782:   if (may_be_alloca)
                   3783:     {
                   3784:       frame_pointer_needed = 1;
                   3785:       may_call_alloca = 1;
                   3786:     }
                   3787: 
                   3788:   /* Don't let pending stack adjusts add up to too much.
                   3789:      Also, do all pending adjustments now
                   3790:      if there is any chance this might be a call to alloca.  */
                   3791: 
                   3792:   if (pending_stack_adjust >= 32
                   3793:       || (pending_stack_adjust > 0 && may_be_alloca))
                   3794:     do_pending_stack_adjust ();
                   3795: 
                   3796:   /* Operand 0 is a pointer-to-function; get the type of the function.  */
                   3797:   funtype = TREE_TYPE (TREE_OPERAND (exp, 0));
                   3798:   if (TREE_CODE (funtype) != POINTER_TYPE)
                   3799:     abort ();
                   3800:   funtype = TREE_TYPE (funtype);
                   3801: 
1.1.1.8   root     3802:   /* If the address for a structure value should be in memory,
                   3803:      and it would go in memory if treated as an extra parameter,
                   3804:      treat it that way.  */
1.1.1.6   root     3805:   if (structure_value_addr && GET_CODE (struct_value_rtx) == MEM)
1.1.1.8   root     3806:     {
                   3807:       rtx tem;
                   3808: 
                   3809:       INIT_CUMULATIVE_ARGS (args_so_far, funtype);
                   3810:       tem = FUNCTION_ARG (args_so_far, Pmode,
                   3811:                          build_pointer_type (TREE_TYPE (funtype)), 1);
1.1.1.10  root     3812:       if (tem != 0 && GET_CODE (tem) == MEM)
1.1.1.8   root     3813:        {
                   3814:          actparms = tree_cons (error_mark_node,
                   3815:                                build (SAVE_EXPR,
                   3816:                                       type_for_size (GET_MODE_BITSIZE (Pmode), 0),
                   3817:                                       0,
                   3818:                                       force_reg (Pmode, structure_value_addr)),
                   3819:                                actparms);
                   3820:          structure_value_addr_parm = 1;
                   3821:        }
                   3822:     }
1.1.1.6   root     3823: 
1.1.1.2   root     3824:   /* Count the arguments and set NUM_ACTUALS.  */
1.1       root     3825:   for (p = actparms, i = 0; p; p = TREE_CHAIN (p)) i++;
                   3826:   num_actuals = i;
1.1.1.2   root     3827: 
                   3828:   /* Compute number of named args.
                   3829:      This may actually be 1 too large, but that happens
                   3830:      only in the case when all args are named, so no trouble results.  */
                   3831:   if (TYPE_ARG_TYPES (funtype) != 0)
                   3832:     n_named_args = list_length (TYPE_ARG_TYPES (funtype));
                   3833:   else
                   3834:     /* If we know nothing, treat all args as named.  */
                   3835:     n_named_args = num_actuals;
                   3836: 
1.1.1.9   root     3837:   /* Make a vector to hold all the information about each arg.  */
                   3838:   args = (struct arg_data *) alloca (num_actuals * sizeof (struct arg_data));
                   3839:   bzero (args, num_actuals * sizeof (struct arg_data));
                   3840: 
                   3841:   args_size.constant = 0;
                   3842:   args_size.var = 0;
                   3843: #ifdef FIRST_PARM_CALLER_OFFSET
                   3844:   args_size.constant = FIRST_PARM_CALLER_OFFSET (fntype);
                   3845:   stack_count_regparms = 1;
                   3846: #endif
                   3847:   starting_args_size = args_size.constant;
1.1.1.2   root     3848: 
                   3849:   /* In this loop, we consider args in the order they are written.
1.1.1.9   root     3850:      We fill up ARGS from the front of from the back if necessary
                   3851:      so that in any case the first arg to be pushed ends up at the front.  */
1.1       root     3852: 
1.1.1.2   root     3853: #ifdef PUSH_ARGS_REVERSED
                   3854:   i = num_actuals - 1, inc = -1;
1.1       root     3855:   /* In this case, must reverse order of args
1.1.1.2   root     3856:      so that we compute and push the last arg first.  */
1.1       root     3857: #else
1.1.1.2   root     3858:   i = 0, inc = 1;
                   3859: #endif
                   3860: 
                   3861:   INIT_CUMULATIVE_ARGS (args_so_far, funtype);
                   3862: 
                   3863:   for (p = actparms; p; p = TREE_CHAIN (p), i += inc)
                   3864:     {
                   3865:       tree type = TREE_TYPE (TREE_VALUE (p));
1.1.1.9   root     3866:       args[i].tree_value = TREE_VALUE (p);
                   3867:       args[i].offset = args_size;
1.1.1.2   root     3868: 
                   3869:       if (type == error_mark_node)
                   3870:        continue;
                   3871: 
                   3872:       /* Decide where to pass this arg.  */
1.1.1.9   root     3873:       /* args[i].reg is nonzero if all or part is passed in registers.
                   3874:         args[i].partial is nonzero if part but not all is passed in registers,
1.1.1.2   root     3875:          and the exact value says how many words are passed in registers.  */
                   3876: 
                   3877:       if (TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST
1.1.1.6   root     3878:          && args_size.var == 0
                   3879:          /* error_mark_node here is a flag for the fake argument
                   3880:             for a structure value address.  */
                   3881:          && TREE_PURPOSE (p) != error_mark_node)
1.1.1.2   root     3882:        {
1.1.1.9   root     3883:          args[i].reg = FUNCTION_ARG (args_so_far, TYPE_MODE (type), type,
                   3884:                                      i < n_named_args);
1.1.1.2   root     3885: #ifdef FUNCTION_ARG_PARTIAL_NREGS
1.1.1.9   root     3886:          args[i].partial
                   3887:            = FUNCTION_ARG_PARTIAL_NREGS (args_so_far,
                   3888:                                          TYPE_MODE (type), type,
                   3889:                                          i < n_named_args);
1.1.1.2   root     3890: #endif
                   3891:        }
                   3892: 
1.1.1.9   root     3893:       /* Compute the stack-size of this argument.  */
1.1.1.2   root     3894: 
1.1.1.9   root     3895:       if (args[i].reg != 0 && args[i].partial == 0
                   3896:          && ! stack_count_regparms)
                   3897:        /* On most machines, don't count stack space for a register arg.  */
1.1.1.2   root     3898:        ;
                   3899:       else if (TYPE_MODE (type) != BLKmode)
                   3900:        {
                   3901:          register int size;
                   3902: 
                   3903:          size = GET_MODE_SIZE (TYPE_MODE (type));
                   3904:          /* Compute how much space the push instruction will push.
                   3905:             On many machines, pushing a byte will advance the stack
                   3906:             pointer by a halfword.  */
                   3907: #ifdef PUSH_ROUNDING
                   3908:          size = PUSH_ROUNDING (size);
1.1       root     3909: #endif
1.1.1.2   root     3910:          /* Compute how much space the argument should get:
1.1.1.6   root     3911:             maybe pad to a multiple of the alignment for arguments.  */
                   3912:          if (none == FUNCTION_ARG_PADDING (TYPE_MODE (type), (rtx)0))
1.1.1.9   root     3913:            args[i].size.constant = size;
1.1.1.6   root     3914:          else
1.1.1.9   root     3915:            args[i].size.constant
1.1.1.6   root     3916:              = (((size + PARM_BOUNDARY / BITS_PER_UNIT - 1)
                   3917:                  / (PARM_BOUNDARY / BITS_PER_UNIT))
                   3918:                 * (PARM_BOUNDARY / BITS_PER_UNIT));
1.1.1.2   root     3919:        }
                   3920:       else
                   3921:        {
                   3922:          register tree size = size_in_bytes (type);
                   3923: 
                   3924:          /* A nonscalar.  Round its size up to a multiple
1.1.1.9   root     3925:             of PARM_BOUNDARY bits, unless it is not supposed to be padded.  */
1.1.1.6   root     3926:          if (none
                   3927:              != FUNCTION_ARG_PADDING (TYPE_MODE (type),
                   3928:                                       expand_expr (size, 0, VOIDmode, 0)))
                   3929:            size = convert_units (convert_units (size, BITS_PER_UNIT,
                   3930:                                                 PARM_BOUNDARY),
                   3931:                                  PARM_BOUNDARY, BITS_PER_UNIT);
1.1.1.9   root     3932:          ADD_PARM_SIZE (args[i].size, size);
                   3933: 
                   3934:          /* Certain data types may not be passed in registers
                   3935:             (eg C++ classes with constructors).
                   3936:             Also, BLKmode parameters initialized from CALL_EXPRs
                   3937:             are treated specially, if it is a win to do so.  */
                   3938:          if (TREE_CODE (TREE_VALUE (p)) == CALL_EXPR
1.1.1.13  root     3939:              || TREE_ADDRESSABLE (type))
1.1.1.9   root     3940:            {
1.1.1.13  root     3941:              if (TREE_ADDRESSABLE (type))
1.1.1.9   root     3942:                BLKmode_parms_forced = 1;
                   3943:              /* This is a marker for such a parameter.  */
                   3944:              args[i].stack = const0_rtx;
                   3945:              BLKmode_parms_sizes += TREE_INT_CST_LOW (size);
                   3946: 
                   3947:              /* If this parm's location is "below" the nominal stack pointer,
                   3948:                 note to decrement the stack pointer while it is computed.  */
                   3949: #ifdef FIRST_PARM_CALLER_OFFSET
                   3950:              if (BLKmode_parms_first_offset == 0)
                   3951:                BLKmode_parms_first_offset
                   3952:                  /* If parameter's offset is variable, assume the worst.  */
                   3953:                  = (args[i].offset.var
                   3954:                     ? FIRST_PARM_CALLER_OFFSET (fntype)
                   3955:                     : args[i].offset.constant);
                   3956: #endif
                   3957:            }
1.1.1.2   root     3958:        }
1.1.1.9   root     3959: 
1.1.1.2   root     3960:       /* If a part of the arg was put into registers,
                   3961:         don't include that part in the amount pushed.  */
1.1.1.9   root     3962:       if (! stack_count_regparms)
                   3963:        args[i].size.constant
                   3964:          -= ((args[i].partial * UNITS_PER_WORD)
                   3965:              / (PARM_BOUNDARY / BITS_PER_UNIT)
                   3966:              * (PARM_BOUNDARY / BITS_PER_UNIT));
1.1.1.2   root     3967: 
1.1.1.9   root     3968:       /* Update ARGS_SIZE, the total stack space for args so far.  */
1.1.1.2   root     3969: 
1.1.1.9   root     3970:       args_size.constant += args[i].size.constant;
                   3971:       if (args[i].size.var)
1.1.1.2   root     3972:        {
1.1.1.9   root     3973:          ADD_PARM_SIZE (args_size, args[i].size.var);
1.1.1.2   root     3974:        }
1.1.1.9   root     3975: 
                   3976:       /* Increment ARGS_SO_FAR, which has info about which arg-registers
                   3977:         have been used, etc.  */
                   3978: 
                   3979:       FUNCTION_ARG_ADVANCE (args_so_far, TYPE_MODE (type), type,
                   3980:                            i < n_named_args);
1.1.1.2   root     3981:     }
                   3982: 
1.1.1.9   root     3983:   /* If we would have to push a partially-in-regs parm
                   3984:      before other stack parms, preallocate stack space instead.  */
                   3985:   must_preallocate = 0;
                   3986:   {
                   3987:     int partial_seen = 0;
                   3988:     for (i = 0; i < num_actuals; i++)
                   3989:       {
                   3990:        if (args[i].partial > 0)
                   3991:          partial_seen = 1;
                   3992:        else if (partial_seen && args[i].reg == 0)
                   3993:          must_preallocate = 1;
                   3994:       }
                   3995:   }
                   3996: 
1.1.1.14! root     3997:   /* Precompute all register parameters.  It isn't safe to compute anything
        !          3998:      once we have started filling any specific hard regs.
        !          3999:      If this function call is cse'able, precompute all the parameters.  */
        !          4000: 
        !          4001:   reg_parm_seen = 0;
        !          4002:   for (i = 0; i < num_actuals; i++)
        !          4003:     if (args[i].reg != 0 || is_const)
        !          4004:       {
        !          4005:        if (args[i].reg != 0)
        !          4006:          reg_parm_seen = 1;
        !          4007:        args[i].value = expand_expr (args[i].tree_value, 0, VOIDmode, 0);
        !          4008:        if (GET_CODE (args[i].value) != MEM
        !          4009:            && ! CONSTANT_P (args[i].value)
        !          4010:            && GET_CODE (args[i].value) != CONST_DOUBLE)
        !          4011:          args[i].value
        !          4012:            = force_reg (TYPE_MODE (TREE_TYPE (args[i].tree_value)),
        !          4013:                         args[i].value);
        !          4014:        /* ANSI doesn't require a sequence point here,
        !          4015:           but PCC has one, so this will avoid some problems.  */
        !          4016:        emit_queue ();
        !          4017:       }
        !          4018: 
        !          4019:   /* Get the function to call, in the form of RTL, if it is a constant.  */
        !          4020:   if (fndecl && is_const)
        !          4021:     {
        !          4022:       /* Get a SYMBOL_REF rtx for the function address.  */
        !          4023:       funexp = XEXP (DECL_RTL (fndecl), 0);
        !          4024: 
        !          4025: #ifndef NO_FUNCTION_CSE
        !          4026:       /* Pass the address through a pseudoreg, if desired,
        !          4027:         before the "beginning" of the library call.
        !          4028:         So this insn isn't "part of" the library call, in case that
        !          4029:         is deleted, or cse'd.  */
        !          4030:       if (! flag_no_function_cse)
        !          4031:        funexp = copy_to_mode_reg (Pmode, funexp);
        !          4032: #endif
        !          4033:     }
        !          4034: 
        !          4035:   /* Now we are about to start emitting insns that can be deleted
        !          4036:      if the libcall is deleted.  */
        !          4037:   insn_before = get_last_insn ();
        !          4038: 
1.1.1.9   root     4039:   /* If we have no actual push instructions, or shouldn't use them,
                   4040:      or we need a variable amount of space, make space for all args right now.
                   4041:      Round the needed size up to multiple of STACK_BOUNDARY.  */
1.1.1.2   root     4042: 
                   4043:   if (args_size.var != 0)
                   4044:     {
                   4045:       old_stack_level = copy_to_mode_reg (Pmode, stack_pointer_rtx);
                   4046:       old_pending_adj = pending_stack_adjust;
                   4047:       argblock = push_block (round_push (ARGS_SIZE_RTX (args_size)));
                   4048:     }
1.1.1.9   root     4049:   else if (args_size.constant > 0)
1.1.1.2   root     4050:     {
                   4051:       int needed = args_size.constant;
                   4052: 
                   4053: #ifdef STACK_BOUNDARY
                   4054:       needed = (needed + STACK_BYTES - 1) / STACK_BYTES * STACK_BYTES;
                   4055:       args_size.constant = needed;
                   4056: #endif
                   4057: 
1.1.1.9   root     4058:       if (
1.1.1.2   root     4059: #ifndef PUSH_ROUNDING
1.1.1.9   root     4060:          1  /* Always preallocate if no push insns.  */
                   4061: #else
                   4062:          must_preallocate || BLKmode_parms_forced
                   4063:          || BLKmode_parms_sizes > (args_size.constant >> 1)
                   4064: #endif
                   4065:          )
1.1.1.2   root     4066:        {
1.1.1.9   root     4067:          /* Try to reuse some or all of the pending_stack_adjust
                   4068:             to get this space.  Maybe we can avoid any pushing.  */
                   4069:          if (needed > pending_stack_adjust)
                   4070:            {
                   4071:              needed -= pending_stack_adjust;
                   4072:              pending_stack_adjust = 0;
                   4073:            }
                   4074:          else
                   4075:            {
                   4076:              pending_stack_adjust -= needed;
                   4077:              needed = 0;
                   4078:            }
                   4079:          argblock = push_block (gen_rtx (CONST_INT, VOIDmode, needed));
1.1.1.2   root     4080:        }
                   4081:     }
1.1.1.13  root     4082: #ifndef PUSH_ROUNDING
                   4083:   else if (BLKmode_parms_forced)
                   4084:     {
                   4085:       /* If we have reg-parms that need to be temporarily on the stack,
                   4086:         set up an arg block address even though there is no space
                   4087:         to be allocated for it.  */
                   4088:       argblock = push_block (const0_rtx);
                   4089:     }
                   4090: #endif
1.1.1.2   root     4091: 
1.1.1.9   root     4092:   /* Don't try to defer pops if preallocating, not even from the first arg,
                   4093:      since ARGBLOCK probably refers to the SP.  */
                   4094:   if (argblock)
                   4095:     NO_DEFER_POP;
                   4096: 
                   4097: #ifdef STACK_GROWS_DOWNWARD
                   4098:   /* If any BLKmode parms need to be preallocated in space
                   4099:      below the nominal stack-pointer address, we need to adjust the
                   4100:      stack pointer so that this location is temporarily above it.
                   4101:      This ensures that computation won't clobber that space.  */
                   4102:   if (BLKmode_parms_first_offset < 0 && argblock != 0)
                   4103:     {
                   4104:       int needed = -BLKmode_parms_first_offset;
                   4105:       argblock = copy_to_reg (argblock);
                   4106: 
                   4107: #ifdef STACK_BOUNDARY
                   4108:       needed = (needed + STACK_BYTES - 1) / STACK_BYTES * STACK_BYTES;
                   4109: #endif
                   4110:       protected_stack = gen_rtx (CONST_INT, VOIDmode, needed);
                   4111:       anti_adjust_stack (protected_stack);
                   4112:     }
                   4113: #endif /* STACK_GROWS_DOWNWARD */
                   4114: 
1.1.1.2   root     4115:   /* Get the function to call, in the form of RTL.  */
                   4116:   if (fndecl)
                   4117:     /* Get a SYMBOL_REF rtx for the function address.  */
                   4118:     funexp = XEXP (DECL_RTL (fndecl), 0);
                   4119:   else
                   4120:     /* Generate an rtx (probably a pseudo-register) for the address.  */
1.1.1.4   root     4121:     {
                   4122:       funexp = expand_expr (TREE_OPERAND (exp, 0), 0, VOIDmode, 0);
                   4123:       emit_queue ();
                   4124:     }
1.1.1.2   root     4125: 
1.1.1.9   root     4126:   /* Now compute and store all non-register parms.
                   4127:      These come before register parms, since they can require block-moves,
                   4128:      which could clobber the registers used for register parms.
                   4129:      Parms which have partial registers are not stored here,
                   4130:      but we do preallocate space here if they want that.  */
1.1.1.2   root     4131: 
1.1       root     4132:   for (i = 0; i < num_actuals; i++)
                   4133:     {
1.1.1.9   root     4134:       /* Preallocate the stack space for a parm if appropriate
                   4135:         so it can be computed directly in the stack space.  */
                   4136:       if (args[i].stack != 0 && argblock != 0)
                   4137:        args[i].stack = target_for_arg (TREE_TYPE (args[i].tree_value),
                   4138:                                        ARGS_SIZE_RTX (args[i].size),
                   4139:                                        argblock, args[i].offset);
1.1       root     4140:       else
1.1.1.9   root     4141:        args[i].stack = 0;
1.1       root     4142: 
1.1.1.9   root     4143:       if (args[i].reg == 0)
                   4144:        store_one_arg (&args[i], argblock, may_be_alloca);
                   4145:     }
1.1       root     4146: 
1.1.1.9   root     4147:   /* Now store any partially-in-registers parm.
                   4148:      This is the last place a block-move can happen.  */
                   4149:   if (reg_parm_seen)
                   4150:     for (i = 0; i < num_actuals; i++)
                   4151:       if (args[i].partial != 0)
                   4152:        store_one_arg (&args[i], argblock, may_be_alloca);
1.1       root     4153: 
1.1.1.9   root     4154:   if (protected_stack != 0)
                   4155:     adjust_stack (protected_stack);
1.1       root     4156: 
1.1.1.9   root     4157:   /* Pass the function the address in which to return a structure value.  */
                   4158:   if (structure_value_addr && ! structure_value_addr_parm)
                   4159:     emit_move_insn (struct_value_rtx, force_reg (Pmode, structure_value_addr));
1.1       root     4160: 
1.1.1.9   root     4161:   /* Now set up any wholly-register parms.  They were computed already.  */
                   4162:   if (reg_parm_seen)
                   4163:     for (i = 0; i < num_actuals; i++)
                   4164:       if (args[i].reg != 0 && args[i].partial == 0)
                   4165:        store_one_arg (&args[i], argblock, may_be_alloca);
1.1       root     4166: 
                   4167:   /* Perform postincrements before actually calling the function.  */
                   4168:   emit_queue ();
                   4169: 
1.1.1.2   root     4170:   /* All arguments and registers used for the call must be set up by now!  */
1.1       root     4171: 
1.1.1.2   root     4172:   /* ??? Other languages need a nontrivial second argument (static chain).  */
                   4173:   funexp = prepare_call_address (funexp, 0);
                   4174: 
                   4175:   /* Mark all register-parms as living through the call.
                   4176:      ??? This is not quite correct, since it doesn't indicate
                   4177:      that they are in use immediately before the call insn.
                   4178:      Currently that doesn't matter since explicitly-used regs
                   4179:      won't be used for reloading.  But if the reloader becomes smarter,
                   4180:      this will have to change somehow.  */
                   4181:   for (i = 0; i < num_actuals; i++)
1.1.1.9   root     4182:     if (args[i].reg != 0)
1.1.1.2   root     4183:       {
1.1.1.9   root     4184:        if (args[i].partial > 0)
                   4185:          use_regs (REGNO (args[i].reg), args[i].partial);
                   4186:        else if (GET_MODE (args[i].reg) == BLKmode)
                   4187:          use_regs (REGNO (args[i].reg),
1.1.1.10  root     4188:                    (int_size_in_bytes (TREE_TYPE (args[i].tree_value))
1.1.1.2   root     4189:                     / UNITS_PER_WORD));
                   4190:        else
1.1.1.9   root     4191:          emit_insn (gen_rtx (USE, VOIDmode, args[i].reg));
1.1.1.2   root     4192:       }
                   4193: 
1.1.1.9   root     4194:   if (structure_value_addr && GET_CODE (struct_value_rtx) == REG)
1.1.1.2   root     4195:     emit_insn (gen_rtx (USE, VOIDmode, struct_value_rtx));
                   4196: 
                   4197:   /* Figure out the register where the value, if any, will come back.  */
                   4198:   valreg = 0;
                   4199:   if (TYPE_MODE (TREE_TYPE (exp)) != VOIDmode
                   4200:       && TYPE_MODE (TREE_TYPE (exp)) != BLKmode)
                   4201:     valreg = hard_function_value (TREE_TYPE (exp), fndecl);
                   4202: 
                   4203:   /* Generate the actual call instruction.  */
1.1.1.9   root     4204:   if (args_size.constant < 0)
                   4205:     args_size.constant = 0;
1.1.1.2   root     4206:   emit_call_1 (funexp, funtype, args_size.constant,
                   4207:               FUNCTION_ARG (args_so_far, VOIDmode, void_type_node, 1),
                   4208:               valreg, old_current_args_size);
1.1       root     4209: 
                   4210: /* ???  Nothing has been done here to record control flow
                   4211:    when contained functions can do nonlocal gotos.  */
                   4212: 
1.1.1.2   root     4213:   /* For calls to `setjmp', etc., inform flow.c it should complain
                   4214:      if nonvolatile values are live.  */
                   4215: 
                   4216:   if (is_setjmp)
1.1.1.11  root     4217:     {
                   4218:       emit_note (IDENTIFIER_POINTER (DECL_NAME (fndecl)), NOTE_INSN_SETJMP);
                   4219:       current_function_calls_setjmp = 1;
                   4220:     }
1.1.1.2   root     4221: 
1.1.1.14! root     4222:   /* Notice functions that cannot return.
        !          4223:      If optimizing, insns emitted below will be dead.
        !          4224:      If not optimizing, they will exist, which is useful
        !          4225:      if the user uses the `return' command in the debugger.  */
        !          4226: 
        !          4227:   if (fndecl && TREE_THIS_VOLATILE (fndecl))
        !          4228:     emit_barrier ();
        !          4229: 
1.1.1.8   root     4230:   /* For calls to __builtin_new, note that it can never return 0.
                   4231:      This is because a new handler will be called, and 0 it not
                   4232:      among the numbers it is supposed to return.  */
                   4233: #if 0
                   4234:   if (is_builtin_new)
                   4235:     emit_note (IDENTIFIER_POINTER (DECL_NAME (fndecl)), NOTE_INSN_BUILTIN_NEW);
                   4236: #endif
1.1.1.2   root     4237: 
1.1       root     4238:   /* If value type not void, return an rtx for the value.  */
                   4239: 
1.1.1.13  root     4240:   /* If there are cleanups to be called, don't use a hard reg as target.  */
                   4241:   if (cleanups_of_this_call != old_cleanups
                   4242:       && target && REG_P (target)
                   4243:       && REGNO (target) < FIRST_PSEUDO_REGISTER)
                   4244:     target = 0;
                   4245: 
1.1.1.2   root     4246:   if (TYPE_MODE (TREE_TYPE (exp)) == VOIDmode
                   4247:       || ignore)
1.1       root     4248:     {
1.1.1.14! root     4249:       target = const0_rtx;
1.1       root     4250:     }
1.1.1.8   root     4251:   else if (structure_value_addr)
                   4252:     {
                   4253:       if (target == 0)
                   4254:        target = gen_rtx (MEM, BLKmode,
                   4255:                          memory_address (BLKmode, structure_value_addr));
                   4256:     }
                   4257:   else if (target && GET_MODE (target) == TYPE_MODE (TREE_TYPE (exp)))
1.1       root     4258:     {
1.1.1.2   root     4259:       if (!rtx_equal_p (target, valreg))
                   4260:        emit_move_insn (target, valreg);
                   4261:       else
                   4262:        /* This tells expand_inline_function to copy valreg to its target.  */
                   4263:        emit_insn (gen_rtx (USE, VOIDmode, valreg));
1.1       root     4264:     }
1.1.1.8   root     4265:   else
                   4266:     target = copy_to_reg (valreg);
                   4267: 
1.1.1.9   root     4268:   /* Perform all cleanups needed for the arguments of this call
                   4269:      (i.e. destructors in C++).  */
                   4270:   while (cleanups_of_this_call != old_cleanups)
                   4271:     {
                   4272:       expand_expr (TREE_VALUE (cleanups_of_this_call), 0, VOIDmode, 0);
                   4273:       cleanups_of_this_call = TREE_CHAIN (cleanups_of_this_call);
                   4274:     }
                   4275: 
1.1.1.8   root     4276:   /* If size of args is variable, restore saved stack-pointer value.  */
                   4277: 
1.1.1.9   root     4278:   if (old_stack_level)
1.1.1.8   root     4279:     {
                   4280:       emit_move_insn (stack_pointer_rtx, old_stack_level);
                   4281:       pending_stack_adjust = old_pending_adj;
                   4282:     }
                   4283: 
1.1.1.14! root     4284:   /* If call is cse'able, make appropriate pair of reg-notes around it.  */
        !          4285:   if (is_const)
        !          4286:     {
        !          4287:       rtx insn_first = NEXT_INSN (insn_before);
        !          4288:       rtx insn_last = get_last_insn ();
        !          4289:       rtx note = 0;
        !          4290: 
        !          4291:       /* Construct an "equal form" for the value
        !          4292:         which mentions all the arguments in order
        !          4293:         as well as the function name.  */
        !          4294:       for (i = 0; i < num_actuals; i++)
        !          4295:        if (args[i].reg != 0 || is_const)
        !          4296:          note = gen_rtx (EXPR_LIST, VOIDmode, args[i].value, note);
        !          4297:       note = gen_rtx (EXPR_LIST, VOIDmode, XEXP (DECL_RTL (fndecl), 0), note);
        !          4298: 
        !          4299:       REG_NOTES (insn_last)
        !          4300:        = gen_rtx (EXPR_LIST, REG_EQUAL, note,
        !          4301:                   gen_rtx (INSN_LIST, REG_RETVAL, insn_first,
        !          4302:                            REG_NOTES (insn_last)));
        !          4303:       REG_NOTES (insn_first)
        !          4304:        = gen_rtx (INSN_LIST, REG_LIBCALL, insn_last,
        !          4305:                   REG_NOTES (insn_first));
        !          4306:     }
        !          4307: 
1.1.1.9   root     4308:   return target;
                   4309: }
                   4310: 
                   4311: /* Return an rtx which represents a suitable home on the stack
                   4312:    given TYPE, the type of the argument looking for a home.
                   4313:    This is called only for BLKmode arguments.
                   4314: 
                   4315:    SIZE is the size needed for this target.
                   4316:    ARGS_ADDR is the address of the bottom of the argument block for this call.
                   4317:    OFFSET describes this parameter's offset into ARGS_ADDR.  It is meaningless
                   4318:    if this machine uses push insns.  */
                   4319: 
                   4320: static rtx
                   4321: target_for_arg (type, size, args_addr, offset)
                   4322:      tree type;
                   4323:      rtx size;
                   4324:      rtx args_addr;
                   4325:      struct args_size offset;
                   4326: {
                   4327:   rtx target;
                   4328:   rtx offset_rtx = ARGS_SIZE_RTX (offset);
                   4329: 
                   4330:   /* We do not call memory_address if possible,
                   4331:      because we want to address as close to the stack
                   4332:      as possible.  For non-variable sized arguments,
                   4333:      this will be stack-pointer relative addressing.  */
                   4334:   if (GET_CODE (offset_rtx) == CONST_INT)
                   4335:     target = plus_constant (args_addr, INTVAL (offset_rtx));
                   4336:   else
1.1.1.8   root     4337:     {
1.1.1.9   root     4338:       /* I have no idea how to guarantee that this
                   4339:         will work in the presence of register parameters.  */
                   4340:       target = gen_rtx (PLUS, Pmode, args_addr, offset_rtx);
                   4341:       target = memory_address (QImode, target);
1.1.1.8   root     4342:     }
1.1.1.9   root     4343: 
                   4344:   return gen_rtx (MEM, BLKmode, target);
                   4345: }
                   4346: 
                   4347: /* Store a single argument for a function call
                   4348:    into the register or memory area where it must be passed.
                   4349:    *ARG describes the argument value and where to pass it.
                   4350:    ARGBLOCK is the address of the stack-block for all the arguments,
                   4351:    or 0 on a machine where arguemnts are pushed individually.
                   4352:    MAY_BE_ALLOCA nonzero says this could be a call to `alloca'
                   4353:    so must be careful about how the stack is used.  */
                   4354: 
                   4355: static void
                   4356: store_one_arg (arg, argblock, may_be_alloca)
                   4357:      struct arg_data *arg;
                   4358:      rtx argblock;
                   4359:      int may_be_alloca;
                   4360: {
                   4361:   register tree pval = arg->tree_value;
                   4362:   int used = 0;
                   4363: 
                   4364:   if (TREE_CODE (pval) == ERROR_MARK)
                   4365:     return;
                   4366: 
                   4367:   if (arg->reg != 0 && arg->partial == 0)
                   4368:     {
                   4369:       /* Being passed entirely in a register.  */
                   4370:       if (arg->value != 0)
                   4371:        {
                   4372:          if (GET_MODE (arg->value) == BLKmode)
                   4373:            move_block_to_reg (REGNO (arg->reg), arg->value,
                   4374:                               (int_size_in_bytes (TREE_TYPE (pval))
                   4375:                                / UNITS_PER_WORD));
                   4376:          else
                   4377:            emit_move_insn (arg->reg, arg->value);
                   4378:        }
                   4379:       else
                   4380:        store_expr (pval, arg->reg, 0);
                   4381: 
                   4382:       /* Don't allow anything left on stack from computation
                   4383:         of argument to alloca.  */
                   4384:       if (may_be_alloca)
                   4385:        do_pending_stack_adjust ();
                   4386:     }
                   4387:   else if (TYPE_MODE (TREE_TYPE (pval)) != BLKmode)
                   4388:     {
                   4389:       register int size;
                   4390:       rtx tem;
                   4391: 
                   4392:       /* Argument is a scalar, not entirely passed in registers.
                   4393:         (If part is passed in registers, arg->partial says how much
                   4394:         and emit_push_insn will take care of putting it there.)
                   4395:         
                   4396:         Push it, and if its size is less than the
                   4397:         amount of space allocated to it,
                   4398:         also bump stack pointer by the additional space.
                   4399:         Note that in C the default argument promotions
                   4400:         will prevent such mismatches.  */
                   4401: 
                   4402:       used = size = GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (pval)));
                   4403:       /* Compute how much space the push instruction will push.
                   4404:         On many machines, pushing a byte will advance the stack
                   4405:         pointer by a halfword.  */
                   4406: #ifdef PUSH_ROUNDING
                   4407:       size = PUSH_ROUNDING (size);
                   4408: #endif
                   4409:       /* Compute how much space the argument should get:
                   4410:         round up to a multiple of the alignment for arguments.  */
                   4411:       if (none != FUNCTION_ARG_PADDING (TYPE_MODE (TREE_TYPE (pval)), (rtx)0))
                   4412:        used = (((size + PARM_BOUNDARY / BITS_PER_UNIT - 1)
                   4413:                 / (PARM_BOUNDARY / BITS_PER_UNIT))
                   4414:                * (PARM_BOUNDARY / BITS_PER_UNIT));
                   4415: 
                   4416:       tem = arg->value;
                   4417:       if (tem == 0)
                   4418:        {
                   4419:          tem = expand_expr (pval, 0, VOIDmode, 0);
                   4420:          /* ANSI doesn't require a sequence point here,
                   4421:             but PCC has one, so this will avoid some problems.  */
                   4422:          emit_queue ();
                   4423:        }
                   4424: 
                   4425:       /* Don't allow anything left on stack from computation
                   4426:         of argument to alloca.  */
                   4427:       if (may_be_alloca)
                   4428:        do_pending_stack_adjust ();
                   4429: 
                   4430:       emit_push_insn (tem, TYPE_MODE (TREE_TYPE (pval)), 0, 0,
                   4431:                      arg->partial, arg->reg, used - size,
                   4432:                      argblock, ARGS_SIZE_RTX (arg->offset));
                   4433:     }
                   4434:   else if (arg->stack != 0)
                   4435:     {
1.1.1.14! root     4436:       /* BLKmode parm, not entirely passed in registers,
        !          4437:         and with space already allocated.  */
        !          4438: 
        !          4439:       tree sizetree = size_in_bytes (TREE_TYPE (pval));
        !          4440:       /* Round the size up to multiple of PARM_BOUNDARY bits.  */
        !          4441:       tree s1 = convert_units (sizetree, BITS_PER_UNIT, PARM_BOUNDARY);
        !          4442:       tree s2 = convert_units (s1, PARM_BOUNDARY, BITS_PER_UNIT);
        !          4443: 
        !          4444:       /* Find out if the parm needs padding, and whether above or below.  */
        !          4445:       enum direction where_pad
        !          4446:        = FUNCTION_ARG_PADDING (TYPE_MODE (TREE_TYPE (pval)),
        !          4447:                                expand_expr (sizetree, 0, VOIDmode, 0));
        !          4448: 
        !          4449:       /* If it is padded below, adjust the stack address
        !          4450:         upward over the padding.  */
        !          4451: 
        !          4452:       if (where_pad == downward)
        !          4453:        {
        !          4454:          rtx offset_rtx;
        !          4455:          rtx address = XEXP (arg->stack, 0);
        !          4456:          struct args_size stack_offset;
        !          4457: 
        !          4458:          stack_offset.constant = 0;
        !          4459:          stack_offset.var = 0;
        !          4460: 
        !          4461:          /* Compute amount of padding.  */
        !          4462:          ADD_PARM_SIZE (stack_offset, s2);
        !          4463:          SUB_PARM_SIZE (stack_offset, sizetree);
        !          4464:          offset_rtx = ARGS_SIZE_RTX (stack_offset);
        !          4465: 
        !          4466:          /* Adjust the address to store at.  */
        !          4467:          if (GET_CODE (offset_rtx) == CONST_INT)
        !          4468:            address = plus_constant (address, INTVAL (offset_rtx));
        !          4469:          else
        !          4470:            {
        !          4471:              address = gen_rtx (PLUS, Pmode, address, offset_rtx);
        !          4472:              address = memory_address (QImode, address);
        !          4473:            }
        !          4474:          arg->stack = change_address (arg->stack, VOIDmode, address);
        !          4475:        }
        !          4476: 
1.1.1.12  root     4477:       /* ARG->stack probably refers to the stack-pointer.  If so,
                   4478:         stabilize it, in case stack-pointer changes during evaluation.  */
                   4479:       if (reg_mentioned_p (stack_pointer_rtx, arg->stack))
                   4480:        arg->stack = change_address (arg->stack, VOIDmode,
                   4481:                                     copy_to_reg (XEXP (arg->stack, 0)));
1.1.1.9   root     4482:       /* BLKmode argument that should go in a prespecified stack location.  */
                   4483:       if (arg->value == 0)
                   4484:        /* Not yet computed => compute it there.  */
                   4485:        /* ??? This should be changed to tell expand_expr
                   4486:           that it can store directly in the target.  */
                   4487:        arg->value = store_expr (arg->tree_value, arg->stack, 0);
                   4488:       else if (arg->value != arg->stack)
                   4489:        /* It was computed somewhere, but not where we wanted.
                   4490:           For example, the value may have come from an official
                   4491:           local variable or parameter.  In that case, expand_expr
                   4492:           does not fill our suggested target.  */
                   4493:        emit_block_move (arg->stack, arg->value, ARGS_SIZE_RTX (arg->size),
1.1.1.10  root     4494:                         TYPE_ALIGN (TREE_TYPE (pval)) / BITS_PER_UNIT);
1.1.1.9   root     4495: 
                   4496:       /* Now, if this value wanted to be partly in registers,
                   4497:         move the value from the stack to the registers
                   4498:         that are supposed to hold the values.  */
                   4499:       if (arg->partial > 0)
                   4500:        move_block_to_reg (REGNO (arg->reg), arg->stack, arg->partial);
                   4501:     }
                   4502:   else
                   4503:     {
1.1.1.14! root     4504:       /* BLKmode, at least partly to be pushed.  */
        !          4505: 
1.1.1.9   root     4506:       register rtx tem
                   4507:        = arg->value ? arg->value : expand_expr (pval, 0, VOIDmode, 0);
                   4508:       register int excess;
                   4509:       rtx size_rtx;
                   4510: 
                   4511:       /* Pushing a nonscalar.
                   4512:         If part is passed in registers, arg->partial says how much
                   4513:         and emit_push_insn will take care of putting it there.  */
                   4514: 
                   4515:       /* Round its size up to a multiple
                   4516:         of the allocation unit for arguments.  */
                   4517: 
                   4518:       if (arg->size.var != 0)
                   4519:        {
                   4520:          excess = 0;
                   4521:          size_rtx = ARGS_SIZE_RTX (arg->size);
                   4522:        }
                   4523:       else
                   4524:        {
                   4525:          register tree size = size_in_bytes (TREE_TYPE (pval));
                   4526:          /* PUSH_ROUNDING has no effect on us, because
                   4527:             emit_push_insn for BLKmode is careful to avoid it.  */
                   4528:          excess = arg->size.constant - TREE_INT_CST_LOW (size);
                   4529:          size_rtx = expand_expr (size, 0, VOIDmode, 0);
                   4530:        }
                   4531: 
                   4532:       if (arg->stack)
                   4533:        abort ();
                   4534: 
                   4535:       emit_push_insn (tem, TYPE_MODE (TREE_TYPE (pval)), size_rtx,
                   4536:                      TYPE_ALIGN (TREE_TYPE (pval)) / BITS_PER_UNIT,
                   4537:                      arg->partial, arg->reg, excess, argblock,
                   4538:                      ARGS_SIZE_RTX (arg->offset));
                   4539:     }
                   4540: 
                   4541:   /* Once we have pushed something, pops can't safely
                   4542:      be deferred during the rest of the arguments.  */
                   4543:   NO_DEFER_POP;
1.1       root     4544: }
                   4545: 
                   4546: /* Expand conditional expressions.  */
                   4547: 
                   4548: /* Generate code to evaluate EXP and jump to LABEL if the value is zero.
                   4549:    LABEL is an rtx of code CODE_LABEL, in this function and all the
                   4550:    functions here.  */
                   4551: 
1.1.1.2   root     4552: void
1.1       root     4553: jumpifnot (exp, label)
                   4554:      tree exp;
                   4555:      rtx label;
                   4556: {
                   4557:   do_jump (exp, label, 0);
                   4558: }
                   4559: 
                   4560: /* Generate code to evaluate EXP and jump to LABEL if the value is nonzero.  */
                   4561: 
1.1.1.2   root     4562: void
1.1       root     4563: jumpif (exp, label)
                   4564:      tree exp;
                   4565:      rtx label;
                   4566: {
                   4567:   do_jump (exp, 0, label);
                   4568: }
                   4569: 
                   4570: /* Generate code to evaluate EXP and jump to IF_FALSE_LABEL if
                   4571:    the result is zero, or IF_TRUE_LABEL if the result is one.
                   4572:    Either of IF_FALSE_LABEL and IF_TRUE_LABEL may be zero,
                   4573:    meaning fall through in that case.
                   4574: 
                   4575:    This function is responsible for optimizing cases such as
                   4576:    &&, || and comparison operators in EXP.  */
                   4577: 
1.1.1.2   root     4578: void
1.1       root     4579: do_jump (exp, if_false_label, if_true_label)
                   4580:      tree exp;
                   4581:      rtx if_false_label, if_true_label;
                   4582: {
                   4583:   register enum tree_code code = TREE_CODE (exp);
                   4584:   /* Some cases need to create a label to jump to
                   4585:      in order to properly fall through.
                   4586:      These cases set DROP_THROUGH_LABEL nonzero.  */
                   4587:   rtx drop_through_label = 0;
                   4588:   rtx temp;
                   4589:   rtx comparison = 0;
                   4590: 
                   4591:   emit_queue ();
                   4592: 
                   4593:   switch (code)
                   4594:     {
                   4595:     case ERROR_MARK:
                   4596:       break;
                   4597: 
                   4598:     case INTEGER_CST:
                   4599:       temp = integer_zerop (exp) ? if_false_label : if_true_label;
                   4600:       if (temp)
                   4601:        emit_jump (temp);
                   4602:       break;
                   4603: 
                   4604:     case ADDR_EXPR:
                   4605:       /* The address of something can never be zero.  */
                   4606:       if (if_true_label)
                   4607:        emit_jump (if_true_label);
                   4608:       break;
1.1.1.6   root     4609: 
1.1       root     4610:     case NOP_EXPR:
                   4611:       do_jump (TREE_OPERAND (exp, 0), if_false_label, if_true_label);
                   4612:       break;
                   4613: 
                   4614:     case TRUTH_NOT_EXPR:
                   4615:       do_jump (TREE_OPERAND (exp, 0), if_true_label, if_false_label);
                   4616:       break;
                   4617: 
                   4618:     case TRUTH_ANDIF_EXPR:
                   4619:       if (if_false_label == 0)
                   4620:        if_false_label = drop_through_label = gen_label_rtx ();
                   4621:       do_jump (TREE_OPERAND (exp, 0), if_false_label, 0);
                   4622:       do_jump (TREE_OPERAND (exp, 1), if_false_label, if_true_label);
                   4623:       break;
                   4624: 
                   4625:     case TRUTH_ORIF_EXPR:
                   4626:       if (if_true_label == 0)
                   4627:        if_true_label = drop_through_label = gen_label_rtx ();
                   4628:       do_jump (TREE_OPERAND (exp, 0), 0, if_true_label);
                   4629:       do_jump (TREE_OPERAND (exp, 1), if_false_label, if_true_label);
                   4630:       break;
                   4631: 
                   4632:     case COMPOUND_EXPR:
1.1.1.2   root     4633:       expand_expr (TREE_OPERAND (exp, 0), const0_rtx, VOIDmode, 0);
1.1       root     4634:       emit_queue ();
                   4635:       do_jump (TREE_OPERAND (exp, 1), if_false_label, if_true_label);
                   4636:       break;
                   4637: 
                   4638:     case COND_EXPR:
                   4639:       {
                   4640:        register rtx label1 = gen_label_rtx ();
                   4641:        drop_through_label = gen_label_rtx ();
                   4642:        do_jump (TREE_OPERAND (exp, 0), label1, 0);
                   4643:        /* Now the THEN-expression.  */
                   4644:        do_jump (TREE_OPERAND (exp, 1),
                   4645:                 if_false_label ? if_false_label : drop_through_label,
                   4646:                 if_true_label ? if_true_label : drop_through_label);
                   4647:        emit_label (label1);
                   4648:        /* Now the ELSE-expression.  */
                   4649:        do_jump (TREE_OPERAND (exp, 2),
                   4650:                 if_false_label ? if_false_label : drop_through_label,
                   4651:                 if_true_label ? if_true_label : drop_through_label);
                   4652:       }
                   4653:       break;
                   4654: 
                   4655:     case EQ_EXPR:
                   4656:       comparison = compare (exp, EQ, EQ, EQ, EQ);
                   4657:       break;
                   4658: 
                   4659:     case NE_EXPR:
                   4660:       comparison = compare (exp, NE, NE, NE, NE);
                   4661:       break;
                   4662: 
                   4663:     case LT_EXPR:
                   4664:       comparison = compare (exp, LT, LTU, GT, GTU);
                   4665:       break;
                   4666: 
                   4667:     case LE_EXPR:
                   4668:       comparison = compare (exp, LE, LEU, GE, GEU);
                   4669:       break;
                   4670: 
                   4671:     case GT_EXPR:
                   4672:       comparison = compare (exp, GT, GTU, LT, LTU);
                   4673:       break;
                   4674: 
                   4675:     case GE_EXPR:
                   4676:       comparison = compare (exp, GE, GEU, LE, LEU);
                   4677:       break;
                   4678: 
                   4679:     default:
                   4680:       temp = expand_expr (exp, 0, VOIDmode, 0);
1.1.1.2   root     4681:       /* Copy to register to avoid generating bad insns by cse
                   4682:         from (set (mem ...) (arithop))  (set (cc0) (mem ...)).  */
                   4683:       if (!cse_not_expected && GET_CODE (temp) == MEM)
                   4684:        temp = copy_to_reg (temp);
1.1       root     4685:       do_pending_stack_adjust ();
1.1.1.2   root     4686:       {
                   4687:        rtx zero;
                   4688:        if (GET_MODE (temp) == SFmode)
                   4689:          zero = fconst0_rtx;
                   4690:        else if (GET_MODE (temp) == DFmode)
                   4691:          zero = dconst0_rtx;
                   4692:        else
                   4693:          zero = const0_rtx;
1.1       root     4694: 
1.1.1.2   root     4695:        if (GET_CODE (temp) == CONST_INT)
                   4696:          comparison = compare_constants (NE, 0,
                   4697:                                          INTVAL (temp), 0, BITS_PER_WORD);
                   4698:        else if (GET_MODE (temp) != VOIDmode)
                   4699:          comparison = compare1 (temp, zero, NE, NE, 0, GET_MODE (temp));
                   4700:        else
                   4701:          abort ();
                   4702:       }
1.1       root     4703:     }
                   4704: 
1.1.1.2   root     4705:   /* Do any postincrements in the expression that was tested.  */
                   4706:   emit_queue ();
                   4707: 
1.1       root     4708:   /* If COMPARISON is nonzero here, it is an rtx that can be substituted
                   4709:      straight into a conditional jump instruction as the jump condition.
                   4710:      Otherwise, all the work has been done already.  */
                   4711: 
1.1.1.2   root     4712:   if (comparison == const1_rtx)
                   4713:     {
                   4714:       if (if_true_label)
                   4715:        emit_jump (if_true_label);
                   4716:     }
                   4717:   else if (comparison == const0_rtx)
                   4718:     {
                   4719:       if (if_false_label)
                   4720:        emit_jump (if_false_label);
                   4721:     }
                   4722:   else if (comparison)
                   4723:     {
                   4724:       if (if_true_label)
                   4725:        {
1.1.1.13  root     4726:          if (bcc_gen_fctn[(int) GET_CODE (comparison)] != 0)
                   4727:            emit_jump_insn ((*bcc_gen_fctn[(int) GET_CODE (comparison)]) (if_true_label));
                   4728:          else
                   4729:            abort ();
                   4730: 
1.1.1.2   root     4731:          if (if_false_label)
                   4732:            emit_jump (if_false_label);
                   4733:        }
                   4734:       else if (if_false_label)
                   4735:        {
1.1.1.13  root     4736:          rtx pat;
                   4737: 
                   4738:          if (bcc_gen_fctn[(int) GET_CODE (comparison)] == 0)
                   4739:            abort ();
                   4740: 
                   4741:          pat = (*bcc_gen_fctn[(int) GET_CODE (comparison)]) (if_false_label);
                   4742:          /* Now invert the sense of the jump by exchanging the two arms
                   4743:             of each IF_THEN_ELSE.  Note that inverting the condition
                   4744:             would be incorrect for IEEE floating point with nans!  */
1.1.1.14! root     4745:          if (GET_CODE (pat) == SEQUENCE)
        !          4746:            {
        !          4747:              int i;
        !          4748:              /* We can invert a sequence if the only jump is at the end.  */
        !          4749:              for (i = 0; i < XVECLEN (pat, 0) - 1; i++)
        !          4750:                if (GET_CODE (XVECEXP (pat, 0, i)) == JUMP_INSN)
        !          4751:                  abort ();
        !          4752:              invert_exp (PATTERN (XVECEXP (pat, 0, XVECLEN (pat, 0) - 1)));
        !          4753:            }
        !          4754:          else
        !          4755:            invert_exp (pat, 0, 0);
        !          4756: 
1.1.1.13  root     4757:          emit_jump_insn (pat);
1.1.1.2   root     4758:        }
                   4759:     }
1.1       root     4760: 
                   4761:   if (drop_through_label)
                   4762:     emit_label (drop_through_label);
                   4763: }
                   4764: 
1.1.1.2   root     4765: /* Compare two integer constant rtx's, OP0 and OP1.
                   4766:    The comparison operation is OPERATION.
                   4767:    Return an rtx representing the value 1 or 0.
                   4768:    WIDTH is the width in bits that is significant.  */
                   4769: 
                   4770: static rtx
                   4771: compare_constants (operation, unsignedp, op0, op1, width)
                   4772:      enum rtx_code operation;
                   4773:      int unsignedp;
                   4774:      int op0, op1;
                   4775:      int width;
                   4776: {
                   4777:   int val;
                   4778: 
                   4779:   /* Sign-extend or zero-extend the operands to a full word
                   4780:      from an initial width of WIDTH bits.  */
                   4781:   if (width < HOST_BITS_PER_INT)
                   4782:     {
                   4783:       op0 &= (1 << width) - 1;
                   4784:       op1 &= (1 << width) - 1;
                   4785: 
                   4786:       if (! unsignedp)
                   4787:        {
                   4788:          if (op0 & (1 << (width - 1)))
                   4789:            op0 |= ((-1) << width);
                   4790:          if (op1 & (1 << (width - 1)))
                   4791:            op1 |= ((-1) << width);
                   4792:        }
                   4793:     }
                   4794: 
                   4795:   switch (operation)
                   4796:     {
                   4797:     case EQ:
                   4798:       val = op0 == op1;
                   4799:       break;
                   4800: 
                   4801:     case NE:
                   4802:       val = op0 != op1;
                   4803:       break;
                   4804: 
                   4805:     case GT:
                   4806:     case GTU:
                   4807:       val = op0 > op1;
                   4808:       break;
                   4809: 
                   4810:     case LT:
                   4811:     case LTU:
                   4812:       val = op0 < op1;
                   4813:       break;
                   4814: 
                   4815:     case GE:
                   4816:     case GEU:
                   4817:       val = op0 >= op1;
                   4818:       break;
                   4819: 
                   4820:     case LE:
                   4821:     case LEU:
                   4822:       val = op0 <= op1;
                   4823:     }
                   4824: 
                   4825:   return val ? const1_rtx : const0_rtx;
                   4826: }
                   4827: 
1.1       root     4828: /* Generate code for a comparison expression EXP
                   4829:    (including code to compute the values to be compared)
                   4830:    and set (CC0) according to the result.
                   4831:    SIGNED_FORWARD should be the rtx operation for this comparison for
                   4832:    signed data; UNSIGNED_FORWARD, likewise for use if data is unsigned.
                   4833:    SIGNED_REVERSE and UNSIGNED_REVERSE are used if it is desirable
                   4834:    to interchange the operands for the compare instruction.
                   4835: 
                   4836:    We force a stack adjustment unless there are currently
                   4837:    things pushed on the stack that aren't yet used.  */
                   4838: 
                   4839: static rtx
                   4840: compare (exp, signed_forward, unsigned_forward,
                   4841:         signed_reverse, unsigned_reverse)
                   4842:      register tree exp;
                   4843:      enum rtx_code signed_forward, unsigned_forward;
                   4844:      enum rtx_code signed_reverse, unsigned_reverse;
                   4845: {
1.1.1.2   root     4846: 
1.1       root     4847:   register rtx op0 = expand_expr (TREE_OPERAND (exp, 0), 0, VOIDmode, 0);
                   4848:   register rtx op1 = expand_expr (TREE_OPERAND (exp, 1), 0, VOIDmode, 0);
                   4849:   register enum machine_mode mode = GET_MODE (op0);
                   4850:   int unsignedp;
                   4851: 
                   4852:   /* If one operand is 0, make it the second one.  */
                   4853: 
                   4854:   if (op0 == const0_rtx || op0 == fconst0_rtx || op0 == dconst0_rtx)
                   4855:     {
                   4856:       rtx tem = op0;
                   4857:       op0 = op1;
                   4858:       op1 = tem;
                   4859:       signed_forward = signed_reverse;
                   4860:       unsigned_forward = unsigned_reverse;
                   4861:     }
                   4862: 
1.1.1.2   root     4863:   if (flag_force_mem)
1.1       root     4864:     {
                   4865:       op0 = force_not_mem (op0);
                   4866:       op1 = force_not_mem (op1);
                   4867:     }
                   4868: 
                   4869:   do_pending_stack_adjust ();
                   4870: 
1.1.1.2   root     4871:   unsignedp = (TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (exp, 0)))
                   4872:               || TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (exp, 1))));
                   4873: 
                   4874:   if (GET_CODE (op0) == CONST_INT && GET_CODE (op1) == CONST_INT)
                   4875:     return compare_constants (signed_forward, unsignedp,
                   4876:                              INTVAL (op0), INTVAL (op1),
                   4877:                              GET_MODE_BITSIZE (TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0)))));
1.1       root     4878: 
                   4879:   emit_cmp_insn (op0, op1,
                   4880:                 (mode == BLKmode) ? expr_size (TREE_OPERAND (exp, 0)) : 0,
1.1.1.14! root     4881:                 unsignedp,
        !          4882:                 TYPE_ALIGN (TREE_TYPE (exp)) / BITS_PER_UNIT);
1.1       root     4883: 
                   4884:   return gen_rtx ((unsignedp ? unsigned_forward : signed_forward),
                   4885:                  VOIDmode, cc0_rtx, const0_rtx);
                   4886: }
                   4887: 
                   4888: /* Like compare but expects the values to compare as two rtx's.
                   4889:    The decision as to signed or unsigned comparison must be made by the caller.
                   4890:    BLKmode is not allowed.  */
                   4891: 
                   4892: static rtx
1.1.1.2   root     4893: compare1 (op0, op1, forward_op, reverse_op, unsignedp, mode)
1.1       root     4894:      register rtx op0, op1;
                   4895:      enum rtx_code forward_op, reverse_op;
                   4896:      int unsignedp;
1.1.1.2   root     4897:      enum machine_mode mode;
1.1       root     4898: {
                   4899:   /* If one operand is 0, make it the second one.  */
                   4900: 
                   4901:   if (op0 == const0_rtx || op0 == fconst0_rtx || op0 == dconst0_rtx)
                   4902:     {
                   4903:       rtx tem = op0;
                   4904:       op0 = op1;
                   4905:       op1 = tem;
                   4906:       forward_op = reverse_op;
                   4907:     }
                   4908: 
1.1.1.2   root     4909:   if (flag_force_mem)
1.1       root     4910:     {
                   4911:       op0 = force_not_mem (op0);
                   4912:       op1 = force_not_mem (op1);
                   4913:     }
                   4914: 
                   4915:   do_pending_stack_adjust ();
                   4916: 
1.1.1.2   root     4917:   if (GET_CODE (op0) == CONST_INT && GET_CODE (op1) == CONST_INT)
                   4918:     return compare_constants (forward_op, unsignedp,
                   4919:                              INTVAL (op0), INTVAL (op1),
                   4920:                              GET_MODE_BITSIZE (mode));
                   4921: 
1.1.1.14! root     4922:   emit_cmp_insn (op0, op1, 0, unsignedp, 0);
1.1       root     4923: 
                   4924:   return gen_rtx (forward_op, VOIDmode, cc0_rtx, const0_rtx);
                   4925: }
                   4926: 
                   4927: /* Generate code to calculate EXP using a store-flag instruction
                   4928:    and return an rtx for the result.
                   4929:    If TARGET is nonzero, store the result there if convenient.
                   4930: 
                   4931:    Return zero if there is no suitable set-flag instruction
                   4932:    available on this machine.  */
                   4933: 
                   4934: static rtx
1.1.1.2   root     4935: do_store_flag (exp, target, mode)
1.1       root     4936:      tree exp;
                   4937:      rtx target;
1.1.1.2   root     4938:      enum machine_mode mode;
1.1       root     4939: {
                   4940:   register enum tree_code code = TREE_CODE (exp);
                   4941:   register rtx comparison = 0;
1.1.1.2   root     4942:   enum machine_mode compare_mode;
1.1       root     4943: 
                   4944:   switch (code)
                   4945:     {
1.1.1.2   root     4946: #ifdef HAVE_seq
1.1       root     4947:     case EQ_EXPR:
1.1.1.2   root     4948:       if (HAVE_seq)
                   4949:        {
                   4950:          comparison = compare (exp, EQ, EQ, EQ, EQ);
                   4951:          compare_mode = insn_operand_mode[(int) CODE_FOR_seq][0];
                   4952:        }
1.1       root     4953:       break;
                   4954: #endif
                   4955: 
1.1.1.2   root     4956: #ifdef HAVE_sne
1.1       root     4957:     case NE_EXPR:
1.1.1.2   root     4958:       if (HAVE_sne)
                   4959:        {
                   4960:          comparison = compare (exp, NE, NE, NE, NE);
                   4961:          compare_mode = insn_operand_mode[(int) CODE_FOR_sne][0];
                   4962:        }
1.1       root     4963:       break;
                   4964: #endif
                   4965: 
1.1.1.2   root     4966: #if defined (HAVE_slt) && defined (HAVE_sltu) && defined (HAVE_sgt) && defined (HAVE_sgtu)
1.1       root     4967:     case LT_EXPR:
1.1.1.2   root     4968:       if (HAVE_slt && HAVE_sltu && HAVE_sgt && HAVE_sgtu)
                   4969:        {
                   4970:          comparison = compare (exp, LT, LTU, GT, GTU);
                   4971:          compare_mode = insn_operand_mode[(int) CODE_FOR_slt][0];
                   4972:        }
1.1       root     4973:       break;
                   4974: 
                   4975:     case GT_EXPR:
1.1.1.2   root     4976:       if (HAVE_slt && HAVE_sltu && HAVE_sgt && HAVE_sgtu)
                   4977:        {
                   4978:          comparison = compare (exp, GT, GTU, LT, LTU);
                   4979:          compare_mode = insn_operand_mode[(int) CODE_FOR_slt][0];
                   4980:        }
1.1       root     4981:       break;
                   4982: #endif
                   4983: 
1.1.1.2   root     4984: #if defined (HAVE_sle) && defined (HAVE_sleu) && defined (HAVE_sge) && defined (HAVE_sgeu)
1.1       root     4985:     case LE_EXPR:
1.1.1.2   root     4986:       if (HAVE_sle && HAVE_sleu && HAVE_sge && HAVE_sgeu)
                   4987:        {
                   4988:          comparison = compare (exp, LE, LEU, GE, GEU);
                   4989:          compare_mode = insn_operand_mode[(int) CODE_FOR_sle][0];
                   4990:        }
1.1       root     4991:       break;
                   4992: 
                   4993:     case GE_EXPR:
1.1.1.2   root     4994:       if (HAVE_sle && HAVE_sleu && HAVE_sge && HAVE_sgeu)
                   4995:        {
                   4996:          comparison = compare (exp, GE, GEU, LE, LEU);
                   4997:          compare_mode = insn_operand_mode[(int) CODE_FOR_sle][0];
                   4998:        }
1.1       root     4999:       break;
                   5000: #endif
                   5001:     }
                   5002:   if (comparison == 0)
                   5003:     return 0;
                   5004: 
1.1.1.2   root     5005:   if (target == 0 || GET_MODE (target) != mode
                   5006:       || (mode != compare_mode && GET_CODE (target) != REG))
                   5007:     target = gen_reg_rtx (mode);
                   5008: 
                   5009:   /* Store the comparison in its proper mode.  */
1.1.1.13  root     5010:   if (GET_CODE (comparison) == CONST_INT)
                   5011:     emit_move_insn (target, comparison);
                   5012:   else if (GET_MODE (target) != compare_mode)
                   5013:     emit_insn ((*setcc_gen_fctn[(int) GET_CODE (comparison)])
                   5014:               (gen_rtx (SUBREG, compare_mode, target, 0)));
1.1.1.2   root     5015:   else
1.1.1.13  root     5016:     emit_insn ((*setcc_gen_fctn[(int) GET_CODE (comparison)]) (target));
1.1.1.2   root     5017: 
                   5018: #if STORE_FLAG_VALUE != 1
                   5019:   expand_bit_and (mode, target, const1_rtx, target);
                   5020: #endif
1.1       root     5021:   return target;
                   5022: }
                   5023: 
                   5024: /* Generate a tablejump instruction (used for switch statements).  */
                   5025: 
                   5026: #ifdef HAVE_tablejump
                   5027: 
                   5028: /* INDEX is the value being switched on, with the lowest value
                   5029:    in the table already subtracted.
                   5030:    RANGE is the length of the jump table.
                   5031:    TABLE_LABEL is a CODE_LABEL rtx for the table itself.
1.1.1.2   root     5032: 
1.1       root     5033:    DEFAULT_LABEL is a CODE_LABEL rtx to jump to if the
                   5034:    index value is out of range.  */
                   5035: 
                   5036: void
                   5037: do_tablejump (index, range, table_label, default_label)
                   5038:      rtx index, range, table_label, default_label;
                   5039: {
                   5040:   register rtx temp;
                   5041: 
1.1.1.14! root     5042:   emit_cmp_insn (range, index, 0, 0, 0);
1.1.1.2   root     5043:   emit_jump_insn (gen_bltu (default_label));
1.1.1.4   root     5044:   /* If flag_force_addr were to affect this address
                   5045:      it could interfere with the tricky assumptions made
                   5046:      about addresses that contain label-refs,
                   5047:      which may be valid only very near the tablejump itself.  */
                   5048:   index = memory_address_noforce
                   5049:     (CASE_VECTOR_MODE,
                   5050:      gen_rtx (PLUS, Pmode,
                   5051:              gen_rtx (MULT, Pmode, index,
                   5052:                       gen_rtx (CONST_INT, VOIDmode,
                   5053:                                GET_MODE_SIZE (CASE_VECTOR_MODE))),
                   5054:              gen_rtx (LABEL_REF, VOIDmode, table_label)));
1.1       root     5055:   temp = gen_reg_rtx (CASE_VECTOR_MODE);
                   5056:   convert_move (temp, gen_rtx (MEM, CASE_VECTOR_MODE, index), 0);
                   5057: 
1.1.1.2   root     5058:   emit_jump_insn (gen_tablejump (temp, table_label));
1.1       root     5059: }
                   5060: 
1.1.1.2   root     5061: #endif /* HAVE_tablejump */

unix.superglobalmegacorp.com

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