OSDN Git Service

* configure.in: Add *-*-freebsd* configurations.
[pf3gnuchains/gcc-fork.git] / gcc / recog.c
index a73d6d7..3289f6e 100644 (file)
@@ -1,23 +1,23 @@
 /* Subroutines used by or related to instruction recognition.
    Copyright (C) 1987, 1988, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998
-   1999, 2000, 2001 Free Software Foundation, Inc.
+   1999, 2000, 2001, 2002 Free Software Foundation, Inc.
 
-This file is part of GNU CC.
+This file is part of GCC.
 
-GNU CC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
 
-GNU CC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
 You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING.  If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.  */
+along with GCC; see the file COPYING.  If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA.  */
 
 
 #include "config.h"
@@ -29,6 +29,7 @@ Boston, MA 02111-1307, USA.  */
 #include "hard-reg-set.h"
 #include "recog.h"
 #include "regs.h"
+#include "expr.h"
 #include "function.h"
 #include "flags.h"
 #include "real.h"
@@ -55,7 +56,6 @@ Boston, MA 02111-1307, USA.  */
 
 static void validate_replace_rtx_1     PARAMS ((rtx *, rtx, rtx, rtx));
 static rtx *find_single_use_1          PARAMS ((rtx, rtx *));
-static rtx *find_constant_term_loc     PARAMS ((rtx *));
 static void validate_replace_src_1     PARAMS ((rtx *, void *));
 static rtx split_insn                  PARAMS ((rtx));
 
@@ -157,7 +157,7 @@ check_asm_operands (x)
       const char *c = constraints[i];
       if (c[0] == '%')
        c++;
-      if (ISDIGIT ((unsigned char)c[0]) && c[1] == '\0')
+      if (ISDIGIT ((unsigned char) c[0]) && c[1] == '\0')
        c = constraints[c[0] - '0'];
 
       if (! asm_operand_ok (operands[i], c))
@@ -182,7 +182,7 @@ static int changes_allocated;
 
 static int num_changes = 0;
 
-/* Validate a proposed change to OBJECT.  LOC is the location in the rtl for
+/* Validate a proposed change to OBJECT.  LOC is the location in the rtl
    at which NEW will be placed.  If OBJECT is zero, no validation is done,
    the change is simply made.
 
@@ -215,7 +215,7 @@ validate_change (object, loc, new, in_group)
   if (in_group == 0 && num_changes != 0)
     abort ();
 
-   *loc = new;
+  *loc = new;
 
   /* Save the information describing this change.  */
   if (num_changes >= changes_allocated)
@@ -353,33 +353,33 @@ apply_change_group ()
              && GET_CODE (XVECEXP (pat, 0, XVECLEN (pat, 0) - 1)) == CLOBBER
              && asm_noperands (PATTERN (object)) < 0)
            {
-              rtx newpat;
-
-              if (XVECLEN (pat, 0) == 2)
-                newpat = XVECEXP (pat, 0, 0);
-              else
-                {
-                  int j;
-
-                  newpat
-                    = gen_rtx_PARALLEL (VOIDmode, 
-                                        rtvec_alloc (XVECLEN (pat, 0) - 1));
-                  for (j = 0; j < XVECLEN (newpat, 0); j++)
-                    XVECEXP (newpat, 0, j) = XVECEXP (pat, 0, j);
-                }
-
-              /* Add a new change to this group to replace the pattern
-                 with this new pattern.  Then consider this change
-                 as having succeeded.  The change we added will
-                 cause the entire call to fail if things remain invalid.
-
-                 Note that this can lose if a later change than the one
-                 we are processing specified &XVECEXP (PATTERN (object), 0, X)
-                 but this shouldn't occur.  */
-
-              validate_change (object, &PATTERN (object), newpat, 1);
-              continue;
-            }
+             rtx newpat;
+
+             if (XVECLEN (pat, 0) == 2)
+               newpat = XVECEXP (pat, 0, 0);
+             else
+               {
+                 int j;
+
+                 newpat
+                   = gen_rtx_PARALLEL (VOIDmode, 
+                                       rtvec_alloc (XVECLEN (pat, 0) - 1));
+                 for (j = 0; j < XVECLEN (newpat, 0); j++)
+                   XVECEXP (newpat, 0, j) = XVECEXP (pat, 0, j);
+               }
+
+             /* Add a new change to this group to replace the pattern
+                with this new pattern.  Then consider this change
+                as having succeeded.  The change we added will
+                cause the entire call to fail if things remain invalid.
+
+                Note that this can lose if a later change than the one
+                we are processing specified &XVECEXP (PATTERN (object), 0, X)
+                but this shouldn't occur.  */
+
+             validate_change (object, &PATTERN (object), newpat, 1);
+             continue;
+           }
          else if (GET_CODE (pat) == USE || GET_CODE (pat) == CLOBBER)
            /* If this insn is a CLOBBER or USE, it is always valid, but is
               never recognized.  */
@@ -392,6 +392,17 @@ apply_change_group ()
 
   if (i == num_changes)
     {
+      basic_block bb;
+
+      for (i = 0; i < num_changes; i++)
+       if (changes[i].object
+           && INSN_P (changes[i].object)
+           && basic_block_for_insn
+           && ((unsigned int)INSN_UID (changes[i].object)
+               < basic_block_for_insn->num_elements)
+           && (bb = BLOCK_FOR_INSN (changes[i].object)))
+        bb->flags |= BB_DIRTY;
+
       num_changes = 0;
       return 1;
     }
