OSDN Git Service

2008-05-21 H.J. Lu <hongjiu.lu@intel.com>
[pf3gnuchains/gcc-fork.git] / gcc / genrecog.c
index 56d6598..43afa7f 100644 (file)
@@ -1,12 +1,13 @@
 /* Generate code from machine description to recognize rtl as insns.
    Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1997, 1998,
-   1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007
+   Free Software Foundation, Inc.
 
    This file is part of GCC.
 
    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)
+   the Free Software Foundation; either version 3, or (at your option)
    any later version.
 
    GCC is distributed in the hope that it will be useful, but WITHOUT
@@ -15,9 +16,8 @@
    License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with GCC; see the file COPYING.  If not, write to the Free
-   Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
-   02110-1301, USA.  */
+   along with GCC; see the file COPYING3.  If not see
+   <http://www.gnu.org/licenses/>.  */
 
 
 /* This program is used to produce insn-recog.c, which contains a
@@ -171,7 +171,7 @@ static int pattern_lineno;
 /* Count of errors.  */
 static int error_count;
 \f
-/* Predicate handling. 
+/* Predicate handling.
 
    We construct from the machine description a table mapping each
    predicate to a list of the rtl codes it can possibly match.  The
@@ -259,7 +259,7 @@ compute_predicate_codes (rtx exp, char codes[NUM_RTX_CODE])
       break;
 
     case IF_THEN_ELSE:
-      /* a ? b : c  accepts the same codes as (a & b) | (!a & c).  */ 
+      /* a ? b : c  accepts the same codes as (a & b) | (!a & c).  */
       compute_predicate_codes (XEXP (exp, 0), op0_codes);
       compute_predicate_codes (XEXP (exp, 1), op1_codes);
       compute_predicate_codes (XEXP (exp, 2), op2_codes);
@@ -295,7 +295,7 @@ compute_predicate_codes (rtx exp, char codes[NUM_RTX_CODE])
          {
            size_t n = next_code - code;
            int found_it = 0;
-           
+
            for (i = 0; i < NUM_RTX_CODE; i++)
              if (!strncmp (code, GET_RTX_NAME (i), n)
                  && GET_RTX_NAME (i)[n] == '\0')
@@ -368,7 +368,6 @@ process_define_predicate (rtx desc)
 {
   struct pred_data *pred = xcalloc (sizeof (struct pred_data), 1);
   char codes[NUM_RTX_CODE];
-  bool seen_one = false;
   int i;
 
   pred->name = XSTR (desc, 0);
@@ -379,26 +378,8 @@ process_define_predicate (rtx desc)
 
   for (i = 0; i < NUM_RTX_CODE; i++)
     if (codes[i] != N)
-      {
-       pred->codes[i] = true;
-       if (GET_RTX_CLASS (i) != RTX_CONST_OBJ)
-         pred->allows_non_const = true;
-       if (i != REG
-           && i != SUBREG
-           && i != MEM
-           && i != CONCAT
-           && i != PARALLEL
-           && i != STRICT_LOW_PART)
-         pred->allows_non_lvalue = true;
-
-       if (seen_one)
-         pred->singleton = UNKNOWN;
-       else
-         {
-           pred->singleton = i;
-           seen_one = true;
-         }
-      }
+      add_predicate_code (pred, i);
+
   add_predicate (pred);
 }
 #undef I
@@ -511,7 +492,7 @@ new_decision_test (enum decision_type type, struct decision_test ***pplace)
   struct decision_test **place = *pplace;
   struct decision_test *test;
 
-  test = xmalloc (sizeof (*test));
+  test = XNEW (struct decision_test);
   test->next = *place;
   test->type = type;
   *place = test;
@@ -1088,7 +1069,7 @@ add_to_sequence (rtx pattern, struct decision_head *last, const char *position,
       if (fmt[i] == 'i')
        {
          gcc_assert (i < 2);
-         
+
          if (!i)
            {
              test = new_decision_test (DT_elt_zero_int, &place);
@@ -2496,6 +2477,8 @@ write_header (void)
 #include \"resource.h\"\n\
 #include \"toplev.h\"\n\
 #include \"reload.h\"\n\
+#include \"regs.h\"\n\
+#include \"tm-constrs.h\"\n\
 \n");
 
   puts ("\n\