home *** CD-ROM | disk | FTP | other *** search
/ GEMini Atari / GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso / files / gnu / g__src1 / expr.c < prev   
Encoding:
C/C++ Source or Header  |  1993-07-23  |  165.2 KB  |  5,460 lines

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