@@ -402,7 +413,7 @@ apply_change_group ()
     }
 }
 
-/* Return the number of changes so far in the current group.   */
+/* Return the number of changes so far in the current group.  */
 
 int
 num_validated_changes ()
@@ -437,9 +448,9 @@ validate_replace_rtx_1 (loc, from, to, object)
      rtx *loc;
      rtx from, to, object;
 {
-  register int i, j;
-  register const char *fmt;
-  register rtx x = *loc;
+  int i, j;
+  const char *fmt;
+  rtx x = *loc;
   enum rtx_code code;
   enum machine_mode op0_mode = VOIDmode;
   int prev_changes = num_changes;
@@ -468,7 +479,7 @@ validate_replace_rtx_1 (loc, from, to, object)
       return;
     }
 
-  /* Call ourseves recursivly to perform the replacements.  */
+  /* Call ourself recursively to perform the replacements.  */
 
   for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
     {
@@ -479,7 +490,7 @@ validate_replace_rtx_1 (loc, from, to, object)
          validate_replace_rtx_1 (&XVECEXP (x, i, j), from, to, object);
     }
 
-  /* In case we didn't substituted, there is nothing to do.  */
+  /* If we didn't substitute, there is nothing more to do.  */
   if (num_changes == prev_changes)
     return;
 
@@ -512,7 +523,8 @@ validate_replace_rtx_1 (loc, from, to, object)
          separated from this function.  */
       if (GET_CODE (XEXP (x, 1)) == CONST_INT)
        validate_change (object, loc,
-                        plus_constant (XEXP (x, 0), XEXP (x, 1)), 1);
+                        simplify_gen_binary
+                        (PLUS, GET_MODE (x), XEXP (x, 0), XEXP (x, 1)), 1);
       break;
     case MINUS:
       if (GET_CODE (XEXP (x, 1)) == CONST_INT
@@ -521,8 +533,8 @@ validate_replace_rtx_1 (loc, from, to, object)
                         simplify_gen_binary
                         (PLUS, GET_MODE (x), XEXP (x, 0),
                          simplify_gen_unary (NEG,
-                                             op0_mode, XEXP (x, 1),
-                                             op0_mode)), 1);
+                                             GET_MODE (x), XEXP (x, 1),
+                                             GET_MODE (x))), 1);
       break;
     case ZERO_EXTEND:
     case SIGN_EXTEND:
@@ -542,7 +554,7 @@ validate_replace_rtx_1 (loc, from, to, object)
       new = simplify_subreg (GET_MODE (x), SUBREG_REG (x), op0_mode,
                             SUBREG_BYTE (x));
 
-      /* Subregs of VOIDmode operands are incorect.  */
+      /* Subregs of VOIDmode operands are incorrect.  */
       if (!new && GET_MODE (SUBREG_REG (x)) == VOIDmode)
        new = gen_rtx_CLOBBER (GET_MODE (x), const0_rtx);
       if (new)
@@ -565,22 +577,20 @@ validate_replace_rtx_1 (loc, from, to, object)
          enum machine_mode is_mode = GET_MODE (XEXP (x, 0));
          int pos = INTVAL (XEXP (x, 2));
 
-#ifdef HAVE_extzv
-         if (code == ZERO_EXTRACT)
+         if (GET_CODE (x) == ZERO_EXTRACT)
            {
-             wanted_mode = insn_data[(int) CODE_FOR_extzv].operand[1].mode;
-             if (wanted_mode == VOIDmode)
-               wanted_mode = word_mode;
+             enum machine_mode new_mode
+               = mode_for_extraction (EP_extzv, 1);
+             if (new_mode != MAX_MACHINE_MODE)
+               wanted_mode = new_mode;
            }
-#endif
-#ifdef HAVE_extv
-         if (code == SIGN_EXTRACT)
+         else if (GET_CODE (x) == SIGN_EXTRACT)
            {
-             wanted_mode = insn_data[(int) CODE_FOR_extv].operand[1].mode;
-             if (wanted_mode == VOIDmode)
-               wanted_mode = word_mode;
+             enum machine_mode new_mode
+               = mode_for_extraction (EP_extv, 1);
+             if (new_mode != MAX_MACHINE_MODE)
+               wanted_mode = new_mode;
            }
