Annotation of gcc/expr.c, revision 1.1.1.13

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