home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 7 / FreshFishVol7.bin / bbs / gnu / gcc-2.3.3-src.lha / GNU / src / amiga / gcc-2.3.3 / expr.c < prev    next >
C/C++ Source or Header  |  1994-02-06  |  230KB  |  7,293 lines

  1. /* Convert tree expression to rtl instructions, for GNU compiler.
  2.    Copyright (C) 1988, 1992 Free Software Foundation, Inc.
  3.  
  4. This file is part of GNU CC.
  5.  
  6. GNU CC is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2, or (at your option)
  9. any later version.
  10.  
  11. GNU CC is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. GNU General Public License for more details.
  15.  
  16. You should have received a copy of the GNU General Public License
  17. along with GNU CC; see the file COPYING.  If not, write to
  18. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  19.  
  20.  
  21. #include "config.h"
  22. #include "rtl.h"
  23. #include "tree.h"
  24. #include "flags.h"
  25. #include "function.h"
  26. #include "insn-flags.h"
  27. #include "insn-codes.h"
  28. #include "expr.h"
  29. #include "insn-config.h"
  30. #include "recog.h"
  31. #include "output.h"
  32. #include "gvarargs.h"
  33. #include "typeclass.h"
  34.  
  35. #define CEIL(x,y) (((x) + (y) - 1) / (y))
  36.  
  37. /* Decide whether a function's arguments should be processed
  38.    from first to last or from last to first.  */
  39.  
  40. #ifdef STACK_GROWS_DOWNWARD
  41. #ifdef PUSH_ROUNDING
  42. #define PUSH_ARGS_REVERSED    /* If it's last to first */
  43. #endif
  44. #endif
  45.  
  46. #ifndef STACK_PUSH_CODE
  47. #ifdef STACK_GROWS_DOWNWARD
  48. #define STACK_PUSH_CODE PRE_DEC
  49. #else
  50. #define STACK_PUSH_CODE PRE_INC
  51. #endif
  52. #endif
  53.  
  54. /* Like STACK_BOUNDARY but in units of bytes, not bits.  */
  55. #define STACK_BYTES (STACK_BOUNDARY / BITS_PER_UNIT)
  56.  
  57. /* If this is nonzero, we do not bother generating VOLATILE
  58.    around volatile memory references, and we are willing to
  59.    output indirect addresses.  If cse is to follow, we reject
  60.    indirect addresses so a useful potential cse is generated;
  61.    if it is used only once, instruction combination will produce
  62.    the same indirect address eventually.  */
  63. int cse_not_expected;
  64.  
  65. /* Nonzero to generate code for all the subroutines within an
  66.    expression before generating the upper levels of the expression.
  67.    Nowadays this is never zero.  */
  68. int do_preexpand_calls = 1;
  69.  
  70. /* Number of units that we should eventually pop off the stack.
  71.    These are the arguments to function calls that have already returned.  */
  72. int pending_stack_adjust;
  73.  
  74. /* Nonzero means stack pops must not be deferred, and deferred stack
  75.    pops must not be output.  It is nonzero inside a function call,
  76.    inside a conditional expression, inside a statement expression,
  77.    and in other cases as well.  */
  78. int inhibit_defer_pop;
  79.  
  80. /* A list of all cleanups which belong to the arguments of
  81.    function calls being expanded by expand_call.  */
  82. tree cleanups_this_call;
  83.  
  84. /* Nonzero means __builtin_saveregs has already been done in this function.
  85.    The value is the pseudoreg containing the value __builtin_saveregs
  86.    returned.  */
  87. static rtx saveregs_value;
  88.  
  89. rtx store_expr ();
  90. static void store_constructor ();
  91. static rtx store_field ();
  92. static rtx expand_builtin ();
  93. static rtx compare ();
  94. static rtx do_store_flag ();
  95. static void preexpand_calls ();
  96. static rtx expand_increment ();
  97. static void init_queue ();
  98.  
  99. void do_pending_stack_adjust ();
  100. static void do_jump_for_compare ();
  101. static void do_jump_by_parts_equality ();
  102. static void do_jump_by_parts_equality_rtx ();
  103. static void do_jump_by_parts_greater ();
  104.  
  105. /* Record for each mode whether we can move a register directly to or
  106.    from an object of that mode in memory.  If we can't, we won't try
  107.    to use that mode directly when accessing a field of that mode.  */
  108.  
  109. static char direct_load[NUM_MACHINE_MODES];
  110. static char direct_store[NUM_MACHINE_MODES];
  111.  
  112. /* MOVE_RATIO is the number of move instructions that is better than
  113.    a block move.  */
  114.  
  115. #ifndef MOVE_RATIO
  116. #if defined (HAVE_movstrqi) || defined (HAVE_movstrhi) || defined (HAVE_movstrsi) || defined (HAVE_movstrdi) || defined (HAVE_movstrti)
  117. #define MOVE_RATIO 2
  118. #else
  119. /* A value of around 6 would minimize code size; infinity would minimize
  120.    execution time.  */
  121. #define MOVE_RATIO 15
  122. #endif
  123. #endif
  124.  
  125. /* This array records the insn_code of insns to perform block moves.  */
  126. static enum insn_code movstr_optab[NUM_MACHINE_MODES];
  127.  
  128. /* SLOW_UNALIGNED_ACCESS is non-zero if unaligned accesses are very slow. */
  129.  
  130. #ifndef SLOW_UNALIGNED_ACCESS
  131. #define SLOW_UNALIGNED_ACCESS 0
  132. #endif
  133.  
  134. /* This is run once per compilation to set up which modes can be used
  135.    directly in memory and to initialize the block move optab.  */
  136.  
  137. void
  138. init_expr_once ()
  139. {
  140.   rtx insn, pat;
  141.   enum machine_mode mode;
  142.   /* Try indexing by frame ptr and try by stack ptr.
  143.      It is known that on the Convex the stack ptr isn't a valid index.
  144.      With luck, one or the other is valid on any machine.  */
  145.   rtx mem = gen_rtx (MEM, VOIDmode, stack_pointer_rtx);
  146.   rtx mem1 = gen_rtx (MEM, VOIDmode, frame_pointer_rtx);
  147.  
  148.   start_sequence ();
  149.   insn = emit_insn (gen_rtx (SET, 0, 0));
  150.   pat = PATTERN (insn);
  151.  
  152.   for (mode = VOIDmode; (int) mode < NUM_MACHINE_MODES;
  153.        mode = (enum machine_mode) ((int) mode + 1))
  154.     {
  155.       int regno;
  156.       rtx reg;
  157.       int num_clobbers;
  158.  
  159.       direct_load[(int) mode] = direct_store[(int) mode] = 0;
  160.       PUT_MODE (mem, mode);
  161.       PUT_MODE (mem1, mode);
  162.  
  163.       /* See if there is some register that can be used in this mode and
  164.      directly loaded or stored from memory.  */
  165.  
  166.       if (mode != VOIDmode && mode != BLKmode)
  167.     for (regno = 0; regno < FIRST_PSEUDO_REGISTER
  168.          && (direct_load[(int) mode] == 0 || direct_store[(int) mode] == 0);
  169.          regno++)
  170.       {
  171.         if (! HARD_REGNO_MODE_OK (regno, mode))
  172.           continue;
  173.  
  174.         reg = gen_rtx (REG, mode, regno);
  175.  
  176.         SET_SRC (pat) = mem;
  177.         SET_DEST (pat) = reg;
  178.         if (recog (pat, insn, &num_clobbers) >= 0)
  179.           direct_load[(int) mode] = 1;
  180.  
  181.         SET_SRC (pat) = mem1;
  182.         SET_DEST (pat) = reg;
  183.         if (recog (pat, insn, &num_clobbers) >= 0)
  184.           direct_load[(int) mode] = 1;
  185.  
  186.         SET_SRC (pat) = reg;
  187.         SET_DEST (pat) = mem;
  188.         if (recog (pat, insn, &num_clobbers) >= 0)
  189.           direct_store[(int) mode] = 1;
  190.  
  191.         SET_SRC (pat) = reg;
  192.         SET_DEST (pat) = mem1;
  193.         if (recog (pat, insn, &num_clobbers) >= 0)
  194.           direct_store[(int) mode] = 1;
  195.       }
  196.  
  197.       movstr_optab[(int) mode] = CODE_FOR_nothing;
  198.     }
  199.  
  200.   end_sequence ();
  201.  
  202. #ifdef HAVE_movstrqi
  203.   if (HAVE_movstrqi)
  204.     movstr_optab[(int) QImode] = CODE_FOR_movstrqi;
  205. #endif
  206. #ifdef HAVE_movstrhi
  207.   if (HAVE_movstrhi)
  208.     movstr_optab[(int) HImode] = CODE_FOR_movstrhi;
  209. #endif
  210. #ifdef HAVE_movstrsi
  211.   if (HAVE_movstrsi)
  212.     movstr_optab[(int) SImode] = CODE_FOR_movstrsi;
  213. #endif
  214. #ifdef HAVE_movstrdi
  215.   if (HAVE_movstrdi)
  216.     movstr_optab[(int) DImode] = CODE_FOR_movstrdi;
  217. #endif
  218. #ifdef HAVE_movstrti
  219.   if (HAVE_movstrti)
  220.     movstr_optab[(int) TImode] = CODE_FOR_movstrti;
  221. #endif
  222. }
  223.       
  224. /* This is run at the start of compiling a function.  */
  225.  
  226. void
  227. init_expr ()
  228. {
  229.   init_queue ();
  230.  
  231.   pending_stack_adjust = 0;
  232.   inhibit_defer_pop = 0;
  233.   cleanups_this_call = 0;
  234.   saveregs_value = 0;
  235.   forced_labels = 0;
  236. }
  237.  
  238. /* Save all variables describing the current status into the structure *P.
  239.    This is used before starting a nested function.  */
  240.  
  241. void
  242. save_expr_status (p)
  243.      struct function *p;
  244. {
  245.   /* Instead of saving the postincrement queue, empty it.  */
  246.   emit_queue ();
  247.  
  248.   p->pending_stack_adjust = pending_stack_adjust;
  249.   p->inhibit_defer_pop = inhibit_defer_pop;
  250.   p->cleanups_this_call = cleanups_this_call;
  251.   p->saveregs_value = saveregs_value;
  252.   p->forced_labels = forced_labels;
  253.  
  254.   pending_stack_adjust = 0;
  255.   inhibit_defer_pop = 0;
  256.   cleanups_this_call = 0;
  257.   saveregs_value = 0;
  258.   forced_labels = 0;
  259. }
  260.  
  261. /* Restore all variables describing the current status from the structure *P.
  262.    This is used after a nested function.  */
  263.  
  264. void
  265. restore_expr_status (p)
  266.      struct function *p;
  267. {
  268.   pending_stack_adjust = p->pending_stack_adjust;
  269.   inhibit_defer_pop = p->inhibit_defer_pop;
  270.   cleanups_this_call = p->cleanups_this_call;
  271.   saveregs_value = p->saveregs_value;
  272.   forced_labels = p->forced_labels;
  273. }
  274.  
  275. /* Manage the queue of increment instructions to be output
  276.    for POSTINCREMENT_EXPR expressions, etc.  */
  277.  
  278. static rtx pending_chain;
  279.  
  280. /* Queue up to increment (or change) VAR later.  BODY says how:
  281.    BODY should be the same thing you would pass to emit_insn
  282.    to increment right away.  It will go to emit_insn later on.
  283.  
  284.    The value is a QUEUED expression to be used in place of VAR
  285.    where you want to guarantee the pre-incrementation value of VAR.  */
  286.  
  287. static rtx
  288. enqueue_insn (var, body)
  289.      rtx var, body;
  290. {
  291.   pending_chain = gen_rtx (QUEUED, GET_MODE (var),
  292.                var, NULL_RTX, NULL_RTX, body, pending_chain);
  293.   return pending_chain;
  294. }
  295.  
  296. /* Use protect_from_queue to convert a QUEUED expression
  297.    into something that you can put immediately into an instruction.
  298.    If the queued incrementation has not happened yet,
  299.    protect_from_queue returns the variable itself.
  300.    If the incrementation has happened, protect_from_queue returns a temp
  301.    that contains a copy of the old value of the variable.
  302.  
  303.    Any time an rtx which might possibly be a QUEUED is to be put
  304.    into an instruction, it must be passed through protect_from_queue first.
  305.    QUEUED expressions are not meaningful in instructions.
  306.  
  307.    Do not pass a value through protect_from_queue and then hold
  308.    on to it for a while before putting it in an instruction!
  309.    If the queue is flushed in between, incorrect code will result.  */
  310.  
  311. rtx
  312. protect_from_queue (x, modify)
  313.      register rtx x;
  314.      int modify;
  315. {
  316.   register RTX_CODE code = GET_CODE (x);
  317.  
  318. #if 0  /* A QUEUED can hang around after the queue is forced out.  */
  319.   /* Shortcut for most common case.  */
  320.   if (pending_chain == 0)
  321.     return x;
  322. #endif
  323.  
  324.   if (code != QUEUED)
  325.     {
  326.       /* A special hack for read access to (MEM (QUEUED ...))
  327.      to facilitate use of autoincrement.
  328.      Make a copy of the contents of the memory location
  329.      rather than a copy of the address, but not
  330.      if the value is of mode BLKmode.  */
  331.       if (code == MEM && GET_MODE (x) != BLKmode
  332.       && GET_CODE (XEXP (x, 0)) == QUEUED && !modify)
  333.     {
  334.       register rtx y = XEXP (x, 0);
  335.       XEXP (x, 0) = QUEUED_VAR (y);
  336.       if (QUEUED_INSN (y))
  337.         {
  338.           register rtx temp = gen_reg_rtx (GET_MODE (x));
  339.           emit_insn_before (gen_move_insn (temp, x),
  340.                 QUEUED_INSN (y));
  341.           return temp;
  342.         }
  343.       return x;
  344.     }
  345.       /* Otherwise, recursively protect the subexpressions of all
  346.      the kinds of rtx's that can contain a QUEUED.  */
  347.       if (code == MEM)
  348.     XEXP (x, 0) = protect_from_queue (XEXP (x, 0), 0);
  349.       else if (code == PLUS || code == MULT)
  350.     {
  351.       XEXP (x, 0) = protect_from_queue (XEXP (x, 0), 0);
  352.       XEXP (x, 1) = protect_from_queue (XEXP (x, 1), 0);
  353.     }
  354.       return x;
  355.     }
  356.   /* If the increment has not happened, use the variable itself.  */
  357.   if (QUEUED_INSN (x) == 0)
  358.     return QUEUED_VAR (x);
  359.   /* If the increment has happened and a pre-increment copy exists,
  360.      use that copy.  */
  361.   if (QUEUED_COPY (x) != 0)
  362.     return QUEUED_COPY (x);
  363.   /* The increment has happened but we haven't set up a pre-increment copy.
  364.      Set one up now, and use it.  */
  365.   QUEUED_COPY (x) = gen_reg_rtx (GET_MODE (QUEUED_VAR (x)));
  366.   emit_insn_before (gen_move_insn (QUEUED_COPY (x), QUEUED_VAR (x)),
  367.             QUEUED_INSN (x));
  368.   return QUEUED_COPY (x);
  369. }
  370.  
  371. /* Return nonzero if X contains a QUEUED expression:
  372.    if it contains anything that will be altered by a queued increment.
  373.    We handle only combinations of MEM, PLUS, MINUS and MULT operators
  374.    since memory addresses generally contain only those.  */
  375.  
  376. static int
  377. queued_subexp_p (x)
  378.      rtx x;
  379. {
  380.   register enum rtx_code code = GET_CODE (x);
  381.   switch (code)
  382.     {
  383.     case QUEUED:
  384.       return 1;
  385.     case MEM:
  386.       return queued_subexp_p (XEXP (x, 0));
  387.     case MULT:
  388.     case PLUS:
  389.     case MINUS:
  390.       return queued_subexp_p (XEXP (x, 0))
  391.     || queued_subexp_p (XEXP (x, 1));
  392.     }
  393.   return 0;
  394. }
  395.  
  396. /* Perform all the pending incrementations.  */
  397.  
  398. void
  399. emit_queue ()
  400. {
  401.   register rtx p;
  402.   while (p = pending_chain)
  403.     {
  404.       QUEUED_INSN (p) = emit_insn (QUEUED_BODY (p));
  405.       pending_chain = QUEUED_NEXT (p);
  406.     }
  407. }
  408.  
  409. static void
  410. init_queue ()
  411. {
  412.   if (pending_chain)
  413.     abort ();
  414. }
  415.  
  416. /* Copy data from FROM to TO, where the machine modes are not the same.
  417.    Both modes may be integer, or both may be floating.
  418.    UNSIGNEDP should be nonzero if FROM is an unsigned type.
  419.    This causes zero-extension instead of sign-extension.  */
  420.  
  421. void
  422. convert_move (to, from, unsignedp)
  423.      register rtx to, from;
  424.      int unsignedp;
  425. {
  426.   enum machine_mode to_mode = GET_MODE (to);
  427.   enum machine_mode from_mode = GET_MODE (from);
  428.   int to_real = GET_MODE_CLASS (to_mode) == MODE_FLOAT;
  429.   int from_real = GET_MODE_CLASS (from_mode) == MODE_FLOAT;
  430.   enum insn_code code;
  431.   rtx libcall;
  432.  
  433.   /* rtx code for making an equivalent value.  */
  434.   enum rtx_code equiv_code = (unsignedp ? ZERO_EXTEND : SIGN_EXTEND);
  435.  
  436.   to = protect_from_queue (to, 1);
  437.   from = protect_from_queue (from, 0);
  438.  
  439.   if (to_real != from_real)
  440.     abort ();
  441.  
  442.   /* If FROM is a SUBREG that indicates that we have already done at least
  443.      the required extension, strip it.  We don't handle such SUBREGs as
  444.      TO here.  */
  445.  
  446.   if (GET_CODE (from) == SUBREG && SUBREG_PROMOTED_VAR_P (from)
  447.       && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (from)))
  448.       >= GET_MODE_SIZE (to_mode))
  449.       && SUBREG_PROMOTED_UNSIGNED_P (from) == unsignedp)
  450.     from = gen_lowpart (to_mode, from), from_mode = to_mode;
  451.  
  452.   if (GET_CODE (to) == SUBREG && SUBREG_PROMOTED_VAR_P (to))
  453.     abort ();
  454.  
  455.   if (to_mode == from_mode
  456.       || (from_mode == VOIDmode && CONSTANT_P (from)))
  457.     {
  458.       emit_move_insn (to, from);
  459.       return;
  460.     }
  461.  
  462.   if (to_real)
  463.     {
  464. #ifdef HAVE_extendsfdf2
  465.       if (HAVE_extendsfdf2 && from_mode == SFmode && to_mode == DFmode)
  466.     {
  467.       emit_unop_insn (CODE_FOR_extendsfdf2, to, from, UNKNOWN);
  468.       return;
  469.     }
  470. #endif
  471. #ifdef HAVE_extendsfxf2
  472.       if (HAVE_extendsfxf2 && from_mode == SFmode && to_mode == XFmode)
  473.     {
  474.       emit_unop_insn (CODE_FOR_extendsfxf2, to, from, UNKNOWN);
  475.       return;
  476.     }
  477. #endif
  478. #ifdef HAVE_extendsftf2
  479.       if (HAVE_extendsftf2 && from_mode == SFmode && to_mode == TFmode)
  480.     {
  481.       emit_unop_insn (CODE_FOR_extendsftf2, to, from, UNKNOWN);
  482.       return;
  483.     }
  484. #endif
  485. #ifdef HAVE_extenddfxf2
  486.       if (HAVE_extenddfxf2 && from_mode == DFmode && to_mode == XFmode)
  487.     {
  488.       emit_unop_insn (CODE_FOR_extenddfxf2, to, from, UNKNOWN);
  489.       return;
  490.     }
  491. #endif
  492. #ifdef HAVE_extenddftf2
  493.       if (HAVE_extenddftf2 && from_mode == DFmode && to_mode == TFmode)
  494.     {
  495.       emit_unop_insn (CODE_FOR_extenddftf2, to, from, UNKNOWN);
  496.       return;
  497.     }
  498. #endif
  499. #ifdef HAVE_truncdfsf2
  500.       if (HAVE_truncdfsf2 && from_mode == DFmode && to_mode == SFmode)
  501.     {
  502.       emit_unop_insn (CODE_FOR_truncdfsf2, to, from, UNKNOWN);
  503.       return;
  504.     }
  505. #endif
  506. #ifdef HAVE_truncxfsf2
  507.       if (HAVE_truncxfsf2 && from_mode == XFmode && to_mode == SFmode)
  508.     {
  509.       emit_unop_insn (CODE_FOR_truncxfsf2, to, from, UNKNOWN);
  510.       return;
  511.     }
  512. #endif
  513. #ifdef HAVE_trunctfsf2
  514.       if (HAVE_trunctfsf2 && from_mode == TFmode && to_mode == SFmode)
  515.     {
  516.       emit_unop_insn (CODE_FOR_trunctfsf2, to, from, UNKNOWN);
  517.       return;
  518.     }
  519. #endif
  520. #ifdef HAVE_truncxfdf2
  521.       if (HAVE_truncxfdf2 && from_mode == XFmode && to_mode == DFmode)
  522.     {
  523.       emit_unop_insn (CODE_FOR_truncxfdf2, to, from, UNKNOWN);
  524.       return;
  525.     }
  526. #endif
  527. #ifdef HAVE_trunctfdf2
  528.       if (HAVE_trunctfdf2 && from_mode == TFmode && to_mode == DFmode)
  529.     {
  530.       emit_unop_insn (CODE_FOR_trunctfdf2, to, from, UNKNOWN);
  531.       return;
  532.     }
  533. #endif
  534.  
  535.       libcall = (rtx) 0;
  536.       switch (from_mode)
  537.     {
  538.     case SFmode:
  539.       switch (to_mode)
  540.         {
  541.         case DFmode:
  542.           libcall = extendsfdf2_libfunc;
  543.           break;
  544.  
  545.         case XFmode:
  546.           libcall = extendsfxf2_libfunc;
  547.           break;
  548.  
  549.         case TFmode:
  550.           libcall = extendsftf2_libfunc;
  551.           break;
  552.         }
  553.       break;
  554.  
  555.     case DFmode:
  556.       switch (to_mode)
  557.         {
  558.         case SFmode:
  559.           libcall = truncdfsf2_libfunc;
  560.           break;
  561.  
  562.         case XFmode:
  563.           libcall = extenddfxf2_libfunc;
  564.           break;
  565.  
  566.         case TFmode:
  567.           libcall = extenddftf2_libfunc;
  568.           break;
  569.         }
  570.       break;
  571.  
  572.     case XFmode:
  573.       switch (to_mode)
  574.         {
  575.         case SFmode:
  576.           libcall = truncxfsf2_libfunc;
  577.           break;
  578.  
  579.         case DFmode:
  580.           libcall = truncxfdf2_libfunc;
  581.           break;
  582.         }
  583.       break;
  584.  
  585.     case TFmode:
  586.       switch (to_mode)
  587.         {
  588.         case SFmode:
  589.           libcall = trunctfsf2_libfunc;
  590.           break;
  591.  
  592.         case DFmode:
  593.           libcall = trunctfdf2_libfunc;
  594.           break;
  595.         }
  596.       break;
  597.     }
  598.  
  599.       if (libcall == (rtx) 0)
  600.     /* This conversion is not implemented yet.  */
  601.     abort ();
  602.  
  603.       emit_library_call (libcall, 1, to_mode, 1, from, from_mode);
  604.       emit_move_insn (to, hard_libcall_value (to_mode));
  605.       return;
  606.     }
  607.  
  608.   /* Now both modes are integers.  */
  609.  
  610.   /* Handle expanding beyond a word.  */
  611.   if (GET_MODE_BITSIZE (from_mode) < GET_MODE_BITSIZE (to_mode)
  612.       && GET_MODE_BITSIZE (to_mode) > BITS_PER_WORD)
  613.     {
  614.       rtx insns;
  615.       rtx lowpart;
  616.       rtx fill_value;
  617.       rtx lowfrom;
  618.       int i;
  619.       enum machine_mode lowpart_mode;
  620.       int nwords = CEIL (GET_MODE_SIZE (to_mode), UNITS_PER_WORD);
  621.  
  622.       /* Try converting directly if the insn is supported.  */
  623.       if ((code = can_extend_p (to_mode, from_mode, unsignedp))
  624.       != CODE_FOR_nothing)
  625.     {
  626.       /* If FROM is a SUBREG, put it into a register.  Do this
  627.          so that we always generate the same set of insns for
  628.          better cse'ing; if an intermediate assignment occurred,
  629.          we won't be doing the operation directly on the SUBREG.  */
  630.       if (optimize > 0 && GET_CODE (from) == SUBREG)
  631.         from = force_reg (from_mode, from);
  632.       emit_unop_insn (code, to, from, equiv_code);
  633.       return;
  634.     }
  635.       /* Next, try converting via full word.  */
  636.       else if (GET_MODE_BITSIZE (from_mode) < BITS_PER_WORD
  637.            && ((code = can_extend_p (to_mode, word_mode, unsignedp))
  638.            != CODE_FOR_nothing))
  639.     {
  640.       convert_move (gen_lowpart (word_mode, to), from, unsignedp);
  641.       emit_unop_insn (code, to,
  642.               gen_lowpart (word_mode, to), equiv_code);
  643.       return;
  644.     }
  645.  
  646.       /* No special multiword conversion insn; do it by hand.  */
  647.       start_sequence ();
  648.  
  649.       /* Get a copy of FROM widened to a word, if necessary.  */
  650.       if (GET_MODE_BITSIZE (from_mode) < BITS_PER_WORD)
  651.     lowpart_mode = word_mode;
  652.       else
  653.     lowpart_mode = from_mode;
  654.  
  655.       lowfrom = convert_to_mode (lowpart_mode, from, unsignedp);
  656.  
  657.       lowpart = gen_lowpart (lowpart_mode, to);
  658.       emit_move_insn (lowpart, lowfrom);
  659.  
  660.       /* Compute the value to put in each remaining word.  */
  661.       if (unsignedp)
  662.     fill_value = const0_rtx;
  663.       else
  664.     {
  665. #ifdef HAVE_slt
  666.       if (HAVE_slt
  667.           && insn_operand_mode[(int) CODE_FOR_slt][0] == word_mode
  668.           && STORE_FLAG_VALUE == -1)
  669.         {
  670.           emit_cmp_insn (lowfrom, const0_rtx, NE, NULL_RTX,
  671.                  lowpart_mode, 0, 0);
  672.           fill_value = gen_reg_rtx (word_mode);
  673.           emit_insn (gen_slt (fill_value));
  674.         }
  675.       else
  676. #endif
  677.         {
  678.           fill_value
  679.         = expand_shift (RSHIFT_EXPR, lowpart_mode, lowfrom,
  680.                 size_int (GET_MODE_BITSIZE (lowpart_mode) - 1),
  681.                 NULL_RTX, 0);
  682.           fill_value = convert_to_mode (word_mode, fill_value, 1);
  683.         }
  684.     }
  685.  
  686.       /* Fill the remaining words.  */
  687.       for (i = GET_MODE_SIZE (lowpart_mode) / UNITS_PER_WORD; i < nwords; i++)
  688.     {
  689.       int index = (WORDS_BIG_ENDIAN ? nwords - i - 1 : i);
  690.       rtx subword = operand_subword (to, index, 1, to_mode);
  691.  
  692.       if (subword == 0)
  693.         abort ();
  694.  
  695.       if (fill_value != subword)
  696.         emit_move_insn (subword, fill_value);
  697.     }
  698.  
  699.       insns = get_insns ();
  700.       end_sequence ();
  701.  
  702.       emit_no_conflict_block (insns, to, from, NULL_RTX,
  703.                   gen_rtx (equiv_code, to_mode, from));
  704.       return;
  705.     }
  706.  
  707.   if (GET_MODE_BITSIZE (from_mode) > BITS_PER_WORD)
  708.     {
  709.       convert_move (to, gen_lowpart (word_mode, from), 0);
  710.       return;
  711.     }
  712.  
  713.   /* Handle pointer conversion */            /* SPEE 900220 */
  714.   if (to_mode == PSImode)
  715.     {
  716.       if (from_mode != SImode)
  717.     from = convert_to_mode (SImode, from, unsignedp);
  718.  
  719. #ifdef HAVE_truncsipsi
  720.       if (HAVE_truncsipsi)
  721.     {
  722.       emit_unop_insn (CODE_FOR_truncsipsi, to, from, UNKNOWN);
  723.       return;
  724.     }
  725. #endif /* HAVE_truncsipsi */
  726.       abort ();
  727.     }
  728.  
  729.   if (from_mode == PSImode)
  730.     {
  731.       if (to_mode != SImode)
  732.     {
  733.       from = convert_to_mode (SImode, from, unsignedp);
  734.       from_mode = SImode;
  735.     }
  736.       else
  737.     {
  738. #ifdef HAVE_extendpsisi
  739.       if (HAVE_extendpsisi)
  740.         {
  741.           emit_unop_insn (CODE_FOR_extendpsisi, to, from, UNKNOWN);
  742.           return;
  743.         }
  744. #endif /* HAVE_extendpsisi */
  745.       abort ();
  746.     }
  747.     }
  748.  
  749.   /* Now follow all the conversions between integers
  750.      no more than a word long.  */
  751.  
  752.   /* For truncation, usually we can just refer to FROM in a narrower mode.  */
  753.   if (GET_MODE_BITSIZE (to_mode) < GET_MODE_BITSIZE (from_mode)
  754.       && TRULY_NOOP_TRUNCATION (GET_MODE_BITSIZE (to_mode),
  755.                 GET_MODE_BITSIZE (from_mode))
  756.       && ((GET_CODE (from) == MEM
  757.        && ! MEM_VOLATILE_P (from)
  758.        && direct_load[(int) to_mode]
  759.        && ! mode_dependent_address_p (XEXP (from, 0)))
  760.       || GET_CODE (from) == REG
  761.       || GET_CODE (from) == SUBREG))
  762.     {
  763.       emit_move_insn (to, gen_lowpart (to_mode, from));
  764.       return;
  765.     }
  766.  
  767.   /* For truncation, usually we can just refer to FROM in a narrower mode.  */
  768.   if (GET_MODE_BITSIZE (to_mode) > GET_MODE_BITSIZE (from_mode))
  769.     {
  770.       /* Convert directly if that works.  */
  771.       if ((code = can_extend_p (to_mode, from_mode, unsignedp))
  772.       != CODE_FOR_nothing)
  773.     {
  774.       /* If FROM is a SUBREG, put it into a register.  Do this
  775.          so that we always generate the same set of insns for
  776.          better cse'ing; if an intermediate assignment occurred,
  777.          we won't be doing the operation directly on the SUBREG.  */
  778.       if (optimize > 0 && GET_CODE (from) == SUBREG)
  779.         from = force_reg (from_mode, from);
  780.       emit_unop_insn (code, to, from, equiv_code);
  781.       return;
  782.     }
  783.       else
  784.     {
  785.       enum machine_mode intermediate;
  786.  
  787.       /* Search for a mode to convert via.  */
  788.       for (intermediate = from_mode; intermediate != VOIDmode;
  789.            intermediate = GET_MODE_WIDER_MODE (intermediate))
  790.         if ((can_extend_p (to_mode, intermediate, unsignedp)
  791.          != CODE_FOR_nothing)
  792.         && (can_extend_p (intermediate, from_mode, unsignedp)
  793.             != CODE_FOR_nothing))
  794.           {
  795.         convert_move (to, convert_to_mode (intermediate, from,
  796.                            unsignedp), unsignedp);
  797.         return;
  798.           }
  799.  
  800.       /* No suitable intermediate mode.  */
  801.       abort ();
  802.     }
  803.     }
  804.  
  805.   /* Support special truncate insns for certain modes.  */ 
  806.  
  807.   if (from_mode == DImode && to_mode == SImode)
  808.     {
  809. #ifdef HAVE_truncdisi2
  810.       if (HAVE_truncdisi2)
  811.     {
  812.       emit_unop_insn (CODE_FOR_truncdisi2, to, from, UNKNOWN);
  813.       return;
  814.     }
  815. #endif
  816.       convert_move (to, force_reg (from_mode, from), unsignedp);
  817.       return;
  818.     }
  819.  
  820.   if (from_mode == DImode && to_mode == HImode)
  821.     {
  822. #ifdef HAVE_truncdihi2
  823.       if (HAVE_truncdihi2)
  824.     {
  825.       emit_unop_insn (CODE_FOR_truncdihi2, to, from, UNKNOWN);
  826.       return;
  827.     }
  828. #endif
  829.       convert_move (to, force_reg (from_mode, from), unsignedp);
  830.       return;
  831.     }
  832.  
  833.   if (from_mode == DImode && to_mode == QImode)
  834.     {
  835. #ifdef HAVE_truncdiqi2
  836.       if (HAVE_truncdiqi2)
  837.     {
  838.       emit_unop_insn (CODE_FOR_truncdiqi2, to, from, UNKNOWN);
  839.       return;
  840.     }
  841. #endif
  842.       convert_move (to, force_reg (from_mode, from), unsignedp);
  843.       return;
  844.     }
  845.  
  846.   if (from_mode == SImode && to_mode == HImode)
  847.     {
  848. #ifdef HAVE_truncsihi2
  849.       if (HAVE_truncsihi2)
  850.     {
  851.       emit_unop_insn (CODE_FOR_truncsihi2, to, from, UNKNOWN);
  852.       return;
  853.     }
  854. #endif
  855.       convert_move (to, force_reg (from_mode, from), unsignedp);
  856.       return;
  857.     }
  858.  
  859.   if (from_mode == SImode && to_mode == QImode)
  860.     {
  861. #ifdef HAVE_truncsiqi2
  862.       if (HAVE_truncsiqi2)
  863.     {
  864.       emit_unop_insn (CODE_FOR_truncsiqi2, to, from, UNKNOWN);
  865.       return;
  866.     }
  867. #endif
  868.       convert_move (to, force_reg (from_mode, from), unsignedp);
  869.       return;
  870.     }
  871.  
  872.   if (from_mode == HImode && to_mode == QImode)
  873.     {
  874. #ifdef HAVE_trunchiqi2
  875.       if (HAVE_trunchiqi2)
  876.     {
  877.       emit_unop_insn (CODE_FOR_trunchiqi2, to, from, UNKNOWN);
  878.       return;
  879.     }
  880. #endif
  881.       convert_move (to, force_reg (from_mode, from), unsignedp);
  882.       return;
  883.     }
  884.  
  885.   /* Handle truncation of volatile memrefs, and so on;
  886.      the things that couldn't be truncated directly,
  887.      and for which there was no special instruction.  */
  888.   if (GET_MODE_BITSIZE (to_mode) < GET_MODE_BITSIZE (from_mode))
  889.     {
  890.       rtx temp = force_reg (to_mode, gen_lowpart (to_mode, from));
  891.       emit_move_insn (to, temp);
  892.       return;
  893.     }
  894.  
  895.   /* Mode combination is not recognized.  */
  896.   abort ();
  897. }
  898.  
  899. /* Return an rtx for a value that would result
  900.    from converting X to mode MODE.
  901.    Both X and MODE may be floating, or both integer.
  902.    UNSIGNEDP is nonzero if X is an unsigned value.
  903.    This can be done by referring to a part of X in place
  904.    or by copying to a new temporary with conversion.
  905.  
  906.    This function *must not* call protect_from_queue
  907.    except when putting X into an insn (in which case convert_move does it).  */
  908.  
  909. rtx
  910. convert_to_mode (mode, x, unsignedp)
  911.      enum machine_mode mode;
  912.      rtx x;
  913.      int unsignedp;
  914. {
  915.   register rtx temp;
  916.  
  917.   /* If FROM is a SUBREG that indicates that we have already done at least
  918.      the required extension, strip it.  */
  919.  
  920.   if (GET_CODE (x) == SUBREG && SUBREG_PROMOTED_VAR_P (x)
  921.       && GET_MODE_SIZE (GET_MODE (SUBREG_REG (x))) >= GET_MODE_SIZE (mode)
  922.       && SUBREG_PROMOTED_UNSIGNED_P (x) == unsignedp)
  923.     x = gen_lowpart (mode, x);
  924.  
  925.   if (mode == GET_MODE (x))
  926.     return x;
  927.  
  928.   /* There is one case that we must handle specially: If we are converting
  929.      a CONST_INT into a mode whose size is twice HOST_BITS_PER_WIDE_INT and
  930.      we are to interpret the constant as unsigned, gen_lowpart will do
  931.      the wrong if the constant appears negative.  What we want to do is
  932.      make the high-order word of the constant zero, not all ones.  */
  933.  
  934.   if (unsignedp && GET_MODE_CLASS (mode) == MODE_INT
  935.       && GET_MODE_BITSIZE (mode) == 2 * HOST_BITS_PER_WIDE_INT
  936.       && GET_CODE (x) == CONST_INT && INTVAL (x) < 0)
  937.     return immed_double_const (INTVAL (x), (HOST_WIDE_INT) 0, mode);
  938.  
  939.   /* We can do this with a gen_lowpart if both desired and current modes
  940.      are integer, and this is either a constant integer, a register, or a
  941.      non-volatile MEM.  Except for the constant case, we must be narrowing
  942.      the operand.  */
  943.  
  944.   if (GET_CODE (x) == CONST_INT
  945.       || (GET_MODE_CLASS (mode) == MODE_INT
  946.       && GET_MODE_CLASS (GET_MODE (x)) == MODE_INT
  947.       && (GET_CODE (x) == CONST_DOUBLE
  948.           || (GET_MODE_SIZE (mode) <= GET_MODE_SIZE (GET_MODE (x))
  949.           && ((GET_CODE (x) == MEM && ! MEM_VOLATILE_P (x))
  950.               && direct_load[(int) mode]
  951.               || GET_CODE (x) == REG)))))
  952.     return gen_lowpart (mode, x);
  953.  
  954.   temp = gen_reg_rtx (mode);
  955.   convert_move (temp, x, unsignedp);
  956.   return temp;
  957. }
  958.  
  959. /* Generate several move instructions to copy LEN bytes
  960.    from block FROM to block TO.  (These are MEM rtx's with BLKmode).
  961.    The caller must pass FROM and TO
  962.     through protect_from_queue before calling.
  963.    ALIGN (in bytes) is maximum alignment we can assume.  */
  964.  
  965. struct move_by_pieces
  966. {
  967.   rtx to;
  968.   rtx to_addr;
  969.   int autinc_to;
  970.   int explicit_inc_to;
  971.   rtx from;
  972.   rtx from_addr;
  973.   int autinc_from;
  974.   int explicit_inc_from;
  975.   int len;
  976.   int offset;
  977.   int reverse;
  978. };
  979.  
  980. static void move_by_pieces_1 ();
  981. static int move_by_pieces_ninsns ();
  982.  
  983. static void
  984. move_by_pieces (to, from, len, align)
  985.      rtx to, from;
  986.      int len, align;
  987. {
  988.   struct move_by_pieces data;
  989.   rtx to_addr = XEXP (to, 0), from_addr = XEXP (from, 0);
  990.   int max_size = MOVE_MAX + 1;
  991.  
  992.   data.offset = 0;
  993.   data.to_addr = to_addr;
  994.   data.from_addr = from_addr;
  995.   data.to = to;
  996.   data.from = from;
  997.   data.autinc_to
  998.     = (GET_CODE (to_addr) == PRE_INC || GET_CODE (to_addr) == PRE_DEC
  999.        || GET_CODE (to_addr) == POST_INC || GET_CODE (to_addr) == POST_DEC);
  1000.   data.autinc_from
  1001.     = (GET_CODE (from_addr) == PRE_INC || GET_CODE (from_addr) == PRE_DEC
  1002.        || GET_CODE (from_addr) == POST_INC
  1003.        || GET_CODE (from_addr) == POST_DEC);
  1004.  
  1005.   data.explicit_inc_from = 0;
  1006.   data.explicit_inc_to = 0;
  1007.   data.reverse
  1008.     = (GET_CODE (to_addr) == PRE_DEC || GET_CODE (to_addr) == POST_DEC);
  1009.   if (data.reverse) data.offset = len;
  1010.   data.len = len;
  1011.  
  1012.   /* If copying requires more than two move insns,
  1013.      copy addresses to registers (to make displacements shorter)
  1014.      and use post-increment if available.  */
  1015.   if (!(data.autinc_from && data.autinc_to)
  1016.       && move_by_pieces_ninsns (len, align) > 2)
  1017.     {
  1018. #ifdef HAVE_PRE_DECREMENT
  1019.       if (data.reverse && ! data.autinc_from)
  1020.     {
  1021.       data.from_addr = copy_addr_to_reg (plus_constant (from_addr, len));
  1022.       data.autinc_from = 1;
  1023.       data.explicit_inc_from = -1;
  1024.     }
  1025. #endif
  1026. #ifdef HAVE_POST_INCREMENT
  1027.       if (! data.autinc_from)
  1028.     {
  1029.       data.from_addr = copy_addr_to_reg (from_addr);
  1030.       data.autinc_from = 1;
  1031.       data.explicit_inc_from = 1;
  1032.     }
  1033. #endif
  1034.       if (!data.autinc_from && CONSTANT_P (from_addr))
  1035.     data.from_addr = copy_addr_to_reg (from_addr);
  1036. #ifdef HAVE_PRE_DECREMENT
  1037.       if (data.reverse && ! data.autinc_to)
  1038.     {
  1039.       data.to_addr = copy_addr_to_reg (plus_constant (to_addr, len));
  1040.       data.autinc_to = 1;
  1041.       data.explicit_inc_to = -1;
  1042.     }
  1043. #endif
  1044. #ifdef HAVE_POST_INCREMENT
  1045.       if (! data.reverse && ! data.autinc_to)
  1046.     {
  1047.       data.to_addr = copy_addr_to_reg (to_addr);
  1048.       data.autinc_to = 1;
  1049.       data.explicit_inc_to = 1;
  1050.     }
  1051. #endif
  1052.       if (!data.autinc_to && CONSTANT_P (to_addr))
  1053.     data.to_addr = copy_addr_to_reg (to_addr);
  1054.     }
  1055.  
  1056.   if (! (STRICT_ALIGNMENT || SLOW_UNALIGNED_ACCESS)
  1057.       || align > MOVE_MAX || align >= BIGGEST_ALIGNMENT / BITS_PER_UNIT)
  1058.     align = MOVE_MAX;
  1059.  
  1060.   /* First move what we can in the largest integer mode, then go to
  1061.      successively smaller modes.  */
  1062.  
  1063.   while (max_size > 1)
  1064.     {
  1065.       enum machine_mode mode = VOIDmode, tmode;
  1066.       enum insn_code icode;
  1067.  
  1068.       for (tmode = GET_CLASS_NARROWEST_MODE (MODE_INT);
  1069.        tmode != VOIDmode; tmode = GET_MODE_WIDER_MODE (tmode))
  1070.     if (GET_MODE_SIZE (tmode) < max_size)
  1071.       mode = tmode;
  1072.  
  1073.       if (mode == VOIDmode)
  1074.     break;
  1075.  
  1076.       icode = mov_optab->handlers[(int) mode].insn_code;
  1077.       if (icode != CODE_FOR_nothing
  1078.       && align >= MIN (BIGGEST_ALIGNMENT / BITS_PER_UNIT,
  1079.                GET_MODE_SIZE (mode)))
  1080.     move_by_pieces_1 (GEN_FCN (icode), mode, &data);
  1081.  
  1082.       max_size = GET_MODE_SIZE (mode);
  1083.     }
  1084.  
  1085.   /* The code above should have handled everything.  */
  1086.   if (data.len != 0)
  1087.     abort ();
  1088. }
  1089.  
  1090. /* Return number of insns required to move L bytes by pieces.
  1091.    ALIGN (in bytes) is maximum alignment we can assume.  */
  1092.  
  1093. static int
  1094. move_by_pieces_ninsns (l, align)
  1095.      unsigned int l;
  1096.      int align;
  1097. {
  1098.   register int n_insns = 0;
  1099.   int max_size = MOVE_MAX + 1;
  1100.  
  1101.   if (! (STRICT_ALIGNMENT || SLOW_UNALIGNED_ACCESS)
  1102.       || align > MOVE_MAX || align >= BIGGEST_ALIGNMENT / BITS_PER_UNIT)
  1103.     align = MOVE_MAX;
  1104.  
  1105.   while (max_size > 1)
  1106.     {
  1107.       enum machine_mode mode = VOIDmode, tmode;
  1108.       enum insn_code icode;
  1109.  
  1110.       for (tmode = GET_CLASS_NARROWEST_MODE (MODE_INT);
  1111.        tmode != VOIDmode; tmode = GET_MODE_WIDER_MODE (tmode))
  1112.     if (GET_MODE_SIZE (tmode) < max_size)
  1113.       mode = tmode;
  1114.  
  1115.       if (mode == VOIDmode)
  1116.     break;
  1117.  
  1118.       icode = mov_optab->handlers[(int) mode].insn_code;
  1119.       if (icode != CODE_FOR_nothing
  1120.       && align >= MIN (BIGGEST_ALIGNMENT / BITS_PER_UNIT,
  1121.                GET_MODE_SIZE (mode)))
  1122.     n_insns += l / GET_MODE_SIZE (mode), l %= GET_MODE_SIZE (mode);
  1123.  
  1124.       max_size = GET_MODE_SIZE (mode);
  1125.     }
  1126.  
  1127.   return n_insns;
  1128. }
  1129.  
  1130. /* Subroutine of move_by_pieces.  Move as many bytes as appropriate
  1131.    with move instructions for mode MODE.  GENFUN is the gen_... function
  1132.    to make a move insn for that mode.  DATA has all the other info.  */
  1133.  
  1134. static void
  1135. move_by_pieces_1 (genfun, mode, data)
  1136.      rtx (*genfun) ();
  1137.      enum machine_mode mode;
  1138.      struct move_by_pieces *data;
  1139. {
  1140.   register int size = GET_MODE_SIZE (mode);
  1141.   register rtx to1, from1;
  1142.  
  1143.   while (data->len >= size)
  1144.     {
  1145.       if (data->reverse) data->offset -= size;
  1146.  
  1147.       to1 = (data->autinc_to
  1148.          ? gen_rtx (MEM, mode, data->to_addr)
  1149.          : change_address (data->to, mode,
  1150.                    plus_constant (data->to_addr, data->offset)));
  1151.       from1 =
  1152.     (data->autinc_from
  1153.      ? gen_rtx (MEM, mode, data->from_addr)
  1154.      : change_address (data->from, mode,
  1155.                plus_constant (data->from_addr, data->offset)));
  1156.  
  1157. #ifdef HAVE_PRE_DECREMENT
  1158.       if (data->explicit_inc_to < 0)
  1159.     emit_insn (gen_add2_insn (data->to_addr, GEN_INT (-size)));
  1160.       if (data->explicit_inc_from < 0)
  1161.     emit_insn (gen_add2_insn (data->from_addr, GEN_INT (-size)));
  1162. #endif
  1163.  
  1164.       emit_insn ((*genfun) (to1, from1));
  1165. #ifdef HAVE_POST_INCREMENT
  1166.       if (data->explicit_inc_to > 0)
  1167.     emit_insn (gen_add2_insn (data->to_addr, GEN_INT (size)));
  1168.       if (data->explicit_inc_from > 0)
  1169.     emit_insn (gen_add2_insn (data->from_addr, GEN_INT (size)));
  1170. #endif
  1171.  
  1172.       if (! data->reverse) data->offset += size;
  1173.  
  1174.       data->len -= size;
  1175.     }
  1176. }
  1177.  
  1178. /* Emit code to move a block Y to a block X.
  1179.    This may be done with string-move instructions,
  1180.    with multiple scalar move instructions, or with a library call.
  1181.  
  1182.    Both X and Y must be MEM rtx's (perhaps inside VOLATILE)
  1183.    with mode BLKmode.
  1184.    SIZE is an rtx that says how long they are.
  1185.    ALIGN is the maximum alignment we can assume they have,
  1186.    measured in bytes.  */
  1187.  
  1188. void
  1189. emit_block_move (x, y, size, align)
  1190.      rtx x, y;
  1191.      rtx size;
  1192.      int align;
  1193. {
  1194.   if (GET_MODE (x) != BLKmode)
  1195.     abort ();
  1196.  
  1197.   if (GET_MODE (y) != BLKmode)
  1198.     abort ();
  1199.  
  1200.   x = protect_from_queue (x, 1);
  1201.   y = protect_from_queue (y, 0);
  1202.   size = protect_from_queue (size, 0);
  1203.  
  1204.   if (GET_CODE (x) != MEM)
  1205.     abort ();
  1206.   if (GET_CODE (y) != MEM)
  1207.     abort ();
  1208.   if (size == 0)
  1209.     abort ();
  1210.  
  1211.   if (GET_CODE (size) == CONST_INT
  1212.       && (move_by_pieces_ninsns (INTVAL (size), align) < MOVE_RATIO))
  1213.     move_by_pieces (x, y, INTVAL (size), align);
  1214.   else
  1215.     {
  1216.       /* Try the most limited insn first, because there's no point
  1217.      including more than one in the machine description unless
  1218.      the more limited one has some advantage.  */
  1219.  
  1220.       rtx opalign = GEN_INT (align);
  1221.       enum machine_mode mode;
  1222.  
  1223.       for (mode = GET_CLASS_NARROWEST_MODE (MODE_INT); mode != VOIDmode;
  1224.        mode = GET_MODE_WIDER_MODE (mode))
  1225.     {
  1226.       enum insn_code code = movstr_optab[(int) mode];
  1227.  
  1228.       if (code != CODE_FOR_nothing
  1229.           /* We don't need MODE to be narrower than BITS_PER_HOST_WIDE_INT
  1230.          here because if SIZE is less than the mode mask, as it is
  1231.          returned by the macro, it will definately be less than the
  1232.          actual mode mask.  */
  1233.           && (unsigned) INTVAL (size) <= GET_MODE_MASK (mode)
  1234.           && (insn_operand_predicate[(int) code][0] == 0
  1235.           || (*insn_operand_predicate[(int) code][0]) (x, BLKmode))
  1236.           && (insn_operand_predicate[(int) code][1] == 0
  1237.           || (*insn_operand_predicate[(int) code][1]) (y, BLKmode))
  1238.           && (insn_operand_predicate[(int) code][3] == 0
  1239.           || (*insn_operand_predicate[(int) code][3]) (opalign,
  1240.                                    VOIDmode)))
  1241.         {
  1242.           rtx op2;
  1243.           rtx last = get_last_insn ();
  1244.           rtx pat;
  1245.  
  1246.           op2 = convert_to_mode (mode, size, 1);
  1247.           if (insn_operand_predicate[(int) code][2] != 0
  1248.           && ! (*insn_operand_predicate[(int) code][2]) (op2, mode))
  1249.         op2 = copy_to_mode_reg (mode, op2);
  1250.  
  1251.           pat = GEN_FCN ((int) code) (x, y, op2, opalign);
  1252.           if (pat)
  1253.         {
  1254.           emit_insn (pat);
  1255.           return;
  1256.         }
  1257.           else
  1258.         delete_insns_since (last);
  1259.         }
  1260.     }
  1261.  
  1262. #ifdef TARGET_MEM_FUNCTIONS
  1263.       emit_library_call (memcpy_libfunc, 0,
  1264.              VOIDmode, 3, XEXP (x, 0), Pmode,
  1265.              XEXP (y, 0), Pmode,
  1266.              convert_to_mode (Pmode, size, 1), Pmode);
  1267. #else
  1268.       emit_library_call (bcopy_libfunc, 0,
  1269.              VOIDmode, 3, XEXP (y, 0), Pmode,
  1270.              XEXP (x, 0), Pmode,
  1271.              convert_to_mode (Pmode, size, 1), Pmode);
  1272. #endif
  1273.     }
  1274. }
  1275.  
  1276. /* Copy all or part of a value X into registers starting at REGNO.
  1277.    The number of registers to be filled is NREGS.  */
  1278.  
  1279. void
  1280. move_block_to_reg (regno, x, nregs, mode)
  1281.      int regno;
  1282.      rtx x;
  1283.      int nregs;
  1284.      enum machine_mode mode;
  1285. {
  1286.   int i;
  1287.   rtx pat, last;
  1288.  
  1289.   if (CONSTANT_P (x) && ! LEGITIMATE_CONSTANT_P (x))
  1290.     x = validize_mem (force_const_mem (mode, x));
  1291.  
  1292.   /* See if the machine can do this with a load multiple insn.  */
  1293. #ifdef HAVE_load_multiple
  1294.   last = get_last_insn ();
  1295.   pat = gen_load_multiple (gen_rtx (REG, word_mode, regno), x,
  1296.                GEN_INT (nregs));
  1297.   if (pat)
  1298.     {
  1299.       emit_insn (pat);
  1300.       return;
  1301.     }
  1302.   else
  1303.     delete_insns_since (last);
  1304. #endif
  1305.  
  1306.   for (i = 0; i < nregs; i++)
  1307.     emit_move_insn (gen_rtx (REG, word_mode, regno + i),
  1308.             operand_subword_force (x, i, mode));
  1309. }
  1310.  
  1311. /* Copy all or part of a BLKmode value X out of registers starting at REGNO.
  1312.    The number of registers to be filled is NREGS.  */
  1313.  
  1314. void
  1315. move_block_from_reg (regno, x, nregs)
  1316.      int regno;
  1317.      rtx x;
  1318.      int nregs;
  1319. {
  1320.   int i;
  1321.   rtx pat, last;
  1322.  
  1323.   /* See if the machine can do this with a store multiple insn.  */
  1324. #ifdef HAVE_store_multiple
  1325.   last = get_last_insn ();
  1326.   pat = gen_store_multiple (x, gen_rtx (REG, word_mode, regno),
  1327.                 GEN_INT (nregs));
  1328.   if (pat)
  1329.     {
  1330.       emit_insn (pat);
  1331.       return;
  1332.     }
  1333.   else
  1334.     delete_insns_since (last);
  1335. #endif
  1336.  
  1337.   for (i = 0; i < nregs; i++)
  1338.     {
  1339.       rtx tem = operand_subword (x, i, 1, BLKmode);
  1340.  
  1341.       if (tem == 0)
  1342.     abort ();
  1343.  
  1344.       emit_move_insn (tem, gen_rtx (REG, word_mode, regno + i));
  1345.     }
  1346. }
  1347.  
  1348. /* Mark NREGS consecutive regs, starting at REGNO, as being live now.  */
  1349.  
  1350. void
  1351. use_regs (regno, nregs)
  1352.      int regno;
  1353.      int nregs;
  1354. {
  1355.   int i;
  1356.  
  1357.   for (i = 0; i < nregs; i++)
  1358.     emit_insn (gen_rtx (USE, VOIDmode, gen_rtx (REG, word_mode, regno + i)));
  1359. }
  1360.  
  1361. /* Mark the instructions since PREV as a libcall block.
  1362.    Add REG_LIBCALL to PREV and add a REG_RETVAL to the most recent insn.  */
  1363.  
  1364. static rtx
  1365. group_insns (prev)
  1366.      rtx prev;
  1367. {
  1368.   rtx insn_first;
  1369.   rtx insn_last;
  1370.  
  1371.   /* Find the instructions to mark */
  1372.   if (prev)
  1373.     insn_first = NEXT_INSN (prev);
  1374.   else
  1375.     insn_first = get_insns ();
  1376.  
  1377.   insn_last = get_last_insn ();
  1378.  
  1379.   REG_NOTES (insn_last) = gen_rtx (INSN_LIST, REG_RETVAL, insn_first,
  1380.                    REG_NOTES (insn_last));
  1381.  
  1382.   REG_NOTES (insn_first) = gen_rtx (INSN_LIST, REG_LIBCALL, insn_last,
  1383.                     REG_NOTES (insn_first));
  1384. }
  1385.  
  1386. /* Write zeros through the storage of OBJECT.
  1387.    If OBJECT has BLKmode, SIZE is its length in bytes.  */
  1388.  
  1389. void
  1390. clear_storage (object, size)
  1391.      rtx object;
  1392.      int size;
  1393. {
  1394.   if (GET_MODE (object) == BLKmode)
  1395.     {
  1396. #ifdef TARGET_MEM_FUNCTIONS
  1397.       emit_library_call (memset_libfunc, 0,
  1398.              VOIDmode, 3,
  1399.              XEXP (object, 0), Pmode, const0_rtx, Pmode,
  1400.              GEN_INT (size), Pmode);
  1401. #else
  1402.       emit_library_call (bzero_libfunc, 0,
  1403.              VOIDmode, 2,
  1404.              XEXP (object, 0), Pmode,
  1405.              GEN_INT (size), Pmode);
  1406. #endif
  1407.     }
  1408.   else
  1409.     emit_move_insn (object, const0_rtx);
  1410. }
  1411.  
  1412. /* Generate code to copy Y into X.
  1413.    Both Y and X must have the same mode, except that
  1414.    Y can be a constant with VOIDmode.
  1415.    This mode cannot be BLKmode; use emit_block_move for that.
  1416.  
  1417.    Return the last instruction emitted.  */
  1418.  
  1419. rtx
  1420. emit_move_insn (x, y)
  1421.      rtx x, y;
  1422. {
  1423.   enum machine_mode mode = GET_MODE (x);
  1424.   enum machine_mode submode;
  1425.   enum mode_class class = GET_MODE_CLASS (mode);
  1426.   int i;
  1427.  
  1428.   x = protect_from_queue (x, 1);
  1429.   y = protect_from_queue (y, 0);
  1430.  
  1431.   if (mode == BLKmode || (GET_MODE (y) != mode && GET_MODE (y) != VOIDmode))
  1432.     abort ();
  1433.  
  1434.   if (CONSTANT_P (y) && ! LEGITIMATE_CONSTANT_P (y))
  1435.     y = force_const_mem (mode, y);
  1436.  
  1437.   /* If X or Y are memory references, verify that their addresses are valid
  1438.      for the machine.  */
  1439.   if (GET_CODE (x) == MEM
  1440.       && ((! memory_address_p (GET_MODE (x), XEXP (x, 0))
  1441.        && ! push_operand (x, GET_MODE (x)))
  1442.       || (flag_force_addr
  1443.           && CONSTANT_ADDRESS_P (XEXP (x, 0)))))
  1444.     x = change_address (x, VOIDmode, XEXP (x, 0));
  1445.  
  1446.   if (GET_CODE (y) == MEM
  1447.       && (! memory_address_p (GET_MODE (y), XEXP (y, 0))
  1448.       || (flag_force_addr
  1449.           && CONSTANT_ADDRESS_P (XEXP (y, 0)))))
  1450.     y = change_address (y, VOIDmode, XEXP (y, 0));
  1451.  
  1452.   if (mode == BLKmode)
  1453.     abort ();
  1454.  
  1455.   if (class == MODE_COMPLEX_FLOAT || class == MODE_COMPLEX_INT)
  1456.     submode = mode_for_size (GET_MODE_UNIT_SIZE (mode) * BITS_PER_UNIT,
  1457.                  (class == MODE_COMPLEX_INT
  1458.                   ? MODE_INT : MODE_FLOAT),
  1459.                  0);
  1460.  
  1461.   if (mov_optab->handlers[(int) mode].insn_code != CODE_FOR_nothing)
  1462.     return
  1463.       emit_insn (GEN_FCN (mov_optab->handlers[(int) mode].insn_code) (x, y));
  1464.  
  1465.   /* Expand complex moves by moving real part and imag part, if posible.  */
  1466.   else if ((class == MODE_COMPLEX_FLOAT || class == MODE_COMPLEX_INT)
  1467.        && submode != BLKmode
  1468.        && (mov_optab->handlers[(int) submode].insn_code
  1469.            != CODE_FOR_nothing))
  1470.     {
  1471.       /* Don't split destination if it is a stack push.  */
  1472.       int stack = push_operand (x, GET_MODE (x));
  1473.       rtx prev = get_last_insn ();
  1474.  
  1475.       /* Tell flow that the whole of the destination is being set.  */
  1476.       if (GET_CODE (x) == REG)
  1477.     emit_insn (gen_rtx (CLOBBER, VOIDmode, x));
  1478.  
  1479.       /* If this is a stack, push the highpart first, so it
  1480.      will be in the argument order.
  1481.  
  1482.      In that case, change_address is used only to convert
  1483.      the mode, not to change the address.  */
  1484.       emit_insn (GEN_FCN (mov_optab->handlers[(int) submode].insn_code)
  1485.          ((stack ? change_address (x, submode, (rtx) 0)
  1486.            : gen_highpart (submode, x)),
  1487.           gen_highpart (submode, y)));
  1488.       emit_insn (GEN_FCN (mov_optab->handlers[(int) submode].insn_code)
  1489.          ((stack ? change_address (x, submode, (rtx) 0)
  1490.            : gen_lowpart (submode, x)),
  1491.           gen_lowpart (submode, y)));
  1492.  
  1493.       group_insns (prev);
  1494.  
  1495.       return get_last_insn ();
  1496.     }
  1497.  
  1498.   /* This will handle any multi-word mode that lacks a move_insn pattern.
  1499.      However, you will get better code if you define such patterns,
  1500.      even if they must turn into multiple assembler instructions.  */
  1501.   else if (GET_MODE_SIZE (mode) > UNITS_PER_WORD)
  1502.     {
  1503.       rtx last_insn = 0;
  1504.       rtx prev_insn = get_last_insn ();
  1505.  
  1506.       for (i = 0;
  1507.        i < (GET_MODE_SIZE (mode)  + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD;
  1508.        i++)
  1509.     {
  1510.       rtx xpart = operand_subword (x, i, 1, mode);
  1511.       rtx ypart = operand_subword (y, i, 1, mode);
  1512.  
  1513.       /* If we can't get a part of Y, put Y into memory if it is a
  1514.          constant.  Otherwise, force it into a register.  If we still
  1515.          can't get a part of Y, abort.  */
  1516.       if (ypart == 0 && CONSTANT_P (y))
  1517.         {
  1518.           y = force_const_mem (mode, y);
  1519.           ypart = operand_subword (y, i, 1, mode);
  1520.         }
  1521.       else if (ypart == 0)
  1522.         ypart = operand_subword_force (y, i, mode);
  1523.  
  1524.       if (xpart == 0 || ypart == 0)
  1525.         abort ();
  1526.  
  1527.       last_insn = emit_move_insn (xpart, ypart);
  1528.     }
  1529.       /* Mark these insns as a libcall block.  */
  1530.       group_insns (prev_insn);
  1531.  
  1532.       return last_insn;
  1533.     }
  1534.   else
  1535.     abort ();
  1536. }
  1537.  
  1538. /* Pushing data onto the stack.  */
  1539.  
  1540. /* Push a block of length SIZE (perhaps variable)
  1541.    and return an rtx to address the beginning of the block.
  1542.    Note that it is not possible for the value returned to be a QUEUED.
  1543.    The value may be virtual_outgoing_args_rtx.
  1544.  
  1545.    EXTRA is the number of bytes of padding to push in addition to SIZE.
  1546.    BELOW nonzero means this padding comes at low addresses;
  1547.    otherwise, the padding comes at high addresses.  */
  1548.  
  1549. rtx
  1550. push_block (size, extra, below)
  1551.      rtx size;
  1552.      int extra, below;
  1553. {
  1554.   register rtx temp;
  1555.   if (CONSTANT_P (size))
  1556.     anti_adjust_stack (plus_constant (size, extra));
  1557.   else if (GET_CODE (size) == REG && extra == 0)
  1558.     anti_adjust_stack (size);
  1559.   else
  1560.     {
  1561.       rtx temp = copy_to_mode_reg (Pmode, size);
  1562.       if (extra != 0)
  1563.     temp = expand_binop (Pmode, add_optab, temp, GEN_INT (extra),
  1564.                  temp, 0, OPTAB_LIB_WIDEN);
  1565.       anti_adjust_stack (temp);
  1566.     }
  1567.  
  1568. #ifdef STACK_GROWS_DOWNWARD
  1569.   temp = virtual_outgoing_args_rtx;
  1570.   if (extra != 0 && below)
  1571.     temp = plus_constant (temp, extra);
  1572. #else
  1573.   if (GET_CODE (size) == CONST_INT)
  1574.     temp = plus_constant (virtual_outgoing_args_rtx,
  1575.               - INTVAL (size) - (below ? 0 : extra));
  1576.   else if (extra != 0 && !below)
  1577.     temp = gen_rtx (PLUS, Pmode, virtual_outgoing_args_rtx,
  1578.             negate_rtx (Pmode, plus_constant (size, extra)));
  1579.   else
  1580.     temp = gen_rtx (PLUS, Pmode, virtual_outgoing_args_rtx,
  1581.             negate_rtx (Pmode, size));
  1582. #endif
  1583.  
  1584.   return memory_address (GET_CLASS_NARROWEST_MODE (MODE_INT), temp);
  1585. }
  1586.  
  1587. rtx
  1588. gen_push_operand ()
  1589. {
  1590.   return gen_rtx (STACK_PUSH_CODE, Pmode, stack_pointer_rtx);
  1591. }
  1592.  
  1593. /* Generate code to push X onto the stack, assuming it has mode MODE and
  1594.    type TYPE.
  1595.    MODE is redundant except when X is a CONST_INT (since they don't
  1596.    carry mode info).
  1597.    SIZE is an rtx for the size of data to be copied (in bytes),
  1598.    needed only if X is BLKmode.
  1599.  
  1600.    ALIGN (in bytes) is maximum alignment we can assume.
  1601.  
  1602.    If PARTIAL is nonzero, then copy that many of the first words
  1603.    of X into registers starting with REG, and push the rest of X.
  1604.    The amount of space pushed is decreased by PARTIAL words,
  1605.    rounded *down* to a multiple of PARM_BOUNDARY.
  1606.    REG must be a hard register in this case.
  1607.  
  1608.    EXTRA is the amount in bytes of extra space to leave next to this arg.
  1609.    This is ignored if an argument block has already been allocated.
  1610.  
  1611.    On a machine that lacks real push insns, ARGS_ADDR is the address of
  1612.    the bottom of the argument block for this call.  We use indexing off there
  1613.    to store the arg.  On machines with push insns, ARGS_ADDR is 0 when a
  1614.    argument block has not been preallocated.
  1615.  
  1616.    ARGS_SO_FAR is the size of args previously pushed for this call.  */
  1617.  
  1618. void
  1619. emit_push_insn (x, mode, type, size, align, partial, reg, extra,
  1620.         args_addr, args_so_far)
  1621.      register rtx x;
  1622.      enum machine_mode mode;
  1623.      tree type;
  1624.      rtx size;
  1625.      int align;
  1626.      int partial;
  1627.      rtx reg;
  1628.      int extra;
  1629.      rtx args_addr;
  1630.      rtx args_so_far;
  1631. {
  1632.   rtx xinner;
  1633.   enum direction stack_direction
  1634. #ifdef STACK_GROWS_DOWNWARD
  1635.     = downward;
  1636. #else
  1637.     = upward;
  1638. #endif
  1639.  
  1640.   /* Decide where to pad the argument: `downward' for below,
  1641.      `upward' for above, or `none' for don't pad it.
  1642.      Default is below for small data on big-endian machines; else above.  */
  1643.   enum direction where_pad = FUNCTION_ARG_PADDING (mode, type);
  1644.  
  1645.   /* Invert direction if stack is post-update.  */
  1646.   if (STACK_PUSH_CODE == POST_INC || STACK_PUSH_CODE == POST_DEC)
  1647.     if (where_pad != none)
  1648.       where_pad = (where_pad == downward ? upward : downward);
  1649.  
  1650.   xinner = x = protect_from_queue (x, 0);
  1651.  
  1652.   if (mode == BLKmode)
  1653.     {
  1654.       /* Copy a block into the stack, entirely or partially.  */
  1655.  
  1656.       register rtx temp;
  1657.       int used = partial * UNITS_PER_WORD;
  1658.       int offset = used % (PARM_BOUNDARY / BITS_PER_UNIT);
  1659.       int skip;
  1660.       
  1661.       if (size == 0)
  1662.     abort ();
  1663.  
  1664.       used -= offset;
  1665.  
  1666.       /* USED is now the # of bytes we need not copy to the stack
  1667.      because registers will take care of them.  */
  1668.  
  1669.       if (partial != 0)
  1670.     xinner = change_address (xinner, BLKmode,
  1671.                  plus_constant (XEXP (xinner, 0), used));
  1672.  
  1673.       /* If the partial register-part of the arg counts in its stack size,
  1674.      skip the part of stack space corresponding to the registers.
  1675.      Otherwise, start copying to the beginning of the stack space,
  1676.      by setting SKIP to 0.  */
  1677. #ifndef REG_PARM_STACK_SPACE
  1678.       skip = 0;
  1679. #else
  1680.       skip = used;
  1681. #endif
  1682.  
  1683. #ifdef PUSH_ROUNDING
  1684.       /* Do it with several push insns if that doesn't take lots of insns
  1685.      and if there is no difficulty with push insns that skip bytes
  1686.      on the stack for alignment purposes.  */
  1687.       if (args_addr == 0
  1688.       && GET_CODE (size) == CONST_INT
  1689.       && skip == 0
  1690.       && (move_by_pieces_ninsns ((unsigned) INTVAL (size) - used, align)
  1691.           < MOVE_RATIO)
  1692.       /* Here we avoid the case of a structure whose weak alignment
  1693.          forces many pushes of a small amount of data,
  1694.          and such small pushes do rounding that causes trouble.  */
  1695.       && ((! STRICT_ALIGNMENT && ! SLOW_UNALIGNED_ACCESS)
  1696.           || align >= BIGGEST_ALIGNMENT / BITS_PER_UNIT
  1697.           || PUSH_ROUNDING (align) == align)
  1698.       && PUSH_ROUNDING (INTVAL (size)) == INTVAL (size))
  1699.     {
  1700.       /* Push padding now if padding above and stack grows down,
  1701.          or if padding below and stack grows up.
  1702.          But if space already allocated, this has already been done.  */
  1703.       if (extra && args_addr == 0
  1704.           && where_pad != none && where_pad != stack_direction)
  1705.         anti_adjust_stack (GEN_INT (extra));
  1706.  
  1707.       move_by_pieces (gen_rtx (MEM, BLKmode, gen_push_operand ()), xinner,
  1708.               INTVAL (size) - used, align);
  1709.     }
  1710.       else
  1711. #endif /* PUSH_ROUNDING */
  1712.     {
  1713.       /* Otherwise make space on the stack and copy the data
  1714.          to the address of that space.  */
  1715.  
  1716.       /* Deduct words put into registers from the size we must copy.  */
  1717.       if (partial != 0)
  1718.         {
  1719.           if (GET_CODE (size) == CONST_INT)
  1720.         size = GEN_INT (INTVAL (size) - used);
  1721.           else
  1722.         size = expand_binop (GET_MODE (size), sub_optab, size,
  1723.                      GEN_INT (used), NULL_RTX, 0,
  1724.                      OPTAB_LIB_WIDEN);
  1725.         }
  1726.  
  1727.       /* Get the address of the stack space.
  1728.          In this case, we do not deal with EXTRA separately.
  1729.          A single stack adjust will do.  */
  1730.       if (! args_addr)
  1731.         {
  1732.           temp = push_block (size, extra, where_pad == downward);
  1733.           extra = 0;
  1734.         }
  1735.       else if (GET_CODE (args_so_far) == CONST_INT)
  1736.         temp = memory_address (BLKmode,
  1737.                    plus_constant (args_addr,
  1738.                           skip + INTVAL (args_so_far)));
  1739.       else
  1740.         temp = memory_address (BLKmode,
  1741.                    plus_constant (gen_rtx (PLUS, Pmode,
  1742.                                args_addr, args_so_far),
  1743.                           skip));
  1744.  
  1745.       /* TEMP is the address of the block.  Copy the data there.  */
  1746.       if (GET_CODE (size) == CONST_INT
  1747.           && (move_by_pieces_ninsns ((unsigned) INTVAL (size), align)
  1748.           < MOVE_RATIO))
  1749.         {
  1750.           move_by_pieces (gen_rtx (MEM, BLKmode, temp), xinner,
  1751.                   INTVAL (size), align);
  1752.           goto ret;
  1753.         }
  1754.       /* Try the most limited insn first, because there's no point
  1755.          including more than one in the machine description unless
  1756.          the more limited one has some advantage.  */
  1757. #ifdef HAVE_movstrqi
  1758.       if (HAVE_movstrqi
  1759.           && GET_CODE (size) == CONST_INT
  1760.           && ((unsigned) INTVAL (size)
  1761.           < (1 << (GET_MODE_BITSIZE (QImode) - 1))))
  1762.         {
  1763.           emit_insn (gen_movstrqi (gen_rtx (MEM, BLKmode, temp),
  1764.                        xinner, size, GEN_INT (align)));
  1765.           goto ret;
  1766.         }
  1767. #endif
  1768. #ifdef HAVE_movstrhi
  1769.       if (HAVE_movstrhi
  1770.           && GET_CODE (size) == CONST_INT
  1771.           && ((unsigned) INTVAL (size)
  1772.           < (1 << (GET_MODE_BITSIZE (HImode) - 1))))
  1773.         {
  1774.           emit_insn (gen_movstrhi (gen_rtx (MEM, BLKmode, temp),
  1775.                        xinner, size, GEN_INT (align)));
  1776.           goto ret;
  1777.         }
  1778. #endif
  1779. #ifdef HAVE_movstrsi
  1780.       if (HAVE_movstrsi)
  1781.         {
  1782.           emit_insn (gen_movstrsi (gen_rtx (MEM, BLKmode, temp),
  1783.                        xinner, size, GEN_INT (align)));
  1784.           goto ret;
  1785.         }
  1786. #endif
  1787. #ifdef HAVE_movstrdi
  1788.       if (HAVE_movstrdi)
  1789.         {
  1790.           emit_insn (gen_movstrdi (gen_rtx (MEM, BLKmode, temp),
  1791.                        xinner, size, GEN_INT (align)));
  1792.           goto ret;
  1793.         }
  1794. #endif
  1795.  
  1796. #ifndef ACCUMULATE_OUTGOING_ARGS
  1797.       /* If the source is referenced relative to the stack pointer,
  1798.          copy it to another register to stabilize it.  We do not need
  1799.          to do this if we know that we won't be changing sp.  */
  1800.  
  1801.       if (reg_mentioned_p (virtual_stack_dynamic_rtx, temp)
  1802.           || reg_mentioned_p (virtual_outgoing_args_rtx, temp))
  1803.         temp = copy_to_reg (temp);
  1804. #endif
  1805.  
  1806.       /* Make inhibit_defer_pop nonzero around the library call
  1807.          to force it to pop the bcopy-arguments right away.  */
  1808.       NO_DEFER_POP;
  1809. #ifdef TARGET_MEM_FUNCTIONS
  1810.       emit_library_call (memcpy_libfunc, 0,
  1811.                  VOIDmode, 3, temp, Pmode, XEXP (xinner, 0), Pmode,
  1812.                  size, Pmode);
  1813. #else
  1814.       emit_library_call (bcopy_libfunc, 0,
  1815.                  VOIDmode, 3, XEXP (xinner, 0), Pmode, temp, Pmode,
  1816.                  size, Pmode);
  1817. #endif
  1818.       OK_DEFER_POP;
  1819.     }
  1820.     }
  1821.   else if (partial > 0)
  1822.     {
  1823.       /* Scalar partly in registers.  */
  1824.  
  1825.       int size = GET_MODE_SIZE (mode) / UNITS_PER_WORD;
  1826.       int i;
  1827.       int not_stack;
  1828.       /* # words of start of argument
  1829.      that we must make space for but need not store.  */
  1830.       int offset = partial % (PARM_BOUNDARY / BITS_PER_WORD);
  1831.       int args_offset = INTVAL (args_so_far);
  1832.       int skip;
  1833.  
  1834.       /* Push padding now if padding above and stack grows down,
  1835.      or if padding below and stack grows up.
  1836.      But if space already allocated, this has already been done.  */
  1837.       if (extra && args_addr == 0
  1838.       && where_pad != none && where_pad != stack_direction)
  1839.     anti_adjust_stack (GEN_INT (extra));
  1840.  
  1841.       /* If we make space by pushing it, we might as well push
  1842.      the real data.  Otherwise, we can leave OFFSET nonzero
  1843.      and leave the space uninitialized.  */
  1844.       if (args_addr == 0)
  1845.     offset = 0;
  1846.  
  1847.       /* Now NOT_STACK gets the number of words that we don't need to
  1848.      allocate on the stack.  */
  1849.       not_stack = partial - offset;
  1850.  
  1851.       /* If the partial register-part of the arg counts in its stack size,
  1852.      skip the part of stack space corresponding to the registers.
  1853.      Otherwise, start copying to the beginning of the stack space,
  1854.      by setting SKIP to 0.  */
  1855. #ifndef REG_PARM_STACK_SPACE
  1856.       skip = 0;
  1857. #else
  1858.       skip = not_stack;
  1859. #endif
  1860.  
  1861.       if (CONSTANT_P (x) && ! LEGITIMATE_CONSTANT_P (x))
  1862.     x = validize_mem (force_const_mem (mode, x));
  1863.  
  1864.       /* If X is a hard register in a non-integer mode, copy it into a pseudo;
  1865.      SUBREGs of such registers are not allowed.  */
  1866.       if ((GET_CODE (x) == REG && REGNO (x) < FIRST_PSEUDO_REGISTER
  1867.        && GET_MODE_CLASS (GET_MODE (x)) != MODE_INT))
  1868.     x = copy_to_reg (x);
  1869.  
  1870.       /* Loop over all the words allocated on the stack for this arg.  */
  1871.       /* We can do it by words, because any scalar bigger than a word
  1872.      has a size a multiple of a word.  */
  1873. #ifndef PUSH_ARGS_REVERSED
  1874.       for (i = not_stack; i < size; i++)
  1875. #else
  1876.       for (i = size - 1; i >= not_stack; i--)
  1877. #endif
  1878.     if (i >= not_stack + offset)
  1879.       emit_push_insn (operand_subword_force (x, i, mode),
  1880.               word_mode, NULL_TREE, NULL_RTX, align, 0, NULL_RTX,
  1881.               0, args_addr,
  1882.               GEN_INT (args_offset + ((i - not_stack + skip)
  1883.                           * UNITS_PER_WORD)));
  1884.     }
  1885.   else
  1886.     {
  1887.       rtx addr;
  1888.  
  1889.       /* Push padding now if padding above and stack grows down,
  1890.      or if padding below and stack grows up.
  1891.      But if space already allocated, this has already been done.  */
  1892.       if (extra && args_addr == 0
  1893.       && where_pad != none && where_pad != stack_direction)
  1894.     anti_adjust_stack (GEN_INT (extra));
  1895.  
  1896. #ifdef PUSH_ROUNDING
  1897.       if (args_addr == 0)
  1898.     addr = gen_push_operand ();
  1899.       else
  1900. #endif
  1901.     if (GET_CODE (args_so_far) == CONST_INT)
  1902.       addr
  1903.         = memory_address (mode,
  1904.                   plus_constant (args_addr, INTVAL (args_so_far)));
  1905.       else
  1906.     addr = memory_address (mode, gen_rtx (PLUS, Pmode, args_addr,
  1907.                           args_so_far));
  1908.  
  1909.       emit_move_insn (gen_rtx (MEM, mode, addr), x);
  1910.     }
  1911.  
  1912.  ret:
  1913.   /* If part should go in registers, copy that part
  1914.      into the appropriate registers.  Do this now, at the end,
  1915.      since mem-to-mem copies above may do function calls.  */
  1916.   if (partial > 0)
  1917.     move_block_to_reg (REGNO (reg), x, partial, mode);
  1918.  
  1919.   if (extra && args_addr == 0 && where_pad == stack_direction)
  1920.     anti_adjust_stack (GEN_INT (extra));
  1921. }
  1922.  
  1923. /* Output a library call to function FUN (a SYMBOL_REF rtx)
  1924.    (emitting the queue unless NO_QUEUE is nonzero),
  1925.    for a value of mode OUTMODE,
  1926.    with NARGS different arguments, passed as alternating rtx values
  1927.    and machine_modes to convert them to.
  1928.    The rtx values should have been passed through protect_from_queue already.
  1929.  
  1930.    NO_QUEUE will be true if and only if the library call is a `const' call
  1931.    which will be enclosed in REG_LIBCALL/REG_RETVAL notes; it is equivalent
  1932.    to the variable is_const in expand_call.
  1933.  
  1934.    NO_QUEUE must be true for const calls, because if it isn't, then
  1935.    any pending increment will be emitted between REG_LIBCALL/REG_RETVAL notes,
  1936.    and will be lost if the libcall sequence is optimized away.
  1937.  
  1938.    NO_QUEUE must be false for non-const calls, because if it isn't, the
  1939.    call insn will have its CONST_CALL_P bit set, and it will be incorrectly
  1940.    optimized.  For instance, the instruction scheduler may incorrectly
  1941.    move memory references across the non-const call.  */
  1942.  
  1943. void
  1944. emit_library_call (va_alist)
  1945.      va_dcl
  1946. {
  1947.   va_list p;
  1948.   struct args_size args_size;
  1949.   register int argnum;
  1950.   enum machine_mode outmode;
  1951.   int nargs;
  1952.   rtx fun;
  1953.   rtx orgfun;
  1954.   int inc;
  1955.   int count;
  1956.   rtx argblock = 0;
  1957.   CUMULATIVE_ARGS args_so_far;
  1958.   struct arg { rtx value; enum machine_mode mode; rtx reg; int partial;
  1959.            struct args_size offset; struct args_size size; };
  1960.   struct arg *argvec;
  1961.   int old_inhibit_defer_pop = inhibit_defer_pop;
  1962.   int no_queue = 0;
  1963.   rtx use_insns;
  1964.  
  1965.   va_start (p);
  1966.   orgfun = fun = va_arg (p, rtx);
  1967.   no_queue = va_arg (p, int);
  1968.   outmode = va_arg (p, enum machine_mode);
  1969.   nargs = va_arg (p, int);
  1970.  
  1971.   /* Copy all the libcall-arguments out of the varargs data
  1972.      and into a vector ARGVEC.
  1973.  
  1974.      Compute how to pass each argument.  We only support a very small subset
  1975.      of the full argument passing conventions to limit complexity here since
  1976.      library functions shouldn't have many args.  */
  1977.  
  1978.   argvec = (struct arg *) alloca (nargs * sizeof (struct arg));
  1979.  
  1980. /* how would you do this RIGHT ?? fake a DECL node? dunno... */
  1981. #ifdef ENCODE_SECTION_INFO
  1982.   /* mark it as a function (to be in the text section that is) */
  1983.   SYMBOL_REF_FLAG (fun) = 1;
  1984. #endif
  1985.  
  1986.   INIT_CUMULATIVE_ARGS (args_so_far, (tree)0, fun);
  1987.  
  1988.   args_size.constant = 0;
  1989.   args_size.var = 0;
  1990.  
  1991.   for (count = 0; count < nargs; count++)
  1992.     {
  1993.       rtx val = va_arg (p, rtx);
  1994.       enum machine_mode mode = va_arg (p, enum machine_mode);
  1995.  
  1996.       /* We cannot convert the arg value to the mode the library wants here;
  1997.      must do it earlier where we know the signedness of the arg.  */
  1998.       if (mode == BLKmode
  1999.       || (GET_MODE (val) != mode && GET_MODE (val) != VOIDmode))
  2000.     abort ();
  2001.  
  2002.       /* On some machines, there's no way to pass a float to a library fcn.
  2003.      Pass it as a double instead.  */
  2004. #ifdef LIBGCC_NEEDS_DOUBLE
  2005.       if (LIBGCC_NEEDS_DOUBLE && mode == SFmode)
  2006.     val = convert_to_mode (DFmode, val, 0), mode = DFmode;
  2007. #endif
  2008.  
  2009.       /* There's no need to call protect_from_queue, because
  2010.      either emit_move_insn or emit_push_insn will do that.  */
  2011.  
  2012.       /* Make sure it is a reasonable operand for a move or push insn.  */
  2013.       if (GET_CODE (val) != REG && GET_CODE (val) != MEM
  2014.       && ! (CONSTANT_P (val) && LEGITIMATE_CONSTANT_P (val)))
  2015.     val = force_operand (val, NULL_RTX);
  2016.  
  2017.       argvec[count].value = val;
  2018.       argvec[count].mode = mode;
  2019.  
  2020. #ifdef FUNCTION_ARG_PASS_BY_REFERENCE
  2021.       if (FUNCTION_ARG_PASS_BY_REFERENCE (args_so_far, mode, NULL_TREE, 1))
  2022.     abort ();
  2023. #endif
  2024.  
  2025.       argvec[count].reg = FUNCTION_ARG (args_so_far, mode, NULL_TREE, 1);
  2026.       if (argvec[count].reg && GET_CODE (argvec[count].reg) == EXPR_LIST)
  2027.     abort ();
  2028. #ifdef FUNCTION_ARG_PARTIAL_NREGS
  2029.       argvec[count].partial
  2030.     = FUNCTION_ARG_PARTIAL_NREGS (args_so_far, mode, NULL_TREE, 1);
  2031. #else
  2032.       argvec[count].partial = 0;
  2033. #endif
  2034.  
  2035.       locate_and_pad_parm (mode, NULL_TREE,
  2036.                argvec[count].reg && argvec[count].partial == 0,
  2037.                NULL_TREE, &args_size, &argvec[count].offset,
  2038.                &argvec[count].size);
  2039.  
  2040.       if (argvec[count].size.var)
  2041.     abort ();
  2042.  
  2043. #ifndef REG_PARM_STACK_SPACE
  2044.       if (argvec[count].partial)
  2045.     argvec[count].size.constant -= argvec[count].partial * UNITS_PER_WORD;
  2046. #endif
  2047.  
  2048.       if (argvec[count].reg == 0 || argvec[count].partial != 0
  2049. #ifdef REG_PARM_STACK_SPACE
  2050.       || 1
  2051. #endif
  2052.       )
  2053.     args_size.constant += argvec[count].size.constant;
  2054.  
  2055. #ifdef ACCUMULATE_OUTGOING_ARGS
  2056.       /* If this arg is actually passed on the stack, it might be
  2057.      clobbering something we already put there (this library call might
  2058.      be inside the evaluation of an argument to a function whose call
  2059.      requires the stack).  This will only occur when the library call
  2060.      has sufficient args to run out of argument registers.  Abort in
  2061.      this case; if this ever occurs, code must be added to save and
  2062.      restore the arg slot.  */
  2063.  
  2064.       if (argvec[count].reg == 0 || argvec[count].partial != 0)
  2065.     abort ();
  2066. #endif
  2067.  
  2068.       FUNCTION_ARG_ADVANCE (args_so_far, mode, (tree)0, 1);
  2069.     }
  2070.   va_end (p);
  2071.  
  2072.   /* If this machine requires an external definition for library
  2073.      functions, write one out.  */
  2074.   assemble_external_libcall (fun);
  2075.  
  2076. #ifdef STACK_BOUNDARY
  2077.   args_size.constant = (((args_size.constant + (STACK_BYTES - 1))
  2078.              / STACK_BYTES) * STACK_BYTES);
  2079. #endif
  2080.  
  2081. #ifdef REG_PARM_STACK_SPACE
  2082.   args_size.constant = MAX (args_size.constant,
  2083.                 REG_PARM_STACK_SPACE ((tree) 0));
  2084. #endif
  2085.  
  2086. #ifdef ACCUMULATE_OUTGOING_ARGS
  2087.   if (args_size.constant > current_function_outgoing_args_size)
  2088.     current_function_outgoing_args_size = args_size.constant;
  2089.   args_size.constant = 0;
  2090. #endif
  2091.  
  2092. #ifndef PUSH_ROUNDING
  2093.   argblock = push_block (GEN_INT (args_size.constant), 0, 0);
  2094. #endif
  2095.  
  2096. #ifdef PUSH_ARGS_REVERSED
  2097.   inc = -1;
  2098.   argnum = nargs - 1;
  2099. #else
  2100.   inc = 1;
  2101.   argnum = 0;
  2102. #endif
  2103.  
  2104.   /* Push the args that need to be pushed.  */
  2105.  
  2106.   for (count = 0; count < nargs; count++, argnum += inc)
  2107.     {
  2108.       register enum machine_mode mode = argvec[argnum].mode;
  2109.       register rtx val = argvec[argnum].value;
  2110.       rtx reg = argvec[argnum].reg;
  2111.       int partial = argvec[argnum].partial;
  2112.  
  2113.       if (! (reg != 0 && partial == 0))
  2114.     emit_push_insn (val, mode, NULL_TREE, NULL_RTX, 0, partial, reg, 0,
  2115.             argblock, GEN_INT (argvec[count].offset.constant));
  2116.       NO_DEFER_POP;
  2117.     }
  2118.  
  2119. #ifdef PUSH_ARGS_REVERSED
  2120.   argnum = nargs - 1;
  2121. #else
  2122.   argnum = 0;
  2123. #endif
  2124.  
  2125.   /* Now load any reg parms into their regs.  */
  2126.  
  2127.   for (count = 0; count < nargs; count++, argnum += inc)
  2128.     {
  2129.       register enum machine_mode mode = argvec[argnum].mode;
  2130.       register rtx val = argvec[argnum].value;
  2131.       rtx reg = argvec[argnum].reg;
  2132.       int partial = argvec[argnum].partial;
  2133.  
  2134.       if (reg != 0 && partial == 0)
  2135.     emit_move_insn (reg, val);
  2136.       NO_DEFER_POP;
  2137.     }
  2138.  
  2139.   /* For version 1.37, try deleting this entirely.  */
  2140.   if (! no_queue)
  2141.     emit_queue ();
  2142.  
  2143.   /* Any regs containing parms remain in use through the call.  */
  2144.   start_sequence ();
  2145.   for (count = 0; count < nargs; count++)
  2146.     if (argvec[count].reg != 0)
  2147.       emit_insn (gen_rtx (USE, VOIDmode, argvec[count].reg));
  2148.  
  2149.   use_insns = get_insns ();
  2150.   end_sequence ();
  2151.  
  2152.   fun = prepare_call_address (fun, NULL_TREE, &use_insns);
  2153.  
  2154.   /* Don't allow popping to be deferred, since then
  2155.      cse'ing of library calls could delete a call and leave the pop.  */
  2156.   NO_DEFER_POP;
  2157.  
  2158.   /* We pass the old value of inhibit_defer_pop + 1 to emit_call_1, which
  2159.      will set inhibit_defer_pop to that value.  */
  2160.  
  2161.   emit_call_1 (fun, get_identifier (XSTR (orgfun, 0)), args_size.constant, 0,
  2162.            FUNCTION_ARG (args_so_far, VOIDmode, void_type_node, 1),
  2163.            outmode != VOIDmode ? hard_libcall_value (outmode) : NULL_RTX,
  2164.            old_inhibit_defer_pop + 1, use_insns, no_queue);
  2165.  
  2166.   /* Now restore inhibit_defer_pop to its actual original value.  */
  2167.   OK_DEFER_POP;
  2168. }
  2169.  
  2170. /* Expand an assignment that stores the value of FROM into TO.
  2171.    If WANT_VALUE is nonzero, return an rtx for the value of TO.
  2172.    (This may contain a QUEUED rtx.)
  2173.    Otherwise, the returned value is not meaningful.
  2174.  
  2175.    SUGGEST_REG is no longer actually used.
  2176.    It used to mean, copy the value through a register
  2177.    and return that register, if that is possible.
  2178.    But now we do this if WANT_VALUE.
  2179.  
  2180.    If the value stored is a constant, we return the constant.  */
  2181.  
  2182. rtx
  2183. expand_assignment (to, from, want_value, suggest_reg)
  2184.      tree to, from;
  2185.      int want_value;
  2186.      int suggest_reg;
  2187. {
  2188.   register rtx to_rtx = 0;
  2189.   rtx result;
  2190.  
  2191.   /* Don't crash if the lhs of the assignment was erroneous.  */
  2192.  
  2193.   if (TREE_CODE (to) == ERROR_MARK)
  2194.     return expand_expr (from, NULL_RTX, VOIDmode, 0);
  2195.  
  2196.   /* Assignment of a structure component needs special treatment
  2197.      if the structure component's rtx is not simply a MEM.
  2198.      Assignment of an array element at a constant index
  2199.      has the same problem.  */
  2200.  
  2201.   if (TREE_CODE (to) == COMPONENT_REF
  2202.       || TREE_CODE (to) == BIT_FIELD_REF
  2203.       || (TREE_CODE (to) == ARRAY_REF
  2204.       && TREE_CODE (TREE_OPERAND (to, 1)) == INTEGER_CST
  2205.       && TREE_CODE (TYPE_SIZE (TREE_TYPE (to))) == INTEGER_CST))
  2206.     {
  2207.       enum machine_mode mode1;
  2208.       int bitsize;
  2209.       int bitpos;
  2210.       tree offset;
  2211.       int unsignedp;
  2212.       int volatilep = 0;
  2213.       tree tem = get_inner_reference (to, &bitsize, &bitpos, &offset,
  2214.                       &mode1, &unsignedp, &volatilep);
  2215.  
  2216.       /* If we are going to use store_bit_field and extract_bit_field,
  2217.      make sure to_rtx will be safe for multiple use.  */
  2218.  
  2219.       if (mode1 == VOIDmode && want_value)
  2220.     tem = stabilize_reference (tem);
  2221.  
  2222.       to_rtx = expand_expr (tem, NULL_RTX, VOIDmode, 0);
  2223.       if (offset != 0)
  2224.     {
  2225.       rtx offset_rtx = expand_expr (offset, NULL_RTX, VOIDmode, 0);
  2226.  
  2227.       if (GET_CODE (to_rtx) != MEM)
  2228.         abort ();
  2229.       to_rtx = change_address (to_rtx, VOIDmode,
  2230.                    gen_rtx (PLUS, Pmode, XEXP (to_rtx, 0),
  2231.                         force_reg (Pmode, offset_rtx)));
  2232.     }
  2233.       if (volatilep)
  2234.     {
  2235.       if (GET_CODE (to_rtx) == MEM)
  2236.         MEM_VOLATILE_P (to_rtx) = 1;
  2237. #if 0  /* This was turned off because, when a field is volatile
  2238.       in an object which is not volatile, the object may be in a register,
  2239.       and then we would abort over here.  */
  2240.       else
  2241.         abort ();
  2242. #endif
  2243.     }
  2244.  
  2245.       result = store_field (to_rtx, bitsize, bitpos, mode1, from,
  2246.                 (want_value
  2247.                  /* Spurious cast makes HPUX compiler happy.  */
  2248.                  ? (enum machine_mode) TYPE_MODE (TREE_TYPE (to))
  2249.                  : VOIDmode),
  2250.                 unsignedp,
  2251.                 /* Required alignment of containing datum.  */
  2252.                 TYPE_ALIGN (TREE_TYPE (tem)) / BITS_PER_UNIT,
  2253.                 int_size_in_bytes (TREE_TYPE (tem)));
  2254.       preserve_temp_slots (result);
  2255.       free_temp_slots ();
  2256.  
  2257.       return result;
  2258.     }
  2259.  
  2260.   /* Ordinary treatment.  Expand TO to get a REG or MEM rtx.
  2261.      Don't re-expand if it was expanded already (in COMPONENT_REF case).  */
  2262.  
  2263.   if (to_rtx == 0)
  2264.     to_rtx = expand_expr (to, NULL_RTX, VOIDmode, 0);
  2265.  
  2266.   /* In case we are returning the contents of an object which overlaps
  2267.      the place the value is being stored, use a safe function when copying
  2268.      a value through a pointer into a structure value return block.  */
  2269.   if (TREE_CODE (to) == RESULT_DECL && TREE_CODE (from) == INDIRECT_REF
  2270.       && current_function_returns_struct
  2271.       && !current_function_returns_pcc_struct)
  2272.     {
  2273.       rtx from_rtx = expand_expr (from, NULL_RTX, VOIDmode, 0);
  2274.       rtx size = expr_size (from);
  2275.  
  2276. #ifdef TARGET_MEM_FUNCTIONS
  2277.       emit_library_call (memcpy_libfunc, 0,
  2278.              VOIDmode, 3, XEXP (to_rtx, 0), Pmode,
  2279.              XEXP (from_rtx, 0), Pmode,
  2280.              size, Pmode);
  2281. #else
  2282.       emit_library_call (bcopy_libfunc, 0,
  2283.              VOIDmode, 3, XEXP (from_rtx, 0), Pmode,
  2284.              XEXP (to_rtx, 0), Pmode,
  2285.              size, Pmode);
  2286. #endif
  2287.  
  2288.       preserve_temp_slots (to_rtx);
  2289.       free_temp_slots ();
  2290.       return to_rtx;
  2291.     }
  2292.  
  2293.   /* Compute FROM and store the value in the rtx we got.  */
  2294.  
  2295.   result = store_expr (from, to_rtx, want_value);
  2296.   preserve_temp_slots (result);
  2297.   free_temp_slots ();
  2298.   return result;
  2299. }
  2300.  
  2301. /* Generate code for computing expression EXP,
  2302.    and storing the value into TARGET.
  2303.    Returns TARGET or an equivalent value.
  2304.    TARGET may contain a QUEUED rtx.
  2305.  
  2306.    If SUGGEST_REG is nonzero, copy the value through a register
  2307.    and return that register, if that is possible.
  2308.  
  2309.    If the value stored is a constant, we return the constant.  */
  2310.  
  2311. rtx
  2312. store_expr (exp, target, suggest_reg)
  2313.      register tree exp;
  2314.      register rtx target;
  2315.      int suggest_reg;
  2316. {
  2317.   register rtx temp;
  2318.   int dont_return_target = 0;
  2319.  
  2320.   if (TREE_CODE (exp) == COMPOUND_EXPR)
  2321.     {
  2322.       /* Perform first part of compound expression, then assign from second
  2323.      part.  */
  2324.       expand_expr (TREE_OPERAND (exp, 0), const0_rtx, VOIDmode, 0);
  2325.       emit_queue ();
  2326.       return store_expr (TREE_OPERAND (exp, 1), target, suggest_reg);
  2327.     }
  2328.   else if (TREE_CODE (exp) == COND_EXPR && GET_MODE (target) == BLKmode)
  2329.     {
  2330.       /* For conditional expression, get safe form of the target.  Then
  2331.      test the condition, doing the appropriate assignment on either
  2332.      side.  This avoids the creation of unnecessary temporaries.
  2333.      For non-BLKmode, it is more efficient not to do this.  */
  2334.  
  2335.       rtx lab1 = gen_label_rtx (), lab2 = gen_label_rtx ();
  2336.  
  2337.       emit_queue ();
  2338.       target = protect_from_queue (target, 1);
  2339.  
  2340.       NO_DEFER_POP;
  2341.       jumpifnot (TREE_OPERAND (exp, 0), lab1);
  2342.       store_expr (TREE_OPERAND (exp, 1), target, suggest_reg);
  2343.       emit_queue ();
  2344.       emit_jump_insn (gen_jump (lab2));
  2345.       emit_barrier ();
  2346.       emit_label (lab1);
  2347.       store_expr (TREE_OPERAND (exp, 2), target, suggest_reg);
  2348.       emit_queue ();
  2349.       emit_label (lab2);
  2350.       OK_DEFER_POP;
  2351.       return target;
  2352.     }
  2353.   else if (suggest_reg && GET_CODE (target) == MEM
  2354.        && GET_MODE (target) != BLKmode)
  2355.     /* If target is in memory and caller wants value in a register instead,
  2356.        arrange that.  Pass TARGET as target for expand_expr so that,
  2357.        if EXP is another assignment, SUGGEST_REG will be nonzero for it.
  2358.        We know expand_expr will not use the target in that case.  */
  2359.     {
  2360.       temp = expand_expr (exp, cse_not_expected ? NULL_RTX : target,
  2361.               GET_MODE (target), 0);
  2362.       if (GET_MODE (temp) != BLKmode && GET_MODE (temp) != VOIDmode)
  2363.     temp = copy_to_reg (temp);
  2364.       dont_return_target = 1;
  2365.     }
  2366.   else if (queued_subexp_p (target))
  2367.     /* If target contains a postincrement, it is not safe
  2368.        to use as the returned value.  It would access the wrong
  2369.        place by the time the queued increment gets output.
  2370.        So copy the value through a temporary and use that temp
  2371.        as the result.  */
  2372.     {
  2373.       if (GET_MODE (target) != BLKmode && GET_MODE (target) != VOIDmode)
  2374.     {
  2375.       /* Expand EXP into a new pseudo.  */
  2376.       temp = gen_reg_rtx (GET_MODE (target));
  2377.       temp = expand_expr (exp, temp, GET_MODE (target), 0);
  2378.     }
  2379.       else
  2380.     temp = expand_expr (exp, NULL_RTX, GET_MODE (target), 0);
  2381.       dont_return_target = 1;
  2382.     }
  2383.   else if (GET_CODE (target) == SUBREG && SUBREG_PROMOTED_VAR_P (target))
  2384.     /* If this is an scalar in a register that is stored in a wider mode
  2385.        than the declared mode, compute the result into its declared mode
  2386.        and then convert to the wider mode.  Our value is the computed
  2387.        expression.  */
  2388.     {
  2389.       temp = expand_expr (exp, NULL_RTX, VOIDmode, 0);
  2390.       convert_move (SUBREG_REG (target), temp,
  2391.             SUBREG_PROMOTED_UNSIGNED_P (target));
  2392.       return temp;
  2393.     }
  2394.   else
  2395.     {
  2396.       temp = expand_expr (exp, target, GET_MODE (target), 0);
  2397.       /* DO return TARGET if it's a specified hardware register.
  2398.      expand_return relies on this.  */
  2399.       if (!(target && GET_CODE (target) == REG
  2400.         && REGNO (target) < FIRST_PSEUDO_REGISTER)
  2401.       && CONSTANT_P (temp))
  2402.     dont_return_target = 1;
  2403.     }
  2404.  
  2405.   /* If value was not generated in the target, store it there.
  2406.      Convert the value to TARGET's type first if nec.  */
  2407.  
  2408.   if (temp != target && TREE_CODE (exp) != ERROR_MARK)
  2409.     {
  2410.       target = protect_from_queue (target, 1);
  2411.       if (GET_MODE (temp) != GET_MODE (target)
  2412.       && GET_MODE (temp) != VOIDmode)
  2413.     {
  2414.       int unsignedp = TREE_UNSIGNED (TREE_TYPE (exp));
  2415.       if (dont_return_target)
  2416.         {
  2417.           /* In this case, we will return TEMP,
  2418.          so make sure it has the proper mode.
  2419.          But don't forget to store the value into TARGET.  */
  2420.           temp = convert_to_mode (GET_MODE (target), temp, unsignedp);
  2421.           emit_move_insn (target, temp);
  2422.         }
  2423.       else
  2424.         convert_move (target, temp, unsignedp);
  2425.     }
  2426.  
  2427.       else if (GET_MODE (temp) == BLKmode && TREE_CODE (exp) == STRING_CST)
  2428.     {
  2429.       /* Handle copying a string constant into an array.
  2430.          The string constant may be shorter than the array.
  2431.          So copy just the string's actual length, and clear the rest.  */
  2432.       rtx size;
  2433.  
  2434.       /* Get the size of the data type of the string,
  2435.          which is actually the size of the target.  */
  2436.       size = expr_size (exp);
  2437.       if (GET_CODE (size) == CONST_INT
  2438.           && INTVAL (size) < TREE_STRING_LENGTH (exp))
  2439.         emit_block_move (target, temp, size,
  2440.                  TYPE_ALIGN (TREE_TYPE (exp)) / BITS_PER_UNIT);
  2441.       else
  2442.         {
  2443.           /* Compute the size of the data to copy from the string.  */
  2444.           tree copy_size
  2445.         = fold (build (MIN_EXPR, sizetype,
  2446.                    size_binop (CEIL_DIV_EXPR,
  2447.                        TYPE_SIZE (TREE_TYPE (exp)),
  2448.                        size_int (BITS_PER_UNIT)),
  2449.                    convert (sizetype,
  2450.                     build_int_2 (TREE_STRING_LENGTH (exp), 0))));
  2451.           rtx copy_size_rtx = expand_expr (copy_size, NULL_RTX,
  2452.                            VOIDmode, 0);
  2453.           rtx label = 0;
  2454.  
  2455.           /* Copy that much.  */
  2456.           emit_block_move (target, temp, copy_size_rtx,
  2457.                    TYPE_ALIGN (TREE_TYPE (exp)) / BITS_PER_UNIT);
  2458.  
  2459.           /* Figure out how much is left in TARGET
  2460.          that we have to clear.  */
  2461.           if (GET_CODE (copy_size_rtx) == CONST_INT)
  2462.         {
  2463.           temp = plus_constant (XEXP (target, 0),
  2464.                     TREE_STRING_LENGTH (exp));
  2465.           size = plus_constant (size,
  2466.                     - TREE_STRING_LENGTH (exp));
  2467.         }
  2468.           else
  2469.         {
  2470.           enum machine_mode size_mode = Pmode;
  2471.  
  2472.           temp = force_reg (Pmode, XEXP (target, 0));
  2473.           temp = expand_binop (size_mode, add_optab, temp,
  2474.                        copy_size_rtx, NULL_RTX, 0,
  2475.                        OPTAB_LIB_WIDEN);
  2476.  
  2477.           size = expand_binop (size_mode, sub_optab, size,
  2478.                        copy_size_rtx, NULL_RTX, 0,
  2479.                        OPTAB_LIB_WIDEN);
  2480.  
  2481.           emit_cmp_insn (size, const0_rtx, LT, NULL_RTX,
  2482.                  GET_MODE (size), 0, 0);
  2483.           label = gen_label_rtx ();
  2484.           emit_jump_insn (gen_blt (label));
  2485.         }
  2486.  
  2487.           if (size != const0_rtx)
  2488.         {
  2489. #ifdef TARGET_MEM_FUNCTIONS
  2490.           emit_library_call (memset_libfunc, 0, VOIDmode, 3,
  2491.                      temp, Pmode, const0_rtx, Pmode, size, Pmode);
  2492. #else
  2493.           emit_library_call (bzero_libfunc, 0, VOIDmode, 2,
  2494.                      temp, Pmode, size, Pmode);
  2495. #endif
  2496.         }
  2497.           if (label)
  2498.         emit_label (label);
  2499.         }
  2500.     }
  2501.       else if (GET_MODE (temp) == BLKmode)
  2502.     emit_block_move (target, temp, expr_size (exp),
  2503.              TYPE_ALIGN (TREE_TYPE (exp)) / BITS_PER_UNIT);
  2504.       else
  2505.     emit_move_insn (target, temp);
  2506.     }
  2507.   if (dont_return_target)
  2508.     return temp;
  2509.   return target;
  2510. }
  2511.  
  2512. /* Store the value of constructor EXP into the rtx TARGET.
  2513.    TARGET is either a REG or a MEM.  */
  2514.  
  2515. static void
  2516. store_constructor (exp, target)
  2517.      tree exp;
  2518.      rtx target;
  2519. {
  2520.   tree type = TREE_TYPE (exp);
  2521.  
  2522.   /* We know our target cannot conflict, since safe_from_p has been called.  */
  2523. #if 0
  2524.   /* Don't try copying piece by piece into a hard register
  2525.      since that is vulnerable to being clobbered by EXP.
  2526.      Instead, construct in a pseudo register and then copy it all.  */
  2527.   if (GET_CODE (target) == REG && REGNO (target) < FIRST_PSEUDO_REGISTER)
  2528.     {
  2529.       rtx temp = gen_reg_rtx (GET_MODE (target));
  2530.       store_constructor (exp, temp);
  2531.       emit_move_insn (target, temp);
  2532.       return;
  2533.     }
  2534. #endif
  2535.  
  2536.   if (TREE_CODE (type) == RECORD_TYPE || TREE_CODE (type) == UNION_TYPE)
  2537.     {
  2538.       register tree elt;
  2539.  
  2540.       /* Inform later passes that the whole union value is dead.  */
  2541.       if (TREE_CODE (type) == UNION_TYPE)
  2542.     emit_insn (gen_rtx (CLOBBER, VOIDmode, target));
  2543.  
  2544.       /* If we are building a static constructor into a register,
  2545.      set the initial value as zero so we can fold the value into
  2546.      a constant.  */
  2547.       else if (GET_CODE (target) == REG && TREE_STATIC (exp))
  2548.     emit_move_insn (target, const0_rtx);
  2549.  
  2550.       /* If the constructor has fewer fields than the structure,
  2551.      clear the whole structure first.  */
  2552.       else if (list_length (CONSTRUCTOR_ELTS (exp))
  2553.            != list_length (TYPE_FIELDS (type)))
  2554.     clear_storage (target, int_size_in_bytes (type));
  2555.       else
  2556.     /* Inform later passes that the old value is dead.  */
  2557.     emit_insn (gen_rtx (CLOBBER, VOIDmode, target));
  2558.  
  2559.       /* Store each element of the constructor into
  2560.      the corresponding field of TARGET.  */
  2561.  
  2562.       for (elt = CONSTRUCTOR_ELTS (exp); elt; elt = TREE_CHAIN (elt))
  2563.     {
  2564.       register tree field = TREE_PURPOSE (elt);
  2565.       register enum machine_mode mode;
  2566.       int bitsize;
  2567.       int bitpos;
  2568.       int unsignedp;
  2569.  
  2570.       /* Just ignore missing fields.
  2571.          We cleared the whole structure, above,
  2572.          if any fields are missing.  */
  2573.       if (field == 0)
  2574.         continue;
  2575.  
  2576.       bitsize = TREE_INT_CST_LOW (DECL_SIZE (field));
  2577.       unsignedp = TREE_UNSIGNED (field);
  2578.       mode = DECL_MODE (field);
  2579.       if (DECL_BIT_FIELD (field))
  2580.         mode = VOIDmode;
  2581.  
  2582.       if (TREE_CODE (DECL_FIELD_BITPOS (field)) != INTEGER_CST)
  2583.         /* ??? This case remains to be written.  */
  2584.         abort ();
  2585.  
  2586.       bitpos = TREE_INT_CST_LOW (DECL_FIELD_BITPOS (field));
  2587.  
  2588.       store_field (target, bitsize, bitpos, mode, TREE_VALUE (elt),
  2589.                /* The alignment of TARGET is
  2590.               at least what its type requires.  */
  2591.                VOIDmode, 0,
  2592.                TYPE_ALIGN (type) / BITS_PER_UNIT,
  2593.                int_size_in_bytes (type));
  2594.     }
  2595.     }
  2596.   else if (TREE_CODE (type) == ARRAY_TYPE)
  2597.     {
  2598.       register tree elt;
  2599.       register int i;
  2600.       tree domain = TYPE_DOMAIN (type);
  2601.       HOST_WIDE_INT minelt = TREE_INT_CST_LOW (TYPE_MIN_VALUE (domain));
  2602.       HOST_WIDE_INT maxelt = TREE_INT_CST_LOW (TYPE_MAX_VALUE (domain));
  2603.       tree elttype = TREE_TYPE (type);
  2604.  
  2605.       /* If the constructor has fewer fields than the structure,
  2606.      clear the whole structure first.  Similarly if this this is
  2607.      static constructor of a non-BLKmode object.  */
  2608.  
  2609.       if (list_length (CONSTRUCTOR_ELTS (exp)) < maxelt - minelt + 1
  2610.       || (GET_CODE (target) == REG && TREE_STATIC (exp)))
  2611.     clear_storage (target, maxelt - minelt + 1);
  2612.       else
  2613.     /* Inform later passes that the old value is dead.  */
  2614.     emit_insn (gen_rtx (CLOBBER, VOIDmode, target));
  2615.  
  2616.       /* Store each element of the constructor into
  2617.      the corresponding element of TARGET, determined
  2618.      by counting the elements.  */
  2619.       for (elt = CONSTRUCTOR_ELTS (exp), i = 0;
  2620.        elt;
  2621.        elt = TREE_CHAIN (elt), i++)
  2622.     {
  2623.       register enum machine_mode mode;
  2624.       int bitsize;
  2625.       int bitpos;
  2626.       int unsignedp;
  2627.  
  2628.       mode = TYPE_MODE (elttype);
  2629.       bitsize = GET_MODE_BITSIZE (mode);
  2630.       unsignedp = TREE_UNSIGNED (elttype);
  2631.  
  2632.       bitpos = (i * TREE_INT_CST_LOW (TYPE_SIZE (elttype)));
  2633.  
  2634.       store_field (target, bitsize, bitpos, mode, TREE_VALUE (elt),
  2635.                /* The alignment of TARGET is
  2636.               at least what its type requires.  */
  2637.                VOIDmode, 0,
  2638.                TYPE_ALIGN (type) / BITS_PER_UNIT,
  2639.                int_size_in_bytes (type));
  2640.     }
  2641.     }
  2642.  
  2643.   else
  2644.     abort ();
  2645. }
  2646.  
  2647. /* Store the value of EXP (an expression tree)
  2648.    into a subfield of TARGET which has mode MODE and occupies
  2649.    BITSIZE bits, starting BITPOS bits from the start of TARGET.
  2650.    If MODE is VOIDmode, it means that we are storing into a bit-field.
  2651.  
  2652.    If VALUE_MODE is VOIDmode, return nothing in particular.
  2653.    UNSIGNEDP is not used in this case.
  2654.  
  2655.    Otherwise, return an rtx for the value stored.  This rtx
  2656.    has mode VALUE_MODE if that is convenient to do.
  2657.    In this case, UNSIGNEDP must be nonzero if the value is an unsigned type.
  2658.  
  2659.    ALIGN is the alignment that TARGET is known to have, measured in bytes.
  2660.    TOTAL_SIZE is the size in bytes of the structure, or -1 if varying.  */
  2661.  
  2662. static rtx
  2663. store_field (target, bitsize, bitpos, mode, exp, value_mode,
  2664.          unsignedp, align, total_size)
  2665.      rtx target;
  2666.      int bitsize, bitpos;
  2667.      enum machine_mode mode;
  2668.      tree exp;
  2669.      enum machine_mode value_mode;
  2670.      int unsignedp;
  2671.      int align;
  2672.      int total_size;
  2673. {
  2674.   HOST_WIDE_INT width_mask = 0;
  2675.  
  2676.   if (bitsize < HOST_BITS_PER_WIDE_INT)
  2677.     width_mask = ((HOST_WIDE_INT) 1 << bitsize) - 1;
  2678.  
  2679.   /* If we are storing into an unaligned field of an aligned union that is
  2680.      in a register, we may have the mode of TARGET being an integer mode but
  2681.      MODE == BLKmode.  In that case, get an aligned object whose size and
  2682.      alignment are the same as TARGET and store TARGET into it (we can avoid
  2683.      the store if the field being stored is the entire width of TARGET).  Then
  2684.      call ourselves recursively to store the field into a BLKmode version of
  2685.      that object.  Finally, load from the object into TARGET.  This is not
  2686.      very efficient in general, but should only be slightly more expensive
  2687.      than the otherwise-required unaligned accesses.  Perhaps this can be
  2688.      cleaned up later.  */
  2689.  
  2690.   if (mode == BLKmode
  2691.       && (GET_CODE (target) == REG || GET_CODE (target) == SUBREG))
  2692.     {
  2693.       rtx object = assign_stack_temp (GET_MODE (target),
  2694.                       GET_MODE_SIZE (GET_MODE (target)), 0);
  2695.       rtx blk_object = copy_rtx (object);
  2696.  
  2697.       PUT_MODE (blk_object, BLKmode);
  2698.  
  2699.       if (bitsize != GET_MODE_BITSIZE (GET_MODE (target)))
  2700.     emit_move_insn (object, target);
  2701.  
  2702.       store_field (blk_object, bitsize, bitpos, mode, exp, VOIDmode, 0,
  2703.            align, total_size);
  2704.  
  2705.       emit_move_insn (target, object);
  2706.  
  2707.       return target;
  2708.     }
  2709.  
  2710.   /* If the structure is in a register or if the component
  2711.      is a bit field, we cannot use addressing to access it.
  2712.      Use bit-field techniques or SUBREG to store in it.  */
  2713.  
  2714.   if (mode == VOIDmode
  2715.       || (mode != BLKmode && ! direct_store[(int) mode])
  2716.       || GET_CODE (target) == REG
  2717.       || GET_CODE (target) == SUBREG)
  2718.     {
  2719.       rtx temp = expand_expr (exp, NULL_RTX, VOIDmode, 0);
  2720.       /* Store the value in the bitfield.  */
  2721.       store_bit_field (target, bitsize, bitpos, mode, temp, align, total_size);
  2722.       if (value_mode != VOIDmode)
  2723.     {
  2724.       /* The caller wants an rtx for the value.  */
  2725.       /* If possible, avoid refetching from the bitfield itself.  */
  2726.       if (width_mask != 0
  2727.           && ! (GET_CODE (target) == MEM && MEM_VOLATILE_P (target)))
  2728.         {
  2729.           tree count;
  2730.           enum machine_mode tmode;
  2731.  
  2732.           if (unsignedp)
  2733.         return expand_and (temp, GEN_INT (width_mask), NULL_RTX);
  2734.           tmode = GET_MODE (temp);
  2735.           if (tmode == VOIDmode)
  2736.         tmode = value_mode;
  2737.           count = build_int_2 (GET_MODE_BITSIZE (tmode) - bitsize, 0);
  2738.           temp = expand_shift (LSHIFT_EXPR, tmode, temp, count, 0, 0);
  2739.           return expand_shift (RSHIFT_EXPR, tmode, temp, count, 0, 0);
  2740.         }
  2741.       return extract_bit_field (target, bitsize, bitpos, unsignedp,
  2742.                     NULL_RTX, value_mode, 0, align,
  2743.                     total_size);
  2744.     }
  2745.       return const0_rtx;
  2746.     }
  2747.   else
  2748.     {
  2749.       rtx addr = XEXP (target, 0);
  2750.       rtx to_rtx;
  2751.  
  2752.       /* If a value is wanted, it must be the lhs;
  2753.      so make the address stable for multiple use.  */
  2754.  
  2755.       if (value_mode != VOIDmode && GET_CODE (addr) != REG
  2756.       && ! CONSTANT_ADDRESS_P (addr)
  2757.       /* A frame-pointer reference is already stable.  */
  2758.       && ! (GET_CODE (addr) == PLUS
  2759.         && GET_CODE (XEXP (addr, 1)) == CONST_INT
  2760.         && (XEXP (addr, 0) == virtual_incoming_args_rtx
  2761.             || XEXP (addr, 0) == virtual_stack_vars_rtx)))
  2762.     addr = copy_to_reg (addr);
  2763.  
  2764.       /* Now build a reference to just the desired component.  */
  2765.  
  2766.       to_rtx = change_address (target, mode,
  2767.                    plus_constant (addr, (bitpos / BITS_PER_UNIT)));
  2768.       MEM_IN_STRUCT_P (to_rtx) = 1;
  2769.  
  2770.       return store_expr (exp, to_rtx, value_mode != VOIDmode);
  2771.     }
  2772. }
  2773.  
  2774. /* Given an expression EXP that may be a COMPONENT_REF, a BIT_FIELD_REF,
  2775.    or an ARRAY_REF, look for nested COMPONENT_REFs, BIT_FIELD_REFs, or
  2776.    ARRAY_REFs at constant positions and find the ultimate containing object,
  2777.    which we return.
  2778.  
  2779.    We set *PBITSIZE to the size in bits that we want, *PBITPOS to the
  2780.    bit position, and *PUNSIGNEDP to the signedness of the field.
  2781.    If the position of the field is variable, we store a tree
  2782.    giving the variable offset (in units) in *POFFSET.
  2783.    This offset is in addition to the bit position.
  2784.    If the position is not variable, we store 0 in *POFFSET.
  2785.  
  2786.    If any of the extraction expressions is volatile,
  2787.    we store 1 in *PVOLATILEP.  Otherwise we don't change that.
  2788.  
  2789.    If the field is a bit-field, *PMODE is set to VOIDmode.  Otherwise, it
  2790.    is a mode that can be used to access the field.  In that case, *PBITSIZE
  2791.    is redundant.
  2792.  
  2793.    If the field describes a variable-sized object, *PMODE is set to
  2794.    VOIDmode and *PBITSIZE is set to -1.  An access cannot be made in
  2795.    this case, but the address of the object can be found.  */
  2796.  
  2797. tree
  2798. get_inner_reference (exp, pbitsize, pbitpos, poffset, pmode, punsignedp, pvolatilep)
  2799.      tree exp;
  2800.      int *pbitsize;
  2801.      int *pbitpos;
  2802.      tree *poffset;
  2803.      enum machine_mode *pmode;
  2804.      int *punsignedp;
  2805.      int *pvolatilep;
  2806. {
  2807.   tree size_tree = 0;
  2808.   enum machine_mode mode = VOIDmode;
  2809.   tree offset = 0;
  2810.  
  2811.   if (TREE_CODE (exp) == COMPONENT_REF)
  2812.     {
  2813.       size_tree = DECL_SIZE (TREE_OPERAND (exp, 1));
  2814.       if (! DECL_BIT_FIELD (TREE_OPERAND (exp, 1)))
  2815.     mode = DECL_MODE (TREE_OPERAND (exp, 1));
  2816.       *punsignedp = TREE_UNSIGNED (TREE_OPERAND (exp, 1));
  2817.     }
  2818.   else if (TREE_CODE (exp) == BIT_FIELD_REF)
  2819.     {
  2820.       size_tree = TREE_OPERAND (exp, 1);
  2821.       *punsignedp = TREE_UNSIGNED (exp);
  2822.     }
  2823.   else
  2824.     {
  2825.       mode = TYPE_MODE (TREE_TYPE (exp));
  2826.       *pbitsize = GET_MODE_BITSIZE (mode);
  2827.       *punsignedp = TREE_UNSIGNED (TREE_TYPE (exp));
  2828.     }
  2829.       
  2830.   if (size_tree)
  2831.     {
  2832.       if (TREE_CODE (size_tree) != INTEGER_CST)
  2833.     mode = BLKmode, *pbitsize = -1;
  2834.       else
  2835.     *pbitsize = TREE_INT_CST_LOW (size_tree);
  2836.     }
  2837.  
  2838.   /* Compute cumulative bit-offset for nested component-refs and array-refs,
  2839.      and find the ultimate containing object.  */
  2840.  
  2841.   *pbitpos = 0;
  2842.  
  2843.   while (1)
  2844.     {
  2845.       if (TREE_CODE (exp) == INDIRECT_REF && flag_volatile)
  2846.      *pvolatilep = 1;
  2847.  
  2848.       if (TREE_CODE (exp) == COMPONENT_REF || TREE_CODE (exp) == BIT_FIELD_REF)
  2849.     {
  2850.       tree pos = (TREE_CODE (exp) == COMPONENT_REF
  2851.               ? DECL_FIELD_BITPOS (TREE_OPERAND (exp, 1))
  2852.               : TREE_OPERAND (exp, 2));
  2853.  
  2854.       if (TREE_CODE (pos) == PLUS_EXPR)
  2855.         {
  2856.           tree constant, var;
  2857.           if (TREE_CODE (TREE_OPERAND (pos, 0)) == INTEGER_CST)
  2858.         {
  2859.           constant = TREE_OPERAND (pos, 0);
  2860.           var = TREE_OPERAND (pos, 1);
  2861.         }
  2862.           else if (TREE_CODE (TREE_OPERAND (pos, 1)) == INTEGER_CST)
  2863.         {
  2864.           constant = TREE_OPERAND (pos, 1);
  2865.           var = TREE_OPERAND (pos, 0);
  2866.         }
  2867.           else
  2868.         abort ();
  2869.           *pbitpos += TREE_INT_CST_LOW (constant);
  2870.           if (offset)
  2871.         offset = size_binop (PLUS_EXPR, offset,
  2872.                      size_binop (FLOOR_DIV_EXPR, var,
  2873.                          size_int (BITS_PER_UNIT)));
  2874.           else
  2875.         offset = size_binop (FLOOR_DIV_EXPR, var,
  2876.                      size_int (BITS_PER_UNIT));
  2877.         }
  2878.       else if (TREE_CODE (pos) == INTEGER_CST)
  2879.         *pbitpos += TREE_INT_CST_LOW (pos);
  2880.       else
  2881.         {
  2882.           /* Assume here that the offset is a multiple of a unit.
  2883.          If not, there should be an explicitly added constant.  */
  2884.           if (offset)
  2885.         offset = size_binop (PLUS_EXPR, offset,
  2886.                      size_binop (FLOOR_DIV_EXPR, pos,
  2887.                          size_int (BITS_PER_UNIT)));
  2888.           else
  2889.         offset = size_binop (FLOOR_DIV_EXPR, pos,
  2890.                      size_int (BITS_PER_UNIT));
  2891.         }
  2892.     }
  2893.  
  2894.       else if (TREE_CODE (exp) == ARRAY_REF
  2895.            && TREE_CODE (TREE_OPERAND (exp, 1)) == INTEGER_CST
  2896.            && TREE_CODE (TYPE_SIZE (TREE_TYPE (exp))) == INTEGER_CST)
  2897.     {
  2898.       *pbitpos += (TREE_INT_CST_LOW (TREE_OPERAND (exp, 1))
  2899.                * TREE_INT_CST_LOW (TYPE_SIZE (TREE_TYPE (exp))));
  2900.     }
  2901.       else if (TREE_CODE (exp) != NON_LVALUE_EXPR
  2902.            && ! ((TREE_CODE (exp) == NOP_EXPR
  2903.               || TREE_CODE (exp) == CONVERT_EXPR)
  2904.              && (TYPE_MODE (TREE_TYPE (exp))
  2905.              == TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0))))))
  2906.     break;
  2907.  
  2908.       /* If any reference in the chain is volatile, the effect is volatile.  */
  2909.       if (TREE_THIS_VOLATILE (exp))
  2910.     *pvolatilep = 1;
  2911.       exp = TREE_OPERAND (exp, 0);
  2912.     }
  2913.  
  2914.   /* If this was a bit-field, see if there is a mode that allows direct
  2915.      access in case EXP is in memory.  */
  2916.   if (mode == VOIDmode && *pbitpos % *pbitsize == 0)
  2917.     {
  2918.       mode = mode_for_size (*pbitsize, MODE_INT, 0);
  2919.       if (mode == BLKmode)
  2920.     mode = VOIDmode;
  2921.     }
  2922.  
  2923.   *pmode = mode;
  2924.   *poffset = offset;
  2925. #if 0
  2926.   /* We aren't finished fixing the callers to really handle nonzero offset.  */
  2927.   if (offset != 0)
  2928.     abort ();
  2929. #endif
  2930.  
  2931.   return exp;
  2932. }
  2933.  
  2934. /* Given an rtx VALUE that may contain additions and multiplications,
  2935.    return an equivalent value that just refers to a register or memory.
  2936.    This is done by generating instructions to perform the arithmetic
  2937.    and returning a pseudo-register containing the value.
  2938.  
  2939.    The returned value may be a REG, SUBREG, MEM or constant.  */
  2940.  
  2941. rtx
  2942. force_operand (value, target)
  2943.      rtx value, target;
  2944. {
  2945.   register optab binoptab = 0;
  2946.   /* Use a temporary to force order of execution of calls to
  2947.      `force_operand'.  */
  2948.   rtx tmp;
  2949.   register rtx op2;
  2950.   /* Use subtarget as the target for operand 0 of a binary operation.  */
  2951.   register rtx subtarget = (target != 0 && GET_CODE (target) == REG ? target : 0);
  2952.  
  2953.   if (GET_CODE (value) == PLUS)
  2954.     binoptab = add_optab;
  2955.   else if (GET_CODE (value) == MINUS)
  2956.     binoptab = sub_optab;
  2957.   else if (GET_CODE (value) == MULT)
  2958.     {
  2959.       op2 = XEXP (value, 1);
  2960.       if (!CONSTANT_P (op2)
  2961.       && !(GET_CODE (op2) == REG && op2 != subtarget))
  2962.     subtarget = 0;
  2963.       tmp = force_operand (XEXP (value, 0), subtarget);
  2964.       return expand_mult (GET_MODE (value), tmp,
  2965.               force_operand (op2, NULL_RTX),
  2966.               target, 0);
  2967.     }
  2968.  
  2969.   if (binoptab)
  2970.     {
  2971.       op2 = XEXP (value, 1);
  2972.       if (!CONSTANT_P (op2)
  2973.       && !(GET_CODE (op2) == REG && op2 != subtarget))
  2974.     subtarget = 0;
  2975.       if (binoptab == sub_optab && GET_CODE (op2) == CONST_INT)
  2976.     {
  2977.       binoptab = add_optab;
  2978.       op2 = negate_rtx (GET_MODE (value), op2);
  2979.     }
  2980.  
  2981.       /* Check for an addition with OP2 a constant integer and our first
  2982.      operand a PLUS of a virtual register and something else.  In that
  2983.      case, we want to emit the sum of the virtual register and the
  2984.      constant first and then add the other value.  This allows virtual
  2985.      register instantiation to simply modify the constant rather than
  2986.      creating another one around this addition.  */
  2987.       if (binoptab == add_optab && GET_CODE (op2) == CONST_INT
  2988.       && GET_CODE (XEXP (value, 0)) == PLUS
  2989.       && GET_CODE (XEXP (XEXP (value, 0), 0)) == REG
  2990.       && REGNO (XEXP (XEXP (value, 0), 0)) >= FIRST_VIRTUAL_REGISTER
  2991.       && REGNO (XEXP (XEXP (value, 0), 0)) <= LAST_VIRTUAL_REGISTER)
  2992.     {
  2993.       rtx temp = expand_binop (GET_MODE (value), binoptab,
  2994.                    XEXP (XEXP (value, 0), 0), op2,
  2995.                    subtarget, 0, OPTAB_LIB_WIDEN);
  2996.       return expand_binop (GET_MODE (value), binoptab, temp,
  2997.                    force_operand (XEXP (XEXP (value, 0), 1), 0),
  2998.                    target, 0, OPTAB_LIB_WIDEN);
  2999.     }
  3000.                    
  3001.       tmp = force_operand (XEXP (value, 0), subtarget);
  3002.       return expand_binop (GET_MODE (value), binoptab, tmp,
  3003.                force_operand (op2, NULL_RTX),
  3004.                target, 0, OPTAB_LIB_WIDEN);
  3005.       /* We give UNSIGNEP = 0 to expand_binop
  3006.      because the only operations we are expanding here are signed ones.  */
  3007.     }
  3008.   return value;
  3009. }
  3010.  
  3011. /* Subroutine of expand_expr:
  3012.    save the non-copied parts (LIST) of an expr (LHS), and return a list
  3013.    which can restore these values to their previous values,
  3014.    should something modify their storage.  */
  3015.  
  3016. static tree
  3017. save_noncopied_parts (lhs, list)
  3018.      tree lhs;
  3019.      tree list;
  3020. {
  3021.   tree tail;
  3022.   tree parts = 0;
  3023.  
  3024.   for (tail = list; tail; tail = TREE_CHAIN (tail))
  3025.     if (TREE_CODE (TREE_VALUE (tail)) == TREE_LIST)
  3026.       parts = chainon (parts, save_noncopied_parts (lhs, TREE_VALUE (tail)));
  3027.     else
  3028.       {
  3029.     tree part = TREE_VALUE (tail);
  3030.     tree part_type = TREE_TYPE (part);
  3031.     tree to_be_saved = build (COMPONENT_REF, part_type, lhs, part);
  3032.     rtx target = assign_stack_temp (TYPE_MODE (part_type),
  3033.                     int_size_in_bytes (part_type), 0);
  3034.     if (! memory_address_p (TYPE_MODE (part_type), XEXP (target, 0)))
  3035.       target = change_address (target, TYPE_MODE (part_type), NULL_RTX);
  3036.     parts = tree_cons (to_be_saved,
  3037.                build (RTL_EXPR, part_type, NULL_TREE,
  3038.                   (tree) target),
  3039.                parts);
  3040.     store_expr (TREE_PURPOSE (parts), RTL_EXPR_RTL (TREE_VALUE (parts)), 0);
  3041.       }
  3042.   return parts;
  3043. }
  3044.  
  3045. /* Subroutine of expand_expr:
  3046.    record the non-copied parts (LIST) of an expr (LHS), and return a list
  3047.    which specifies the initial values of these parts.  */
  3048.  
  3049. static tree
  3050. init_noncopied_parts (lhs, list)
  3051.      tree lhs;
  3052.      tree list;
  3053. {
  3054.   tree tail;
  3055.   tree parts = 0;
  3056.  
  3057.   for (tail = list; tail; tail = TREE_CHAIN (tail))
  3058.     if (TREE_CODE (TREE_VALUE (tail)) == TREE_LIST)
  3059.       parts = chainon (parts, init_noncopied_parts (lhs, TREE_VALUE (tail)));
  3060.     else
  3061.       {
  3062.     tree part = TREE_VALUE (tail);
  3063.     tree part_type = TREE_TYPE (part);
  3064.     tree to_be_initialized = build (COMPONENT_REF, part_type, lhs, part);
  3065.     parts = tree_cons (TREE_PURPOSE (tail), to_be_initialized, parts);
  3066.       }
  3067.   return parts;
  3068. }
  3069.  
  3070. /* Subroutine of expand_expr: return nonzero iff there is no way that
  3071.    EXP can reference X, which is being modified.  */
  3072.  
  3073. static int
  3074. safe_from_p (x, exp)
  3075.      rtx x;
  3076.      tree exp;
  3077. {
  3078.   rtx exp_rtl = 0;
  3079.   int i, nops;
  3080.  
  3081.   if (x == 0)
  3082.     return 1;
  3083.  
  3084.   /* If this is a subreg of a hard register, declare it unsafe, otherwise,
  3085.      find the underlying pseudo.  */
  3086.   if (GET_CODE (x) == SUBREG)
  3087.     {
  3088.       x = SUBREG_REG (x);
  3089.       if (GET_CODE (x) == REG && REGNO (x) < FIRST_PSEUDO_REGISTER)
  3090.     return 0;
  3091.     }
  3092.  
  3093.   /* If X is a location in the outgoing argument area, it is always safe.  */
  3094.   if (GET_CODE (x) == MEM
  3095.       && (XEXP (x, 0) == virtual_outgoing_args_rtx
  3096.       || (GET_CODE (XEXP (x, 0)) == PLUS
  3097.           && XEXP (XEXP (x, 0), 0) == virtual_outgoing_args_rtx)))
  3098.     return 1;
  3099.  
  3100.   switch (TREE_CODE_CLASS (TREE_CODE (exp)))
  3101.     {
  3102.     case 'd':
  3103.       exp_rtl = DECL_RTL (exp);
  3104.       break;
  3105.  
  3106.     case 'c':
  3107.       return 1;
  3108.  
  3109.     case 'x':
  3110.       if (TREE_CODE (exp) == TREE_LIST)
  3111.     return ((TREE_VALUE (exp) == 0
  3112.          || safe_from_p (x, TREE_VALUE (exp)))
  3113.         && (TREE_CHAIN (exp) == 0
  3114.             || safe_from_p (x, TREE_CHAIN (exp))));
  3115.       else
  3116.     return 0;
  3117.  
  3118.     case '1':
  3119.       return safe_from_p (x, TREE_OPERAND (exp, 0));
  3120.  
  3121.     case '2':
  3122.     case '<':
  3123.       return (safe_from_p (x, TREE_OPERAND (exp, 0))
  3124.           && safe_from_p (x, TREE_OPERAND (exp, 1)));
  3125.  
  3126.     case 'e':
  3127.     case 'r':
  3128.       /* Now do code-specific tests.  EXP_RTL is set to any rtx we find in
  3129.      the expression.  If it is set, we conflict iff we are that rtx or
  3130.      both are in memory.  Otherwise, we check all operands of the
  3131.      expression recursively.  */
  3132.  
  3133.       switch (TREE_CODE (exp))
  3134.     {
  3135.     case ADDR_EXPR:
  3136.       return staticp (TREE_OPERAND (exp, 0));
  3137.  
  3138.     case INDIRECT_REF:
  3139.       if (GET_CODE (x) == MEM)
  3140.         return 0;
  3141.       break;
  3142.  
  3143.     case CALL_EXPR:
  3144.       exp_rtl = CALL_EXPR_RTL (exp);
  3145.       if (exp_rtl == 0)
  3146.         {
  3147.           /* Assume that the call will clobber all hard registers and
  3148.          all of memory.  */
  3149.           if ((GET_CODE (x) == REG && REGNO (x) < FIRST_PSEUDO_REGISTER)
  3150.           || GET_CODE (x) == MEM)
  3151.         return 0;
  3152.         }
  3153.  
  3154.       break;
  3155.  
  3156.     case RTL_EXPR:
  3157.       exp_rtl = RTL_EXPR_RTL (exp);
  3158.       if (exp_rtl == 0)
  3159.         /* We don't know what this can modify.  */
  3160.         return 0;
  3161.  
  3162.       break;
  3163.  
  3164.     case WITH_CLEANUP_EXPR:
  3165.       exp_rtl = RTL_EXPR_RTL (exp);
  3166.       break;
  3167.  
  3168.     case SAVE_EXPR:
  3169.       exp_rtl = SAVE_EXPR_RTL (exp);
  3170.       break;
  3171.  
  3172.     case BIND_EXPR:
  3173.       /* The only operand we look at is operand 1.  The rest aren't
  3174.          part of the expression.  */
  3175.       return safe_from_p (x, TREE_OPERAND (exp, 1));
  3176.  
  3177.     case METHOD_CALL_EXPR:
  3178.       /* This takes a rtx argument, but shouldn't appear here. */
  3179.       abort ();
  3180.     }
  3181.  
  3182.       /* If we have an rtx, we do not need to scan our operands.  */
  3183.       if (exp_rtl)
  3184.     break;
  3185.  
  3186.       nops = tree_code_length[(int) TREE_CODE (exp)];
  3187.       for (i = 0; i < nops; i++)
  3188.     if (TREE_OPERAND (exp, i) != 0
  3189.         && ! safe_from_p (x, TREE_OPERAND (exp, i)))
  3190.       return 0;
  3191.     }
  3192.  
  3193.   /* If we have an rtl, find any enclosed object.  Then see if we conflict
  3194.      with it.  */
  3195.   if (exp_rtl)
  3196.     {
  3197.       if (GET_CODE (exp_rtl) == SUBREG)
  3198.     {
  3199.       exp_rtl = SUBREG_REG (exp_rtl);
  3200.       if (GET_CODE (exp_rtl) == REG
  3201.           && REGNO (exp_rtl) < FIRST_PSEUDO_REGISTER)
  3202.         return 0;
  3203.     }
  3204.  
  3205.       /* If the rtl is X, then it is not safe.  Otherwise, it is unless both
  3206.      are memory and EXP is not readonly.  */
  3207.       return ! (rtx_equal_p (x, exp_rtl)
  3208.         || (GET_CODE (x) == MEM && GET_CODE (exp_rtl) == MEM
  3209.             && ! TREE_READONLY (exp)));
  3210.     }
  3211.  
  3212.   /* If we reach here, it is safe.  */
  3213.   return 1;
  3214. }
  3215.  
  3216. /* Subroutine of expand_expr: return nonzero iff EXP is an
  3217.    expression whose type is statically determinable.  */
  3218.  
  3219. static int
  3220. fixed_type_p (exp)
  3221.      tree exp;
  3222. {
  3223.   if (TREE_CODE (exp) == PARM_DECL
  3224.       || TREE_CODE (exp) == VAR_DECL
  3225.       || TREE_CODE (exp) == CALL_EXPR || TREE_CODE (exp) == TARGET_EXPR
  3226.       || TREE_CODE (exp) == COMPONENT_REF
  3227.       || TREE_CODE (exp) == ARRAY_REF)
  3228.     return 1;
  3229.   return 0;
  3230. }
  3231.  
  3232. /* expand_expr: generate code for computing expression EXP.
  3233.    An rtx for the computed value is returned.  The value is never null.
  3234.    In the case of a void EXP, const0_rtx is returned.
  3235.  
  3236.    The value may be stored in TARGET if TARGET is nonzero.
  3237.    TARGET is just a suggestion; callers must assume that
  3238.    the rtx returned may not be the same as TARGET.
  3239.  
  3240.    If TARGET is CONST0_RTX, it means that the value will be ignored.
  3241.  
  3242.    If TMODE is not VOIDmode, it suggests generating the
  3243.    result in mode TMODE.  But this is done only when convenient.
  3244.    Otherwise, TMODE is ignored and the value generated in its natural mode.
  3245.    TMODE is just a suggestion; callers must assume that
  3246.    the rtx returned may not have mode TMODE.
  3247.  
  3248.    EXPAND_CONST_ADDRESS says that it is okay to return a MEM
  3249.    with a constant address even if that address is not normally legitimate.
  3250.    EXPAND_INITIALIZER and EXPAND_SUM also have this effect.
  3251.  
  3252.    If MODIFIER is EXPAND_SUM then when EXP is an addition
  3253.    we can return an rtx of the form (MULT (REG ...) (CONST_INT ...))
  3254.    or a nest of (PLUS ...) and (MINUS ...) where the terms are
  3255.    products as above, or REG or MEM, or constant.
  3256.    Ordinarily in such cases we would output mul or add instructions
  3257.    and then return a pseudo reg containing the sum.
  3258.  
  3259.    EXPAND_INITIALIZER is much like EXPAND_SUM except that
  3260.    it also marks a label as absolutely required (it can't be dead).
  3261.    It also makes a ZERO_EXTEND or SIGN_EXTEND instead of emitting extend insns.
  3262.    This is used for outputting expressions used in initializers.  */
  3263.  
  3264. rtx
  3265. expand_expr (exp, target, tmode, modifier)
  3266.      register tree exp;
  3267.      rtx target;
  3268.      enum machine_mode tmode;
  3269.      enum expand_modifier modifier;
  3270. {
  3271.   register rtx op0, op1, temp;
  3272.   tree type = TREE_TYPE (exp);
  3273.   int unsignedp = TREE_UNSIGNED (type);
  3274.   register enum machine_mode mode = TYPE_MODE (type);
  3275.   register enum tree_code code = TREE_CODE (exp);
  3276.   optab this_optab;
  3277.   /* Use subtarget as the target for operand 0 of a binary operation.  */
  3278.   rtx subtarget = (target != 0 && GET_CODE (target) == REG ? target : 0);
  3279.   rtx original_target = target;
  3280.   int ignore = target == const0_rtx;
  3281.   tree context;
  3282.  
  3283.   /* Don't use hard regs as subtargets, because the combiner
  3284.      can only handle pseudo regs.  */
  3285.   if (subtarget && REGNO (subtarget) < FIRST_PSEUDO_REGISTER)
  3286.     subtarget = 0;
  3287.   /* Avoid subtargets inside loops,
  3288.      since they hide some invariant expressions.  */
  3289.   if (preserve_subexpressions_p ())
  3290.     subtarget = 0;
  3291.  
  3292.   if (ignore) target = 0, original_target = 0;
  3293.  
  3294.   /* If will do cse, generate all results into pseudo registers
  3295.      since 1) that allows cse to find more things
  3296.      and 2) otherwise cse could produce an insn the machine
  3297.      cannot support.  */
  3298.  
  3299.   if (! cse_not_expected && mode != BLKmode && target
  3300.       && (GET_CODE (target) != REG || REGNO (target) < FIRST_PSEUDO_REGISTER))
  3301.     target = subtarget;
  3302.  
  3303.   /* Ensure we reference a volatile object even if value is ignored.  */
  3304.   if (ignore && TREE_THIS_VOLATILE (exp)
  3305.       && mode != VOIDmode && mode != BLKmode)
  3306.     {
  3307.       target = gen_reg_rtx (mode);
  3308.       temp = expand_expr (exp, target, VOIDmode, modifier);
  3309.       if (temp != target)
  3310.     emit_move_insn (target, temp);
  3311.       return target;
  3312.     }
  3313.  
  3314.   switch (code)
  3315.     {
  3316.     case LABEL_DECL:
  3317.       {
  3318.     tree function = decl_function_context (exp);
  3319.     /* Handle using a label in a containing function.  */
  3320.     if (function != current_function_decl && function != 0)
  3321.       {
  3322.         struct function *p = find_function_data (function);
  3323.         /* Allocate in the memory associated with the function
  3324.            that the label is in.  */
  3325.         push_obstacks (p->function_obstack,
  3326.                p->function_maybepermanent_obstack);
  3327.  
  3328.         p->forced_labels = gen_rtx (EXPR_LIST, VOIDmode,
  3329.                     label_rtx (exp), p->forced_labels);
  3330.         pop_obstacks ();
  3331.       }
  3332.     else if (modifier == EXPAND_INITIALIZER)
  3333.       forced_labels = gen_rtx (EXPR_LIST, VOIDmode,
  3334.                    label_rtx (exp), forced_labels);
  3335.     temp = gen_rtx (MEM, FUNCTION_MODE,
  3336.             gen_rtx (LABEL_REF, Pmode, label_rtx (exp)));
  3337.     if (function != current_function_decl && function != 0)
  3338.       LABEL_REF_NONLOCAL_P (XEXP (temp, 0)) = 1;
  3339.     return temp;
  3340.       }
  3341.  
  3342.     case PARM_DECL:
  3343.       if (DECL_RTL (exp) == 0)
  3344.     {
  3345.       error_with_decl (exp, "prior parameter's size depends on `%s'");
  3346.       return CONST0_RTX (mode);
  3347.     }
  3348.  
  3349.     case FUNCTION_DECL:
  3350.     case VAR_DECL:
  3351.     case RESULT_DECL:
  3352.       if (DECL_RTL (exp) == 0)
  3353.     abort ();
  3354.       /* Ensure variable marked as used
  3355.      even if it doesn't go through a parser.  */
  3356.       TREE_USED (exp) = 1;
  3357.       /* Handle variables inherited from containing functions.  */
  3358.       context = decl_function_context (exp);
  3359.  
  3360.       /* We treat inline_function_decl as an alias for the current function
  3361.      because that is the inline function whose vars, types, etc.
  3362.      are being merged into the current function.
  3363.      See expand_inline_function.  */
  3364.       if (context != 0 && context != current_function_decl
  3365.       && context != inline_function_decl
  3366.       /* If var is static, we don't need a static chain to access it.  */
  3367.       && ! (GET_CODE (DECL_RTL (exp)) == MEM
  3368.         && CONSTANT_P (XEXP (DECL_RTL (exp), 0))))
  3369.     {
  3370.       rtx addr;
  3371.  
  3372.       /* Mark as non-local and addressable.  */
  3373.       DECL_NONLOCAL (exp) = 1;
  3374.       mark_addressable (exp);
  3375.       if (GET_CODE (DECL_RTL (exp)) != MEM)
  3376.         abort ();
  3377.       addr = XEXP (DECL_RTL (exp), 0);
  3378.       if (GET_CODE (addr) == MEM)
  3379.         addr = gen_rtx (MEM, Pmode, fix_lexical_addr (XEXP (addr, 0), exp));
  3380.       else
  3381.         addr = fix_lexical_addr (addr, exp);
  3382.       return change_address (DECL_RTL (exp), mode, addr);
  3383.     }
  3384.  
  3385.       /* This is the case of an array whose size is to be determined
  3386.      from its initializer, while the initializer is still being parsed.
  3387.      See expand_decl.  */
  3388.       if (GET_CODE (DECL_RTL (exp)) == MEM
  3389.       && GET_CODE (XEXP (DECL_RTL (exp), 0)) == REG)
  3390.     return change_address (DECL_RTL (exp), GET_MODE (DECL_RTL (exp)),
  3391.                    XEXP (DECL_RTL (exp), 0));
  3392.       if (GET_CODE (DECL_RTL (exp)) == MEM
  3393.       && modifier != EXPAND_CONST_ADDRESS
  3394.       && modifier != EXPAND_SUM
  3395.       && modifier != EXPAND_INITIALIZER)
  3396.     {
  3397.       /* DECL_RTL probably contains a constant address.
  3398.          On RISC machines where a constant address isn't valid,
  3399.          make some insns to get that address into a register.  */
  3400.       if (!memory_address_p (DECL_MODE (exp), XEXP (DECL_RTL (exp), 0))
  3401.           || (flag_force_addr
  3402.           && CONSTANT_ADDRESS_P (XEXP (DECL_RTL (exp), 0))))
  3403.         return change_address (DECL_RTL (exp), VOIDmode,
  3404.                    copy_rtx (XEXP (DECL_RTL (exp), 0)));
  3405.     }
  3406.  
  3407.       /* If the mode of DECL_RTL does not match that of the decl, it
  3408.      must be a promoted value.  We return a SUBREG of the wanted mode,
  3409.      but mark it so that we know that it was already extended.  */
  3410.  
  3411.       if (GET_CODE (DECL_RTL (exp)) == REG
  3412.       && GET_MODE (DECL_RTL (exp)) != mode)
  3413.     {
  3414.       enum machine_mode decl_mode = DECL_MODE (exp);
  3415.  
  3416.       /* Get the signedness used for this variable.  Ensure we get the
  3417.          same mode we got when the variable was declared.  */
  3418.  
  3419.       PROMOTE_MODE (decl_mode, unsignedp, type);
  3420.  
  3421.       if (decl_mode != GET_MODE (DECL_RTL (exp)))
  3422.         abort ();
  3423.  
  3424.       temp = gen_rtx (SUBREG, mode, DECL_RTL (exp), 0);
  3425.       SUBREG_PROMOTED_VAR_P (temp) = 1;
  3426.       SUBREG_PROMOTED_UNSIGNED_P (temp) = unsignedp;
  3427.       return temp;
  3428.     }
  3429.  
  3430.       return DECL_RTL (exp);
  3431.  
  3432.     case INTEGER_CST:
  3433.       return immed_double_const (TREE_INT_CST_LOW (exp),
  3434.                  TREE_INT_CST_HIGH (exp),
  3435.                  mode);
  3436.  
  3437.     case CONST_DECL:
  3438.       return expand_expr (DECL_INITIAL (exp), target, VOIDmode, 0);
  3439.  
  3440.     case REAL_CST:
  3441.       /* If optimized, generate immediate CONST_DOUBLE
  3442.      which will be turned into memory by reload if necessary. 
  3443.      
  3444.      We used to force a register so that loop.c could see it.  But
  3445.      this does not allow gen_* patterns to perform optimizations with
  3446.      the constants.  It also produces two insns in cases like "x = 1.0;".
  3447.      On most machines, floating-point constants are not permitted in
  3448.      many insns, so we'd end up copying it to a register in any case.
  3449.  
  3450.      Now, we do the copying in expand_binop, if appropriate.  */
  3451.       return immed_real_const (exp);
  3452.  
  3453.     case COMPLEX_CST:
  3454.     case STRING_CST:
  3455.       if (! TREE_CST_RTL (exp))
  3456.     output_constant_def (exp);
  3457.  
  3458.       /* TREE_CST_RTL probably contains a constant address.
  3459.      On RISC machines where a constant address isn't valid,
  3460.      make some insns to get that address into a register.  */
  3461.       if (GET_CODE (TREE_CST_RTL (exp)) == MEM
  3462.       && modifier != EXPAND_CONST_ADDRESS
  3463.       && modifier != EXPAND_INITIALIZER
  3464.       && modifier != EXPAND_SUM
  3465.       && !memory_address_p (mode, XEXP (TREE_CST_RTL (exp), 0)))
  3466.     return change_address (TREE_CST_RTL (exp), VOIDmode,
  3467.                    copy_rtx (XEXP (TREE_CST_RTL (exp), 0)));
  3468.       return TREE_CST_RTL (exp);
  3469.  
  3470.     case SAVE_EXPR:
  3471.       context = decl_function_context (exp);
  3472.       /* We treat inline_function_decl as an alias for the current function
  3473.      because that is the inline function whose vars, types, etc.
  3474.      are being merged into the current function.
  3475.      See expand_inline_function.  */
  3476.       if (context == current_function_decl || context == inline_function_decl)
  3477.     context = 0;
  3478.  
  3479.       /* If this is non-local, handle it.  */
  3480.       if (context)
  3481.     {
  3482.       temp = SAVE_EXPR_RTL (exp);
  3483.       if (temp && GET_CODE (temp) == REG)
  3484.         {
  3485.           put_var_into_stack (exp);
  3486.           temp = SAVE_EXPR_RTL (exp);
  3487.         }
  3488.       if (temp == 0 || GET_CODE (temp) != MEM)
  3489.         abort ();
  3490.       return change_address (temp, mode,
  3491.                  fix_lexical_addr (XEXP (temp, 0), exp));
  3492.     }
  3493.       if (SAVE_EXPR_RTL (exp) == 0)
  3494.     {
  3495.       if (mode == BLKmode)
  3496.         temp
  3497.           = assign_stack_temp (mode,
  3498.                    int_size_in_bytes (TREE_TYPE (exp)), 0);
  3499.       else
  3500.         {
  3501.           enum machine_mode var_mode = mode;
  3502.  
  3503.           if (TREE_CODE (type) == INTEGER_TYPE
  3504.           || TREE_CODE (type) == ENUMERAL_TYPE
  3505.           || TREE_CODE (type) == BOOLEAN_TYPE
  3506.           || TREE_CODE (type) == CHAR_TYPE
  3507.           || TREE_CODE (type) == REAL_TYPE
  3508.           || TREE_CODE (type) == POINTER_TYPE
  3509.           || TREE_CODE (type) == OFFSET_TYPE)
  3510.         {
  3511.           PROMOTE_MODE (var_mode, unsignedp, type);
  3512.         }
  3513.  
  3514.           temp = gen_reg_rtx (var_mode);
  3515.         }
  3516.  
  3517.       SAVE_EXPR_RTL (exp) = temp;
  3518.       store_expr (TREE_OPERAND (exp, 0), temp, 0);
  3519.       if (!optimize && GET_CODE (temp) == REG)
  3520.         save_expr_regs = gen_rtx (EXPR_LIST, VOIDmode, temp,
  3521.                       save_expr_regs);
  3522.     }
  3523.  
  3524.       /* If the mode of SAVE_EXPR_RTL does not match that of the expression, it
  3525.      must be a promoted value.  We return a SUBREG of the wanted mode,
  3526.      but mark it so that we know that it was already extended.  Note
  3527.      that `unsignedp' was modified above in this case.  */
  3528.  
  3529.       if (GET_CODE (SAVE_EXPR_RTL (exp)) == REG
  3530.       && GET_MODE (SAVE_EXPR_RTL (exp)) != mode)
  3531.     {
  3532.       temp = gen_rtx (SUBREG, mode, SAVE_EXPR_RTL (exp), 0);
  3533.       SUBREG_PROMOTED_VAR_P (temp) = 1;
  3534.       SUBREG_PROMOTED_UNSIGNED_P (temp) = unsignedp;
  3535.       return temp;
  3536.     }
  3537.  
  3538.       return SAVE_EXPR_RTL (exp);
  3539.  
  3540.     case EXIT_EXPR:
  3541.       /* Exit the current loop if the body-expression is true.  */
  3542.       {
  3543.     rtx label = gen_label_rtx ();
  3544.     do_jump (TREE_OPERAND (exp, 0), label, NULL_RTX);
  3545.     expand_exit_loop (NULL_PTR);
  3546.     emit_label (label);
  3547.       }
  3548.       return const0_rtx;
  3549.  
  3550.     case LOOP_EXPR:
  3551.       expand_start_loop (1);
  3552.       expand_expr_stmt (TREE_OPERAND (exp, 0));
  3553.       expand_end_loop ();
  3554.  
  3555.       return const0_rtx;
  3556.  
  3557.     case BIND_EXPR:
  3558.       {
  3559.     tree vars = TREE_OPERAND (exp, 0);
  3560.     int vars_need_expansion = 0;
  3561.  
  3562.     /* Need to open a binding contour here because
  3563.        if there are any cleanups they most be contained here.  */
  3564.     expand_start_bindings (0);
  3565.  
  3566.     /* Mark the corresponding BLOCK for output in its proper place.  */
  3567.     if (TREE_OPERAND (exp, 2) != 0
  3568.         && ! TREE_USED (TREE_OPERAND (exp, 2)))
  3569.       insert_block (TREE_OPERAND (exp, 2));
  3570.  
  3571.     /* If VARS have not yet been expanded, expand them now.  */
  3572.     while (vars)
  3573.       {
  3574.         if (DECL_RTL (vars) == 0)
  3575.           {
  3576.         vars_need_expansion = 1;
  3577.         expand_decl (vars);
  3578.           }
  3579.         expand_decl_init (vars);
  3580.         vars = TREE_CHAIN (vars);
  3581.       }
  3582.  
  3583.     temp = expand_expr (TREE_OPERAND (exp, 1), target, tmode, modifier);
  3584.  
  3585.     expand_end_bindings (TREE_OPERAND (exp, 0), 0, 0);
  3586.  
  3587.     return temp;
  3588.       }
  3589.  
  3590.     case RTL_EXPR:
  3591.       if (RTL_EXPR_SEQUENCE (exp) == const0_rtx)
  3592.     abort ();
  3593.       emit_insns (RTL_EXPR_SEQUENCE (exp));
  3594.       RTL_EXPR_SEQUENCE (exp) = const0_rtx;
  3595.       return RTL_EXPR_RTL (exp);
  3596.  
  3597.     case CONSTRUCTOR:
  3598.       /* All elts simple constants => refer to a constant in memory.  But
  3599.      if this is a non-BLKmode mode, let it store a field at a time
  3600.      since that should make a CONST_INT or CONST_DOUBLE when we
  3601.      fold.  */
  3602.       if (TREE_STATIC (exp) && (mode == BLKmode || TREE_ADDRESSABLE (exp)))
  3603.     {
  3604.       rtx constructor = output_constant_def (exp);
  3605.       if (modifier != EXPAND_CONST_ADDRESS
  3606.           && modifier != EXPAND_INITIALIZER
  3607.           && modifier != EXPAND_SUM
  3608.           && !memory_address_p (GET_MODE (constructor),
  3609.                     XEXP (constructor, 0)))
  3610.         constructor = change_address (constructor, VOIDmode,
  3611.                       XEXP (constructor, 0));
  3612.       return constructor;
  3613.     }
  3614.  
  3615.       if (ignore)
  3616.     {
  3617.       tree elt;
  3618.       for (elt = CONSTRUCTOR_ELTS (exp); elt; elt = TREE_CHAIN (elt))
  3619.         expand_expr (TREE_VALUE (elt), const0_rtx, VOIDmode, 0);
  3620.       return const0_rtx;
  3621.     }
  3622.       else
  3623.     {
  3624.       if (target == 0 || ! safe_from_p (target, exp))
  3625.         {
  3626.           if (mode != BLKmode && ! TREE_ADDRESSABLE (exp))
  3627.         target = gen_reg_rtx (mode);
  3628.           else
  3629.         {
  3630.           rtx safe_target = assign_stack_temp (mode, int_size_in_bytes (type), 0);
  3631.           if (target)
  3632.             MEM_IN_STRUCT_P (safe_target) = MEM_IN_STRUCT_P (target);
  3633.           target = safe_target;
  3634.         }
  3635.         }
  3636.       store_constructor (exp, target);
  3637.       return target;
  3638.     }
  3639.  
  3640.     case INDIRECT_REF:
  3641.       {
  3642.     tree exp1 = TREE_OPERAND (exp, 0);
  3643.     tree exp2;
  3644.  
  3645.     /* A SAVE_EXPR as the address in an INDIRECT_EXPR is generated
  3646.        for  *PTR += ANYTHING  where PTR is put inside the SAVE_EXPR.
  3647.        This code has the same general effect as simply doing
  3648.        expand_expr on the save expr, except that the expression PTR
  3649.        is computed for use as a memory address.  This means different
  3650.        code, suitable for indexing, may be generated.  */
  3651.     if (TREE_CODE (exp1) == SAVE_EXPR
  3652.         && SAVE_EXPR_RTL (exp1) == 0
  3653.         && TREE_CODE (exp2 = TREE_OPERAND (exp1, 0)) != ERROR_MARK
  3654.         && TYPE_MODE (TREE_TYPE (exp1)) == Pmode
  3655.         && TYPE_MODE (TREE_TYPE (exp2)) == Pmode)
  3656.       {
  3657.         temp = expand_expr (TREE_OPERAND (exp1, 0), NULL_RTX,
  3658.                 VOIDmode, EXPAND_SUM);
  3659.         op0 = memory_address (mode, temp);
  3660.         op0 = copy_all_regs (op0);
  3661.         SAVE_EXPR_RTL (exp1) = op0;
  3662.       }
  3663.     else
  3664.       {
  3665.         op0 = expand_expr (exp1, NULL_RTX, VOIDmode, EXPAND_SUM);
  3666.         op0 = memory_address (mode, op0);
  3667.       }
  3668.  
  3669.     temp = gen_rtx (MEM, mode, op0);
  3670.     /* If address was computed by addition,
  3671.        mark this as an element of an aggregate.  */
  3672.     if (TREE_CODE (TREE_OPERAND (exp, 0)) == PLUS_EXPR
  3673.         || (TREE_CODE (TREE_OPERAND (exp, 0)) == SAVE_EXPR
  3674.         && TREE_CODE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0)) == PLUS_EXPR)
  3675.         || TREE_CODE (TREE_TYPE (exp)) == ARRAY_TYPE
  3676.         || TREE_CODE (TREE_TYPE (exp)) == RECORD_TYPE
  3677.         || TREE_CODE (TREE_TYPE (exp)) == UNION_TYPE
  3678.         || (TREE_CODE (exp1) == ADDR_EXPR
  3679.         && (exp2 = TREE_OPERAND (exp1, 0))
  3680.         && (TREE_CODE (TREE_TYPE (exp2)) == ARRAY_TYPE
  3681.             || TREE_CODE (TREE_TYPE (exp2)) == RECORD_TYPE
  3682.             || TREE_CODE (TREE_TYPE (exp2)) == UNION_TYPE)))
  3683.       MEM_IN_STRUCT_P (temp) = 1;
  3684.     MEM_VOLATILE_P (temp) = TREE_THIS_VOLATILE (exp) || flag_volatile;
  3685. #if 0 /* It is incorrectto set RTX_UNCHANGING_P here, because the fact that
  3686.      a location is accessed through a pointer to const does not mean
  3687.      that the value there can never change.  */
  3688.     RTX_UNCHANGING_P (temp) = TREE_READONLY (exp);
  3689. #endif
  3690.     return temp;
  3691.       }
  3692.  
  3693.     case ARRAY_REF:
  3694.       if (TREE_CODE (TREE_OPERAND (exp, 1)) != INTEGER_CST
  3695.       || TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST)
  3696.     {
  3697.       /* Nonconstant array index or nonconstant element size.
  3698.          Generate the tree for *(&array+index) and expand that,
  3699.          except do it in a language-independent way
  3700.          and don't complain about non-lvalue arrays.
  3701.          `mark_addressable' should already have been called
  3702.          for any array for which this case will be reached.  */
  3703.  
  3704.       /* Don't forget the const or volatile flag from the array element. */
  3705.       tree variant_type = build_type_variant (type,
  3706.                           TREE_READONLY (exp),
  3707.                           TREE_THIS_VOLATILE (exp));
  3708.       tree array_adr = build1 (ADDR_EXPR, build_pointer_type (variant_type),
  3709.                    TREE_OPERAND (exp, 0));
  3710.       tree index = TREE_OPERAND (exp, 1);
  3711.       tree elt;
  3712.  
  3713.       /* Convert the integer argument to a type the same size as a pointer
  3714.          so the multiply won't overflow spuriously.  */
  3715.       if (TYPE_PRECISION (TREE_TYPE (index)) != POINTER_SIZE)
  3716.         index = convert (type_for_size (POINTER_SIZE, 0), index);
  3717.  
  3718.       /* Don't think the address has side effects
  3719.          just because the array does.
  3720.          (In some cases the address might have side effects,
  3721.          and we fail to record that fact here.  However, it should not
  3722.          matter, since expand_expr should not care.)  */
  3723.       TREE_SIDE_EFFECTS (array_adr) = 0;
  3724.  
  3725.       elt = build1 (INDIRECT_REF, type,
  3726.             fold (build (PLUS_EXPR, TYPE_POINTER_TO (variant_type),
  3727.                      array_adr,
  3728.                      fold (build (MULT_EXPR,
  3729.                           TYPE_POINTER_TO (variant_type),
  3730.                           index, size_in_bytes (type))))));
  3731.  
  3732.       /* Volatility, etc., of new expression is same as old expression.  */
  3733.       TREE_SIDE_EFFECTS (elt) = TREE_SIDE_EFFECTS (exp);
  3734.       TREE_THIS_VOLATILE (elt) = TREE_THIS_VOLATILE (exp);
  3735.       TREE_READONLY (elt) = TREE_READONLY (exp);
  3736.  
  3737.       return expand_expr (elt, target, tmode, modifier);
  3738.     }
  3739.  
  3740.       /* Fold an expression like: "foo"[2].
  3741.      This is not done in fold so it won't happen inside &.  */
  3742.       {
  3743.     int i;
  3744.     tree arg0 = TREE_OPERAND (exp, 0);
  3745.     tree arg1 = TREE_OPERAND (exp, 1);
  3746.  
  3747.     if (TREE_CODE (arg0) == STRING_CST
  3748.         && TREE_CODE (arg1) == INTEGER_CST
  3749.         && !TREE_INT_CST_HIGH (arg1)
  3750.         && (i = TREE_INT_CST_LOW (arg1)) < TREE_STRING_LENGTH (arg0))
  3751.       {
  3752.         if (TREE_TYPE (TREE_TYPE (arg0)) == integer_type_node)
  3753.           {
  3754.         exp = build_int_2 (((int *)TREE_STRING_POINTER (arg0))[i], 0);
  3755.         TREE_TYPE (exp) = integer_type_node;
  3756.         return expand_expr (exp, target, tmode, modifier);
  3757.           }
  3758.         if (TREE_TYPE (TREE_TYPE (arg0)) == char_type_node)
  3759.           {
  3760.         exp = build_int_2 (TREE_STRING_POINTER (arg0)[i], 0);
  3761.         TREE_TYPE (exp) = integer_type_node;
  3762.         return expand_expr (convert (TREE_TYPE (TREE_TYPE (arg0)), exp), target, tmode, modifier);
  3763.           }
  3764.       }
  3765.       }
  3766.  
  3767.       /* If this is a constant index into a constant array,
  3768.      just get the value from the array.  Handle both the cases when
  3769.      we have an explicit constructor and when our operand is a variable
  3770.      that was declared const.  */
  3771.  
  3772.       if (TREE_CODE (TREE_OPERAND (exp, 0)) == CONSTRUCTOR
  3773.       && ! TREE_SIDE_EFFECTS (TREE_OPERAND (exp, 0)))
  3774.     {
  3775.       tree index = fold (TREE_OPERAND (exp, 1));
  3776.       if (TREE_CODE (index) == INTEGER_CST
  3777.           && TREE_INT_CST_HIGH (index) == 0)
  3778.         {
  3779.           int i = TREE_INT_CST_LOW (index);
  3780.           tree elem = CONSTRUCTOR_ELTS (TREE_OPERAND (exp, 0));
  3781.  
  3782.           while (elem && i--)
  3783.         elem = TREE_CHAIN (elem);
  3784.           if (elem)
  3785.         return expand_expr (fold (TREE_VALUE (elem)), target,
  3786.                     tmode, modifier);
  3787.         }
  3788.     }
  3789.       
  3790.       else if (TREE_READONLY (TREE_OPERAND (exp, 0))
  3791.            && ! TREE_SIDE_EFFECTS (TREE_OPERAND (exp, 0))
  3792.            && TREE_CODE (TREE_TYPE (TREE_OPERAND (exp, 0))) == ARRAY_TYPE
  3793.            && TREE_CODE (TREE_OPERAND (exp, 0)) == VAR_DECL
  3794.            && DECL_INITIAL (TREE_OPERAND (exp, 0))
  3795.            && optimize >= 1
  3796.            && (TREE_CODE (DECL_INITIAL (TREE_OPERAND (exp, 0)))
  3797.            != ERROR_MARK))
  3798.     {
  3799.       tree index = fold (TREE_OPERAND (exp, 1));
  3800.       if (TREE_CODE (index) == INTEGER_CST
  3801.           && TREE_INT_CST_HIGH (index) == 0)
  3802.         {
  3803.           int i = TREE_INT_CST_LOW (index);
  3804.           tree init = DECL_INITIAL (TREE_OPERAND (exp, 0));
  3805.  
  3806.           if (TREE_CODE (init) == CONSTRUCTOR)
  3807.         {
  3808.           tree elem = CONSTRUCTOR_ELTS (init);
  3809.  
  3810.           while (elem && i--)
  3811.             elem = TREE_CHAIN (elem);
  3812.           if (elem)
  3813.             return expand_expr (fold (TREE_VALUE (elem)), target,
  3814.                     tmode, modifier);
  3815.         }
  3816.           else if (TREE_CODE (init) == STRING_CST
  3817.                && i < TREE_STRING_LENGTH (init))
  3818.         {
  3819.           temp = GEN_INT (TREE_STRING_POINTER (init)[i]);
  3820.           return convert_to_mode (mode, temp, 0);
  3821.         }
  3822.         }
  3823.     }
  3824.       /* Treat array-ref with constant index as a component-ref.  */
  3825.  
  3826.     case COMPONENT_REF:
  3827.     case BIT_FIELD_REF:
  3828.       /* If the operand is a CONSTRUCTOR, we can just extract the
  3829.      appropriate field if it is present.  */
  3830.       if (code != ARRAY_REF
  3831.       && TREE_CODE (TREE_OPERAND (exp, 0)) == CONSTRUCTOR)
  3832.     {
  3833.       tree elt;
  3834.  
  3835.       for (elt = CONSTRUCTOR_ELTS (TREE_OPERAND (exp, 0)); elt;
  3836.            elt = TREE_CHAIN (elt))
  3837.         if (TREE_PURPOSE (elt) == TREE_OPERAND (exp, 1))
  3838.           return expand_expr (TREE_VALUE (elt), target, tmode, modifier);
  3839.     }
  3840.  
  3841.       {
  3842.     enum machine_mode mode1;
  3843.     int bitsize;
  3844.     int bitpos;
  3845.     tree offset;
  3846.     int volatilep = 0;
  3847.     tree tem = get_inner_reference (exp, &bitsize, &bitpos, &offset,
  3848.                     &mode1, &unsignedp, &volatilep);
  3849.  
  3850.     /* In some cases, we will be offsetting OP0's address by a constant.
  3851.        So get it as a sum, if possible.  If we will be using it
  3852.        directly in an insn, we validate it.  */
  3853.     op0 = expand_expr (tem, NULL_RTX, VOIDmode, EXPAND_SUM);
  3854.  
  3855.     /* If this is a constant, put it into a register if it is a
  3856.        legimate constant and memory if it isn't.  */
  3857.     if (CONSTANT_P (op0))
  3858.       {
  3859.         enum machine_mode mode = TYPE_MODE (TREE_TYPE (tem));
  3860.         if (LEGITIMATE_CONSTANT_P (op0))
  3861.           op0 = force_reg (mode, op0);
  3862.         else
  3863.           op0 = validize_mem (force_const_mem (mode, op0));
  3864.       }
  3865.  
  3866.     if (offset != 0)
  3867.       {
  3868.         rtx offset_rtx = expand_expr (offset, NULL_RTX, VOIDmode, 0);
  3869.  
  3870.         if (GET_CODE (op0) != MEM)
  3871.           abort ();
  3872.         op0 = change_address (op0, VOIDmode,
  3873.                   gen_rtx (PLUS, Pmode, XEXP (op0, 0),
  3874.                        force_reg (Pmode, offset_rtx)));
  3875.       }
  3876.  
  3877.     /* Don't forget about volatility even if this is a bitfield.  */
  3878.     if (GET_CODE (op0) == MEM && volatilep && ! MEM_VOLATILE_P (op0))
  3879.       {
  3880.         op0 = copy_rtx (op0);
  3881.         MEM_VOLATILE_P (op0) = 1;
  3882.       }
  3883.  
  3884.     if (mode1 == VOIDmode
  3885.         || (mode1 != BLKmode && ! direct_load[(int) mode1]
  3886.         && modifier != EXPAND_CONST_ADDRESS
  3887.         && modifier != EXPAND_SUM && modifier != EXPAND_INITIALIZER)
  3888.         || GET_CODE (op0) == REG || GET_CODE (op0) == SUBREG)
  3889.       {
  3890.         /* In cases where an aligned union has an unaligned object
  3891.            as a field, we might be extracting a BLKmode value from
  3892.            an integer-mode (e.g., SImode) object.  Handle this case
  3893.            by doing the extract into an object as wide as the field
  3894.            (which we know to be the width of a basic mode), then
  3895.            storing into memory, and changing the mode to BLKmode.  */
  3896.         enum machine_mode ext_mode = mode;
  3897.  
  3898.         if (ext_mode == BLKmode)
  3899.           ext_mode = mode_for_size (bitsize, MODE_INT, 1);
  3900.  
  3901.         if (ext_mode == BLKmode)
  3902.           abort ();
  3903.  
  3904.         op0 = extract_bit_field (validize_mem (op0), bitsize, bitpos,
  3905.                      unsignedp, target, ext_mode, ext_mode,
  3906.                      TYPE_ALIGN (TREE_TYPE (tem)) / BITS_PER_UNIT,
  3907.                      int_size_in_bytes (TREE_TYPE (tem)));
  3908.         if (mode == BLKmode)
  3909.           {
  3910.         rtx new = assign_stack_temp (ext_mode,
  3911.                          bitsize / BITS_PER_UNIT, 0);
  3912.  
  3913.         emit_move_insn (new, op0);
  3914.         op0 = copy_rtx (new);
  3915.         PUT_MODE (op0, BLKmode);
  3916.           }
  3917.  
  3918.         return op0;
  3919.       }
  3920.  
  3921.     /* Get a reference to just this component.  */
  3922.     if (modifier == EXPAND_CONST_ADDRESS
  3923.         || modifier == EXPAND_SUM || modifier == EXPAND_INITIALIZER)
  3924.       op0 = gen_rtx (MEM, mode1, plus_constant (XEXP (op0, 0),
  3925.                             (bitpos / BITS_PER_UNIT)));
  3926.     else
  3927.       op0 = change_address (op0, mode1,
  3928.                 plus_constant (XEXP (op0, 0),
  3929.                            (bitpos / BITS_PER_UNIT)));
  3930.     MEM_IN_STRUCT_P (op0) = 1;
  3931.     MEM_VOLATILE_P (op0) |= volatilep;
  3932.     if (mode == mode1 || mode1 == BLKmode || mode1 == tmode)
  3933.       return op0;
  3934.     if (target == 0)
  3935.       target = gen_reg_rtx (tmode != VOIDmode ? tmode : mode);
  3936.     convert_move (target, op0, unsignedp);
  3937.     return target;
  3938.       }
  3939.  
  3940.     case OFFSET_REF:
  3941.       {
  3942.     tree base = build_unary_op (ADDR_EXPR, TREE_OPERAND (exp, 0), 0);
  3943.     tree addr = build (PLUS_EXPR, type, base, TREE_OPERAND (exp, 1));
  3944.     op0 = expand_expr (addr, NULL_RTX, VOIDmode, EXPAND_SUM);
  3945.     temp = gen_rtx (MEM, mode, memory_address (mode, op0));
  3946.     MEM_IN_STRUCT_P (temp) = 1;
  3947.     MEM_VOLATILE_P (temp) = TREE_THIS_VOLATILE (exp) || flag_volatile;
  3948. #if 0 /* It is incorrectto set RTX_UNCHANGING_P here, because the fact that
  3949.      a location is accessed through a pointer to const does not mean
  3950.      that the value there can never change.  */
  3951.     RTX_UNCHANGING_P (temp) = TREE_READONLY (exp);
  3952. #endif
  3953.     return temp;
  3954.       }
  3955.  
  3956.       /* Intended for a reference to a buffer of a file-object in Pascal.
  3957.      But it's not certain that a special tree code will really be
  3958.      necessary for these.  INDIRECT_REF might work for them.  */
  3959.     case BUFFER_REF:
  3960.       abort ();
  3961.  
  3962.     /* IN_EXPR: Inlined pascal set IN expression.
  3963.  
  3964.        Algorithm:
  3965.          rlo       = set_low - (set_low%bits_per_word);
  3966.      the_word  = set [ (index - rlo)/bits_per_word ];
  3967.      bit_index = index % bits_per_word;
  3968.      bitmask   = 1 << bit_index;
  3969.      return !!(the_word & bitmask);  */
  3970.     case IN_EXPR:
  3971.       preexpand_calls (exp);
  3972.       {
  3973.     tree set = TREE_OPERAND (exp, 0);
  3974.     tree index = TREE_OPERAND (exp, 1);
  3975.     tree set_type = TREE_TYPE (set);
  3976.  
  3977.     tree set_low_bound = TYPE_MIN_VALUE (TYPE_DOMAIN (set_type));
  3978.     tree set_high_bound = TYPE_MAX_VALUE (TYPE_DOMAIN (set_type));
  3979.  
  3980.     rtx index_val;
  3981.     rtx lo_r;
  3982.     rtx hi_r;
  3983.     rtx rlow;
  3984.     rtx diff, quo, rem, addr, bit, result;
  3985.     rtx setval, setaddr;
  3986.     enum machine_mode index_mode = TYPE_MODE (TREE_TYPE (index));
  3987.  
  3988.     if (target == 0)
  3989.       target = gen_reg_rtx (TYPE_MODE (TREE_TYPE (exp)));
  3990.  
  3991.     /* If domain is empty, answer is no.  */
  3992.     if (tree_int_cst_lt (set_high_bound, set_low_bound))
  3993.       return const0_rtx;
  3994.  
  3995.     index_val = expand_expr (index, 0, VOIDmode, 0);
  3996.     lo_r = expand_expr (set_low_bound, 0, VOIDmode, 0);
  3997.     hi_r = expand_expr (set_high_bound, 0, VOIDmode, 0);
  3998.     setval = expand_expr (set, 0, VOIDmode, 0);
  3999.     setaddr = XEXP (setval, 0); 
  4000.  
  4001.     /* Compare index against bounds, if they are constant.  */
  4002.     if (GET_CODE (index_val) == CONST_INT
  4003.         && GET_CODE (lo_r) == CONST_INT)
  4004.       {
  4005.         if (INTVAL (index_val) < INTVAL (lo_r))
  4006.           return const0_rtx;
  4007.       }
  4008.  
  4009.     if (GET_CODE (index_val) == CONST_INT
  4010.         && GET_CODE (hi_r) == CONST_INT)
  4011.       {
  4012.         if (INTVAL (hi_r) < INTVAL (index_val))
  4013.           return const0_rtx;
  4014.       }
  4015.  
  4016.     /* If we get here, we have to generate the code for both cases
  4017.        (in range and out of range).  */
  4018.  
  4019.     op0 = gen_label_rtx ();
  4020.     op1 = gen_label_rtx ();
  4021.  
  4022.     if (! (GET_CODE (index_val) == CONST_INT
  4023.            && GET_CODE (lo_r) == CONST_INT))
  4024.       {
  4025.         emit_cmp_insn (index_val, lo_r, LT, 0, GET_MODE (index_val), 0, 0);
  4026.         emit_jump_insn (gen_blt (op1));
  4027.       }
  4028.  
  4029.     if (! (GET_CODE (index_val) == CONST_INT
  4030.            && GET_CODE (hi_r) == CONST_INT))
  4031.       {
  4032.         emit_cmp_insn (index_val, hi_r, GT, 0, GET_MODE (index_val), 0, 0);
  4033.         emit_jump_insn (gen_bgt (op1));
  4034.       }
  4035.  
  4036.     /* Calculate the element number of bit zero in the first word
  4037.        of the set.  */
  4038.     if (GET_CODE (lo_r) == CONST_INT)
  4039.       rlow = gen_rtx (CONST_INT, VOIDmode,
  4040.               INTVAL (lo_r) & ~ (1 << BITS_PER_UNIT));
  4041.     else
  4042.       rlow = expand_binop (index_mode, and_optab,
  4043.                    lo_r, gen_rtx (CONST_INT, VOIDmode,
  4044.                           ~ (1 << BITS_PER_UNIT)),
  4045.                    0, 0, OPTAB_LIB_WIDEN);
  4046.  
  4047.     diff = expand_binop (index_mode, sub_optab,
  4048.                  index_val, rlow, 0, 0, OPTAB_LIB_WIDEN);
  4049.  
  4050.     quo = expand_divmod (0, TRUNC_DIV_EXPR, index_mode, diff,
  4051.                  gen_rtx (CONST_INT, VOIDmode, BITS_PER_UNIT),
  4052.                  0, 0);
  4053.     rem = expand_divmod (1, TRUNC_MOD_EXPR, index_mode, index_val,
  4054.                  gen_rtx (CONST_INT, VOIDmode, BITS_PER_UNIT),
  4055.                  0, 0);
  4056.     addr = memory_address (byte_mode,
  4057.                    expand_binop (index_mode, add_optab,
  4058.                          diff, setaddr));
  4059.     /* Extract the bit we want to examine */
  4060.     bit = expand_shift (RSHIFT_EXPR, byte_mode,
  4061.                 gen_rtx (MEM, byte_mode, addr), rem, 0, 1);
  4062.     result = expand_binop (SImode, and_optab, bit, const1_rtx, target,
  4063.                    1, OPTAB_LIB_WIDEN);
  4064.     emit_move_insn (target, result);
  4065.  
  4066.     /* Output the code to handle the out-of-range case.  */
  4067.     emit_jump (op0);
  4068.     emit_label (op1);
  4069.     emit_move_insn (target, const0_rtx);
  4070.     emit_label (op0);
  4071.     return target;
  4072.       }
  4073.  
  4074.     case WITH_CLEANUP_EXPR:
  4075.       if (RTL_EXPR_RTL (exp) == 0)
  4076.     {
  4077.       RTL_EXPR_RTL (exp)
  4078.         = expand_expr (TREE_OPERAND (exp, 0), target, tmode, modifier);
  4079.       cleanups_this_call
  4080.         = tree_cons (NULL_TREE, TREE_OPERAND (exp, 2), cleanups_this_call);
  4081.       /* That's it for this cleanup.  */
  4082.       TREE_OPERAND (exp, 2) = 0;
  4083.     }
  4084.       return RTL_EXPR_RTL (exp);
  4085.  
  4086.     case CALL_EXPR:
  4087.       /* Check for a built-in function.  */
  4088.       if (TREE_CODE (TREE_OPERAND (exp, 0)) == ADDR_EXPR
  4089.       && TREE_CODE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0)) == FUNCTION_DECL
  4090.       && DECL_BUILT_IN (TREE_OPERAND (TREE_OPERAND (exp, 0), 0)))
  4091.     return expand_builtin (exp, target, subtarget, tmode, ignore);
  4092.       /* If this call was expanded already by preexpand_calls,
  4093.      just return the result we got.  */
  4094.       if (CALL_EXPR_RTL (exp) != 0)
  4095.     return CALL_EXPR_RTL (exp);
  4096.       return expand_call (exp, target, ignore);
  4097.  
  4098.     case NON_LVALUE_EXPR:
  4099.     case NOP_EXPR:
  4100.     case CONVERT_EXPR:
  4101.     case REFERENCE_EXPR:
  4102.       if (TREE_CODE (type) == VOID_TYPE || ignore)
  4103.     {
  4104.       expand_expr (TREE_OPERAND (exp, 0), const0_rtx, VOIDmode, modifier);
  4105.       return const0_rtx;
  4106.     }
  4107.       if (mode == TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0))))
  4108.     return expand_expr (TREE_OPERAND (exp, 0), target, VOIDmode, modifier);
  4109.       if (TREE_CODE (type) == UNION_TYPE)
  4110.     {
  4111.       tree valtype = TREE_TYPE (TREE_OPERAND (exp, 0));
  4112.       if (target == 0)
  4113.         {
  4114.           if (mode == BLKmode)
  4115.         {
  4116.           if (TYPE_SIZE (type) == 0
  4117.               || TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST)
  4118.             abort ();
  4119.           target = assign_stack_temp (BLKmode,
  4120.                           (TREE_INT_CST_LOW (TYPE_SIZE (type))
  4121.                            + BITS_PER_UNIT - 1)
  4122.                           / BITS_PER_UNIT, 0);
  4123.         }
  4124.           else
  4125.         target = gen_reg_rtx (mode);
  4126.         }
  4127.       if (GET_CODE (target) == MEM)
  4128.         /* Store data into beginning of memory target.  */
  4129.         store_expr (TREE_OPERAND (exp, 0),
  4130.             change_address (target, TYPE_MODE (valtype), 0), 0);
  4131.  
  4132.       else if (GET_CODE (target) == REG)
  4133.         /* Store this field into a union of the proper type.  */
  4134.         store_field (target, GET_MODE_BITSIZE (TYPE_MODE (valtype)), 0,
  4135.              TYPE_MODE (valtype), TREE_OPERAND (exp, 0),
  4136.              VOIDmode, 0, 1,
  4137.              int_size_in_bytes (TREE_TYPE (TREE_OPERAND (exp, 0))));
  4138.       else
  4139.         abort ();
  4140.  
  4141.       /* Return the entire union.  */
  4142.       return target;
  4143.     }
  4144.       op0 = expand_expr (TREE_OPERAND (exp, 0), NULL_RTX, mode, 0);
  4145.       if (GET_MODE (op0) == mode || GET_MODE (op0) == VOIDmode)
  4146.     return op0;
  4147.       if (modifier == EXPAND_INITIALIZER)
  4148.     return gen_rtx (unsignedp ? ZERO_EXTEND : SIGN_EXTEND, mode, op0);
  4149.       if (flag_force_mem && GET_CODE (op0) == MEM)
  4150.     op0 = copy_to_reg (op0);
  4151.  
  4152.       if (target == 0)
  4153.     return convert_to_mode (mode, op0, TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (exp, 0))));
  4154.       else
  4155.     convert_move (target, op0, TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (exp, 0))));
  4156.       return target;
  4157.  
  4158.     case PLUS_EXPR:
  4159.       /* We come here from MINUS_EXPR when the second operand is a constant. */
  4160.     plus_expr:
  4161.       this_optab = add_optab;
  4162.  
  4163.       /* If we are adding a constant, an RTL_EXPR that is sp, fp, or ap, and
  4164.      something else, make sure we add the register to the constant and
  4165.      then to the other thing.  This case can occur during strength
  4166.      reduction and doing it this way will produce better code if the
  4167.      frame pointer or argument pointer is eliminated.
  4168.  
  4169.      fold-const.c will ensure that the constant is always in the inner
  4170.      PLUS_EXPR, so the only case we need to do anything about is if
  4171.      sp, ap, or fp is our second argument, in which case we must swap
  4172.      the innermost first argument and our second argument.  */
  4173.  
  4174.       if (TREE_CODE (TREE_OPERAND (exp, 0)) == PLUS_EXPR
  4175.       && TREE_CODE (TREE_OPERAND (TREE_OPERAND (exp, 0), 1)) == INTEGER_CST
  4176.       && TREE_CODE (TREE_OPERAND (exp, 1)) == RTL_EXPR
  4177.       && (RTL_EXPR_RTL (TREE_OPERAND (exp, 1)) == frame_pointer_rtx
  4178.           || RTL_EXPR_RTL (TREE_OPERAND (exp, 1)) == stack_pointer_rtx
  4179.           || RTL_EXPR_RTL (TREE_OPERAND (exp, 1)) == arg_pointer_rtx))
  4180.     {
  4181.       tree t = TREE_OPERAND (exp, 1);
  4182.  
  4183.       TREE_OPERAND (exp, 1) = TREE_OPERAND (TREE_OPERAND (exp, 0), 0);
  4184.       TREE_OPERAND (TREE_OPERAND (exp, 0), 0) = t;
  4185.     }
  4186.  
  4187.       /* If the result is to be Pmode and we are adding an integer to
  4188.      something, we might be forming a constant.  So try to use
  4189.      plus_constant.  If it produces a sum and we can't accept it,
  4190.      use force_operand.  This allows P = &ARR[const] to generate
  4191.      efficient code on machines where a SYMBOL_REF is not a valid
  4192.      address.
  4193.  
  4194.      If this is an EXPAND_SUM call, always return the sum.  */
  4195.       if (TREE_CODE (TREE_OPERAND (exp, 0)) == INTEGER_CST
  4196.       && GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT
  4197.       && (modifier == EXPAND_SUM || modifier == EXPAND_INITIALIZER
  4198.           || mode == Pmode))
  4199.     {
  4200.       op1 = expand_expr (TREE_OPERAND (exp, 1), subtarget, VOIDmode,
  4201.                  EXPAND_SUM);
  4202.       op1 = plus_constant (op1, TREE_INT_CST_LOW (TREE_OPERAND (exp, 0)));
  4203.       if (modifier != EXPAND_SUM && modifier != EXPAND_INITIALIZER)
  4204.         op1 = force_operand (op1, target);
  4205.       return op1;
  4206.     }
  4207.  
  4208.       else if (TREE_CODE (TREE_OPERAND (exp, 1)) == INTEGER_CST
  4209.            && GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_INT
  4210.            && (modifier == EXPAND_SUM || modifier == EXPAND_INITIALIZER
  4211.            || mode == Pmode))
  4212.     {
  4213.       op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode,
  4214.                  EXPAND_SUM);
  4215.       op0 = plus_constant (op0, TREE_INT_CST_LOW (TREE_OPERAND (exp, 1)));
  4216.       if (modifier != EXPAND_SUM && modifier != EXPAND_INITIALIZER)
  4217.         op0 = force_operand (op0, target);
  4218.       return op0;
  4219.     }
  4220.  
  4221.       /* No sense saving up arithmetic to be done
  4222.      if it's all in the wrong mode to form part of an address.
  4223.      And force_operand won't know whether to sign-extend or
  4224.      zero-extend.  */
  4225.       if ((modifier != EXPAND_SUM && modifier != EXPAND_INITIALIZER)
  4226.       || mode != Pmode) goto binop;
  4227.  
  4228.       preexpand_calls (exp);
  4229.       if (! safe_from_p (subtarget, TREE_OPERAND (exp, 1)))
  4230.     subtarget = 0;
  4231.  
  4232.       op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, modifier);
  4233.       op1 = expand_expr (TREE_OPERAND (exp, 1), NULL_RTX, VOIDmode, modifier);
  4234.  
  4235.       /* Make sure any term that's a sum with a constant comes last.  */
  4236.       if (GET_CODE (op0) == PLUS
  4237.       && CONSTANT_P (XEXP (op0, 1)))
  4238.     {
  4239.       temp = op0;
  4240.       op0 = op1;
  4241.       op1 = temp;
  4242.     }
  4243.       /* If adding to a sum including a constant,
  4244.      associate it to put the constant outside.  */
  4245.       if (GET_CODE (op1) == PLUS
  4246.       && CONSTANT_P (XEXP (op1, 1)))
  4247.     {
  4248.       rtx constant_term = const0_rtx;
  4249.  
  4250.       temp = simplify_binary_operation (PLUS, mode, XEXP (op1, 0), op0);
  4251.       if (temp != 0)
  4252.         op0 = temp;
  4253.       /* Ensure that MULT comes first if there is one.  */
  4254.       else if (GET_CODE (op0) == MULT)
  4255.         op0 = gen_rtx (PLUS, mode, op0, XEXP (op1, 0));
  4256.       else
  4257.         op0 = gen_rtx (PLUS, mode, XEXP (op1, 0), op0);
  4258.  
  4259.       /* Let's also eliminate constants from op0 if possible.  */
  4260.       op0 = eliminate_constant_term (op0, &constant_term);
  4261.  
  4262.       /* CONSTANT_TERM and XEXP (op1, 1) are known to be constant, so
  4263.          their sum should be a constant.  Form it into OP1, since the 
  4264.          result we want will then be OP0 + OP1.  */
  4265.  
  4266.       temp = simplify_binary_operation (PLUS, mode, constant_term,
  4267.                         XEXP (op1, 1));
  4268.       if (temp != 0)
  4269.         op1 = temp;
  4270.       else
  4271.         op1 = gen_rtx (PLUS, mode, constant_term, XEXP (op1, 1));
  4272.     }
  4273.  
  4274.       /* Put a constant term last and put a multiplication first.  */
  4275.       if (CONSTANT_P (op0) || GET_CODE (op1) == MULT)
  4276.     temp = op1, op1 = op0, op0 = temp;
  4277.  
  4278.       temp = simplify_binary_operation (PLUS, mode, op0, op1);
  4279.       return temp ? temp : gen_rtx (PLUS, mode, op0, op1);
  4280.  
  4281.     case MINUS_EXPR:
  4282.       /* Handle difference of two symbolic constants,
  4283.      for the sake of an initializer.  */
  4284.       if ((modifier == EXPAND_SUM || modifier == EXPAND_INITIALIZER)
  4285.       && really_constant_p (TREE_OPERAND (exp, 0))
  4286.       && really_constant_p (TREE_OPERAND (exp, 1)))
  4287.     {
  4288.       rtx op0 = expand_expr (TREE_OPERAND (exp, 0), NULL_RTX,
  4289.                  VOIDmode, modifier);
  4290.       rtx op1 = expand_expr (TREE_OPERAND (exp, 1), NULL_RTX,
  4291.                  VOIDmode, modifier);
  4292.       return gen_rtx (MINUS, mode, op0, op1);
  4293.     }
  4294.       /* Convert A - const to A + (-const).  */
  4295.       if (TREE_CODE (TREE_OPERAND (exp, 1)) == INTEGER_CST)
  4296.     {
  4297.       exp = build (PLUS_EXPR, type, TREE_OPERAND (exp, 0),
  4298.                fold (build1 (NEGATE_EXPR, type,
  4299.                      TREE_OPERAND (exp, 1))));
  4300.       goto plus_expr;
  4301.     }
  4302.       this_optab = sub_optab;
  4303.       goto binop;
  4304.  
  4305.     case MULT_EXPR:
  4306.       preexpand_calls (exp);
  4307.       /* If first operand is constant, swap them.
  4308.      Thus the following special case checks need only
  4309.      check the second operand.  */
  4310.       if (TREE_CODE (TREE_OPERAND (exp, 0)) == INTEGER_CST)
  4311.     {
  4312.       register tree t1 = TREE_OPERAND (exp, 0);
  4313.       TREE_OPERAND (exp, 0) = TREE_OPERAND (exp, 1);
  4314.       TREE_OPERAND (exp, 1) = t1;
  4315.     }
  4316.  
  4317.       /* Attempt to return something suitable for generating an
  4318.      indexed address, for machines that support that.  */
  4319.  
  4320.       if (modifier == EXPAND_SUM && mode == Pmode
  4321.       && TREE_CODE (TREE_OPERAND (exp, 1)) == INTEGER_CST
  4322.       && GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT)
  4323.     {
  4324.       op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, EXPAND_SUM);
  4325.  
  4326.       /* Apply distributive law if OP0 is x+c.  */
  4327.       if (GET_CODE (op0) == PLUS
  4328.           && GET_CODE (XEXP (op0, 1)) == CONST_INT)
  4329.         return gen_rtx (PLUS, mode,
  4330.                 gen_rtx (MULT, mode, XEXP (op0, 0),
  4331.                      GEN_INT (TREE_INT_CST_LOW (TREE_OPERAND (exp, 1)))),
  4332.                 GEN_INT (TREE_INT_CST_LOW (TREE_OPERAND (exp, 1))
  4333.                      * INTVAL (XEXP (op0, 1))));
  4334.  
  4335.       if (GET_CODE (op0) != REG)
  4336.         op0 = force_operand (op0, NULL_RTX);
  4337.       if (GET_CODE (op0) != REG)
  4338.         op0 = copy_to_mode_reg (mode, op0);
  4339.  
  4340.       return gen_rtx (MULT, mode, op0,
  4341.               GEN_INT (TREE_INT_CST_LOW (TREE_OPERAND (exp, 1))));
  4342.     }
  4343.  
  4344.       if (! safe_from_p (subtarget, TREE_OPERAND (exp, 1)))
  4345.     subtarget = 0;
  4346.  
  4347.       /* Check for multiplying things that have been extended
  4348.      from a narrower type.  If this machine supports multiplying
  4349.      in that narrower type with a result in the desired type,
  4350.      do it that way, and avoid the explicit type-conversion.  */
  4351.       if (TREE_CODE (TREE_OPERAND (exp, 0)) == NOP_EXPR
  4352.       && TREE_CODE (type) == INTEGER_TYPE
  4353.       && (TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0)))
  4354.           < TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (exp, 0))))
  4355.       && ((TREE_CODE (TREE_OPERAND (exp, 1)) == INTEGER_CST
  4356.            && int_fits_type_p (TREE_OPERAND (exp, 1),
  4357.                    TREE_TYPE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0)))
  4358.            /* Don't use a widening multiply if a shift will do.  */
  4359.            && ((GET_MODE_BITSIZE (TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 1))))
  4360.             > HOST_BITS_PER_WIDE_INT)
  4361.            || exact_log2 (TREE_INT_CST_LOW (TREE_OPERAND (exp, 1))) < 0))
  4362.           ||
  4363.           (TREE_CODE (TREE_OPERAND (exp, 1)) == NOP_EXPR
  4364.            && (TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (exp, 1), 0)))
  4365.            ==
  4366.            TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0))))
  4367.            /* If both operands are extended, they must either both
  4368.           be zero-extended or both be sign-extended.  */
  4369.            && (TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (exp, 1), 0)))
  4370.            ==
  4371.            TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0)))))))
  4372.     {
  4373.       enum machine_mode innermode
  4374.         = TYPE_MODE (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0)));
  4375.       this_optab = (TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0)))
  4376.             ? umul_widen_optab : smul_widen_optab);
  4377.       if (mode == GET_MODE_WIDER_MODE (innermode)
  4378.           && this_optab->handlers[(int) mode].insn_code != CODE_FOR_nothing)
  4379.         {
  4380.           op0 = expand_expr (TREE_OPERAND (TREE_OPERAND (exp, 0), 0),
  4381.                  NULL_RTX, VOIDmode, 0);
  4382.           if (TREE_CODE (TREE_OPERAND (exp, 1)) == INTEGER_CST)
  4383.         op1 = expand_expr (TREE_OPERAND (exp, 1), NULL_RTX,
  4384.                    VOIDmode, 0);
  4385.           else
  4386.         op1 = expand_expr (TREE_OPERAND (TREE_OPERAND (exp, 1), 0),
  4387.                    NULL_RTX, VOIDmode, 0);
  4388.           goto binop2;
  4389.         }
  4390.     }
  4391.       op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, 0);
  4392.       op1 = expand_expr (TREE_OPERAND (exp, 1), NULL_RTX, VOIDmode, 0);
  4393.       return expand_mult (mode, op0, op1, target, unsignedp);
  4394.  
  4395.     case TRUNC_DIV_EXPR:
  4396.     case FLOOR_DIV_EXPR:
  4397.     case CEIL_DIV_EXPR:
  4398.     case ROUND_DIV_EXPR:
  4399.     case EXACT_DIV_EXPR:
  4400.       preexpand_calls (exp);
  4401.       if (! safe_from_p (subtarget, TREE_OPERAND (exp, 1)))
  4402.     subtarget = 0;
  4403.       /* Possible optimization: compute the dividend with EXPAND_SUM
  4404.      then if the divisor is constant can optimize the case
  4405.      where some terms of the dividend have coeffs divisible by it.  */
  4406.       op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, 0);
  4407.       op1 = expand_expr (TREE_OPERAND (exp, 1), NULL_RTX, VOIDmode, 0);
  4408.       return expand_divmod (0, code, mode, op0, op1, target, unsignedp);
  4409.  
  4410.     case RDIV_EXPR:
  4411.       this_optab = flodiv_optab;
  4412.       goto binop;
  4413.  
  4414.     case TRUNC_MOD_EXPR:
  4415.     case FLOOR_MOD_EXPR:
  4416.     case CEIL_MOD_EXPR:
  4417.     case ROUND_MOD_EXPR:
  4418.       preexpand_calls (exp);
  4419.       if (! safe_from_p (subtarget, TREE_OPERAND (exp, 1)))
  4420.     subtarget = 0;
  4421.       op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, 0);
  4422.       op1 = expand_expr (TREE_OPERAND (exp, 1), NULL_RTX, VOIDmode, 0);
  4423.       return expand_divmod (1, code, mode, op0, op1, target, unsignedp);
  4424.  
  4425.     case FIX_ROUND_EXPR:
  4426.     case FIX_FLOOR_EXPR:
  4427.     case FIX_CEIL_EXPR:
  4428.       abort ();            /* Not used for C.  */
  4429.  
  4430.     case FIX_TRUNC_EXPR:
  4431.       op0 = expand_expr (TREE_OPERAND (exp, 0), NULL_RTX, VOIDmode, 0);
  4432.       if (target == 0)
  4433.     target = gen_reg_rtx (mode);
  4434.       expand_fix (target, op0, unsignedp);
  4435.       return target;
  4436.  
  4437.     case FLOAT_EXPR:
  4438.       op0 = expand_expr (TREE_OPERAND (exp, 0), NULL_RTX, VOIDmode, 0);
  4439.       if (target == 0)
  4440.     target = gen_reg_rtx (mode);
  4441.       /* expand_float can't figure out what to do if FROM has VOIDmode.
  4442.      So give it the correct mode.  With -O, cse will optimize this.  */
  4443.       if (GET_MODE (op0) == VOIDmode)
  4444.     op0 = copy_to_mode_reg (TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0))),
  4445.                 op0);
  4446.       expand_float (target, op0,
  4447.             TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (exp, 0))));
  4448.       return target;
  4449.  
  4450.     case NEGATE_EXPR:
  4451.       op0 = expand_expr (TREE_OPERAND (exp, 0), target, VOIDmode, 0);
  4452.       temp = expand_unop (mode, neg_optab, op0, target, 0);
  4453.       if (temp == 0)
  4454.     abort ();
  4455.       return temp;
  4456.  
  4457.     case ABS_EXPR:
  4458.       op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, 0);
  4459.  
  4460.       /* Handle complex values specially.  */
  4461.       {
  4462.     enum machine_mode opmode
  4463.       = TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0)));
  4464.  
  4465.     if (GET_MODE_CLASS (opmode) == MODE_COMPLEX_INT
  4466.         || GET_MODE_CLASS (opmode) == MODE_COMPLEX_FLOAT)
  4467.       return expand_complex_abs (opmode, op0, target, unsignedp);
  4468.       }
  4469.  
  4470.       /* Unsigned abs is simply the operand.  Testing here means we don't
  4471.      risk generating incorrect code below.  */
  4472.       if (TREE_UNSIGNED (type))
  4473.     return op0;
  4474.  
  4475.       /* First try to do it with a special abs instruction.  */
  4476.       temp = expand_unop (mode, abs_optab, op0, target, 0);
  4477.       if (temp != 0)
  4478.     return temp;
  4479.  
  4480.       /* If this machine has expensive jumps, we can do integer absolute
  4481.      value of X as (((signed) x >> (W-1)) ^ x) - ((signed) x >> (W-1)),
  4482.      where W is the width of MODE.  */
  4483.  
  4484.       if (GET_MODE_CLASS (mode) == MODE_INT && BRANCH_COST >= 2)
  4485.     {
  4486.       rtx extended = expand_shift (RSHIFT_EXPR, mode, op0,
  4487.                        size_int (GET_MODE_BITSIZE (mode) - 1),
  4488.                        NULL_RTX, 0);
  4489.  
  4490.       temp = expand_binop (mode, xor_optab, extended, op0, target, 0,
  4491.                    OPTAB_LIB_WIDEN);
  4492.       if (temp != 0)
  4493.         temp = expand_binop (mode, sub_optab, temp, extended, target, 0,
  4494.                  OPTAB_LIB_WIDEN);
  4495.  
  4496.       if (temp != 0)
  4497.         return temp;
  4498.     }
  4499.  
  4500.       /* If that does not win, use conditional jump and negate.  */
  4501.       target = original_target;
  4502.       temp = gen_label_rtx ();
  4503.       if (target == 0 || ! safe_from_p (target, TREE_OPERAND (exp, 0))
  4504.       || (GET_CODE (target) == REG
  4505.           && REGNO (target) < FIRST_PSEUDO_REGISTER))
  4506.     target = gen_reg_rtx (mode);
  4507.       emit_move_insn (target, op0);
  4508.       emit_cmp_insn (target,
  4509.              expand_expr (convert (type, integer_zero_node),
  4510.                   NULL_RTX, VOIDmode, 0),
  4511.              GE, NULL_RTX, mode, 0, 0);
  4512.       NO_DEFER_POP;
  4513.       emit_jump_insn (gen_bge (temp));
  4514.       op0 = expand_unop (mode, neg_optab, target, target, 0);
  4515.       if (op0 != target)
  4516.     emit_move_insn (target, op0);
  4517.       emit_label (temp);
  4518.       OK_DEFER_POP;
  4519.       return target;
  4520.  
  4521.     case MAX_EXPR:
  4522.     case MIN_EXPR:
  4523.       target = original_target;
  4524.       if (target == 0 || ! safe_from_p (target, TREE_OPERAND (exp, 1))
  4525.       || (GET_CODE (target) == REG
  4526.           && REGNO (target) < FIRST_PSEUDO_REGISTER))
  4527.     target = gen_reg_rtx (mode);
  4528.       op1 = expand_expr (TREE_OPERAND (exp, 1), NULL_RTX, VOIDmode, 0);
  4529.       op0 = expand_expr (TREE_OPERAND (exp, 0), target, VOIDmode, 0);
  4530.  
  4531.       /* First try to do it with a special MIN or MAX instruction.
  4532.      If that does not win, use a conditional jump to select the proper
  4533.      value.  */
  4534.       this_optab = (TREE_UNSIGNED (type)
  4535.             ? (code == MIN_EXPR ? umin_optab : umax_optab)
  4536.             : (code == MIN_EXPR ? smin_optab : smax_optab));
  4537.  
  4538.       temp = expand_binop (mode, this_optab, op0, op1, target, unsignedp,
  4539.                OPTAB_WIDEN);
  4540.       if (temp != 0)
  4541.     return temp;
  4542.  
  4543.       if (target != op0)
  4544.     emit_move_insn (target, op0);
  4545.       op0 = gen_label_rtx ();
  4546.       if (code == MAX_EXPR)
  4547.     temp = (TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (exp, 1)))
  4548.         ? compare_from_rtx (target, op1, GEU, 1, mode, NULL_RTX, 0)
  4549.         : compare_from_rtx (target, op1, GE, 0, mode, NULL_RTX, 0));
  4550.       else
  4551.     temp = (TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (exp, 1)))
  4552.         ? compare_from_rtx (target, op1, LEU, 1, mode, NULL_RTX, 0)
  4553.         : compare_from_rtx (target, op1, LE, 0, mode, NULL_RTX, 0));
  4554.       if (temp == const0_rtx)
  4555.     emit_move_insn (target, op1);
  4556.       else if (temp != const_true_rtx)
  4557.     {
  4558.       if (bcc_gen_fctn[(int) GET_CODE (temp)] != 0)
  4559.         emit_jump_insn ((*bcc_gen_fctn[(int) GET_CODE (temp)]) (op0));
  4560.       else
  4561.         abort ();
  4562.       emit_move_insn (target, op1);
  4563.     }
  4564.       emit_label (op0);
  4565.       return target;
  4566.  
  4567. /* ??? Can optimize when the operand of this is a bitwise operation,
  4568.    by using a different bitwise operation.  */
  4569.     case BIT_NOT_EXPR:
  4570.       op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, 0);
  4571.       temp = expand_unop (mode, one_cmpl_optab, op0, target, 1);
  4572.       if (temp == 0)
  4573.     abort ();
  4574.       return temp;
  4575.  
  4576.     case FFS_EXPR:
  4577.       op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, 0);
  4578.       temp = expand_unop (mode, ffs_optab, op0, target, 1);
  4579.       if (temp == 0)
  4580.     abort ();
  4581.       return temp;
  4582.  
  4583. /* ??? Can optimize bitwise operations with one arg constant.
  4584.    Can optimize (a bitwise1 n) bitwise2 (a bitwise3 b)
  4585.    and (a bitwise1 b) bitwise2 b (etc)
  4586.    but that is probably not worth while.  */
  4587.  
  4588. /* BIT_AND_EXPR is for bitwise anding.
  4589.    TRUTH_AND_EXPR is for anding two boolean values
  4590.    when we want in all cases to compute both of them.
  4591.    In general it is fastest to do TRUTH_AND_EXPR by
  4592.    computing both operands as actual zero-or-1 values
  4593.    and then bitwise anding.  In cases where there cannot
  4594.    be any side effects, better code would be made by
  4595.    treating TRUTH_AND_EXPR like TRUTH_ANDIF_EXPR;
  4596.    but the question is how to recognize those cases.  */
  4597.  
  4598.     case TRUTH_AND_EXPR:
  4599.     case BIT_AND_EXPR:
  4600.       this_optab = and_optab;
  4601.       goto binop;
  4602.  
  4603. /* See comment above about TRUTH_AND_EXPR; it applies here too.  */
  4604.     case TRUTH_OR_EXPR:
  4605.     case BIT_IOR_EXPR:
  4606.       this_optab = ior_optab;
  4607.       goto binop;
  4608.  
  4609.     case BIT_XOR_EXPR:
  4610.       this_optab = xor_optab;
  4611.       goto binop;
  4612.  
  4613.     case LSHIFT_EXPR:
  4614.     case RSHIFT_EXPR:
  4615.     case LROTATE_EXPR:
  4616.     case RROTATE_EXPR:
  4617.       preexpand_calls (exp);
  4618.       if (! safe_from_p (subtarget, TREE_OPERAND (exp, 1)))
  4619.     subtarget = 0;
  4620.       op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, 0);
  4621.       return expand_shift (code, mode, op0, TREE_OPERAND (exp, 1), target,
  4622.                unsignedp);
  4623.  
  4624. /* Could determine the answer when only additive constants differ.
  4625.    Also, the addition of one can be handled by changing the condition.  */
  4626.     case LT_EXPR:
  4627.     case LE_EXPR:
  4628.     case GT_EXPR:
  4629.     case GE_EXPR:
  4630.     case EQ_EXPR:
  4631.     case NE_EXPR:
  4632.       preexpand_calls (exp);
  4633.       temp = do_store_flag (exp, target, tmode != VOIDmode ? tmode : mode, 0);
  4634.       if (temp != 0)
  4635.     return temp;
  4636.       /* For foo != 0, load foo, and if it is nonzero load 1 instead. */
  4637.       if (code == NE_EXPR && integer_zerop (TREE_OPERAND (exp, 1))
  4638.       && original_target
  4639.       && GET_CODE (original_target) == REG
  4640.       && (GET_MODE (original_target)
  4641.           == TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0)))))
  4642.     {
  4643.       temp = expand_expr (TREE_OPERAND (exp, 0), original_target, VOIDmode, 0);
  4644.       if (temp != original_target)
  4645.         temp = copy_to_reg (temp);
  4646.       op1 = gen_label_rtx ();
  4647.       emit_cmp_insn (temp, const0_rtx, EQ, NULL_RTX,
  4648.              GET_MODE (temp), unsignedp, 0);
  4649.       emit_jump_insn (gen_beq (op1));
  4650.       emit_move_insn (temp, const1_rtx);
  4651.       emit_label (op1);
  4652.       return temp;
  4653.     }
  4654.       /* If no set-flag instruction, must generate a conditional
  4655.      store into a temporary variable.  Drop through
  4656.      and handle this like && and ||.  */
  4657.  
  4658.     case TRUTH_ANDIF_EXPR:
  4659.     case TRUTH_ORIF_EXPR:
  4660.       if (target == 0 || ! safe_from_p (target, exp)
  4661.       /* Make sure we don't have a hard reg (such as function's return
  4662.          value) live across basic blocks, if not optimizing.  */
  4663.       || (!optimize && GET_CODE (target) == REG
  4664.           && REGNO (target) < FIRST_PSEUDO_REGISTER))
  4665.     target = gen_reg_rtx (tmode != VOIDmode ? tmode : mode);
  4666.       emit_clr_insn (target);
  4667.       op1 = gen_label_rtx ();
  4668.       jumpifnot (exp, op1);
  4669.       emit_0_to_1_insn (target);
  4670.       emit_label (op1);
  4671.       return target;
  4672.  
  4673.     case TRUTH_NOT_EXPR:
  4674.       op0 = expand_expr (TREE_OPERAND (exp, 0), target, VOIDmode, 0);
  4675.       /* The parser is careful to generate TRUTH_NOT_EXPR
  4676.      only with operands that are always zero or one.  */
  4677.       temp = expand_binop (mode, xor_optab, op0, const1_rtx,
  4678.                target, 1, OPTAB_LIB_WIDEN);
  4679.       if (temp == 0)
  4680.     abort ();
  4681.       return temp;
  4682.  
  4683.     case COMPOUND_EXPR:
  4684.       expand_expr (TREE_OPERAND (exp, 0), const0_rtx, VOIDmode, 0);
  4685.       emit_queue ();
  4686.       return expand_expr (TREE_OPERAND (exp, 1),
  4687.               (ignore ? const0_rtx : target),
  4688.               VOIDmode, 0);
  4689.  
  4690.     case COND_EXPR:
  4691.       {
  4692.     /* Note that COND_EXPRs whose type is a structure or union
  4693.        are required to be constructed to contain assignments of
  4694.        a temporary variable, so that we can evaluate them here
  4695.        for side effect only.  If type is void, we must do likewise.  */
  4696.  
  4697.     /* If an arm of the branch requires a cleanup,
  4698.        only that cleanup is performed.  */
  4699.  
  4700.     tree singleton = 0;
  4701.     tree binary_op = 0, unary_op = 0;
  4702.     tree old_cleanups = cleanups_this_call;
  4703.     cleanups_this_call = 0;
  4704.  
  4705.     /* If this is (A ? 1 : 0) and A is a condition, just evaluate it and
  4706.        convert it to our mode, if necessary.  */
  4707.     if (integer_onep (TREE_OPERAND (exp, 1))
  4708.         && integer_zerop (TREE_OPERAND (exp, 2))
  4709.         && TREE_CODE_CLASS (TREE_CODE (TREE_OPERAND (exp, 0))) == '<')
  4710.       {
  4711.         op0 = expand_expr (TREE_OPERAND (exp, 0), target, mode, modifier);
  4712.         if (GET_MODE (op0) == mode)
  4713.           return op0;
  4714.         if (target == 0)
  4715.           target = gen_reg_rtx (mode);
  4716.         convert_move (target, op0, unsignedp);
  4717.         return target;
  4718.       }
  4719.  
  4720.     /* If we are not to produce a result, we have no target.  Otherwise,
  4721.        if a target was specified use it; it will not be used as an
  4722.        intermediate target unless it is safe.  If no target, use a 
  4723.        temporary.  */
  4724.  
  4725.     if (mode == VOIDmode || ignore)
  4726.       temp = 0;
  4727.     else if (original_target
  4728.          && safe_from_p (original_target, TREE_OPERAND (exp, 0)))
  4729.       temp = original_target;
  4730.     else if (mode == BLKmode)
  4731.       {
  4732.         if (TYPE_SIZE (type) == 0
  4733.         || TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST)
  4734.           abort ();
  4735.         temp = assign_stack_temp (BLKmode,
  4736.                       (TREE_INT_CST_LOW (TYPE_SIZE (type))
  4737.                        + BITS_PER_UNIT - 1)
  4738.                       / BITS_PER_UNIT, 0);
  4739.       }
  4740.     else
  4741.       temp = gen_reg_rtx (mode);
  4742.  
  4743.     /* Check for X ? A + B : A.  If we have this, we can copy
  4744.        A to the output and conditionally add B.  Similarly for unary
  4745.        operations.  Don't do this if X has side-effects because
  4746.        those side effects might affect A or B and the "?" operation is
  4747.        a sequence point in ANSI.  (We test for side effects later.)  */
  4748.  
  4749.     if (TREE_CODE_CLASS (TREE_CODE (TREE_OPERAND (exp, 1))) == '2'
  4750.         && operand_equal_p (TREE_OPERAND (exp, 2),
  4751.                 TREE_OPERAND (TREE_OPERAND (exp, 1), 0), 0))
  4752.       singleton = TREE_OPERAND (exp, 2), binary_op = TREE_OPERAND (exp, 1);
  4753.     else if (TREE_CODE_CLASS (TREE_CODE (TREE_OPERAND (exp, 2))) == '2'
  4754.          && operand_equal_p (TREE_OPERAND (exp, 1),
  4755.                      TREE_OPERAND (TREE_OPERAND (exp, 2), 0), 0))
  4756.       singleton = TREE_OPERAND (exp, 1), binary_op = TREE_OPERAND (exp, 2);
  4757.     else if (TREE_CODE_CLASS (TREE_CODE (TREE_OPERAND (exp, 1))) == '1'
  4758.          && operand_equal_p (TREE_OPERAND (exp, 2),
  4759.                      TREE_OPERAND (TREE_OPERAND (exp, 1), 0), 0))
  4760.       singleton = TREE_OPERAND (exp, 2), unary_op = TREE_OPERAND (exp, 1);
  4761.     else if (TREE_CODE_CLASS (TREE_CODE (TREE_OPERAND (exp, 2))) == '1'
  4762.          && operand_equal_p (TREE_OPERAND (exp, 1),
  4763.                      TREE_OPERAND (TREE_OPERAND (exp, 2), 0), 0))
  4764.       singleton = TREE_OPERAND (exp, 1), unary_op = TREE_OPERAND (exp, 2);
  4765.  
  4766.     /* If we had X ? A + 1 : A and we can do the test of X as a store-flag
  4767.        operation, do this as A + (X != 0).  Similarly for other simple
  4768.        binary operators.  */
  4769.     if (singleton && binary_op
  4770.         && ! TREE_SIDE_EFFECTS (TREE_OPERAND (exp, 0))
  4771.         && (TREE_CODE (binary_op) == PLUS_EXPR
  4772.         || TREE_CODE (binary_op) == MINUS_EXPR
  4773.         || TREE_CODE (binary_op) == BIT_IOR_EXPR
  4774.         || TREE_CODE (binary_op) == BIT_XOR_EXPR
  4775.         || TREE_CODE (binary_op) == BIT_AND_EXPR)
  4776.         && integer_onep (TREE_OPERAND (binary_op, 1))
  4777.         && TREE_CODE_CLASS (TREE_CODE (TREE_OPERAND (exp, 0))) == '<')
  4778.       {
  4779.         rtx result;
  4780.         optab boptab = (TREE_CODE (binary_op) == PLUS_EXPR ? add_optab
  4781.                 : TREE_CODE (binary_op) == MINUS_EXPR ? sub_optab
  4782.                 : TREE_CODE (binary_op) == BIT_IOR_EXPR ? ior_optab
  4783.                 : TREE_CODE (binary_op) == BIT_XOR_EXPR ? xor_optab
  4784.                 : and_optab);
  4785.  
  4786.         /* If we had X ? A : A + 1, do this as A + (X == 0).
  4787.  
  4788.            We have to invert the truth value here and then put it
  4789.            back later if do_store_flag fails.  We cannot simply copy
  4790.            TREE_OPERAND (exp, 0) to another variable and modify that
  4791.            because invert_truthvalue can modify the tree pointed to
  4792.            by its argument.  */
  4793.         if (singleton == TREE_OPERAND (exp, 1))
  4794.           TREE_OPERAND (exp, 0)
  4795.         = invert_truthvalue (TREE_OPERAND (exp, 0));
  4796.  
  4797.         result = do_store_flag (TREE_OPERAND (exp, 0),
  4798.                     (safe_from_p (temp, singleton)
  4799.                      ? temp : NULL_RTX),
  4800.                     mode, BRANCH_COST <= 1);
  4801.  
  4802.         if (result)
  4803.           {
  4804.         op1 = expand_expr (singleton, NULL_RTX, VOIDmode, 0);
  4805.         return expand_binop (mode, boptab, op1, result, temp,
  4806.                      unsignedp, OPTAB_LIB_WIDEN);
  4807.           }
  4808.         else if (singleton == TREE_OPERAND (exp, 1))
  4809.           TREE_OPERAND (exp, 0)
  4810.         = invert_truthvalue (TREE_OPERAND (exp, 0));
  4811.       }
  4812.         
  4813.     NO_DEFER_POP;
  4814.     op0 = gen_label_rtx ();
  4815.  
  4816.     if (singleton && ! TREE_SIDE_EFFECTS (TREE_OPERAND (exp, 0)))
  4817.       {
  4818.         if (temp != 0)
  4819.           {
  4820.         /* If the target conflicts with the other operand of the
  4821.            binary op, we can't use it.  Also, we can't use the target
  4822.            if it is a hard register, because evaluating the condition
  4823.            might clobber it.  */
  4824.         if ((binary_op
  4825.              && ! safe_from_p (temp, TREE_OPERAND (binary_op, 1)))
  4826.             || (GET_CODE (temp) == REG
  4827.             && REGNO (temp) < FIRST_PSEUDO_REGISTER))
  4828.           temp = gen_reg_rtx (mode);
  4829.         store_expr (singleton, temp, 0);
  4830.           }
  4831.         else
  4832.           expand_expr (singleton,
  4833.                ignore ? const1_rtx : NULL_RTX, VOIDmode, 0);
  4834.         if (cleanups_this_call)
  4835.           {
  4836.         sorry ("aggregate value in COND_EXPR");
  4837.         cleanups_this_call = 0;
  4838.           }
  4839.         if (singleton == TREE_OPERAND (exp, 1))
  4840.           jumpif (TREE_OPERAND (exp, 0), op0);
  4841.         else
  4842.           jumpifnot (TREE_OPERAND (exp, 0), op0);
  4843.  
  4844.         if (binary_op && temp == 0)
  4845.           /* Just touch the other operand.  */
  4846.           expand_expr (TREE_OPERAND (binary_op, 1),
  4847.                ignore ? const0_rtx : NULL_RTX, VOIDmode, 0);
  4848.         else if (binary_op)
  4849.           store_expr (build (TREE_CODE (binary_op), type,
  4850.                  make_tree (type, temp),
  4851.                  TREE_OPERAND (binary_op, 1)),
  4852.               temp, 0);
  4853.         else
  4854.           store_expr (build1 (TREE_CODE (unary_op), type,
  4855.                   make_tree (type, temp)),
  4856.               temp, 0);
  4857.         op1 = op0;
  4858.       }
  4859. #if 0
  4860.     /* This is now done in jump.c and is better done there because it
  4861.        produces shorter register lifetimes.  */
  4862.        
  4863.     /* Check for both possibilities either constants or variables
  4864.        in registers (but not the same as the target!).  If so, can
  4865.        save branches by assigning one, branching, and assigning the
  4866.        other.  */
  4867.     else if (temp && GET_MODE (temp) != BLKmode
  4868.          && (TREE_CONSTANT (TREE_OPERAND (exp, 1))
  4869.              || ((TREE_CODE (TREE_OPERAND (exp, 1)) == PARM_DECL
  4870.               || TREE_CODE (TREE_OPERAND (exp, 1)) == VAR_DECL)
  4871.              && DECL_RTL (TREE_OPERAND (exp, 1))
  4872.              && GET_CODE (DECL_RTL (TREE_OPERAND (exp, 1))) == REG
  4873.              && DECL_RTL (TREE_OPERAND (exp, 1)) != temp))
  4874.          && (TREE_CONSTANT (TREE_OPERAND (exp, 2))
  4875.              || ((TREE_CODE (TREE_OPERAND (exp, 2)) == PARM_DECL
  4876.               || TREE_CODE (TREE_OPERAND (exp, 2)) == VAR_DECL)
  4877.              && DECL_RTL (TREE_OPERAND (exp, 2))
  4878.              && GET_CODE (DECL_RTL (TREE_OPERAND (exp, 2))) == REG
  4879.              && DECL_RTL (TREE_OPERAND (exp, 2)) != temp)))
  4880.       {
  4881.         if (GET_CODE (temp) == REG && REGNO (temp) < FIRST_PSEUDO_REGISTER)
  4882.           temp = gen_reg_rtx (mode);
  4883.         store_expr (TREE_OPERAND (exp, 2), temp, 0);
  4884.         jumpifnot (TREE_OPERAND (exp, 0), op0);
  4885.         store_expr (TREE_OPERAND (exp, 1), temp, 0);
  4886.         op1 = op0;
  4887.       }
  4888. #endif
  4889.     /* Check for A op 0 ? A : FOO and A op 0 ? FOO : A where OP is any
  4890.        comparison operator.  If we have one of these cases, set the
  4891.        output to A, branch on A (cse will merge these two references),
  4892.        then set the output to FOO.  */
  4893.     else if (temp
  4894.          && TREE_CODE_CLASS (TREE_CODE (TREE_OPERAND (exp, 0))) == '<'
  4895.          && integer_zerop (TREE_OPERAND (TREE_OPERAND (exp, 0), 1))
  4896.          && operand_equal_p (TREE_OPERAND (TREE_OPERAND (exp, 0), 0),
  4897.                      TREE_OPERAND (exp, 1), 0)
  4898.          && ! TREE_SIDE_EFFECTS (TREE_OPERAND (exp, 0))
  4899.          && safe_from_p (temp, TREE_OPERAND (exp, 2)))
  4900.       {
  4901.         if (GET_CODE (temp) == REG && REGNO (temp) < FIRST_PSEUDO_REGISTER)
  4902.           temp = gen_reg_rtx (mode);
  4903.         store_expr (TREE_OPERAND (exp, 1), temp, 0);
  4904.         jumpif (TREE_OPERAND (exp, 0), op0);
  4905.         store_expr (TREE_OPERAND (exp, 2), temp, 0);
  4906.         op1 = op0;
  4907.       }
  4908.     else if (temp
  4909.          && TREE_CODE_CLASS (TREE_CODE (TREE_OPERAND (exp, 0))) == '<'
  4910.          && integer_zerop (TREE_OPERAND (TREE_OPERAND (exp, 0), 1))
  4911.          && operand_equal_p (TREE_OPERAND (TREE_OPERAND (exp, 0), 0),
  4912.                      TREE_OPERAND (exp, 2), 0)
  4913.          && ! TREE_SIDE_EFFECTS (TREE_OPERAND (exp, 0))
  4914.          && safe_from_p (temp, TREE_OPERAND (exp, 1)))
  4915.       {
  4916.         if (GET_CODE (temp) == REG && REGNO (temp) < FIRST_PSEUDO_REGISTER)
  4917.           temp = gen_reg_rtx (mode);
  4918.         store_expr (TREE_OPERAND (exp, 2), temp, 0);
  4919.         jumpifnot (TREE_OPERAND (exp, 0), op0);
  4920.         store_expr (TREE_OPERAND (exp, 1), temp, 0);
  4921.         op1 = op0;
  4922.       }
  4923.     else
  4924.       {
  4925.         op1 = gen_label_rtx ();
  4926.         jumpifnot (TREE_OPERAND (exp, 0), op0);
  4927.         if (temp != 0)
  4928.           store_expr (TREE_OPERAND (exp, 1), temp, 0);
  4929.         else
  4930.           expand_expr (TREE_OPERAND (exp, 1),
  4931.                ignore ? const0_rtx : NULL_RTX, VOIDmode, 0);
  4932.         if (cleanups_this_call)
  4933.           {
  4934.         sorry ("aggregate value in COND_EXPR");
  4935.         cleanups_this_call = 0;
  4936.           }
  4937.  
  4938.         emit_queue ();
  4939.         emit_jump_insn (gen_jump (op1));
  4940.         emit_barrier ();
  4941.         emit_label (op0);
  4942.         if (temp != 0)
  4943.           store_expr (TREE_OPERAND (exp, 2), temp, 0);
  4944.         else
  4945.           expand_expr (TREE_OPERAND (exp, 2),
  4946.                ignore ? const0_rtx : NULL_RTX, VOIDmode, 0);
  4947.       }
  4948.  
  4949.     if (cleanups_this_call)
  4950.       {
  4951.         sorry ("aggregate value in COND_EXPR");
  4952.         cleanups_this_call = 0;
  4953.       }
  4954.  
  4955.     emit_queue ();
  4956.     emit_label (op1);
  4957.     OK_DEFER_POP;
  4958.     cleanups_this_call = old_cleanups;
  4959.     return temp;
  4960.       }
  4961.  
  4962.     case TARGET_EXPR:
  4963.       {
  4964.     /* Something needs to be initialized, but we didn't know
  4965.        where that thing was when building the tree.  For example,
  4966.        it could be the return value of a function, or a parameter
  4967.        to a function which lays down in the stack, or a temporary
  4968.        variable which must be passed by reference.
  4969.  
  4970.        We guarantee that the expression will either be constructed
  4971.        or copied into our original target.  */
  4972.  
  4973.     tree slot = TREE_OPERAND (exp, 0);
  4974.     tree exp1;
  4975.  
  4976.     if (TREE_CODE (slot) != VAR_DECL)
  4977.       abort ();
  4978.  
  4979.     if (target == 0)
  4980.       {
  4981.         if (DECL_RTL (slot) != 0)
  4982.           {
  4983.         target = DECL_RTL (slot);
  4984.         /* If we have already expanded the slot, so don't do
  4985.            it again.  (mrs)  */
  4986.         if (TREE_OPERAND (exp, 1) == NULL_TREE)
  4987.           return target;
  4988.           }
  4989.         else
  4990.           {
  4991.         target = assign_stack_temp (mode, int_size_in_bytes (type), 0);
  4992.         /* All temp slots at this level must not conflict.  */
  4993.         preserve_temp_slots (target);
  4994.         DECL_RTL (slot) = target;
  4995.           }
  4996.  
  4997. #if 0
  4998.         /* I bet this needs to be done, and I bet that it needs to
  4999.            be above, inside the else clause.  The reason is
  5000.            simple, how else is it going to get cleaned up? (mrs)
  5001.  
  5002.            The reason is probably did not work before, and was
  5003.            commented out is because this was re-expanding already
  5004.            expanded target_exprs (target == 0 and DECL_RTL (slot)
  5005.            != 0) also cleaning them up many times as well.  :-( */
  5006.  
  5007.         /* Since SLOT is not known to the called function
  5008.            to belong to its stack frame, we must build an explicit
  5009.            cleanup.  This case occurs when we must build up a reference
  5010.            to pass the reference as an argument.  In this case,
  5011.            it is very likely that such a reference need not be
  5012.            built here.  */
  5013.  
  5014.         if (TREE_OPERAND (exp, 2) == 0)
  5015.           TREE_OPERAND (exp, 2) = maybe_build_cleanup (slot);
  5016.         if (TREE_OPERAND (exp, 2))
  5017.           cleanups_this_call = tree_cons (NULL_TREE, TREE_OPERAND (exp, 2),
  5018.                           cleanups_this_call);
  5019. #endif
  5020.       }
  5021.     else
  5022.       {
  5023.         /* This case does occur, when expanding a parameter which
  5024.            needs to be constructed on the stack.  The target
  5025.            is the actual stack address that we want to initialize.
  5026.            The function we call will perform the cleanup in this case.  */
  5027.  
  5028.         DECL_RTL (slot) = target;
  5029.       }
  5030.  
  5031.     exp1 = TREE_OPERAND (exp, 1);
  5032.     /* Mark it as expanded.  */
  5033.     TREE_OPERAND (exp, 1) = NULL_TREE;
  5034.  
  5035.     return expand_expr (exp1, target, tmode, modifier);
  5036.       }
  5037.  
  5038.     case INIT_EXPR:
  5039.       {
  5040.     tree lhs = TREE_OPERAND (exp, 0);
  5041.     tree rhs = TREE_OPERAND (exp, 1);
  5042.     tree noncopied_parts = 0;
  5043.     tree lhs_type = TREE_TYPE (lhs);
  5044.  
  5045.     temp = expand_assignment (lhs, rhs, ! ignore, original_target != 0);
  5046.     if (TYPE_NONCOPIED_PARTS (lhs_type) != 0 && !fixed_type_p (rhs))
  5047.       noncopied_parts = init_noncopied_parts (stabilize_reference (lhs),
  5048.                           TYPE_NONCOPIED_PARTS (lhs_type));
  5049.     while (noncopied_parts != 0)
  5050.       {
  5051.         expand_assignment (TREE_VALUE (noncopied_parts),
  5052.                    TREE_PURPOSE (noncopied_parts), 0, 0);
  5053.         noncopied_parts = TREE_CHAIN (noncopied_parts);
  5054.       }
  5055.     return temp;
  5056.       }
  5057.  
  5058.     case MODIFY_EXPR:
  5059.       {
  5060.     /* If lhs is complex, expand calls in rhs before computing it.
  5061.        That's so we don't compute a pointer and save it over a call.
  5062.        If lhs is simple, compute it first so we can give it as a
  5063.        target if the rhs is just a call.  This avoids an extra temp and copy
  5064.        and that prevents a partial-subsumption which makes bad code.
  5065.        Actually we could treat component_ref's of vars like vars.  */
  5066.  
  5067.     tree lhs = TREE_OPERAND (exp, 0);
  5068.     tree rhs = TREE_OPERAND (exp, 1);
  5069.     tree noncopied_parts = 0;
  5070.     tree lhs_type = TREE_TYPE (lhs);
  5071.  
  5072.     temp = 0;
  5073.  
  5074.     if (TREE_CODE (lhs) != VAR_DECL
  5075.         && TREE_CODE (lhs) != RESULT_DECL
  5076.         && TREE_CODE (lhs) != PARM_DECL)
  5077.       preexpand_calls (exp);
  5078.  
  5079.     /* Check for |= or &= of a bitfield of size one into another bitfield
  5080.        of size 1.  In this case, (unless we need the result of the
  5081.        assignment) we can do this more efficiently with a
  5082.        test followed by an assignment, if necessary.
  5083.  
  5084.        ??? At this point, we can't get a BIT_FIELD_REF here.  But if
  5085.        things change so we do, this code should be enhanced to
  5086.        support it.  */
  5087.     if (ignore
  5088.         && TREE_CODE (lhs) == COMPONENT_REF
  5089.         && (TREE_CODE (rhs) == BIT_IOR_EXPR
  5090.         || TREE_CODE (rhs) == BIT_AND_EXPR)
  5091.         && TREE_OPERAND (rhs, 0) == lhs
  5092.         && TREE_CODE (TREE_OPERAND (rhs, 1)) == COMPONENT_REF
  5093.         && TREE_INT_CST_LOW (DECL_SIZE (TREE_OPERAND (lhs, 1))) == 1
  5094.         && TREE_INT_CST_LOW (DECL_SIZE (TREE_OPERAND (TREE_OPERAND (rhs, 1), 1))) == 1)
  5095.       {
  5096.         rtx label = gen_label_rtx ();
  5097.  
  5098.         do_jump (TREE_OPERAND (rhs, 1),
  5099.              TREE_CODE (rhs) == BIT_IOR_EXPR ? label : 0,
  5100.              TREE_CODE (rhs) == BIT_AND_EXPR ? label : 0);
  5101.         expand_assignment (lhs, convert (TREE_TYPE (rhs),
  5102.                          (TREE_CODE (rhs) == BIT_IOR_EXPR
  5103.                           ? integer_one_node
  5104.                           : integer_zero_node)),
  5105.                    0, 0);
  5106.         do_pending_stack_adjust ();
  5107.         emit_label (label);
  5108.         return const0_rtx;
  5109.       }
  5110.  
  5111.     if (TYPE_NONCOPIED_PARTS (lhs_type) != 0
  5112.         && ! (fixed_type_p (lhs) && fixed_type_p (rhs)))
  5113.       noncopied_parts = save_noncopied_parts (stabilize_reference (lhs),
  5114.                           TYPE_NONCOPIED_PARTS (lhs_type));
  5115.  
  5116.     temp = expand_assignment (lhs, rhs, ! ignore, original_target != 0);
  5117.     while (noncopied_parts != 0)
  5118.       {
  5119.         expand_assignment (TREE_PURPOSE (noncopied_parts),
  5120.                    TREE_VALUE (noncopied_parts), 0, 0);
  5121.         noncopied_parts = TREE_CHAIN (noncopied_parts);
  5122.       }
  5123.     return temp;
  5124.       }
  5125.  
  5126.     case PREINCREMENT_EXPR:
  5127.     case PREDECREMENT_EXPR:
  5128.       return expand_increment (exp, 0);
  5129.  
  5130.     case POSTINCREMENT_EXPR:
  5131.     case POSTDECREMENT_EXPR:
  5132.       /* Faster to treat as pre-increment if result is not used.  */
  5133.       return expand_increment (exp, ! ignore);
  5134.  
  5135.     case ADDR_EXPR:
  5136.       /* Are we taking the address of a nested function?  */
  5137.       if (TREE_CODE (TREE_OPERAND (exp, 0)) == FUNCTION_DECL
  5138.       && decl_function_context (TREE_OPERAND (exp, 0)) != 0)
  5139.     {
  5140.       op0 = trampoline_address (TREE_OPERAND (exp, 0));
  5141.       op0 = force_operand (op0, target);
  5142.     }
  5143.       else
  5144.     {
  5145.       op0 = expand_expr (TREE_OPERAND (exp, 0), NULL_RTX, VOIDmode,
  5146.                  (modifier == EXPAND_INITIALIZER
  5147.                   ? modifier : EXPAND_CONST_ADDRESS));
  5148.       if (GET_CODE (op0) != MEM)
  5149.         abort ();
  5150.   
  5151.       if (modifier == EXPAND_SUM || modifier == EXPAND_INITIALIZER)
  5152.         return XEXP (op0, 0);
  5153.       op0 = force_operand (XEXP (op0, 0), target);
  5154.     }
  5155.       if (flag_force_addr && GET_CODE (op0) != REG)
  5156.     return force_reg (Pmode, op0);
  5157.       return op0;
  5158.  
  5159.     case ENTRY_VALUE_EXPR:
  5160.       abort ();
  5161.  
  5162.     /* COMPLEX type for Extended Pascal & Fortran  */
  5163.     case COMPLEX_EXPR:
  5164.       {
  5165.     enum machine_mode mode = TYPE_MODE (TREE_TYPE (TREE_TYPE (exp)));
  5166.  
  5167.     rtx prev;
  5168.  
  5169.     /* Get the rtx code of the operands.  */
  5170.     op0 = expand_expr (TREE_OPERAND (exp, 0), 0, VOIDmode, 0);
  5171.     op1 = expand_expr (TREE_OPERAND (exp, 1), 0, VOIDmode, 0);
  5172.  
  5173.     if (! target)
  5174.       target = gen_reg_rtx (TYPE_MODE (TREE_TYPE (exp)));
  5175.  
  5176.     prev = get_last_insn ();
  5177.  
  5178.     /* Tell flow that the whole of the destination is being set.  */
  5179.     if (GET_CODE (target) == REG)
  5180.       emit_insn (gen_rtx (CLOBBER, VOIDmode, target));
  5181.  
  5182.     /* Move the real (op0) and imaginary (op1) parts to their location.  */
  5183.     emit_move_insn (gen_realpart (mode, target), op0);
  5184.     emit_move_insn (gen_imagpart (mode, target), op1);
  5185.  
  5186.     /* Complex construction should appear as a single unit.  */
  5187.     group_insns (prev);
  5188.  
  5189.     return target;
  5190.       }
  5191.  
  5192.     case REALPART_EXPR:
  5193.       op0 = expand_expr (TREE_OPERAND (exp, 0), 0, VOIDmode, 0);
  5194.       return gen_realpart (mode, op0);
  5195.       
  5196.     case IMAGPART_EXPR:
  5197.       op0 = expand_expr (TREE_OPERAND (exp, 0), 0, VOIDmode, 0);
  5198.       return gen_imagpart (mode, op0);
  5199.  
  5200.     case CONJ_EXPR:
  5201.       {
  5202.     enum machine_mode mode = TYPE_MODE (TREE_TYPE (TREE_TYPE (exp)));
  5203.     rtx imag_t;
  5204.     rtx prev;
  5205.     
  5206.     op0  = expand_expr (TREE_OPERAND (exp, 0), 0, VOIDmode, 0);
  5207.  
  5208.     if (! target)
  5209.       target = gen_reg_rtx (TYPE_MODE (TREE_TYPE (exp)));
  5210.                                     
  5211.     prev = get_last_insn ();
  5212.  
  5213.     /* Tell flow that the whole of the destination is being set.  */
  5214.     if (GET_CODE (target) == REG)
  5215.       emit_insn (gen_rtx (CLOBBER, VOIDmode, target));
  5216.  
  5217.     /* Store the realpart and the negated imagpart to target.  */
  5218.     emit_move_insn (gen_realpart (mode, target), gen_realpart (mode, op0));
  5219.  
  5220.     imag_t = gen_imagpart (mode, target);
  5221.     temp   = expand_unop (mode, neg_optab,
  5222.                   gen_imagpart (mode, op0), imag_t, 0);
  5223.     if (temp != imag_t)
  5224.       emit_move_insn (imag_t, temp);
  5225.  
  5226.     /* Conjugate should appear as a single unit */
  5227.     group_insns (prev);
  5228.  
  5229.     return target;
  5230.       }
  5231.  
  5232.     case ERROR_MARK:
  5233.       return const0_rtx;
  5234.  
  5235.     default:
  5236.       return (*lang_expand_expr) (exp, target, tmode, modifier);
  5237.     }
  5238.  
  5239.   /* Here to do an ordinary binary operator, generating an instruction
  5240.      from the optab already placed in `this_optab'.  */
  5241.  binop:
  5242.   preexpand_calls (exp);
  5243.   if (! safe_from_p (subtarget, TREE_OPERAND (exp, 1)))
  5244.     subtarget = 0;
  5245.   op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, 0);
  5246.   op1 = expand_expr (TREE_OPERAND (exp, 1), NULL_RTX, VOIDmode, 0);
  5247.  binop2:
  5248.   temp = expand_binop (mode, this_optab, op0, op1, target,
  5249.                unsignedp, OPTAB_LIB_WIDEN);
  5250.   if (temp == 0)
  5251.     abort ();
  5252.   return temp;
  5253. }
  5254.  
  5255. /* Return the alignment in bits of EXP, a pointer valued expression.
  5256.    But don't return more than MAX_ALIGN no matter what.
  5257.    The alignment returned is, by default, the alignment of the thing that
  5258.    EXP points to (if it is not a POINTER_TYPE, 0 is returned).
  5259.  
  5260.    Otherwise, look at the expression to see if we can do better, i.e., if the
  5261.    expression is actually pointing at an object whose alignment is tighter.  */
  5262.  
  5263. static int
  5264. get_pointer_alignment (exp, max_align)
  5265.      tree exp;
  5266.      unsigned max_align;
  5267. {
  5268.   unsigned align, inner;
  5269.  
  5270.   if (TREE_CODE (TREE_TYPE (exp)) != POINTER_TYPE)
  5271.     return 0;
  5272.  
  5273.   align = TYPE_ALIGN (TREE_TYPE (TREE_TYPE (exp)));
  5274.   align = MIN (align, max_align);
  5275.  
  5276.   while (1)
  5277.     {
  5278.       switch (TREE_CODE (exp))
  5279.     {
  5280.     case NOP_EXPR:
  5281.     case CONVERT_EXPR:
  5282.     case NON_LVALUE_EXPR:
  5283.       exp = TREE_OPERAND (exp, 0);
  5284.       if (TREE_CODE (TREE_TYPE (exp)) != POINTER_TYPE)
  5285.         return align;
  5286.       inner = TYPE_ALIGN (TREE_TYPE (TREE_TYPE (exp)));
  5287.       inner = MIN (inner, max_align);
  5288.       align = MAX (align, inner);
  5289.       break;
  5290.  
  5291.     case PLUS_EXPR:
  5292.       /* If sum of pointer + int, restrict our maximum alignment to that
  5293.          imposed by the integer.  If not, we can't do any better than
  5294.          ALIGN.  */
  5295.       if (TREE_CODE (TREE_OPERAND (exp, 1)) != INTEGER_CST)
  5296.         return align;
  5297.  
  5298.       while (((TREE_INT_CST_LOW (TREE_OPERAND (exp, 1)) * BITS_PER_UNIT)
  5299.           & (max_align - 1))
  5300.          != 0)
  5301.         max_align >>= 1;
  5302.  
  5303.       exp = TREE_OPERAND (exp, 0);
  5304.       break;
  5305.  
  5306.     case ADDR_EXPR:
  5307.       /* See what we are pointing at and look at its alignment.  */
  5308.       exp = TREE_OPERAND (exp, 0);
  5309.       if (TREE_CODE (exp) == FUNCTION_DECL)
  5310.         align = MAX (align, FUNCTION_BOUNDARY);
  5311.       else if (TREE_CODE_CLASS (TREE_CODE (exp)) == 'd')
  5312.         align = MAX (align, DECL_ALIGN (exp));
  5313. #ifdef CONSTANT_ALIGNMENT
  5314.       else if (TREE_CODE_CLASS (TREE_CODE (exp)) == 'c')
  5315.         align = CONSTANT_ALIGNMENT (exp, align);
  5316. #endif
  5317.       return MIN (align, max_align);
  5318.  
  5319.     default:
  5320.       return align;
  5321.     }
  5322.     }
  5323. }
  5324.  
  5325. /* Return the tree node and offset if a given argument corresponds to
  5326.    a string constant.  */
  5327.  
  5328. static tree
  5329. string_constant (arg, ptr_offset)
  5330.      tree arg;
  5331.      tree *ptr_offset;
  5332. {
  5333.   STRIP_NOPS (arg);
  5334.  
  5335.   if (TREE_CODE (arg) == ADDR_EXPR
  5336.       && TREE_CODE (TREE_OPERAND (arg, 0)) == STRING_CST)
  5337.     {
  5338.       *ptr_offset = integer_zero_node;
  5339.       return TREE_OPERAND (arg, 0);
  5340.     }
  5341.   else if (TREE_CODE (arg) == PLUS_EXPR)
  5342.     {
  5343.       tree arg0 = TREE_OPERAND (arg, 0);
  5344.       tree arg1 = TREE_OPERAND (arg, 1);
  5345.  
  5346.       STRIP_NOPS (arg0);
  5347.       STRIP_NOPS (arg1);
  5348.  
  5349.       if (TREE_CODE (arg0) == ADDR_EXPR
  5350.       && TREE_CODE (TREE_OPERAND (arg0, 0)) == STRING_CST)
  5351.     {
  5352.       *ptr_offset = arg1;
  5353.       return TREE_OPERAND (arg0, 0);
  5354.     }
  5355.       else if (TREE_CODE (arg1) == ADDR_EXPR
  5356.            && TREE_CODE (TREE_OPERAND (arg1, 0)) == STRING_CST)
  5357.     {
  5358.       *ptr_offset = arg0;
  5359.       return TREE_OPERAND (arg1, 0);
  5360.     }
  5361.     }
  5362.  
  5363.   return 0;
  5364. }
  5365.  
  5366. /* Compute the length of a C string.  TREE_STRING_LENGTH is not the right
  5367.    way, because it could contain a zero byte in the middle.
  5368.    TREE_STRING_LENGTH is the size of the character array, not the string.
  5369.  
  5370.    Unfortunately, string_constant can't access the values of const char
  5371.    arrays with initializers, so neither can we do so here.  */
  5372.  
  5373. static tree
  5374. c_strlen (src)
  5375.      tree src;
  5376. {
  5377.   tree offset_node;
  5378.   int offset, max;
  5379.   char *ptr;
  5380.  
  5381.   src = string_constant (src, &offset_node);
  5382.   if (src == 0)
  5383.     return 0;
  5384.   max = TREE_STRING_LENGTH (src);
  5385.   ptr = TREE_STRING_POINTER (src);
  5386.   if (offset_node && TREE_CODE (offset_node) != INTEGER_CST)
  5387.     {
  5388.       /* If the string has an internal zero byte (e.g., "foo\0bar"), we can't
  5389.      compute the offset to the following null if we don't know where to
  5390.      start searching for it.  */
  5391.       int i;
  5392.       for (i = 0; i < max; i++)
  5393.     if (ptr[i] == 0)
  5394.       return 0;
  5395.       /* We don't know the starting offset, but we do know that the string
  5396.      has no internal zero bytes.  We can assume that the offset falls
  5397.      within the bounds of the string; otherwise, the programmer deserves
  5398.      what he gets.  Subtract the offset from the length of the string,
  5399.      and return that.  */
  5400.       /* This would perhaps not be valid if we were dealing with named
  5401.          arrays in addition to literal string constants.  */
  5402.       return size_binop (MINUS_EXPR, size_int (max), offset_node);
  5403.     }
  5404.  
  5405.   /* We have a known offset into the string.  Start searching there for
  5406.      a null character.  */
  5407.   if (offset_node == 0)
  5408.     offset = 0;
  5409.   else
  5410.     {
  5411.       /* Did we get a long long offset?  If so, punt.  */
  5412.       if (TREE_INT_CST_HIGH (offset_node) != 0)
  5413.     return 0;
  5414.       offset = TREE_INT_CST_LOW (offset_node);
  5415.     }
  5416.   /* If the offset is known to be out of bounds, warn, and call strlen at
  5417.      runtime.  */
  5418.   if (offset < 0 || offset > max)
  5419.     {
  5420.       warning ("offset outside bounds of constant string");
  5421.       return 0;
  5422.     }
  5423.   /* Use strlen to search for the first zero byte.  Since any strings
  5424.      constructed with build_string will have nulls appended, we win even
  5425.      if we get handed something like (char[4])"abcd".
  5426.  
  5427.      Since OFFSET is our starting index into the string, no further
  5428.      calculation is needed.  */
  5429.   return size_int (strlen (ptr + offset));
  5430. }
  5431.  
  5432. /* Expand an expression EXP that calls a built-in function,
  5433.    with result going to TARGET if that's convenient
  5434.    (and in mode MODE if that's convenient).
  5435.    SUBTARGET may be used as the target for computing one of EXP's operands.
  5436.    IGNORE is nonzero if the value is to be ignored.  */
  5437.  
  5438. static rtx
  5439. expand_builtin (exp, target, subtarget, mode, ignore)
  5440.      tree exp;
  5441.      rtx target;
  5442.      rtx subtarget;
  5443.      enum machine_mode mode;
  5444.      int ignore;
  5445. {
  5446.   tree fndecl = TREE_OPERAND (TREE_OPERAND (exp, 0), 0);
  5447.   tree arglist = TREE_OPERAND (exp, 1);
  5448.   rtx op0;
  5449.   rtx lab1, insns;
  5450.   enum machine_mode value_mode = TYPE_MODE (TREE_TYPE (exp));
  5451.   optab builtin_optab;
  5452.  
  5453.   switch (DECL_FUNCTION_CODE (fndecl))
  5454.     {
  5455.     case BUILT_IN_ABS:
  5456.     case BUILT_IN_LABS:
  5457.     case BUILT_IN_FABS:
  5458.       /* build_function_call changes these into ABS_EXPR.  */
  5459.       abort ();
  5460.  
  5461.     case BUILT_IN_SIN:
  5462.     case BUILT_IN_COS:
  5463.     case BUILT_IN_FSQRT:
  5464.       /* If not optimizing, call the library function.  */
  5465.       if (! optimize)
  5466.     break;
  5467.  
  5468.       if (arglist == 0
  5469.       /* Arg could be wrong type if user redeclared this fcn wrong.  */
  5470.       || TREE_CODE (TREE_TYPE (TREE_VALUE (arglist))) != REAL_TYPE)
  5471.     return CONST0_RTX (TYPE_MODE (TREE_TYPE (exp)));
  5472.  
  5473.       /* Stabilize and compute the argument.  */
  5474.       if (TREE_CODE (TREE_VALUE (arglist)) != VAR_DECL
  5475.       && TREE_CODE (TREE_VALUE (arglist)) != PARM_DECL)
  5476.     {
  5477.       exp = copy_node (exp);
  5478.       arglist = copy_node (arglist);
  5479.       TREE_OPERAND (exp, 1) = arglist;
  5480.       TREE_VALUE (arglist) = save_expr (TREE_VALUE (arglist));
  5481.     }
  5482.       op0 = expand_expr (TREE_VALUE (arglist), subtarget, VOIDmode, 0);
  5483.  
  5484.       /* Make a suitable register to place result in.  */
  5485.       target = gen_reg_rtx (TYPE_MODE (TREE_TYPE (exp)));
  5486.  
  5487.       emit_queue ();
  5488.       start_sequence ();
  5489.  
  5490.       switch (DECL_FUNCTION_CODE (fndecl))
  5491.     {
  5492.     case BUILT_IN_SIN:
  5493.       builtin_optab = sin_optab; break;
  5494.     case BUILT_IN_COS:
  5495.       builtin_optab = cos_optab; break;
  5496.     case BUILT_IN_FSQRT:
  5497.       builtin_optab = sqrt_optab; break;
  5498.     default:
  5499.       abort ();
  5500.     }
  5501.  
  5502.       /* Compute into TARGET.
  5503.      Set TARGET to wherever the result comes back.  */
  5504.       target = expand_unop (TYPE_MODE (TREE_TYPE (TREE_VALUE (arglist))),
  5505.                 builtin_optab, op0, target, 0);
  5506.  
  5507.       /* If we were unable to expand via the builtin, stop the
  5508.      sequence (without outputting the insns) and break, causing
  5509.      a call the the library function.  */
  5510.       if (target == 0)
  5511.     {
  5512.       end_sequence ();
  5513.       break;
  5514.         }
  5515.  
  5516.       /* Check the results by default.  But if flag_fast_math is turned on,
  5517.      then assume sqrt will always be called with valid arguments.  */
  5518.  
  5519.       if (! flag_fast_math)
  5520.     {
  5521.       /* Don't define the builtin FP instructions
  5522.          if your machine is not IEEE.  */
  5523.       if (TARGET_FLOAT_FORMAT != IEEE_FLOAT_FORMAT)
  5524.         abort ();
  5525.  
  5526.       lab1 = gen_label_rtx ();
  5527.  
  5528.       /* Test the result; if it is NaN, set errno=EDOM because
  5529.          the argument was not in the domain.  */
  5530.       emit_cmp_insn (target, target, EQ, 0, GET_MODE (target), 0, 0);
  5531.       emit_jump_insn (gen_beq (lab1));
  5532.  
  5533. #if TARGET_EDOM
  5534.       {
  5535. #ifdef GEN_ERRNO_RTX
  5536.         rtx errno_rtx = GEN_ERRNO_RTX;
  5537. #else
  5538.         rtx errno_rtx
  5539.           = gen_rtx (MEM, word_mode, gen_rtx (SYMBOL_REF, Pmode, "*errno"));
  5540. #endif
  5541.  
  5542.         emit_move_insn (errno_rtx, GEN_INT (TARGET_EDOM));
  5543.       }
  5544. #else
  5545.       /* We can't set errno=EDOM directly; let the library call do it.
  5546.          Pop the arguments right away in case the call gets deleted. */
  5547.       NO_DEFER_POP;
  5548.       expand_call (exp, target, 0);
  5549.       OK_DEFER_POP;
  5550. #endif
  5551.  
  5552.       emit_label (lab1);
  5553.     }
  5554.  
  5555.       /* Output the entire sequence. */
  5556.       insns = get_insns ();
  5557.       end_sequence ();
  5558.       emit_insns (insns);
  5559.  
  5560.       return target;
  5561.  
  5562.     case BUILT_IN_SAVEREGS:
  5563.       /* Don't do __builtin_saveregs more than once in a function.
  5564.      Save the result of the first call and reuse it.  */
  5565.       if (saveregs_value != 0)
  5566.     return saveregs_value;
  5567.       {
  5568.     /* When this function is called, it means that registers must be
  5569.        saved on entry to this function.  So we migrate the
  5570.        call to the first insn of this function.  */
  5571.     rtx temp;
  5572.     rtx seq;
  5573.     rtx valreg, saved_valreg;
  5574.  
  5575.     /* Now really call the function.  `expand_call' does not call
  5576.        expand_builtin, so there is no danger of infinite recursion here.  */
  5577.     start_sequence ();
  5578.  
  5579. #ifdef EXPAND_BUILTIN_SAVEREGS
  5580.     /* Do whatever the machine needs done in this case.  */
  5581.     temp = EXPAND_BUILTIN_SAVEREGS (arglist);
  5582. #else
  5583.     /* The register where the function returns its value
  5584.        is likely to have something else in it, such as an argument.
  5585.        So preserve that register around the call.  */
  5586.     if (value_mode != VOIDmode)
  5587.       {
  5588.         valreg = hard_libcall_value (value_mode);
  5589.         saved_valreg = gen_reg_rtx (value_mode);
  5590.         emit_move_insn (saved_valreg, valreg);
  5591.       }
  5592.  
  5593.     /* Generate the call, putting the value in a pseudo.  */
  5594.     temp = expand_call (exp, target, ignore);
  5595.  
  5596.     if (value_mode != VOIDmode)
  5597.       emit_move_insn (valreg, saved_valreg);
  5598. #endif
  5599.  
  5600.     seq = get_insns ();
  5601.     end_sequence ();
  5602.  
  5603.     saveregs_value = temp;
  5604.  
  5605.     /* This won't work inside a SEQUENCE--it really has to be
  5606.        at the start of the function.  */
  5607.     if (in_sequence_p ())
  5608.       {
  5609.         /* Better to do this than to crash.  */
  5610.         error ("`va_start' used within `({...})'");
  5611.         return temp;
  5612.       }
  5613.  
  5614.     /* Put the sequence after the NOTE that starts the function.  */
  5615.     emit_insns_before (seq, NEXT_INSN (get_insns ()));
  5616.     return temp;
  5617.       }
  5618.  
  5619.       /* __builtin_args_info (N) returns word N of the arg space info
  5620.      for the current function.  The number and meanings of words
  5621.      is controlled by the definition of CUMULATIVE_ARGS.  */
  5622.     case BUILT_IN_ARGS_INFO:
  5623.       {
  5624.     int nwords = sizeof (CUMULATIVE_ARGS) / sizeof (int);
  5625.     int i;
  5626.     int *word_ptr = (int *) ¤t_function_args_info;
  5627.     tree type, elts, result;
  5628.  
  5629.     if (sizeof (CUMULATIVE_ARGS) % sizeof (int) != 0)
  5630.       fatal ("CUMULATIVE_ARGS type defined badly; see %s, line %d",
  5631.          __FILE__, __LINE__);
  5632.  
  5633.     if (arglist != 0)
  5634.       {
  5635.         tree arg = TREE_VALUE (arglist);
  5636.         if (TREE_CODE (arg) != INTEGER_CST)
  5637.           error ("argument of __builtin_args_info must be constant");
  5638.         else
  5639.           {
  5640.         int wordnum = TREE_INT_CST_LOW (arg);
  5641.  
  5642.         if (wordnum < 0 || wordnum >= nwords)
  5643.           error ("argument of __builtin_args_info out of range");
  5644.         else
  5645.           return GEN_INT (word_ptr[wordnum]);
  5646.           }
  5647.       }
  5648.     else
  5649.       error ("missing argument in __builtin_args_info");
  5650.  
  5651.     return const0_rtx;
  5652.  
  5653. #if 0
  5654.     for (i = 0; i < nwords; i++)
  5655.       elts = tree_cons (NULL_TREE, build_int_2 (word_ptr[i], 0));
  5656.  
  5657.     type = build_array_type (integer_type_node,
  5658.                  build_index_type (build_int_2 (nwords, 0)));
  5659.     result = build (CONSTRUCTOR, type, NULL_TREE, nreverse (elts));
  5660.     TREE_CONSTANT (result) = 1;
  5661.     TREE_STATIC (result) = 1;
  5662.     result = build (INDIRECT_REF, build_pointer_type (type), result);
  5663.     TREE_CONSTANT (result) = 1;
  5664.     return expand_expr (result, NULL_RTX, VOIDmode, 0);
  5665. #endif
  5666.       }
  5667.  
  5668.       /* Return the address of the first anonymous stack arg.  */
  5669.     case BUILT_IN_NEXT_ARG:
  5670.       {
  5671.     tree fntype = TREE_TYPE (current_function_decl);
  5672.     if (!(TYPE_ARG_TYPES (fntype) != 0
  5673.           && (TREE_VALUE (tree_last (TYPE_ARG_TYPES (fntype)))
  5674.           != void_type_node)))
  5675.       {
  5676.         error ("`va_start' used in function with fixed args");
  5677.         return const0_rtx;
  5678.       }
  5679.       }
  5680.  
  5681.       return expand_binop (Pmode, add_optab,
  5682.                current_function_internal_arg_pointer,
  5683.                current_function_arg_offset_rtx,
  5684.                NULL_RTX, 0, OPTAB_LIB_WIDEN);
  5685.  
  5686.     case BUILT_IN_CLASSIFY_TYPE:
  5687.       if (arglist != 0)
  5688.     {
  5689.       tree type = TREE_TYPE (TREE_VALUE (arglist));
  5690.       enum tree_code code = TREE_CODE (type);
  5691.       if (code == VOID_TYPE)
  5692.         return GEN_INT (void_type_class);
  5693.       if (code == INTEGER_TYPE)
  5694.         return GEN_INT (integer_type_class);
  5695.       if (code == CHAR_TYPE)
  5696.         return GEN_INT (char_type_class);
  5697.       if (code == ENUMERAL_TYPE)
  5698.         return GEN_INT (enumeral_type_class);
  5699.       if (code == BOOLEAN_TYPE)
  5700.         return GEN_INT (boolean_type_class);
  5701.       if (code == POINTER_TYPE)
  5702.         return GEN_INT (pointer_type_class);
  5703.       if (code == REFERENCE_TYPE)
  5704.         return GEN_INT (reference_type_class);
  5705.       if (code == OFFSET_TYPE)
  5706.         return GEN_INT (offset_type_class);
  5707.       if (code == REAL_TYPE)
  5708.         return GEN_INT (real_type_class);
  5709.       if (code == COMPLEX_TYPE)
  5710.         return GEN_INT (complex_type_class);
  5711.       if (code == FUNCTION_TYPE)
  5712.         return GEN_INT (function_type_class);
  5713.       if (code == METHOD_TYPE)
  5714.         return GEN_INT (method_type_class);
  5715.       if (code == RECORD_TYPE)
  5716.         return GEN_INT (record_type_class);
  5717.       if (code == UNION_TYPE)
  5718.         return GEN_INT (union_type_class);
  5719.       if (code == ARRAY_TYPE)
  5720.         return GEN_INT (array_type_class);
  5721.       if (code == STRING_TYPE)
  5722.         return GEN_INT (string_type_class);
  5723.       if (code == SET_TYPE)
  5724.         return GEN_INT (set_type_class);
  5725.       if (code == FILE_TYPE)
  5726.         return GEN_INT (file_type_class);
  5727.       if (code == LANG_TYPE)
  5728.         return GEN_INT (lang_type_class);
  5729.     }
  5730.       return GEN_INT (no_type_class);
  5731.  
  5732.     case BUILT_IN_CONSTANT_P:
  5733.       if (arglist == 0)
  5734.     return const0_rtx;
  5735.       else
  5736.     return (TREE_CODE_CLASS (TREE_CODE (TREE_VALUE (arglist))) == 'c'
  5737.         ? const1_rtx : const0_rtx);
  5738.  
  5739.     case BUILT_IN_FRAME_ADDRESS:
  5740.       /* The argument must be a nonnegative integer constant.
  5741.      It counts the number of frames to scan up the stack.
  5742.      The value is the address of that frame.  */
  5743.     case BUILT_IN_RETURN_ADDRESS:
  5744.       /* The argument must be a nonnegative integer constant.
  5745.      It counts the number of frames to scan up the stack.
  5746.      The value is the return address saved in that frame.  */
  5747.       if (arglist == 0)
  5748.     /* Warning about missing arg was already issued.  */
  5749.     return const0_rtx;
  5750.       else if (TREE_CODE (TREE_VALUE (arglist)) != INTEGER_CST)
  5751.     {
  5752.       error ("invalid arg to __builtin_return_address");
  5753.       return const0_rtx;
  5754.     }
  5755.       else if (tree_int_cst_lt (TREE_VALUE (arglist), integer_zero_node))
  5756.     {
  5757.       error ("invalid arg to __builtin_return_address");
  5758.       return const0_rtx;
  5759.     }
  5760.       else
  5761.     {
  5762.       int count = TREE_INT_CST_LOW (TREE_VALUE (arglist)); 
  5763.       rtx tem = frame_pointer_rtx;
  5764.       int i;
  5765.  
  5766.       /* Scan back COUNT frames to the specified frame.  */
  5767.       for (i = 0; i < count; i++)
  5768.         {
  5769.           /* Assume the dynamic chain pointer is in the word that
  5770.          the frame address points to, unless otherwise specified.  */
  5771. #ifdef DYNAMIC_CHAIN_ADDRESS
  5772.           tem = DYNAMIC_CHAIN_ADDRESS (tem);
  5773. #endif
  5774.           tem = memory_address (Pmode, tem);
  5775.           tem = copy_to_reg (gen_rtx (MEM, Pmode, tem));
  5776.         }
  5777.  
  5778.       /* For __builtin_frame_address, return what we've got.  */
  5779.       if (DECL_FUNCTION_CODE (fndecl) == BUILT_IN_FRAME_ADDRESS)
  5780.         return tem;
  5781.  
  5782.       /* For __builtin_return_address,
  5783.          Get the return address from that frame.  */
  5784. #ifdef RETURN_ADDR_RTX
  5785.       return RETURN_ADDR_RTX (count, tem);
  5786. #else
  5787.       tem = memory_address (Pmode,
  5788.                 plus_constant (tem, GET_MODE_SIZE (Pmode)));
  5789.       return copy_to_reg (gen_rtx (MEM, Pmode, tem));
  5790. #endif
  5791.     }
  5792.  
  5793.     case BUILT_IN_ALLOCA:
  5794.       if (arglist == 0
  5795.       /* Arg could be non-integer if user redeclared this fcn wrong.  */
  5796.       || TREE_CODE (TREE_TYPE (TREE_VALUE (arglist))) != INTEGER_TYPE)
  5797.     return const0_rtx;
  5798.       current_function_calls_alloca = 1;
  5799.       /* Compute the argument.  */
  5800.       op0 = expand_expr (TREE_VALUE (arglist), NULL_RTX, VOIDmode, 0);
  5801.  
  5802.       /* Allocate the desired space.  */
  5803.       target = allocate_dynamic_stack_space (op0, target, BITS_PER_UNIT);
  5804.  
  5805.       /* Record the new stack level for nonlocal gotos.  */
  5806.       if (nonlocal_goto_handler_slot != 0)
  5807.     emit_stack_save (SAVE_NONLOCAL, &nonlocal_goto_stack_level, NULL_RTX);
  5808.       return target;
  5809.  
  5810.     case BUILT_IN_FFS:
  5811.       /* If not optimizing, call the library function.  */
  5812.       if (!optimize)
  5813.     break;
  5814.  
  5815.       if (arglist == 0
  5816.       /* Arg could be non-integer if user redeclared this fcn wrong.  */
  5817.       || TREE_CODE (TREE_TYPE (TREE_VALUE (arglist))) != INTEGER_TYPE)
  5818.     return const0_rtx;
  5819.  
  5820.       /* Compute the argument.  */
  5821.       op0 = expand_expr (TREE_VALUE (arglist), subtarget, VOIDmode, 0);
  5822.       /* Compute ffs, into TARGET if possible.
  5823.      Set TARGET to wherever the result comes back.  */
  5824.       target = expand_unop (TYPE_MODE (TREE_TYPE (TREE_VALUE (arglist))),
  5825.                 ffs_optab, op0, target, 1);
  5826.       if (target == 0)
  5827.     abort ();
  5828.       return target;
  5829.  
  5830.     case BUILT_IN_STRLEN:
  5831.       /* If not optimizing, call the library function.  */
  5832.       if (!optimize)
  5833.     break;
  5834.  
  5835.       if (arglist == 0
  5836.       /* Arg could be non-pointer if user redeclared this fcn wrong.  */
  5837.       || TREE_CODE (TREE_TYPE (TREE_VALUE (arglist))) != POINTER_TYPE)
  5838.     return const0_rtx;
  5839.       else
  5840.     {
  5841.       tree src = TREE_VALUE (arglist);
  5842.       tree len = c_strlen (src);
  5843.  
  5844.       int align
  5845.         = get_pointer_alignment (src, BIGGEST_ALIGNMENT) / BITS_PER_UNIT;
  5846.  
  5847.       rtx result, src_rtx, char_rtx;
  5848.       enum machine_mode insn_mode = value_mode, char_mode;
  5849.       enum insn_code icode;
  5850.  
  5851.       /* If the length is known, just return it. */
  5852.       if (len != 0)
  5853.         return expand_expr (len, target, mode, 0);
  5854.  
  5855.       /* If SRC is not a pointer type, don't do this operation inline. */
  5856.       if (align == 0)
  5857.         break;
  5858.  
  5859.       /* Call a function if we can't compute strlen in the right mode. */
  5860.  
  5861.       while (insn_mode != VOIDmode)
  5862.         {
  5863.           icode = strlen_optab->handlers[(int) insn_mode].insn_code;
  5864.           if (icode != CODE_FOR_nothing)
  5865.         break;
  5866.  
  5867.           insn_mode = GET_MODE_WIDER_MODE (insn_mode);
  5868.         }
  5869.       if (insn_mode == VOIDmode)
  5870.         break;
  5871.  
  5872.       /* Make a place to write the result of the instruction.  */
  5873.       result = target;
  5874.       if (! (result != 0
  5875.          && GET_CODE (result) == REG
  5876.          && GET_MODE (result) == insn_mode
  5877.          && REGNO (result) >= FIRST_PSEUDO_REGISTER))
  5878.         result = gen_reg_rtx (insn_mode);
  5879.  
  5880.       /* Make sure the operands are acceptable to the predicates.  */
  5881.  
  5882.       if (! (*insn_operand_predicate[(int)icode][0]) (result, insn_mode))
  5883.         result = gen_reg_rtx (insn_mode);
  5884.  
  5885.       src_rtx = memory_address (BLKmode,
  5886.                     expand_expr (src, NULL_RTX, Pmode,
  5887.                          EXPAND_NORMAL));
  5888.       if (! (*insn_operand_predicate[(int)icode][1]) (src_rtx, Pmode))
  5889.         src_rtx = copy_to_mode_reg (Pmode, src_rtx);
  5890.  
  5891.       char_rtx = const0_rtx;
  5892.       char_mode = insn_operand_mode[(int)icode][2];
  5893.       if (! (*insn_operand_predicate[(int)icode][2]) (char_rtx, char_mode))
  5894.         char_rtx = copy_to_mode_reg (char_mode, char_rtx);
  5895.  
  5896.       emit_insn (GEN_FCN (icode) (result,
  5897.                       gen_rtx (MEM, BLKmode, src_rtx),
  5898.                       char_rtx, GEN_INT (align)));
  5899.  
  5900.       /* Return the value in the proper mode for this function.  */
  5901.       if (GET_MODE (result) == value_mode)
  5902.         return result;
  5903.       else if (target != 0)
  5904.         {
  5905.           convert_move (target, result, 0);
  5906.           return target;
  5907.         }
  5908.       else
  5909.         return convert_to_mode (value_mode, result, 0);
  5910.     }
  5911.  
  5912.     case BUILT_IN_STRCPY:
  5913.       /* If not optimizing, call the library function.  */
  5914.       if (!optimize)
  5915.     break;
  5916.  
  5917.       if (arglist == 0
  5918.       /* Arg could be non-pointer if user redeclared this fcn wrong.  */
  5919.       || TREE_CODE (TREE_TYPE (TREE_VALUE (arglist))) != POINTER_TYPE
  5920.       || TREE_CHAIN (arglist) == 0
  5921.       || TREE_CODE (TREE_TYPE (TREE_VALUE (TREE_CHAIN (arglist)))) != POINTER_TYPE)
  5922.     return const0_rtx;
  5923.       else
  5924.     {
  5925.       tree len = c_strlen (TREE_VALUE (TREE_CHAIN (arglist)));
  5926.  
  5927.       if (len == 0)
  5928.         break;
  5929.  
  5930.       len = size_binop (PLUS_EXPR, len, integer_one_node);
  5931.  
  5932.       chainon (arglist, build_tree_list (NULL_TREE, len));
  5933.     }
  5934.  
  5935.       /* Drops in.  */
  5936.     case BUILT_IN_MEMCPY:
  5937.       /* If not optimizing, call the library function.  */
  5938.       if (!optimize)
  5939.     break;
  5940.  
  5941.       if (arglist == 0
  5942.       /* Arg could be non-pointer if user redeclared this fcn wrong.  */
  5943.       || TREE_CODE (TREE_TYPE (TREE_VALUE (arglist))) != POINTER_TYPE
  5944.       || TREE_CHAIN (arglist) == 0
  5945.       || TREE_CODE (TREE_TYPE (TREE_VALUE (TREE_CHAIN (arglist)))) != POINTER_TYPE
  5946.       || TREE_CHAIN (TREE_CHAIN (arglist)) == 0
  5947.       || TREE_CODE (TREE_TYPE (TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist))))) != INTEGER_TYPE)
  5948.     return const0_rtx;
  5949.       else
  5950.     {
  5951.       tree dest = TREE_VALUE (arglist);
  5952.       tree src = TREE_VALUE (TREE_CHAIN (arglist));
  5953.       tree len = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist)));
  5954.  
  5955.       int src_align
  5956.         = get_pointer_alignment (src, BIGGEST_ALIGNMENT) / BITS_PER_UNIT;
  5957.       int dest_align
  5958.         = get_pointer_alignment (dest, BIGGEST_ALIGNMENT) / BITS_PER_UNIT;
  5959.       rtx dest_rtx;
  5960.  
  5961.       /* If either SRC or DEST is not a pointer type, don't do
  5962.          this operation in-line.  */
  5963.       if (src_align == 0 || dest_align == 0)
  5964.         {
  5965.           if (DECL_FUNCTION_CODE (fndecl) == BUILT_IN_STRCPY)
  5966.         TREE_CHAIN (TREE_CHAIN (arglist)) = 0;
  5967.           break;
  5968.         }
  5969.  
  5970.       dest_rtx = expand_expr (dest, NULL_RTX, Pmode, EXPAND_NORMAL);
  5971.  
  5972.       /* Copy word part most expediently.  */
  5973.       emit_block_move (gen_rtx (MEM, BLKmode,
  5974.                     memory_address (BLKmode, dest_rtx)),
  5975.                gen_rtx (MEM, BLKmode,
  5976.                     memory_address (BLKmode,
  5977.                             expand_expr (src, NULL_RTX,
  5978.                                  Pmode,
  5979.                                  EXPAND_NORMAL))),
  5980.                expand_expr (len, NULL_RTX, VOIDmode, 0),
  5981.                MIN (src_align, dest_align));
  5982.       return dest_rtx;
  5983.     }
  5984.  
  5985. /* These comparison functions need an instruction that returns an actual
  5986.    index.  An ordinary compare that just sets the condition codes
  5987.    is not enough.  */
  5988. #ifdef HAVE_cmpstrsi
  5989.     case BUILT_IN_STRCMP:
  5990.       /* If not optimizing, call the library function.  */
  5991.       if (!optimize)
  5992.     break;
  5993.  
  5994.       if (arglist == 0
  5995.       /* Arg could be non-pointer if user redeclared this fcn wrong.  */
  5996.       || TREE_CODE (TREE_TYPE (TREE_VALUE (arglist))) != POINTER_TYPE
  5997.       || TREE_CHAIN (arglist) == 0
  5998.       || TREE_CODE (TREE_TYPE (TREE_VALUE (TREE_CHAIN (arglist)))) != POINTER_TYPE)
  5999.     return const0_rtx;
  6000.       else if (!HAVE_cmpstrsi)
  6001.     break;
  6002.       {
  6003.     tree arg1 = TREE_VALUE (arglist);
  6004.     tree arg2 = TREE_VALUE (TREE_CHAIN (arglist));
  6005.     tree offset;
  6006.     tree len, len2;
  6007.  
  6008.     len = c_strlen (arg1);
  6009.     if (len)
  6010.       len = size_binop (PLUS_EXPR, integer_one_node, len);
  6011.     len2 = c_strlen (arg2);
  6012.     if (len2)
  6013.       len2 = size_binop (PLUS_EXPR, integer_one_node, len2);
  6014.  
  6015.     /* If we don't have a constant length for the first, use the length
  6016.        of the second, if we know it.  We don't require a constant for
  6017.        this case; some cost analysis could be done if both are available
  6018.        but neither is constant.  For now, assume they're equally cheap.
  6019.  
  6020.        If both strings have constant lengths, use the smaller.  This
  6021.        could arise if optimization results in strcpy being called with
  6022.        two fixed strings, or if the code was machine-generated.  We should
  6023.        add some code to the `memcmp' handler below to deal with such
  6024.        situations, someday.  */
  6025.     if (!len || TREE_CODE (len) != INTEGER_CST)
  6026.       {
  6027.         if (len2)
  6028.           len = len2;
  6029.         else if (len == 0)
  6030.           break;
  6031.       }
  6032.     else if (len2 && TREE_CODE (len2) == INTEGER_CST)
  6033.       {
  6034.         if (tree_int_cst_lt (len2, len))
  6035.           len = len2;
  6036.       }
  6037.  
  6038.     chainon (arglist, build_tree_list (NULL_TREE, len));
  6039.       }
  6040.  
  6041.       /* Drops in.  */
  6042.     case BUILT_IN_MEMCMP:
  6043.       /* If not optimizing, call the library function.  */
  6044.       if (!optimize)
  6045.     break;
  6046.  
  6047.       if (arglist == 0
  6048.       /* Arg could be non-pointer if user redeclared this fcn wrong.  */
  6049.       || TREE_CODE (TREE_TYPE (TREE_VALUE (arglist))) != POINTER_TYPE
  6050.       || TREE_CHAIN (arglist) == 0
  6051.       || TREE_CODE (TREE_TYPE (TREE_VALUE (TREE_CHAIN (arglist)))) != POINTER_TYPE
  6052.       || TREE_CHAIN (TREE_CHAIN (arglist)) == 0
  6053.       || TREE_CODE (TREE_TYPE (TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist))))) != INTEGER_TYPE)
  6054.     return const0_rtx;
  6055.       else if (!HAVE_cmpstrsi)
  6056.     break;
  6057.       {
  6058.     tree arg1 = TREE_VALUE (arglist);
  6059.     tree arg2 = TREE_VALUE (TREE_CHAIN (arglist));
  6060.     tree len = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist)));
  6061.     rtx result;
  6062.  
  6063.     int arg1_align
  6064.       = get_pointer_alignment (arg1, BIGGEST_ALIGNMENT) / BITS_PER_UNIT;
  6065.     int arg2_align
  6066.       = get_pointer_alignment (arg2, BIGGEST_ALIGNMENT) / BITS_PER_UNIT;
  6067.     enum machine_mode insn_mode
  6068.       = insn_operand_mode[(int) CODE_FOR_cmpstrsi][0];
  6069.  
  6070.     /* If we don't have POINTER_TYPE, call the function.  */
  6071.     if (arg1_align == 0 || arg2_align == 0)
  6072.       {
  6073.         if (DECL_FUNCTION_CODE (fndecl) == BUILT_IN_STRCMP)
  6074.           TREE_CHAIN (TREE_CHAIN (arglist)) = 0;
  6075.         break;
  6076.       }
  6077.  
  6078.     /* Make a place to write the result of the instruction.  */
  6079.     result = target;
  6080.     if (! (result != 0
  6081.            && GET_CODE (result) == REG && GET_MODE (result) == insn_mode
  6082.            && REGNO (result) >= FIRST_PSEUDO_REGISTER))
  6083.       result = gen_reg_rtx (insn_mode);
  6084.  
  6085.     emit_insn (gen_cmpstrsi (result,
  6086.                  gen_rtx (MEM, BLKmode,
  6087.                       expand_expr (arg1, NULL_RTX, Pmode,
  6088.                                EXPAND_NORMAL)),
  6089.                  gen_rtx (MEM, BLKmode,
  6090.                       expand_expr (arg2, NULL_RTX, Pmode,
  6091.                                EXPAND_NORMAL)),
  6092.                  expand_expr (len, NULL_RTX, VOIDmode, 0),
  6093.                  GEN_INT (MIN (arg1_align, arg2_align))));
  6094.  
  6095.     /* Return the value in the proper mode for this function.  */
  6096.     mode = TYPE_MODE (TREE_TYPE (exp));
  6097.     if (GET_MODE (result) == mode)
  6098.       return result;
  6099.     else if (target != 0)
  6100.       {
  6101.         convert_move (target, result, 0);
  6102.         return target;
  6103.       }
  6104.     else
  6105.       return convert_to_mode (mode, result, 0);
  6106.       }    
  6107. #else
  6108.     case BUILT_IN_STRCMP:
  6109.     case BUILT_IN_MEMCMP:
  6110.       break;
  6111. #endif
  6112.  
  6113.     default:            /* just do library call, if unknown builtin */
  6114.       error ("built-in function %s not currently supported",
  6115.          IDENTIFIER_POINTER (DECL_NAME (fndecl)));
  6116.     }
  6117.  
  6118.   /* The switch statement above can drop through to cause the function
  6119.      to be called normally.  */
  6120.  
  6121.   return expand_call (exp, target, ignore);
  6122. }
  6123.  
  6124. /* Expand code for a post- or pre- increment or decrement
  6125.    and return the RTX for the result.
  6126.    POST is 1 for postinc/decrements and 0 for preinc/decrements.  */
  6127.  
  6128. static rtx
  6129. expand_increment (exp, post)
  6130.      register tree exp;
  6131.      int post;
  6132. {
  6133.   register rtx op0, op1;
  6134.   register rtx temp, value;
  6135.   register tree incremented = TREE_OPERAND (exp, 0);
  6136.   optab this_optab = add_optab;
  6137.   int icode;
  6138.   enum machine_mode mode = TYPE_MODE (TREE_TYPE (exp));
  6139.   int op0_is_copy = 0;
  6140.  
  6141.   /* Stabilize any component ref that might need to be
  6142.      evaluated more than once below.  */
  6143.   if (TREE_CODE (incremented) == BIT_FIELD_REF
  6144.       || (TREE_CODE (incremented) == COMPONENT_REF
  6145.       && (TREE_CODE (TREE_OPERAND (incremented, 0)) != INDIRECT_REF
  6146.           || DECL_BIT_FIELD (TREE_OPERAND (incremented, 1)))))
  6147.     incremented = stabilize_reference (incremented);
  6148.  
  6149.   /* Compute the operands as RTX.
  6150.      Note whether OP0 is the actual lvalue or a copy of it:
  6151.      I believe it is a copy iff it is a register or subreg
  6152.      and insns were generated in computing it.   */
  6153.  
  6154.   temp = get_last_insn ();
  6155.   op0 = expand_expr (incremented, NULL_RTX, VOIDmode, 0);
  6156.  
  6157.   /* If OP0 is a SUBREG made for a promoted variable, we cannot increment
  6158.      in place but intead must do sign- or zero-extension during assignment,
  6159.      so we copy it into a new register and let the code below use it as
  6160.      a copy.
  6161.  
  6162.      Note that we can safely modify this SUBREG since it is know not to be
  6163.      shared (it was made by the expand_expr call above).  */
  6164.  
  6165.   if (GET_CODE (op0) == SUBREG && SUBREG_PROMOTED_VAR_P (op0))
  6166.     SUBREG_REG (op0) = copy_to_reg (SUBREG_REG (op0));
  6167.  
  6168.   op0_is_copy = ((GET_CODE (op0) == SUBREG || GET_CODE (op0) == REG)
  6169.          && temp != get_last_insn ());
  6170.   op1 = expand_expr (TREE_OPERAND (exp, 1), NULL_RTX, VOIDmode, 0);
  6171.  
  6172.   /* Decide whether incrementing or decrementing.  */
  6173.   if (TREE_CODE (exp) == POSTDECREMENT_EXPR
  6174.       || TREE_CODE (exp) == PREDECREMENT_EXPR)
  6175.     this_optab = sub_optab;
  6176.  
  6177.   /* If OP0 is not the actual lvalue, but rather a copy in a register,
  6178.      then we cannot just increment OP0.  We must
  6179.      therefore contrive to increment the original value.
  6180.      Then we can return OP0 since it is a copy of the old value.  */
  6181.   if (op0_is_copy)
  6182.     {
  6183.       /* This is the easiest way to increment the value wherever it is.
  6184.      Problems with multiple evaluation of INCREMENTED
  6185.      are prevented because either (1) it is a component_ref,
  6186.      in which case it was stabilized above, or (2) it is an array_ref
  6187.      with constant index in an array in a register, which is
  6188.      safe to reevaluate.  */
  6189.       tree newexp = build ((this_optab == add_optab
  6190.                 ? PLUS_EXPR : MINUS_EXPR),
  6191.                TREE_TYPE (exp),
  6192.                incremented,
  6193.                TREE_OPERAND (exp, 1));
  6194.       temp = expand_assignment (incremented, newexp, ! post, 0);
  6195.       return post ? op0 : temp;
  6196.     }
  6197.  
  6198.   /* Convert decrement by a constant into a negative increment.  */
  6199.   if (this_optab == sub_optab
  6200.       && GET_CODE (op1) == CONST_INT)
  6201.     {
  6202.       op1 = GEN_INT (- INTVAL (op1));
  6203.       this_optab = add_optab;
  6204.     }
  6205.  
  6206.   if (post)
  6207.     {
  6208.       /* We have a true reference to the value in OP0.
  6209.      If there is an insn to add or subtract in this mode, queue it.  */
  6210.  
  6211. #if 0  /* Turned off to avoid making extra insn for indexed memref.  */
  6212.       op0 = stabilize (op0);
  6213. #endif
  6214.  
  6215.       icode = (int) this_optab->handlers[(int) mode].insn_code;
  6216.       if (icode != (int) CODE_FOR_nothing
  6217.       /* Make sure that OP0 is valid for operands 0 and 1
  6218.          of the insn we want to queue.  */
  6219.       && (*insn_operand_predicate[icode][0]) (op0, mode)
  6220.       && (*insn_operand_predicate[icode][1]) (op0, mode))
  6221.     {
  6222.       if (! (*insn_operand_predicate[icode][2]) (op1, mode))
  6223.         op1 = force_reg (mode, op1);
  6224.  
  6225.       return enqueue_insn (op0, GEN_FCN (icode) (op0, op0, op1));
  6226.     }
  6227.     }
  6228.  
  6229.   /* Preincrement, or we can't increment with one simple insn.  */
  6230.   if (post)
  6231.     /* Save a copy of the value before inc or dec, to return it later.  */
  6232.     temp = value = copy_to_reg (op0);
  6233.   else
  6234.     /* Arrange to return the incremented value.  */
  6235.     /* Copy the rtx because expand_binop will protect from the queue,
  6236.        and the results of that would be invalid for us to return
  6237.        if our caller does emit_queue before using our result.  */
  6238.     temp = copy_rtx (value = op0);
  6239.  
  6240.   /* Increment however we can.  */
  6241.   op1 = expand_binop (mode, this_optab, value, op1, op0,
  6242.               TREE_UNSIGNED (TREE_TYPE (exp)), OPTAB_LIB_WIDEN);
  6243.   /* Make sure the value is stored into OP0.  */
  6244.   if (op1 != op0)
  6245.     emit_move_insn (op0, op1);
  6246.  
  6247.   return temp;
  6248. }
  6249.  
  6250. /* Expand all function calls contained within EXP, innermost ones first.
  6251.    But don't look within expressions that have sequence points.
  6252.    For each CALL_EXPR, record the rtx for its value
  6253.    in the CALL_EXPR_RTL field.  */
  6254.  
  6255. static void
  6256. preexpand_calls (exp)
  6257.      tree exp;
  6258. {
  6259.   register int nops, i;
  6260.   int type = TREE_CODE_CLASS (TREE_CODE (exp));
  6261.  
  6262.   if (! do_preexpand_calls)
  6263.     return;
  6264.  
  6265.   /* Only expressions and references can contain calls.  */
  6266.  
  6267.   if (type != 'e' && type != '<' && type != '1' && type != '2' && type != 'r')
  6268.     return;
  6269.  
  6270.   switch (TREE_CODE (exp))
  6271.     {
  6272.     case CALL_EXPR:
  6273.       /* Do nothing if already expanded.  */
  6274.       if (CALL_EXPR_RTL (exp) != 0)
  6275.     return;
  6276.  
  6277.       /* Do nothing to built-in functions.  */
  6278.       if (TREE_CODE (TREE_OPERAND (exp, 0)) != ADDR_EXPR
  6279.       || TREE_CODE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0)) != FUNCTION_DECL
  6280.       || ! DECL_BUILT_IN (TREE_OPERAND (TREE_OPERAND (exp, 0), 0)))
  6281.     CALL_EXPR_RTL (exp) = expand_call (exp, NULL_RTX, 0);
  6282.       return;
  6283.  
  6284.     case COMPOUND_EXPR:
  6285.     case COND_EXPR:
  6286.     case TRUTH_ANDIF_EXPR:
  6287.     case TRUTH_ORIF_EXPR:
  6288.       /* If we find one of these, then we can be sure
  6289.      the adjust will be done for it (since it makes jumps).
  6290.      Do it now, so that if this is inside an argument
  6291.      of a function, we don't get the stack adjustment
  6292.      after some other args have already been pushed.  */
  6293.       do_pending_stack_adjust ();
  6294.       return;
  6295.  
  6296.     case BLOCK:
  6297.     case RTL_EXPR:
  6298.     case WITH_CLEANUP_EXPR:
  6299.       return;
  6300.  
  6301.     case SAVE_EXPR:
  6302.       if (SAVE_EXPR_RTL (exp) != 0)
  6303.     return;
  6304.     }
  6305.  
  6306.   nops = tree_code_length[(int) TREE_CODE (exp)];
  6307.   for (i = 0; i < nops; i++)
  6308.     if (TREE_OPERAND (exp, i) != 0)
  6309.       {
  6310.     type = TREE_CODE_CLASS (TREE_CODE (TREE_OPERAND (exp, i)));
  6311.     if (type == 'e' || type == '<' || type == '1' || type == '2'
  6312.         || type == 'r')
  6313.       preexpand_calls (TREE_OPERAND (exp, i));
  6314.       }
  6315. }
  6316.  
  6317. /* At the start of a function, record that we have no previously-pushed
  6318.    arguments waiting to be popped.  */
  6319.  
  6320. void
  6321. init_pending_stack_adjust ()
  6322. {
  6323.   pending_stack_adjust = 0;
  6324. }
  6325.  
  6326. /* When exiting from function, if safe, clear out any pending stack adjust
  6327.    so the adjustment won't get done.  */
  6328.  
  6329. void
  6330. clear_pending_stack_adjust ()
  6331. {
  6332. #ifdef EXIT_IGNORE_STACK
  6333.   if (! flag_omit_frame_pointer && EXIT_IGNORE_STACK
  6334.       && ! (DECL_INLINE (current_function_decl) && ! flag_no_inline)
  6335.       && ! flag_inline_functions)
  6336.     pending_stack_adjust = 0;
  6337. #endif
  6338. }
  6339.  
  6340. /* Pop any previously-pushed arguments that have not been popped yet.  */
  6341.  
  6342. void
  6343. do_pending_stack_adjust ()
  6344. {
  6345.   if (inhibit_defer_pop == 0)
  6346.     {
  6347.       if (pending_stack_adjust != 0)
  6348.     adjust_stack (GEN_INT (pending_stack_adjust));
  6349.       pending_stack_adjust = 0;
  6350.     }
  6351. }
  6352.  
  6353. /* Expand all cleanups up to OLD_CLEANUPS.
  6354.    Needed here, and also for language-dependent calls.  */
  6355.  
  6356. void
  6357. expand_cleanups_to (old_cleanups)
  6358.      tree old_cleanups;
  6359. {
  6360.   while (cleanups_this_call != old_cleanups)
  6361.     {
  6362.       expand_expr (TREE_VALUE (cleanups_this_call), NULL_RTX, VOIDmode, 0);
  6363.       cleanups_this_call = TREE_CHAIN (cleanups_this_call);
  6364.     }
  6365. }
  6366.  
  6367. /* Expand conditional expressions.  */
  6368.  
  6369. /* Generate code to evaluate EXP and jump to LABEL if the value is zero.
  6370.    LABEL is an rtx of code CODE_LABEL, in this function and all the
  6371.    functions here.  */
  6372.  
  6373. void
  6374. jumpifnot (exp, label)
  6375.      tree exp;
  6376.      rtx label;
  6377. {
  6378.   do_jump (exp, label, NULL_RTX);
  6379. }
  6380.  
  6381. /* Generate code to evaluate EXP and jump to LABEL if the value is nonzero.  */
  6382.  
  6383. void
  6384. jumpif (exp, label)
  6385.      tree exp;
  6386.      rtx label;
  6387. {
  6388.   do_jump (exp, NULL_RTX, label);
  6389. }
  6390.  
  6391. /* Generate code to evaluate EXP and jump to IF_FALSE_LABEL if
  6392.    the result is zero, or IF_TRUE_LABEL if the result is one.
  6393.    Either of IF_FALSE_LABEL and IF_TRUE_LABEL may be zero,
  6394.    meaning fall through in that case.
  6395.  
  6396.    do_jump always does any pending stack adjust except when it does not
  6397.    actually perform a jump.  An example where there is no jump
  6398.    is when EXP is `(foo (), 0)' and IF_FALSE_LABEL is null.
  6399.  
  6400.    This function is responsible for optimizing cases such as
  6401.    &&, || and comparison operators in EXP.  */
  6402.  
  6403. void
  6404. do_jump (exp, if_false_label, if_true_label)
  6405.      tree exp;
  6406.      rtx if_false_label, if_true_label;
  6407. {
  6408.   register enum tree_code code = TREE_CODE (exp);
  6409.   /* Some cases need to create a label to jump to
  6410.      in order to properly fall through.
  6411.      These cases set DROP_THROUGH_LABEL nonzero.  */
  6412.   rtx drop_through_label = 0;
  6413.   rtx temp;
  6414.   rtx comparison = 0;
  6415.   int i;
  6416.   tree type;
  6417.  
  6418.   emit_queue ();
  6419.  
  6420.   switch (code)
  6421.     {
  6422.     case ERROR_MARK:
  6423.       break;
  6424.  
  6425.     case INTEGER_CST:
  6426.       temp = integer_zerop (exp) ? if_false_label : if_true_label;
  6427.       if (temp)
  6428.     emit_jump (temp);
  6429.       break;
  6430.  
  6431. #if 0
  6432.       /* This is not true with #pragma weak  */
  6433.     case ADDR_EXPR:
  6434.       /* The address of something can never be zero.  */
  6435.       if (if_true_label)
  6436.     emit_jump (if_true_label);
  6437.       break;
  6438. #endif
  6439.  
  6440.     case NOP_EXPR:
  6441.       if (TREE_CODE (TREE_OPERAND (exp, 0)) == COMPONENT_REF
  6442.       || TREE_CODE (TREE_OPERAND (exp, 0)) == BIT_FIELD_REF
  6443.       || TREE_CODE (TREE_OPERAND (exp, 0)) == ARRAY_REF)
  6444.     goto normal;
  6445.     case CONVERT_EXPR:
  6446.       /* If we are narrowing the operand, we have to do the compare in the
  6447.      narrower mode.  */
  6448.       if ((TYPE_PRECISION (TREE_TYPE (exp))
  6449.        < TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (exp, 0)))))
  6450.     goto normal;
  6451.     case NON_LVALUE_EXPR:
  6452.     case REFERENCE_EXPR:
  6453.     case ABS_EXPR:
  6454.     case NEGATE_EXPR:
  6455.     case LROTATE_EXPR:
  6456.     case RROTATE_EXPR:
  6457.       /* These cannot change zero->non-zero or vice versa.  */
  6458.       do_jump (TREE_OPERAND (exp, 0), if_false_label, if_true_label);
  6459.       break;
  6460.  
  6461. #if 0
  6462.       /* This is never less insns than evaluating the PLUS_EXPR followed by
  6463.      a test and can be longer if the test is eliminated.  */
  6464.     case PLUS_EXPR:
  6465.       /* Reduce to minus.  */
  6466.       exp = build (MINUS_EXPR, TREE_TYPE (exp),
  6467.            TREE_OPERAND (exp, 0),
  6468.            fold (build1 (NEGATE_EXPR, TREE_TYPE (TREE_OPERAND (exp, 1)),
  6469.                  TREE_OPERAND (exp, 1))));
  6470.       /* Process as MINUS.  */
  6471. #endif
  6472.  
  6473.     case MINUS_EXPR:
  6474.       /* Non-zero iff operands of minus differ.  */
  6475.       comparison = compare (build (NE_EXPR, TREE_TYPE (exp),
  6476.                    TREE_OPERAND (exp, 0),
  6477.                    TREE_OPERAND (exp, 1)),
  6478.                 NE, NE);
  6479.       break;
  6480.  
  6481.     case BIT_AND_EXPR:
  6482.       /* If we are AND'ing with a small constant, do this comparison in the
  6483.      smallest type that fits.  If the machine doesn't have comparisons
  6484.      that small, it will be converted back to the wider comparison.
  6485.      This helps if we are testing the sign bit of a narrower object.
  6486.      combine can't do this for us because it can't know whether a
  6487.      ZERO_EXTRACT or a compare in a smaller mode exists, but we do.  */
  6488.  
  6489.       if (! SLOW_BYTE_ACCESS
  6490.       && TREE_CODE (TREE_OPERAND (exp, 1)) == INTEGER_CST
  6491.       && TYPE_PRECISION (TREE_TYPE (exp)) <= HOST_BITS_PER_WIDE_INT
  6492.       && (i = floor_log2 (TREE_INT_CST_LOW (TREE_OPERAND (exp, 1)))) >= 0
  6493.       && (type = type_for_size (i + 1, 1)) != 0
  6494.       && TYPE_PRECISION (type) < TYPE_PRECISION (TREE_TYPE (exp))
  6495.       && (cmp_optab->handlers[(int) TYPE_MODE (type)].insn_code
  6496.           != CODE_FOR_nothing))
  6497.     {
  6498.       do_jump (convert (type, exp), if_false_label, if_true_label);
  6499.       break;
  6500.     }
  6501.       goto normal;
  6502.  
  6503.     case TRUTH_NOT_EXPR:
  6504.       do_jump (TREE_OPERAND (exp, 0), if_true_label, if_false_label);
  6505.       break;
  6506.  
  6507.     case TRUTH_ANDIF_EXPR:
  6508.       if (if_false_label == 0)
  6509.     if_false_label = drop_through_label = gen_label_rtx ();
  6510.       do_jump (TREE_OPERAND (exp, 0), if_false_label, NULL_RTX);
  6511.       do_jump (TREE_OPERAND (exp, 1), if_false_label, if_true_label);
  6512.       break;
  6513.  
  6514.     case TRUTH_ORIF_EXPR:
  6515.       if (if_true_label == 0)
  6516.     if_true_label = drop_through_label = gen_label_rtx ();
  6517.       do_jump (TREE_OPERAND (exp, 0), NULL_RTX, if_true_label);
  6518.       do_jump (TREE_OPERAND (exp, 1), if_false_label, if_true_label);
  6519.       break;
  6520.  
  6521.     case COMPOUND_EXPR:
  6522.       expand_expr (TREE_OPERAND (exp, 0), const0_rtx, VOIDmode, 0);
  6523.       free_temp_slots ();
  6524.       emit_queue ();
  6525.       do_pending_stack_adjust ();
  6526.       do_jump (TREE_OPERAND (exp, 1), if_false_label, if_true_label);
  6527.       break;
  6528.  
  6529.     case COMPONENT_REF:
  6530.     case BIT_FIELD_REF:
  6531.     case ARRAY_REF:
  6532.       {
  6533.     int bitsize, bitpos, unsignedp;
  6534.     enum machine_mode mode;
  6535.     tree type;
  6536.     tree offset;
  6537.     int volatilep = 0;
  6538.  
  6539.     /* Get description of this reference.  We don't actually care
  6540.        about the underlying object here.  */
  6541.     get_inner_reference (exp, &bitsize, &bitpos, &offset,
  6542.                  &mode, &unsignedp, &volatilep);
  6543.  
  6544.     type = type_for_size (bitsize, unsignedp);
  6545.     if (! SLOW_BYTE_ACCESS
  6546.         && type != 0 && bitsize >= 0
  6547.         && TYPE_PRECISION (type) < TYPE_PRECISION (TREE_TYPE (exp))
  6548.         && (cmp_optab->handlers[(int) TYPE_MODE (type)].insn_code
  6549.         != CODE_FOR_nothing))
  6550.       {
  6551.         do_jump (convert (type, exp), if_false_label, if_true_label);
  6552.         break;
  6553.       }
  6554.     goto normal;
  6555.       }
  6556.  
  6557.     case COND_EXPR:
  6558.       /* Do (a ? 1 : 0) and (a ? 0 : 1) as special cases.  */
  6559.       if (integer_onep (TREE_OPERAND (exp, 1))
  6560.       && integer_zerop (TREE_OPERAND (exp, 2)))
  6561.     do_jump (TREE_OPERAND (exp, 0), if_false_label, if_true_label);
  6562.  
  6563.       else if (integer_zerop (TREE_OPERAND (exp, 1))
  6564.            && integer_onep (TREE_OPERAND (exp, 2)))
  6565.     do_jump (TREE_OPERAND (exp, 0), if_true_label, if_false_label);
  6566.  
  6567.       else
  6568.     {
  6569.       register rtx label1 = gen_label_rtx ();
  6570.       drop_through_label = gen_label_rtx ();
  6571.       do_jump (TREE_OPERAND (exp, 0), label1, NULL_RTX);
  6572.       /* Now the THEN-expression.  */
  6573.       do_jump (TREE_OPERAND (exp, 1),
  6574.            if_false_label ? if_false_label : drop_through_label,
  6575.            if_true_label ? if_true_label : drop_through_label);
  6576.       /* In case the do_jump just above never jumps.  */
  6577.       do_pending_stack_adjust ();
  6578.       emit_label (label1);
  6579.       /* Now the ELSE-expression.  */
  6580.       do_jump (TREE_OPERAND (exp, 2),
  6581.            if_false_label ? if_false_label : drop_through_label,
  6582.            if_true_label ? if_true_label : drop_through_label);
  6583.     }
  6584.       break;
  6585.  
  6586.     case EQ_EXPR:
  6587.       if (integer_zerop (TREE_OPERAND (exp, 1)))
  6588.     do_jump (TREE_OPERAND (exp, 0), if_true_label, if_false_label);
  6589.       else if ((GET_MODE_CLASS (TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0))))
  6590.         == MODE_INT)
  6591.            && 
  6592.            !can_compare_p (TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0)))))
  6593.     do_jump_by_parts_equality (exp, if_false_label, if_true_label);
  6594.       else
  6595.     comparison = compare (exp, EQ, EQ);
  6596.       break;
  6597.  
  6598.     case NE_EXPR:
  6599.       if (integer_zerop (TREE_OPERAND (exp, 1)))
  6600.     do_jump (TREE_OPERAND (exp, 0), if_false_label, if_true_label);
  6601.       else if ((GET_MODE_CLASS (TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0))))
  6602.         == MODE_INT)
  6603.            && 
  6604.            !can_compare_p (TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0)))))
  6605.     do_jump_by_parts_equality (exp, if_true_label, if_false_label);
  6606.       else
  6607.     comparison = compare (exp, NE, NE);
  6608.       break;
  6609.  
  6610.     case LT_EXPR:
  6611.       if ((GET_MODE_CLASS (TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0))))
  6612.        == MODE_INT)
  6613.       && !can_compare_p (TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0)))))
  6614.     do_jump_by_parts_greater (exp, 1, if_false_label, if_true_label);
  6615.       else
  6616.     comparison = compare (exp, LT, LTU);
  6617.       break;
  6618.  
  6619.     case LE_EXPR:
  6620.       if ((GET_MODE_CLASS (TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0))))
  6621.        == MODE_INT)
  6622.       && !can_compare_p (TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0)))))
  6623.     do_jump_by_parts_greater (exp, 0, if_true_label, if_false_label);
  6624.       else
  6625.     comparison = compare (exp, LE, LEU);
  6626.       break;
  6627.  
  6628.     case GT_EXPR:
  6629.       if ((GET_MODE_CLASS (TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0))))
  6630.        == MODE_INT)
  6631.       && !can_compare_p (TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0)))))
  6632.     do_jump_by_parts_greater (exp, 0, if_false_label, if_true_label);
  6633.       else
  6634.     comparison = compare (exp, GT, GTU);
  6635.       break;
  6636.  
  6637.     case GE_EXPR:
  6638.       if ((GET_MODE_CLASS (TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0))))
  6639.        == MODE_INT)
  6640.       && !can_compare_p (TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0)))))
  6641.     do_jump_by_parts_greater (exp, 1, if_true_label, if_false_label);
  6642.       else
  6643.     comparison = compare (exp, GE, GEU);
  6644.       break;
  6645.  
  6646.     default:
  6647.     normal:
  6648.       temp = expand_expr (exp, NULL_RTX, VOIDmode, 0);
  6649. #if 0
  6650.       /* This is not needed any more and causes poor code since it causes
  6651.      comparisons and tests from non-SI objects to have different code
  6652.      sequences.  */
  6653.       /* Copy to register to avoid generating bad insns by cse
  6654.      from (set (mem ...) (arithop))  (set (cc0) (mem ...)).  */
  6655.       if (!cse_not_expected && GET_CODE (temp) == MEM)
  6656.     temp = copy_to_reg (temp);
  6657. #endif
  6658.       do_pending_stack_adjust ();
  6659.       if (GET_CODE (temp) == CONST_INT)
  6660.     comparison = (temp == const0_rtx ? const0_rtx : const_true_rtx);
  6661.       else if (GET_CODE (temp) == LABEL_REF)
  6662.     comparison = const_true_rtx;
  6663.       else if (GET_MODE_CLASS (GET_MODE (temp)) == MODE_INT
  6664.            && !can_compare_p (GET_MODE (temp)))
  6665.     /* Note swapping the labels gives us not-equal.  */
  6666.     do_jump_by_parts_equality_rtx (temp, if_true_label, if_false_label);
  6667.       else if (GET_MODE (temp) != VOIDmode)
  6668.     comparison = compare_from_rtx (temp, CONST0_RTX (GET_MODE (temp)),
  6669.                        NE, TREE_UNSIGNED (TREE_TYPE (exp)),
  6670.                        GET_MODE (temp), NULL_RTX, 0);
  6671.       else
  6672.     abort ();
  6673.     }
  6674.  
  6675.   /* Do any postincrements in the expression that was tested.  */
  6676.   emit_queue ();
  6677.  
  6678.   /* If COMPARISON is nonzero here, it is an rtx that can be substituted
  6679.      straight into a conditional jump instruction as the jump condition.
  6680.      Otherwise, all the work has been done already.  */
  6681.  
  6682.   if (comparison == const_true_rtx)
  6683.     {
  6684.       if (if_true_label)
  6685.     emit_jump (if_true_label);
  6686.     }
  6687.   else if (comparison == const0_rtx)
  6688.     {
  6689.       if (if_false_label)
  6690.     emit_jump (if_false_label);
  6691.     }
  6692.   else if (comparison)
  6693.     do_jump_for_compare (comparison, if_false_label, if_true_label);
  6694.  
  6695.   free_temp_slots ();
  6696.  
  6697.   if (drop_through_label)
  6698.     {
  6699.       /* If do_jump produces code that might be jumped around,
  6700.      do any stack adjusts from that code, before the place
  6701.      where control merges in.  */
  6702.       do_pending_stack_adjust ();
  6703.       emit_label (drop_through_label);
  6704.     }
  6705. }
  6706.  
  6707. /* Given a comparison expression EXP for values too wide to be compared
  6708.    with one insn, test the comparison and jump to the appropriate label.
  6709.    The code of EXP is ignored; we always test GT if SWAP is 0,
  6710.    and LT if SWAP is 1.  */
  6711.  
  6712. static void
  6713. do_jump_by_parts_greater (exp, swap, if_false_label, if_true_label)
  6714.      tree exp;
  6715.      int swap;
  6716.      rtx if_false_label, if_true_label;
  6717. {
  6718.   rtx op0 = expand_expr (TREE_OPERAND (exp, swap), NULL_RTX, VOIDmode, 0);
  6719.   rtx op1 = expand_expr (TREE_OPERAND (exp, !swap), NULL_RTX, VOIDmode, 0);
  6720.   enum machine_mode mode = TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0)));
  6721.   int nwords = (GET_MODE_SIZE (mode) / UNITS_PER_WORD);
  6722.   rtx drop_through_label = 0;
  6723.   int unsignedp = TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (exp, 0)));
  6724.   int i;
  6725.  
  6726.   if (! if_true_label || ! if_false_label)
  6727.     drop_through_label = gen_label_rtx ();
  6728.   if (! if_true_label)
  6729.     if_true_label = drop_through_label;
  6730.   if (! if_false_label)
  6731.     if_false_label = drop_through_label;
  6732.  
  6733.   /* Compare a word at a time, high order first.  */
  6734.   for (i = 0; i < nwords; i++)
  6735.     {
  6736.       rtx comp;
  6737.       rtx op0_word, op1_word;
  6738.  
  6739.       if (WORDS_BIG_ENDIAN)
  6740.     {
  6741.       op0_word = operand_subword_force (op0, i, mode);
  6742.       op1_word = operand_subword_force (op1, i, mode);
  6743.     }
  6744.       else
  6745.     {
  6746.       op0_word = operand_subword_force (op0, nwords - 1 - i, mode);
  6747.       op1_word = operand_subword_force (op1, nwords - 1 - i, mode);
  6748.     }
  6749.  
  6750.       /* All but high-order word must be compared as unsigned.  */
  6751.       comp = compare_from_rtx (op0_word, op1_word,
  6752.                    (unsignedp || i > 0) ? GTU : GT,
  6753.                    unsignedp, word_mode, NULL_RTX, 0);
  6754.       if (comp == const_true_rtx)
  6755.     emit_jump (if_true_label);
  6756.       else if (comp != const0_rtx)
  6757.     do_jump_for_compare (comp, NULL_RTX, if_true_label);
  6758.  
  6759.       /* Consider lower words only if these are equal.  */
  6760.       comp = compare_from_rtx (op0_word, op1_word, NE, unsignedp, word_mode,
  6761.                    NULL_RTX, 0);
  6762.       if (comp == const_true_rtx)
  6763.     emit_jump (if_false_label);
  6764.       else if (comp != const0_rtx)
  6765.     do_jump_for_compare (comp, NULL_RTX, if_false_label);
  6766.     }
  6767.  
  6768.   if (if_false_label)
  6769.     emit_jump (if_false_label);
  6770.   if (drop_through_label)
  6771.     emit_label (drop_through_label);
  6772. }
  6773.  
  6774. /* Given an EQ_EXPR expression EXP for values too wide to be compared
  6775.    with one insn, test the comparison and jump to the appropriate label.  */
  6776.  
  6777. static void
  6778. do_jump_by_parts_equality (exp, if_false_label, if_true_label)
  6779.      tree exp;
  6780.      rtx if_false_label, if_true_label;
  6781. {
  6782.   rtx op0 = expand_expr (TREE_OPERAND (exp, 0), NULL_RTX, VOIDmode, 0);
  6783.   rtx op1 = expand_expr (TREE_OPERAND (exp, 1), NULL_RTX, VOIDmode, 0);
  6784.   enum machine_mode mode = TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0)));
  6785.   int nwords = (GET_MODE_SIZE (mode) / UNITS_PER_WORD);
  6786.   int i;
  6787.   rtx drop_through_label = 0;
  6788.  
  6789.   if (! if_false_label)
  6790.     drop_through_label = if_false_label = gen_label_rtx ();
  6791.  
  6792.   for (i = 0; i < nwords; i++)
  6793.     {
  6794.       rtx comp = compare_from_rtx (operand_subword_force (op0, i, mode),
  6795.                    operand_subword_force (op1, i, mode),
  6796.                    EQ, TREE_UNSIGNED (TREE_TYPE (exp)),
  6797.                    word_mode, NULL_RTX, 0);
  6798.       if (comp == const_true_rtx)
  6799.     emit_jump (if_false_label);
  6800.       else if (comp != const0_rtx)
  6801.     do_jump_for_compare (comp, if_false_label, NULL_RTX);
  6802.     }
  6803.  
  6804.   if (if_true_label)
  6805.     emit_jump (if_true_label);
  6806.   if (drop_through_label)
  6807.     emit_label (drop_through_label);
  6808. }
  6809.  
  6810. /* Jump according to whether OP0 is 0.
  6811.    We assume that OP0 has an integer mode that is too wide
  6812.    for the available compare insns.  */
  6813.  
  6814. static void
  6815. do_jump_by_parts_equality_rtx (op0, if_false_label, if_true_label)
  6816.      rtx op0;
  6817.      rtx if_false_label, if_true_label;
  6818. {
  6819.   int nwords = GET_MODE_SIZE (GET_MODE (op0)) / UNITS_PER_WORD;
  6820.   int i;
  6821.   rtx drop_through_label = 0;
  6822.  
  6823.   if (! if_false_label)
  6824.     drop_through_label = if_false_label = gen_label_rtx ();
  6825.  
  6826.   for (i = 0; i < nwords; i++)
  6827.     {
  6828.       rtx comp = compare_from_rtx (operand_subword_force (op0, i,
  6829.                               GET_MODE (op0)),
  6830.                    const0_rtx, EQ, 1, word_mode, NULL_RTX, 0);
  6831.       if (comp == const_true_rtx)
  6832.     emit_jump (if_false_label);
  6833.       else if (comp != const0_rtx)
  6834.     do_jump_for_compare (comp, if_false_label, NULL_RTX);
  6835.     }
  6836.  
  6837.   if (if_true_label)
  6838.     emit_jump (if_true_label);
  6839.   if (drop_through_label)
  6840.     emit_label (drop_through_label);
  6841. }
  6842.  
  6843. /* Given a comparison expression in rtl form, output conditional branches to
  6844.    IF_TRUE_LABEL, IF_FALSE_LABEL, or both.  */
  6845.  
  6846. static void
  6847. do_jump_for_compare (comparison, if_false_label, if_true_label)
  6848.      rtx comparison, if_false_label, if_true_label;
  6849. {
  6850.   if (if_true_label)
  6851.     {
  6852.       if (bcc_gen_fctn[(int) GET_CODE (comparison)] != 0)
  6853.     emit_jump_insn ((*bcc_gen_fctn[(int) GET_CODE (comparison)]) (if_true_label));
  6854.       else
  6855.     abort ();
  6856.  
  6857.       if (if_false_label)
  6858.     emit_jump (if_false_label);
  6859.     }
  6860.   else if (if_false_label)
  6861.     {
  6862.       rtx insn;
  6863.       rtx prev = PREV_INSN (get_last_insn ());
  6864.       rtx branch = 0;
  6865.  
  6866.       /* Output the branch with the opposite condition.  Then try to invert
  6867.      what is generated.  If more than one insn is a branch, or if the
  6868.      branch is not the last insn written, abort. If we can't invert
  6869.      the branch, emit make a true label, redirect this jump to that,
  6870.      emit a jump to the false label and define the true label.  */
  6871.  
  6872.       if (bcc_gen_fctn[(int) GET_CODE (comparison)] != 0)
  6873.     emit_jump_insn ((*bcc_gen_fctn[(int) GET_CODE (comparison)]) (if_false_label));
  6874.       else
  6875.     abort ();
  6876.  
  6877.       /* Here we get the insn before what was just emitted.
  6878.      On some machines, emitting the branch can discard
  6879.      the previous compare insn and emit a replacement.  */
  6880.       if (prev == 0)
  6881.     /* If there's only one preceding insn...  */
  6882.     insn = get_insns ();
  6883.       else
  6884.     insn = NEXT_INSN (prev);
  6885.  
  6886.       for (insn = NEXT_INSN (insn); insn; insn = NEXT_INSN (insn))
  6887.     if (GET_CODE (insn) == JUMP_INSN)
  6888.       {
  6889.         if (branch)
  6890.           abort ();
  6891.         branch = insn;
  6892.       }
  6893.  
  6894.       if (branch != get_last_insn ())
  6895.     abort ();
  6896.  
  6897.       if (! invert_jump (branch, if_false_label))
  6898.     {
  6899.       if_true_label = gen_label_rtx ();
  6900.       redirect_jump (branch, if_true_label);
  6901.       emit_jump (if_false_label);
  6902.       emit_label (if_true_label);
  6903.     }
  6904.     }
  6905. }
  6906.  
  6907. /* Generate code for a comparison expression EXP
  6908.    (including code to compute the values to be compared)
  6909.    and set (CC0) according to the result.
  6910.    SIGNED_CODE should be the rtx operation for this comparison for
  6911.    signed data; UNSIGNED_CODE, likewise for use if data is unsigned.
  6912.  
  6913.    We force a stack adjustment unless there are currently
  6914.    things pushed on the stack that aren't yet used.  */
  6915.  
  6916. static rtx
  6917. compare (exp, signed_code, unsigned_code)
  6918.      register tree exp;
  6919.      enum rtx_code signed_code, unsigned_code;
  6920. {
  6921.   register rtx op0
  6922.     = expand_expr (TREE_OPERAND (exp, 0), NULL_RTX, VOIDmode, 0);
  6923.   register rtx op1
  6924.     = expand_expr (TREE_OPERAND (exp, 1), NULL_RTX, VOIDmode, 0);
  6925.   register tree type = TREE_TYPE (TREE_OPERAND (exp, 0));
  6926.   register enum machine_mode mode = TYPE_MODE (type);
  6927.   int unsignedp = TREE_UNSIGNED (type);
  6928.   enum rtx_code code = unsignedp ? unsigned_code : signed_code;
  6929.  
  6930.   return compare_from_rtx (op0, op1, code, unsignedp, mode,
  6931.                ((mode == BLKmode)
  6932.                 ? expr_size (TREE_OPERAND (exp, 0)) : NULL_RTX),
  6933.                TYPE_ALIGN (TREE_TYPE (exp)) / BITS_PER_UNIT);
  6934. }
  6935.  
  6936. /* Like compare but expects the values to compare as two rtx's.
  6937.    The decision as to signed or unsigned comparison must be made by the caller.
  6938.  
  6939.    If MODE is BLKmode, SIZE is an RTX giving the size of the objects being
  6940.    compared.
  6941.  
  6942.    If ALIGN is non-zero, it is the alignment of this type; if zero, the
  6943.    size of MODE should be used.  */
  6944.  
  6945. rtx
  6946. compare_from_rtx (op0, op1, code, unsignedp, mode, size, align)
  6947.      register rtx op0, op1;
  6948.      enum rtx_code code;
  6949.      int unsignedp;
  6950.      enum machine_mode mode;
  6951.      rtx size;
  6952.      int align;
  6953. {
  6954.   /* If one operand is constant, make it the second one.  */
  6955.  
  6956.   if (GET_CODE (op0) == CONST_INT || GET_CODE (op0) == CONST_DOUBLE)
  6957.     {
  6958.       rtx tem = op0;
  6959.       op0 = op1;
  6960.       op1 = tem;
  6961.       code = swap_condition (code);
  6962.     }
  6963.  
  6964.   if (flag_force_mem)
  6965.     {
  6966.       op0 = force_not_mem (op0);
  6967.       op1 = force_not_mem (op1);
  6968.     }
  6969.  
  6970.   do_pending_stack_adjust ();
  6971.  
  6972.   if (GET_CODE (op0) == CONST_INT && GET_CODE (op1) == CONST_INT)
  6973.     return simplify_relational_operation (code, mode, op0, op1);
  6974.  
  6975. #if 0
  6976.   /* There's no need to do this now that combine.c can eliminate lots of
  6977.      sign extensions.  This can be less efficient in certain cases on other
  6978.      machines.
  6979.  
  6980.   /* If this is a signed equality comparison, we can do it as an
  6981.      unsigned comparison since zero-extension is cheaper than sign
  6982.      extension and comparisons with zero are done as unsigned.  This is
  6983.      the case even on machines that can do fast sign extension, since
  6984.      zero-extension is easier to combinen with other operations than
  6985.      sign-extension is.  If we are comparing against a constant, we must
  6986.      convert it to what it would look like unsigned.  */
  6987.   if ((code == EQ || code == NE) && ! unsignedp
  6988.       && GET_MODE_BITSIZE (GET_MODE (op0)) <= HOST_BITS_PER_WIDE_INT)
  6989.     {
  6990.       if (GET_CODE (op1) == CONST_INT
  6991.       && (INTVAL (op1) & GET_MODE_MASK (GET_MODE (op0))) != INTVAL (op1))
  6992.     op1 = GEN_INT (INTVAL (op1) & GET_MODE_MASK (GET_MODE (op0)));
  6993.       unsignedp = 1;
  6994.     }
  6995. #endif
  6996.     
  6997.   emit_cmp_insn (op0, op1, code, size, mode, unsignedp, align);
  6998.  
  6999.   return gen_rtx (code, VOIDmode, cc0_rtx, const0_rtx);
  7000. }
  7001.  
  7002. /* Generate code to calculate EXP using a store-flag instruction
  7003.    and return an rtx for the result.  EXP is either a comparison
  7004.    or a TRUTH_NOT_EXPR whose operand is a comparison.
  7005.  
  7006.    If TARGET is nonzero, store the result there if convenient.
  7007.  
  7008.    If ONLY_CHEAP is non-zero, only do this if it is likely to be very
  7009.    cheap.
  7010.  
  7011.    Return zero if there is no suitable set-flag instruction
  7012.    available on this machine.
  7013.  
  7014.    Once expand_expr has been called on the arguments of the comparison,
  7015.    we are committed to doing the store flag, since it is not safe to
  7016.    re-evaluate the expression.  We emit the store-flag insn by calling
  7017.    emit_store_flag, but only expand the arguments if we have a reason
  7018.    to believe that emit_store_flag will be successful.  If we think that
  7019.    it will, but it isn't, we have to simulate the store-flag with a
  7020.    set/jump/set sequence.  */
  7021.  
  7022. static rtx
  7023. do_store_flag (exp, target, mode, only_cheap)
  7024.      tree exp;
  7025.      rtx target;
  7026.      enum machine_mode mode;
  7027.      int only_cheap;
  7028. {
  7029.   enum rtx_code code;
  7030.   tree arg0, arg1, type;
  7031.   tree tem;
  7032.   enum machine_mode operand_mode;
  7033.   int invert = 0;
  7034.   int unsignedp;
  7035.   rtx op0, op1;
  7036.   enum insn_code icode;
  7037.   rtx subtarget = target;
  7038.   rtx result, label, pattern, jump_pat;
  7039.  
  7040.   /* If this is a TRUTH_NOT_EXPR, set a flag indicating we must invert the
  7041.      result at the end.  We can't simply invert the test since it would
  7042.      have already been inverted if it were valid.  This case occurs for
  7043.      some floating-point comparisons.  */
  7044.  
  7045.   if (TREE_CODE (exp) == TRUTH_NOT_EXPR)
  7046.     invert = 1, exp = TREE_OPERAND (exp, 0);
  7047.  
  7048.   arg0 = TREE_OPERAND (exp, 0);
  7049.   arg1 = TREE_OPERAND (exp, 1);
  7050.   type = TREE_TYPE (arg0);
  7051.   operand_mode = TYPE_MODE (type);
  7052.   unsignedp = TREE_UNSIGNED (type);
  7053.  
  7054.   /* We won't bother with BLKmode store-flag operations because it would mean
  7055.      passing a lot of information to emit_store_flag.  */
  7056.   if (operand_mode == BLKmode)
  7057.     return 0;
  7058.  
  7059.   STRIP_NOPS (arg0);
  7060.   STRIP_NOPS (arg1);
  7061.  
  7062.   /* Get the rtx comparison code to use.  We know that EXP is a comparison
  7063.      operation of some type.  Some comparisons against 1 and -1 can be
  7064.      converted to comparisons with zero.  Do so here so that the tests
  7065.      below will be aware that we have a comparison with zero.   These
  7066.      tests will not catch constants in the first operand, but constants
  7067.      are rarely passed as the first operand.  */
  7068.  
  7069.   switch (TREE_CODE (exp))
  7070.     {
  7071.     case EQ_EXPR:
  7072.       code = EQ;
  7073.       break;
  7074.     case NE_EXPR:
  7075.       code = NE;
  7076.       break;
  7077.     case LT_EXPR:
  7078.       if (integer_onep (arg1))
  7079.     arg1 = integer_zero_node, code = unsignedp ? LEU : LE;
  7080.       else
  7081.     code = unsignedp ? LTU : LT;
  7082.       break;
  7083.     case LE_EXPR:
  7084.       if (integer_all_onesp (arg1))
  7085.     arg1 = integer_zero_node, code = unsignedp ? LTU : LT;
  7086.       else
  7087.     code = unsignedp ? LEU : LE;
  7088.       break;
  7089.     case GT_EXPR:
  7090.       if (integer_all_onesp (arg1))
  7091.     arg1 = integer_zero_node, code = unsignedp ? GEU : GE;
  7092.       else
  7093.     code = unsignedp ? GTU : GT;
  7094.       break;
  7095.     case GE_EXPR:
  7096.       if (integer_onep (arg1))
  7097.     arg1 = integer_zero_node, code = unsignedp ? GTU : GT;
  7098.       else
  7099.     code = unsignedp ? GEU : GE;
  7100.       break;
  7101.     default:
  7102.       abort ();
  7103.     }
  7104.  
  7105.   /* Put a constant second.  */
  7106.   if (TREE_CODE (arg0) == REAL_CST || TREE_CODE (arg0) == INTEGER_CST)
  7107.     {
  7108.       tem = arg0; arg0 = arg1; arg1 = tem;
  7109.       code = swap_condition (code);
  7110.     }
  7111.  
  7112.   /* If this is an equality or inequality test of a single bit, we can
  7113.      do this by shifting the bit being tested to the low-order bit and
  7114.      masking the result with the constant 1.  If the condition was EQ,
  7115.      we xor it with 1.  This does not require an scc insn and is faster
  7116.      than an scc insn even if we have it.  */
  7117.  
  7118.   if ((code == NE || code == EQ)
  7119.       && TREE_CODE (arg0) == BIT_AND_EXPR && integer_zerop (arg1)
  7120.       && integer_pow2p (TREE_OPERAND (arg0, 1))
  7121.       && TYPE_PRECISION (type) <= HOST_BITS_PER_WIDE_INT)
  7122.     {
  7123.       int bitnum = exact_log2 (INTVAL (expand_expr (TREE_OPERAND (arg0, 1),
  7124.                             NULL_RTX, VOIDmode, 0)));
  7125.  
  7126.       if (subtarget == 0 || GET_CODE (subtarget) != REG
  7127.       || GET_MODE (subtarget) != operand_mode
  7128.       || ! safe_from_p (subtarget, TREE_OPERAND (arg0, 0)))
  7129.     subtarget = 0;
  7130.  
  7131.       op0 = expand_expr (TREE_OPERAND (arg0, 0), subtarget, VOIDmode, 0);
  7132.  
  7133.       if (bitnum != 0)
  7134.     op0 = expand_shift (RSHIFT_EXPR, GET_MODE (op0), op0,
  7135.                 size_int (bitnum), target, 1);
  7136.  
  7137.       if (GET_MODE (op0) != mode)
  7138.     op0 = convert_to_mode (mode, op0, 1);
  7139.  
  7140.       if (bitnum != TYPE_PRECISION (type) - 1)
  7141.     op0 = expand_and (op0, const1_rtx, target);
  7142.  
  7143.       if ((code == EQ && ! invert) || (code == NE && invert))
  7144.     op0 = expand_binop (mode, xor_optab, op0, const1_rtx, target, 0,
  7145.                 OPTAB_LIB_WIDEN);
  7146.  
  7147.       return op0;
  7148.     }
  7149.  
  7150.   /* Now see if we are likely to be able to do this.  Return if not.  */
  7151.   if (! can_compare_p (operand_mode))
  7152.     return 0;
  7153.   icode = setcc_gen_code[(int) code];
  7154.   if (icode == CODE_FOR_nothing
  7155.       || (only_cheap && insn_operand_mode[(int) icode][0] != mode))
  7156.     {
  7157.       /* We can only do this if it is one of the special cases that
  7158.      can be handled without an scc insn.  */
  7159.       if ((code == LT && integer_zerop (arg1))
  7160.       || (! only_cheap && code == GE && integer_zerop (arg1)))
  7161.     ;
  7162.       else if (BRANCH_COST >= 0
  7163.            && ! only_cheap && (code == NE || code == EQ)
  7164.            && TREE_CODE (type) != REAL_TYPE
  7165.            && ((abs_optab->handlers[(int) operand_mode].insn_code
  7166.             != CODE_FOR_nothing)
  7167.            || (ffs_optab->handlers[(int) operand_mode].insn_code
  7168.                != CODE_FOR_nothing)))
  7169.     ;
  7170.       else
  7171.     return 0;
  7172.     }
  7173.       
  7174.   preexpand_calls (exp);
  7175.   if (subtarget == 0 || GET_CODE (subtarget) != REG
  7176.       || GET_MODE (subtarget) != operand_mode
  7177.       || ! safe_from_p (subtarget, arg1))
  7178.     subtarget = 0;
  7179.  
  7180.   op0 = expand_expr (arg0, subtarget, VOIDmode, 0);
  7181.   op1 = expand_expr (arg1, NULL_RTX, VOIDmode, 0);
  7182.  
  7183.   if (target == 0)
  7184.     target = gen_reg_rtx (mode);
  7185.  
  7186.   /* Pass copies of OP0 and OP1 in case they contain a QUEUED.  This is safe
  7187.      because, if the emit_store_flag does anything it will succeed and
  7188.      OP0 and OP1 will not be used subsequently.  */
  7189.  
  7190.   result = emit_store_flag (target, code,
  7191.                 queued_subexp_p (op0) ? copy_rtx (op0) : op0,
  7192.                 queued_subexp_p (op1) ? copy_rtx (op1) : op1,
  7193.                 operand_mode, unsignedp, 1);
  7194.  
  7195.   if (result)
  7196.     {
  7197.       if (invert)
  7198.     result = expand_binop (mode, xor_optab, result, const1_rtx,
  7199.                    result, 0, OPTAB_LIB_WIDEN);
  7200.       return result;
  7201.     }
  7202.  
  7203.   /* If this failed, we have to do this with set/compare/jump/set code.  */
  7204.   if (target == 0 || GET_CODE (target) != REG
  7205.       || reg_mentioned_p (target, op0) || reg_mentioned_p (target, op1))
  7206.     target = gen_reg_rtx (GET_MODE (target));
  7207.  
  7208.   emit_move_insn (target, invert ? const0_rtx : const1_rtx);
  7209.   result = compare_from_rtx (op0, op1, code, unsignedp,
  7210.                  operand_mode, NULL_RTX, 0);
  7211.   if (GET_CODE (result) == CONST_INT)
  7212.     return (((result == const0_rtx && ! invert)
  7213.          || (result != const0_rtx && invert))
  7214.         ? const0_rtx : const1_rtx);
  7215.  
  7216.   label = gen_label_rtx ();
  7217.   if (bcc_gen_fctn[(int) code] == 0)
  7218.     abort ();
  7219.  
  7220.   emit_jump_insn ((*bcc_gen_fctn[(int) code]) (label));
  7221.   emit_move_insn (target, invert ? const1_rtx : const0_rtx);
  7222.   emit_label (label);
  7223.  
  7224.   return target;
  7225. }
  7226.  
  7227. /* Generate a tablejump instruction (used for switch statements).  */
  7228.  
  7229. #ifdef HAVE_tablejump
  7230.  
  7231. /* INDEX is the value being switched on, with the lowest value
  7232.    in the table already subtracted.
  7233.    MODE is its expected mode (needed if INDEX is constant).
  7234.    RANGE is the length of the jump table.
  7235.    TABLE_LABEL is a CODE_LABEL rtx for the table itself.
  7236.  
  7237.    DEFAULT_LABEL is a CODE_LABEL rtx to jump to if the
  7238.    index value is out of range.  */
  7239.  
  7240. void
  7241. do_tablejump (index, mode, range, table_label, default_label)
  7242.      rtx index, range, table_label, default_label;
  7243.      enum machine_mode mode;
  7244. {
  7245.   register rtx temp, vector;
  7246.  
  7247.   /* Do an unsigned comparison (in the proper mode) between the index
  7248.      expression and the value which represents the length of the range.
  7249.      Since we just finished subtracting the lower bound of the range
  7250.      from the index expression, this comparison allows us to simultaneously
  7251.      check that the original index expression value is both greater than
  7252.      or equal to the minimum value of the range and less than or equal to
  7253.      the maximum value of the range.  */
  7254.  
  7255.   emit_cmp_insn (range, index, LTU, NULL_RTX, mode, 0, 0);
  7256.   emit_jump_insn (gen_bltu (default_label));
  7257.  
  7258.   /* If index is in range, it must fit in Pmode.
  7259.      Convert to Pmode so we can index with it.  */
  7260.   if (mode != Pmode)
  7261.     index = convert_to_mode (Pmode, index, 1);
  7262.  
  7263.   /* If flag_force_addr were to affect this address
  7264.      it could interfere with the tricky assumptions made
  7265.      about addresses that contain label-refs,
  7266.      which may be valid only very near the tablejump itself.  */
  7267.   /* ??? The only correct use of CASE_VECTOR_MODE is the one inside the
  7268.      GET_MODE_SIZE, because this indicates how large insns are.  The other
  7269.      uses should all be Pmode, because they are addresses.  This code
  7270.      could fail if addresses and insns are not the same size.  */
  7271.   index = memory_address_noforce
  7272.     (CASE_VECTOR_MODE,
  7273.      gen_rtx (PLUS, Pmode,
  7274.           gen_rtx (MULT, Pmode, index,
  7275.                GEN_INT (GET_MODE_SIZE (CASE_VECTOR_MODE))),
  7276.           gen_rtx (LABEL_REF, Pmode, table_label)));
  7277.   temp = gen_reg_rtx (CASE_VECTOR_MODE);
  7278.   vector = gen_rtx (MEM, CASE_VECTOR_MODE, index);
  7279.   RTX_UNCHANGING_P (vector) = 1;
  7280.   convert_move (temp, vector, 0);
  7281.  
  7282.   emit_jump_insn (gen_tablejump (temp, table_label));
  7283.  
  7284. #ifndef CASE_VECTOR_PC_RELATIVE
  7285.   /* If we are generating PIC code or if the table is PC-relative, the
  7286.      table and JUMP_INSN must be adjacent, so don't output a BARRIER.  */
  7287.   if (! flag_pic)
  7288.     emit_barrier ();
  7289. #endif
  7290. }
  7291.  
  7292. #endif /* HAVE_tablejump */
  7293.