OSDN Git Service

* gcc.dg/const-elim-1.c: Remove xfail for xtensa-*-*.
[pf3gnuchains/gcc-fork.git] / gcc / genpreds.c
index cdfc8f5..b07abed 100644 (file)
@@ -2,7 +2,7 @@
    - prototype declarations for operand predicates (tm-preds.h)
    - function definitions of operand predicates, if defined new-style
      (insn-preds.c)
-   Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -106,7 +106,7 @@ write_tm_preds_h (void)
              (match_test "basereg_operand_1 (op, mode)")))
 
    The only wart is that there's no way to insist on a { } string in
-   an RTL template, so we have to handle "" strings. */
+   an RTL template, so we have to handle "" strings.  */
 
    
 static void
@@ -138,6 +138,7 @@ write_predicate_subfunction (struct pred_data *p)
   printf ("static inline int\n"
          "%s_1 (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED)\n",
          p->name);
+  print_rtx_ptr_loc (p->c_block);
   if (p->c_block[0] == '{')
     fputs (p->c_block, stdout);
   else
@@ -167,7 +168,7 @@ mark_mode_tests (rtx exp)
        struct pred_data *p = lookup_predicate (XSTR (exp, 1));
        if (!p)
          error ("reference to undefined predicate '%s'", XSTR (exp, 1));
-       else if (p->special)
+       else if (p->special || GET_MODE (exp) != VOIDmode)
          NO_MODE_TEST (exp) = 1;
       }
       break;
@@ -259,38 +260,47 @@ add_mode_tests (struct pred_data *p)
   for (;;)
     {
       rtx subexp = *pos;
-      if (GET_CODE (subexp) == IOR)
-       {
-         if (NO_MODE_TEST (XEXP (subexp, 0))
-             && NO_MODE_TEST (XEXP (subexp, 1)))
-           break;
-         else if (NO_MODE_TEST (XEXP (subexp, 0)))
-           pos = &XEXP (subexp, 0);
-         else if (NO_MODE_TEST (XEXP (subexp, 1)))
-           pos = &XEXP (subexp, 1);
-         else
-           abort ();
-       }
-      else if (GET_CODE (subexp) == IF_THEN_ELSE)
+
+      switch (GET_CODE (subexp))
        {
-         if (NO_MODE_TEST (XEXP (subexp, 0))
-             && NO_MODE_TEST (XEXP (subexp, 1))
-             && NO_MODE_TEST (XEXP (subexp, 2)))
-           break;
-         else if (NO_MODE_TEST (XEXP (subexp, 0))
-                  && NO_MODE_TEST (XEXP (subexp, 1)))
-           /* Must put it on the dependent clause, not the controlling
-              expression, or we change the meaning of the test. */
-           pos = &XEXP (subexp, 1);
-         else if (NO_MODE_TEST (XEXP (subexp, 2)))
-           pos = &XEXP (subexp, 2);
-         else
-           abort ();
+       case IOR:
+         {
+           int test0 = NO_MODE_TEST (XEXP (subexp, 0));
+           int test1 = NO_MODE_TEST (XEXP (subexp, 1));
+           
+           gcc_assert (test0 || test1);
+           
+           if (test0 && test1)
+             goto break_loop;
+           pos = test0 ? &XEXP (subexp, 0) : &XEXP (subexp, 1);
+         }
+         break;
+         
+       case IF_THEN_ELSE:
+         {
+           int test0 = NO_MODE_TEST (XEXP (subexp, 0));
+           int test1 = NO_MODE_TEST (XEXP (subexp, 1));
+           int test2 = NO_MODE_TEST (XEXP (subexp, 2));
+           
+           gcc_assert ((test0 && test1) || test2);
+           
+           if (test0 && test1 && test2)
+             goto break_loop;
+           if (test0 && test1)
+             /* Must put it on the dependent clause, not the
+                controlling expression, or we change the meaning of
+                the test.  */
+             pos = &XEXP (subexp, 1);
+           else
+             pos = &XEXP (subexp, 2);
+         }
+         break;
+         
+       default:
+         goto break_loop;
        }
-      else
-       break;
     }
-
+ break_loop:
   XEXP (and_exp, 0) = *pos;
   *pos = and_exp;
 }
@@ -357,7 +367,10 @@ write_predicate_expr (const char *name, rtx exp)
       break;
 
     case MATCH_OPERAND:
-      printf ("%s (op, mode)", XSTR (exp, 1));
+      if (GET_MODE (exp) == VOIDmode)
+        printf ("%s (op, mode)", XSTR (exp, 1));
+      else
+        printf ("%s (op, %smode)", XSTR (exp, 1), mode_name[GET_MODE (exp)]);
       break;
 
     case MATCH_CODE:
@@ -365,7 +378,7 @@ write_predicate_expr (const char *name, rtx exp)
       break;
 
     case MATCH_TEST:
-      fputs (XSTR (exp, 0), stdout);
+      print_c_condition (XSTR (exp, 0));
       break;
 
     default:
@@ -428,7 +441,8 @@ write_insn_preds_c (void)
 #include \"hard-reg-set.h\"\n\
 #include \"resource.h\"\n\
 #include \"toplev.h\"\n\
-#include \"reload.h\"\n");
+#include \"reload.h\"\n\
+#include \"regs.h\"\n");
 
   FOR_ALL_PREDICATES (p)
     write_one_predicate_function (p);