-#endif
 
          /* If we have a narrower mode, we can do something.  */
          if (wanted_mode != VOIDmode
@@ -598,10 +608,7 @@ validate_replace_rtx_1 (loc, from, to, object)
 
              pos %= GET_MODE_BITSIZE (wanted_mode);
 
-             newmem = gen_rtx_MEM (wanted_mode,
-                                   plus_constant (XEXP (XEXP (x, 0), 0),
-                                                  offset));
-             MEM_COPY_ATTRIBUTES (newmem, XEXP (x, 0));
+             newmem = adjust_address_nv (XEXP (x, 0), wanted_mode, offset);
 
              validate_change (object, &XEXP (x, 2), GEN_INT (pos), 1);
              validate_change (object, &XEXP (x, 0), newmem, 1);
@@ -692,7 +699,7 @@ int
 next_insn_tests_no_inequality (insn)
      rtx insn;
 {
-  register rtx next = next_cc0_user (insn);
+  rtx next = next_cc0_user (insn);
 
   /* If there is no next insn, we have to take the conservative choice.  */
   if (next == 0)
@@ -712,7 +719,7 @@ int
 next_insns_test_no_inequality (insn)
      rtx insn;
 {
-  register rtx next = NEXT_INSN (insn);
+  rtx next = NEXT_INSN (insn);
 
   for (; next != 0; next = NEXT_INSN (next))
     {
@@ -757,6 +764,7 @@ find_single_use_1 (dest, loc)
     case LABEL_REF:
     case SYMBOL_REF:
     case CONST_DOUBLE:
+    case CONST_VECTOR:
     case CLOBBER:
       return 0;
 
@@ -918,10 +926,10 @@ find_single_use (dest, insn, ploc)
 
 int
 general_operand (op, mode)
-     register rtx op;
+     rtx op;
      enum machine_mode mode;
 {
-  register enum rtx_code code = GET_CODE (op);
+  enum rtx_code code = GET_CODE (op);
 
   if (mode == VOIDmode)
     mode = GET_MODE (op);
@@ -981,7 +989,7 @@ general_operand (op, mode)
 
   if (code == MEM)
     {
-      register rtx y = XEXP (op, 0);
+      rtx y = XEXP (op, 0);
 
       if (! volatile_ok && MEM_VOLATILE_P (op))
        return 0;
@@ -1013,7 +1021,7 @@ general_operand (op, mode)
 
 int
 address_operand (op, mode)
-     register rtx op;
+     rtx op;
      enum machine_mode mode;
 {
   return memory_address_p (mode, op);
@@ -1035,7 +1043,7 @@ address_operand (op, mode)
 
 int
 register_operand (op, mode)
-     register rtx op;
+     rtx op;
      enum machine_mode mode;
 {
   if (GET_MODE (op) != mode && mode != VOIDmode)
@@ -1068,7 +1076,7 @@ register_operand (op, mode)
     }
 
   /* If we have an ADDRESSOF, consider it valid since it will be
-     converted into something that will not be a MEM. */
+     converted into something that will not be a MEM.  */
   if (GET_CODE (op) == ADDRESSOF)
     return 1;
 
@@ -1094,7 +1102,7 @@ pmode_register_operand (op, mode)
 
 int
 scratch_operand (op, mode)
-     register rtx op;
+     rtx op;
      enum machine_mode mode;
 {
   if (GET_MODE (op) != mode && mode != VOIDmode)
@@ -1112,7 +1120,7 @@ scratch_operand (op, mode)
 
 int
 immediate_operand (op, mode)
-     register rtx op;
+     rtx op;
      enum machine_mode mode;
 {
   /* Don't accept CONST_INT or anything similar
@@ -1145,7 +1153,7 @@ immediate_operand (op, mode)
 
 int
 const_int_operand (op, mode)
-     register rtx op;
+     rtx op;
      enum machine_mode mode;
 {
   if (GET_CODE (op) != CONST_INT)
@@ -1163,7 +1171,7 @@ const_int_operand (op, mode)
 
 int
 const_double_operand (op, mode)
-     register rtx op;
+     rtx op;
      enum machine_mode mode;
 {
   /* Don't accept CONST_INT or anything similar
@@ -1182,7 +1190,7 @@ const_double_operand (op, mode)
 
 int
 nonimmediate_operand (op, mode)
-     register rtx op;
+     rtx op;
      enum machine_mode mode;
 {
   return (general_operand (op, mode) && ! CONSTANT_P (op));
@@ -1192,7 +1200,7 @@ nonimmediate_operand (op, mode)
 
 int
 nonmemory_operand (op, mode)
-     register rtx op;
+     rtx op;
      enum machine_mode mode;
 {
   if (CONSTANT_P (op))
@@ -1209,7 +1217,7 @@ nonmemory_operand (op, mode)
        return 0;
 
       return ((GET_MODE (op) == VOIDmode || GET_MODE (op) == mode
-             || mode == VOIDmode)
+              || mode == VOIDmode)
 #ifdef LEGITIMATE_PIC_OPERAND_P
              && (! flag_pic || LEGITIMATE_PIC_OPERAND_P (op))
 #endif
@@ -1317,7 +1325,7 @@ pop_operand (op, mode)
 int
 memory_address_p (mode, addr)
      enum machine_mode mode ATTRIBUTE_UNUSED;
-     register rtx addr;
+     rtx addr;
 {
   if (GET_CODE (addr) == ADDRESSOF)
     return 1;
@@ -1337,7 +1345,7 @@ memory_address_p (mode, addr)
 
 int
 memory_operand (op, mode)
-     register rtx op;
+     rtx op;
      enum machine_mode mode;
 {
   rtx inner;
@@ -1362,14 +1370,14 @@ memory_operand (op, mode)
 
 int
 indirect_operand (op, mode)
-     register rtx op;
+     rtx op;
      enum machine_mode mode;
 {
   /* Before reload, a SUBREG isn't in memory (see memory_operand, above).  */
   if (! reload_completed
       && GET_CODE (op) == SUBREG && GET_CODE (SUBREG_REG (op)) == MEM)
     {
-      register int offset = SUBREG_BYTE (op);
+      int offset = SUBREG_BYTE (op);
       rtx inner = SUBREG_REG (op);
 
       if (mode != VOIDmode && GET_MODE (op) != mode)
@@ -1397,7 +1405,7 @@ indirect_operand (op, mode)
 
 int
 comparison_operator (op, mode)
-    register rtx op;
+    rtx op;
     enum machine_mode mode;
 {
   return ((mode == VOIDmode || GET_MODE (op) == mode)
@@ -1501,7 +1509,7 @@ decode_asm_operands (body, operands, operand_locs, constraints, modes)
      const char **constraints;
      enum machine_mode *modes;
 {
-  register int i;
+  int i;
   int noperands;
   const char *template = 0;
 
@@ -1559,7 +1567,8 @@ decode_asm_operands (body, operands, operand_locs, constraints, modes)
       template = ASM_OPERANDS_TEMPLATE (asmop);
     }
   else if (GET_CODE (body) == PARALLEL
-          && GET_CODE (XVECEXP (body, 0, 0)) == SET)
+          && GET_CODE (XVECEXP (body, 0, 0)) == SET
+          && GET_CODE (SET_SRC (XVECEXP (body, 0, 0))) == ASM_OPERANDS)
     {
       rtx asmop = SET_SRC (XVECEXP (body, 0, 0));
       int nparallel = XVECLEN (body, 0); /* Includes CLOBBERs.  */
@@ -1662,6 +1671,8 @@ asm_operand_ok (op, constraint)
             proper matching constraint, but we can't actually fail
             the check if they didn't.  Indicate that results are
             inconclusive.  */
+         while (ISDIGIT (*constraint))
+           constraint++;
          result = -1;
          break;
 
@@ -1705,16 +1716,6 @@ asm_operand_ok (op, constraint)
          break;
 
        case 'E':
-#ifndef REAL_ARITHMETIC
-         /* Match any floating double constant, but only if
-            we can examine the bits of it reliably.  */
-         if ((HOST_FLOAT_FORMAT != TARGET_FLOAT_FORMAT
-              || HOST_BITS_PER_WIDE_INT != BITS_PER_WORD)
-             && GET_MODE (op) != VOIDmode && ! flag_pretend_float)
-           break;
-#endif
-         /* FALLTHRU */
-
        case 'F':
          if (GET_CODE (op) == CONST_DOUBLE)
            return 1;
@@ -1829,12 +1830,12 @@ asm_operand_ok (op, constraint)
    return the location (type rtx *) of the pointer to that constant term.
    Otherwise, return a null pointer.  */
 
-static rtx *
+rtx *
 find_constant_term_loc (p)
      rtx *p;
 {
-  register rtx *tem;
-  register enum rtx_code code = GET_CODE (*p);
+  rtx *tem;
+  enum rtx_code code = GET_CODE (*p);
 
   /* If *P IS such a constant term, P is its location.  */
 
@@ -1916,10 +1917,10 @@ int
 offsettable_address_p (strictp, mode, y)
      int strictp;
      enum machine_mode mode;
-     register rtx y;
+     rtx y;
 {
-  register enum rtx_code ycode = GET_CODE (y);
-  register rtx z;
+  enum rtx_code ycode = GET_CODE (y);
+  rtx z;
   rtx y1 = y;
   rtx *y2;
   int (*addressp) PARAMS ((enum machine_mode, rtx)) =
@@ -1966,9 +1967,13 @@ offsettable_address_p (strictp, mode, y)
   /* The offset added here is chosen as the maximum offset that
      any instruction could need to add when operating on something
      of the specified mode.  We assume that if Y and Y+c are
-     valid addresses then so is Y+d for all 0<d<c.  */
-
-  z = plus_constant_for_output (y, mode_sz - 1);
+     valid addresses then so is Y+d for all 0<d<c.  adjust_address will
+     go inside a LO_SUM here, so we do so as well.  */
+  if (GET_CODE (y) == LO_SUM)
+    z = gen_rtx_LO_SUM (GET_MODE (y), XEXP (y, 0),
+                       plus_constant (XEXP (y, 1), mode_sz - 1));
+  else
+    z = plus_constant (y, mode_sz - 1);
 
   /* Use QImode because an odd displacement may be automatically invalid
      for any wider mode.  But it should be valid for a single byte.  */
@@ -1983,11 +1988,11 @@ offsettable_address_p (strictp, mode, y)
 
 int
 mode_dependent_address_p (addr)
-  rtx addr ATTRIBUTE_UNUSED; /* Maybe used in GO_IF_MODE_DEPENDENT_ADDRESS. */
+  rtx addr ATTRIBUTE_UNUSED; /* Maybe used in GO_IF_MODE_DEPENDENT_ADDRESS.  */
 {
   GO_IF_MODE_DEPENDENT_ADDRESS (addr, win);
   return 0;
-  /* Label `win' might (not) be used via GO_IF_MODE_DEPENDENT_ADDRESS. */
+  /* Label `win' might (not) be used via GO_IF_MODE_DEPENDENT_ADDRESS.  */
  win: ATTRIBUTE_UNUSED_LABEL
   return 1;
 }
@@ -2011,57 +2016,10 @@ mode_independent_operand (op, mode)
   addr = XEXP (op, 0);
   GO_IF_MODE_DEPENDENT_ADDRESS (addr, lose);
   return 1;
-  /* Label `lose' might (not) be used via GO_IF_MODE_DEPENDENT_ADDRESS. */
+  /* Label `lose' might (not) be used via GO_IF_MODE_DEPENDENT_ADDRESS.  */
  lose: ATTRIBUTE_UNUSED_LABEL
   return 0;
 }
-
-/* Given an operand OP that is a valid memory reference which
-   satisfies offsettable_memref_p, return a new memory reference whose
-   address has been adjusted by OFFSET.  OFFSET should be positive and
-   less than the size of the object referenced.  */
-
-rtx
-adj_offsettable_operand (op, offset)
-     rtx op;
-     int offset;
-{
-  register enum rtx_code code = GET_CODE (op);
-
-  if (code == MEM) 
-    {
-      register rtx y = XEXP (op, 0);
-      register rtx new;
-
-      if (CONSTANT_ADDRESS_P (y))
-       {
-         new = gen_rtx_MEM (GET_MODE (op),
-                            plus_constant_for_output (y, offset));
-         MEM_COPY_ATTRIBUTES (new, op);
-         return new;
-       }
-
-      if (GET_CODE (y) == PLUS)
-       {
-         rtx z = y;
-         register rtx *const_loc;
-
-         op = copy_rtx (op);
-         z = XEXP (op, 0);
-         const_loc = find_constant_term_loc (&z);
-         if (const_loc)
-           {
-             *const_loc = plus_constant_for_output (*const_loc, offset);
-             return op;
-           }
-       }
-
-      new = gen_rtx_MEM (GET_MODE (op), plus_constant_for_output (y, offset));
-      MEM_COPY_ATTRIBUTES (new, op);
-      return new;
-    }
-  abort ();
-}
 \f
 /* Like extract_insn, but save insn extracted and don't extract again, when
    called again for the same insn expecting that recog_data still contain the
@@ -2259,8 +2217,12 @@ preprocess_constraints ()
 
                case '0': case '1': case '2': case '3': case '4':
                case '5': case '6': case '7': case '8': case '9':
-                 op_alt[j].matches = c - '0';
-                 recog_op_alt[op_alt[j].matches][j].matched = i;
+                 {
+                   char *end;
+                   op_alt[j].matches = strtoul (p - 1, &end, 10);
+                   recog_op_alt[op_alt[j].matches][j].matched = i;
+                   p = end;
+                 }
                  break;
 
                case 'm':
@@ -2284,7 +2246,8 @@ preprocess_constraints ()
 
                case 'p':
                  op_alt[j].is_address = 1;
-                 op_alt[j].class = reg_class_subunion[(int) op_alt[j].class][(int) BASE_REG_CLASS];
+                 op_alt[j].class = reg_class_subunion[(int) op_alt[j].class]
+                   [(int) MODE_BASE_REG_CLASS (VOIDmode)];
                  break;
 
                case 'g': case 'r':
@@ -2292,7 +2255,7 @@ preprocess_constraints ()
                  break;
 
                default:
-                 op_alt[j].class = reg_class_subunion[(int) op_alt[j].class][(int) REG_CLASS_FROM_LETTER ((unsigned char)c)];
+                 op_alt[j].class = reg_class_subunion[(int) op_alt[j].class][(int) REG_CLASS_FROM_LETTER ((unsigned char) c)];
                  break;
                }
            }
@@ -2339,7 +2302,7 @@ constrain_operands (strict)
   const char *constraints[MAX_RECOG_OPERANDS];
   int matching_operands[MAX_RECOG_OPERANDS];
   int earlyclobber[MAX_RECOG_OPERANDS];
-  register int c;
+  int c;
 
   struct funny_match funny_match[MAX_RECOG_OPERANDS];
   int funny_match_index;
@@ -2356,15 +2319,15 @@ constrain_operands (strict)
 
   do
     {
-      register int opno;
+      int opno;
       int lose = 0;
       funny_match_index = 0;
 
       for (opno = 0; opno < recog_data.n_operands; opno++)
        {
-         register rtx op = recog_data.operand[opno];
+         rtx op = recog_data.operand[opno];
          enum machine_mode mode = GET_MODE (op);
-         register const char *p = constraints[opno];
+         const char *p = constraints[opno];
          int offset = 0;
          int win = 0;
          int val;
@@ -2412,45 +2375,54 @@ constrain_operands (strict)
 
              case '0':  case '1':  case '2':  case '3':  case '4':
              case '5':  case '6':  case '7':  case '8':  case '9':
+               {
+                 /* This operand must be the same as a previous one.
+                    This kind of constraint is used for instructions such
+                    as add when they take only two operands.
 
-               /* This operand must be the same as a previous one.
-                  This kind of constraint is used for instructions such
-                  as add when they take only two operands.
+                    Note that the lower-numbered operand is passed first.
 
-                  Note that the lower-numbered operand is passed first.
+                    If we are not testing strictly, assume that this
+                    constraint will be satisfied.  */
 
-                  If we are not testing strictly, assume that this constraint
-                  will be satisfied.  */
-               if (strict < 0)
-                 val = 1;
-               else
-                 {
-                   rtx op1 = recog_data.operand[c - '0'];
-                   rtx op2 = recog_data.operand[opno];
+                 char *end;
+                 int match;
 
-                   /* A unary operator may be accepted by the predicate,
-                      but it is irrelevant for matching constraints.  */
-                   if (GET_RTX_CLASS (GET_CODE (op1)) == '1')
-                     op1 = XEXP (op1, 0);
-                   if (GET_RTX_CLASS (GET_CODE (op2)) == '1')
-                     op2 = XEXP (op2, 0);
+                 match = strtoul (p - 1, &end, 10);
+                 p = end;
 
-                   val = operands_match_p (op1, op2);
-                 }
+                 if (strict < 0)
+                   val = 1;
+                 else
+                   {
+                     rtx op1 = recog_data.operand[match];
+                     rtx op2 = recog_data.operand[opno];
 
-               matching_operands[opno] = c - '0';
-               matching_operands[c - '0'] = opno;
+                     /* A unary operator may be accepted by the predicate,
+                        but it is irrelevant for matching constraints.  */
+                     if (GET_RTX_CLASS (GET_CODE (op1)) == '1')
+                       op1 = XEXP (op1, 0);
+                     if (GET_RTX_CLASS (GET_CODE (op2)) == '1')
+                       op2 = XEXP (op2, 0);
 
-               if (val != 0)
-                 win = 1;
-               /* If output is *x and input is *--x,
-                  arrange later to change the output to *--x as well,
-                  since the output op is the one that will be printed.  */
-               if (val == 2 && strict > 0)
-                 {
-                   funny_match[funny_match_index].this = opno;
-                   funny_match[funny_match_index++].other = c - '0';
-                 }
+                     val = operands_match_p (op1, op2);
+                   }
+
+                 matching_operands[opno] = match;
+                 matching_operands[match] = opno;
+
+                 if (val != 0)
+                   win = 1;
+
+                 /* If output is *x and input is *--x, arrange later
+                    to change the output to *--x as well, since the
+                    output op is the one that will be printed.  */
+                 if (val == 2 && strict > 0)
+                   {
+                     funny_match[funny_match_index].this = opno;
+                     funny_match[funny_match_index++].other = match;
+                   }
+               }
                break;
 
              case 'p':
@@ -2510,18 +2482,6 @@ constrain_operands (strict)
                break;
 
              case 'E':
-#ifndef REAL_ARITHMETIC
-               /* Match any CONST_DOUBLE, but only if
-                  we can examine the bits of it reliably.  */
-               if ((HOST_FLOAT_FORMAT != TARGET_FLOAT_FORMAT
-                    || HOST_BITS_PER_WIDE_INT != BITS_PER_WORD)
-                   && GET_MODE (op) != VOIDmode && ! flag_pretend_float)
-                 break;
-#endif
-               if (GET_CODE (op) == CONST_DOUBLE)
-                 win = 1;
-               break;
-
              case 'F':
                if (GET_CODE (op) == CONST_DOUBLE)
                  win = 1;
@@ -2679,16 +2639,16 @@ constrain_operands (strict)
 int
 reg_fits_class_p (operand, class, offset, mode)
      rtx operand;
-     register enum reg_class class;
+     enum reg_class class;
      int offset;
      enum machine_mode mode;
 {
-  register int regno = REGNO (operand);
+  int regno = REGNO (operand);
   if (regno < FIRST_PSEUDO_REGISTER
       && TEST_HARD_REG_BIT (reg_class_contents[(int) class],
                            regno + offset))
     {
-      register int sr;
+      int sr;
       regno += offset;
       for (sr = HARD_REGNO_NREGS (regno, mode) - 1;
           sr > 0; sr--)
@@ -2702,7 +2662,7 @@ reg_fits_class_p (operand, class, offset, mode)
 }
 \f
 /* Split single instruction.  Helper function for split_all_insns.
-   Return last insn in the sequence if succesfull, or NULL if unsuccesfull.  */
+   Return last insn in the sequence if successful, or NULL if unsuccessful.  */
 static rtx
 split_insn (insn)
      rtx insn;
@@ -2722,11 +2682,7 @@ split_insn (insn)
          allocation, and there are unlikely to be very many
          nops then anyways.  */
       if (reload_completed)
-       {
-         PUT_CODE (insn, NOTE);
-         NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
-         NOTE_SOURCE_FILE (insn) = 0;
-       }
+       delete_insn_and_edges (insn);
     }
   else
     {
@@ -2771,22 +2727,6 @@ split_all_insns (upd_life)
   int changed;
   int i;
 
-  if (!upd_life)
-    {
-      rtx next, insn;
-
-      for (insn = get_insns (); insn ; insn = next)
-       {
-         rtx last;
-
-         /* Can't use `next_real_insn' because that might go across
-            CODE_LABELS and short-out basic blocks.  */
-         next = NEXT_INSN (insn);
-         last = split_insn (insn);
-       }
-      return;
-    }
-
   blocks = sbitmap_alloc (n_basic_blocks);
   sbitmap_zero (blocks);
   changed = 0;
@@ -2795,41 +2735,64 @@ split_all_insns (upd_life)
     {
       basic_block bb = BASIC_BLOCK (i);
       rtx insn, next;
+      bool finish = false;
 
-      for (insn = bb->head; insn ; insn = next)
+      for (insn = bb->head; !finish ; insn = next)
        {
          rtx last;
 
          /* Can't use `next_real_insn' because that might go across
             CODE_LABELS and short-out basic blocks.  */
          next = NEXT_INSN (insn);
+         finish = (insn == bb->end);
          last = split_insn (insn);
          if (last)
            {
+             /* The split sequence may include barrier, but the
+                BB boundary we are interested in will be set to previous
+                one.  */
+
+             while (GET_CODE (last) == BARRIER)
+               last = PREV_INSN (last);
              SET_BIT (blocks, i);
              changed = 1;
-             if (insn == bb->end)
-               bb->end = last;
              insn = last;
            }
-
-         if (insn == bb->end)
-           break;
        }
+    }
 
-      if (insn == NULL)
-       abort ();
+  if (changed)
+    {
+      find_many_sub_basic_blocks (blocks);
     }
 
   if (changed && upd_life)
     {
-      compute_bb_for_insn (get_max_uid ());
       count_or_remove_death_notes (blocks, 1);
       update_life_info (blocks, UPDATE_LIFE_LOCAL, PROP_DEATH_NOTES);
     }
+#ifdef ENABLE_CHECKING
+  verify_flow_info ();
+#endif
 
   sbitmap_free (blocks);
 }
+
+/* Same as split_all_insns, but do not expect CFG to be available. 
+   Used by machine depedent reorg passes.  */
+
+void
+split_all_insns_noflow ()
+{
+  rtx next, insn;
+
+  for (insn = get_insns (); insn; insn = next)
+    {
+      next = NEXT_INSN (insn);
+      split_insn (insn);
+    }
+  return;
+}
 \f
 #ifdef HAVE_peephole2
 struct peep2_insn_data
@@ -3025,7 +2988,7 @@ peep2_find_free_register (from, to, class_str, mode, reg_set)
   return NULL_RTX;
 }
 
-/* Perform the peephole2 optimization pass. */
+/* Perform the peephole2 optimization pass.  */
 
 void
 peephole2_optimize (dump_file)
@@ -3037,8 +3000,9 @@ peephole2_optimize (dump_file)
   int i, b;
 #ifdef HAVE_conditional_execution
   sbitmap blocks;
-  int changed;
+  bool changed;
 #endif
+  bool do_cleanup_cfg = false;
 
   /* Initialize the regsets we're going to use.  */
   for (i = 0; i < MAX_INSNS_PER_PEEP2 + 1; ++i)
@@ -3048,7 +3012,7 @@ peephole2_optimize (dump_file)
 #ifdef HAVE_conditional_execution
   blocks = sbitmap_alloc (n_basic_blocks);
   sbitmap_zero (blocks);
-  changed = 0;
+  changed = false;
 #else
   count_or_remove_death_notes (NULL, 1);
 #endif
@@ -3081,8 +3045,9 @@ peephole2_optimize (dump_file)
          prev = PREV_INSN (insn);
          if (INSN_P (insn))
            {
-             rtx try;
+             rtx try, before_try;
              int match_len;
+             rtx note;
 
              /* Record this insn.  */
              if (--peep2_current < 0)
@@ -3095,19 +3060,134 @@ peephole2_optimize (dump_file)
              try = peephole2_insns (PATTERN (insn), insn, &match_len);
              if (try != NULL)
                {
+                 /* If we are splitting a CALL_INSN, look for the CALL_INSN
+                    in SEQ and copy our CALL_INSN_FUNCTION_USAGE and other
+                    cfg-related call notes.  */
+                 for (i = 0; i <= match_len; ++i)
+                   {
+                     int j, k;
+                     rtx old_insn, new_insn, note;
+
+                     j = i + peep2_current;
+                     if (j >= MAX_INSNS_PER_PEEP2 + 1)
+                       j -= MAX_INSNS_PER_PEEP2 + 1;
+                     old_insn = peep2_insn_data[j].insn;
+                     if (GET_CODE (old_insn) != CALL_INSN)
+                       continue;
+
+                     new_insn = NULL_RTX;
+                     if (GET_CODE (try) == SEQUENCE)
+                       for (k = XVECLEN (try, 0) - 1; k >= 0; k--)
+                         {
+                           rtx x = XVECEXP (try, 0, k);
+                           if (GET_CODE (x) == CALL_INSN)
+                             {
+                               new_insn = x;
+                               break;
+                             }
+                         }
+                     else if (GET_CODE (try) == CALL_INSN)
+                       new_insn = try;
+                     if (! new_insn)
+                       abort ();
+
+                     CALL_INSN_FUNCTION_USAGE (new_insn)
+                       = CALL_INSN_FUNCTION_USAGE (old_insn);
+
+                     for (note = REG_NOTES (old_insn);
+                          note;
+                          note = XEXP (note, 1))
+                       switch (REG_NOTE_KIND (note))
+                         {
+                         case REG_NORETURN:
+                         case REG_SETJMP:
+                         case REG_ALWAYS_RETURN:
+                           REG_NOTES (new_insn)
+                             = gen_rtx_EXPR_LIST (REG_NOTE_KIND (note),
+                                                  XEXP (note, 0),
+                                                  REG_NOTES (new_insn));
+                         default:
+                           /* Discard all other reg notes.  */
+                           break;
+                         }
+
+                     /* Croak if there is another call in the sequence.  */
+                     while (++i <= match_len)
+                       {
+                         j = i + peep2_current;
+                         if (j >= MAX_INSNS_PER_PEEP2 + 1)
+                           j -= MAX_INSNS_PER_PEEP2 + 1;
+                         old_insn = peep2_insn_data[j].insn;
+                         if (GET_CODE (old_insn) == CALL_INSN)
+                           abort ();
+                       }
+                     break;
+                   }
+
                  i = match_len + peep2_current;
                  if (i >= MAX_INSNS_PER_PEEP2 + 1)
                    i -= MAX_INSNS_PER_PEEP2 + 1;
 
+                 note = find_reg_note (peep2_insn_data[i].insn, 
+                                       REG_EH_REGION, NULL_RTX);
+
                  /* Replace the old sequence with the new.  */
-                 flow_delete_insn_chain (insn, peep2_insn_data[i].insn);
-                 try = emit_insn_after (try, prev);
+                 try = emit_insn_after (try, peep2_insn_data[i].insn);
+                 before_try = PREV_INSN (insn);
+                 delete_insn_chain (insn, peep2_insn_data[i].insn);
 
-                 /* Adjust the basic block boundaries.  */
-                 if (peep2_insn_data[i].insn == bb->end)
-                   bb->end = try;
-                 if (insn == bb->head)
-                   bb->head = NEXT_INSN (prev);
+                 /* Re-insert the EH_REGION notes.  */
+                 if (note)
+                   {
+                     rtx x;
+                     edge eh_edge;
+
+                     for (eh_edge = bb->succ; eh_edge
+                          ; eh_edge = eh_edge->succ_next)
+                       if (eh_edge->flags & EDGE_EH)
+                         break;
+
+                     for (x = try ; x != before_try ; x = PREV_INSN (x))
+                       if (GET_CODE (x) == CALL_INSN
+                           || (flag_non_call_exceptions
+                               && may_trap_p (PATTERN (x))
+                               && !find_reg_note (x, REG_EH_REGION, NULL)))
+                         {
+                           REG_NOTES (x)
+                             = gen_rtx_EXPR_LIST (REG_EH_REGION,
+                                                  XEXP (note, 0),
+                                                  REG_NOTES (x));
+
+                           if (x != bb->end && eh_edge)
+                             {
+                               edge nfte, nehe;
+                               int flags;
+
+                               nfte = split_block (bb, x);
+                               flags = EDGE_EH | EDGE_ABNORMAL;
+                               if (GET_CODE (x) == CALL_INSN)
+                                 flags |= EDGE_ABNORMAL_CALL;
+                               nehe = make_edge (nfte->src, eh_edge->dest,
+                                                 flags);
+
+                               nehe->probability = eh_edge->probability;
+                               nfte->probability
+                                 = REG_BR_PROB_BASE - nehe->probability;
+
+                               do_cleanup_cfg |= purge_dead_edges (nfte->dest);
+#ifdef HAVE_conditional_execution
+                               SET_BIT (blocks, nfte->dest->index);
+                               changed = true;
+#endif
+                               bb = nfte->src;
+                               eh_edge = nehe;
+                             }
+                         }
+
+                     /* Converting possibly trapping insn to non-trapping is
+                        possible.  Zap dummy outgoing edges.  */
+                     do_cleanup_cfg |= purge_dead_edges (bb);
+                   }
 
 #ifdef HAVE_conditional_execution
                  /* With conditional execution, we cannot back up the
@@ -3116,7 +3196,7 @@ peephole2_optimize (dump_file)
                     So record that we've made a modification to this
                     block and update life information at the end.  */
                  SET_BIT (blocks, b);
-                 changed = 1;
+                 changed = true;
 
                  for (i = 0; i < MAX_INSNS_PER_PEEP2 + 1; ++i)
                    peep2_insn_data[i].insn = NULL_RTX;
@@ -3162,9 +3242,20 @@ peephole2_optimize (dump_file)
     FREE_REG_SET (peep2_insn_data[i].live_before);
   FREE_REG_SET (live);
 
+  /* If we eliminated EH edges, we may be able to merge blocks.  Further,
+     we've changed global life since exception handlers are no longer
+     reachable.  */
+  if (do_cleanup_cfg)
+    {
+      cleanup_cfg (0);
+      update_life_info (0, UPDATE_LIFE_GLOBAL_RM_NOTES, PROP_DEATH_NOTES);
+    }
 #ifdef HAVE_conditional_execution
-  count_or_remove_death_notes (blocks, 1);
-  update_life_info (blocks, UPDATE_LIFE_LOCAL, PROP_DEATH_NOTES);
+  else
+    {
+      count_or_remove_death_notes (blocks, 1);
+      update_life_info (blocks, UPDATE_LIFE_LOCAL, PROP_DEATH_NOTES);
+    }
   sbitmap_free (blocks);
 #endif
 }