OSDN Git Service

Add NIOS2 support. Code from SourceyG++.
[pf3gnuchains/gcc-fork.git] / gcc / genrecog.c
index 70ab877..16a7b56 100644 (file)
@@ -1,6 +1,6 @@
 /* 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, 2007
+   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009
    Free Software Foundation, Inc.
 
    This file is part of GCC.
@@ -71,6 +71,17 @@ struct decision_head
   struct decision *last;
 };
 
+/* These types are roughly in the order in which we'd like to test them.  */
+enum decision_type
+{
+  DT_num_insns,
+  DT_mode, DT_code, DT_veclen,
+  DT_elt_zero_int, DT_elt_one_int, DT_elt_zero_wide, DT_elt_zero_wide_safe,
+  DT_const_int,
+  DT_veclen_ge, DT_dup, DT_pred, DT_c_test,
+  DT_accept_op, DT_accept_insn
+};
+
 /* A single test.  The two accept types aren't tests per-se, but
    their equality (or lack thereof) does affect tree merging so
    it is convenient to keep them here.  */
@@ -80,16 +91,7 @@ struct decision_test
   /* A linked list through the tests attached to a node.  */
   struct decision_test *next;
 
-  /* These types are roughly in the order in which we'd like to test them.  */
-  enum decision_type
-    {
-      DT_num_insns,
-      DT_mode, DT_code, DT_veclen,
-      DT_elt_zero_int, DT_elt_one_int, DT_elt_zero_wide, DT_elt_zero_wide_safe,
-      DT_const_int,
-      DT_veclen_ge, DT_dup, DT_pred, DT_c_test,
-      DT_accept_op, DT_accept_insn
-    } type;
+  enum decision_type type;
 
   union
   {
@@ -378,7 +380,7 @@ process_define_predicate (rtx desc)
 
   for (i = 0; i < NUM_RTX_CODE; i++)
     if (codes[i] != N)
-      add_predicate_code (pred, i);
+      add_predicate_code (pred, (enum rtx_code) i);
 
   add_predicate (pred);
 }
@@ -793,7 +795,8 @@ validate_pattern (rtx pattern, rtx insn, rtx set, int set_code)
                 && GET_CODE (dest) != CC0
                 && GET_CODE (src) != PC
                 && GET_CODE (src) != CC0
-                && GET_CODE (src) != CONST_INT)
+                && !CONST_INT_P (src)
+                && GET_CODE (src) != CALL)
          {
            const char *which;
            which = (dmode == VOIDmode ? "destination" : "source");
@@ -1243,7 +1246,7 @@ maybe_both_true_2 (struct decision_test *d1, struct decision_test *d2)
          else if (d2->type == DT_pred && d2->u.pred.data)
            {
              bool common = false;
-             enum rtx_code c;
+             int c;
 
              for (c = 0; c < NUM_RTX_CODE; c++)
                if (d1->u.pred.data->codes[c] && d2->u.pred.data->codes[c])
@@ -1921,7 +1924,8 @@ write_switch (struct decision *start, int depth)
       while (p && p->tests->type == DT_pred && p->tests->u.pred.data)
        {
          const struct pred_data *data = p->tests->u.pred.data;
-         RTX_CODE c;
+         int c;
+
          for (c = 0; c < NUM_RTX_CODE; c++)
            if (codemap[c] && data->codes[c])
              goto pred_done;
@@ -1930,7 +1934,7 @@ write_switch (struct decision *start, int depth)
            if (data->codes[c])
              {
                fputs ("    case ", stdout);
-               print_code (c);
+               print_code ((enum rtx_code) c);
                fputs (":\n", stdout);
                codemap[c] = 1;
              }
@@ -2470,7 +2474,6 @@ write_header (void)
 #include \"function.h\"\n\
 #include \"insn-config.h\"\n\
 #include \"recog.h\"\n\
-#include \"real.h\"\n\
 #include \"output.h\"\n\
 #include \"flags.h\"\n\
 #include \"hard-reg-set.h\"\n\