OSDN Git Service

(c_sizeof, build_c_cast): Set TREE_OVERFLOW in addition
[pf3gnuchains/gcc-fork.git] / gcc / genrecog.c
index c749359..2480ea9 100644 (file)
@@ -46,7 +46,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
    it returns the split rtl in a SEQUENCE.  */
 
 #include <stdio.h>
-#include "config.h"
+#include "hconfig.h"
 #include "rtl.h"
 #include "obstack.h"
 
@@ -164,26 +164,37 @@ static struct pred_table
 
 #define NUM_KNOWN_PREDS (sizeof preds / sizeof preds[0])
 
-static int try_merge_1 ();
-static int no_same_mode ();
-static int same_codes ();
-static int same_modes ();
-char *xmalloc ();
-static struct decision *add_to_sequence ();
-static struct decision_head merge_trees ();
-static struct decision *try_merge_2 ();
-static void write_subroutine ();
-static void print_code ();
-static void clear_codes ();
-static void clear_modes ();
-static void change_state ();
-static void write_tree ();
-static char *copystr ();
-static char *concat ();
-static void fatal ();
-void fancy_abort ();
-static void mybzero ();
-static void mybcopy ();
+static struct decision_head make_insn_sequence PROTO((rtx, enum routine_type));
+static struct decision *add_to_sequence PROTO((rtx, struct decision_head *,
+                                              char *));
+static int not_both_true       PROTO((struct decision *, struct decision *,
+                                      int));
+static int position_merit      PROTO((struct decision *, enum machine_mode,
+                                      enum rtx_code));
+static struct decision_head merge_trees PROTO((struct decision_head,
+                                              struct decision_head));
+static int break_out_subroutines PROTO((struct decision_head,
+                                       enum routine_type, int));
+static void write_subroutine   PROTO((struct decision *, enum routine_type));
+static void write_tree_1       PROTO((struct decision *, char *,
+                                      struct decision *, enum routine_type));
+static void print_code         PROTO((enum rtx_code));
+static int same_codes          PROTO((struct decision *, enum rtx_code));
+static void clear_codes                PROTO((struct decision *));
+static int same_modes          PROTO((struct decision *, enum machine_mode));
+static void clear_modes                PROTO((struct decision *));
+static void write_tree         PROTO((struct decision *, char *,
+                                      struct decision *, int,
+                                      enum routine_type));
+static void change_state       PROTO((char *, char *, int));
+static char *copystr           PROTO((char *));
+static void mybzero            PROTO((char *, unsigned));
+static void mybcopy            PROTO((char *, char *, unsigned));
+static char *concat            PROTO((char *, char *));
+static void fatal              PROTO((char *));
+char *xrealloc                 PROTO((char *, unsigned));
+char *xmalloc                  PROTO((unsigned));
+void fancy_abort               PROTO((void));
 \f
 /* Construct and return a sequence of decisions
    that will recognize INSN.
@@ -418,6 +429,7 @@ add_to_sequence (pattern, last, position)
       return new;
 
     case MATCH_DUP:
+    case MATCH_PAR_DUP:
       new->dupno = XINT (pattern, 0);
       new->code = UNKNOWN;
       new->enforce_mode = 0;
@@ -587,7 +599,7 @@ not_both_true (d1, d2, toplevel)
         for D1's predicate.  */
       if (d2->code != UNKNOWN)
        {
-         for (i = 0; i < NUM_RTX_CODE && preds[d1->pred].codes[i]; i++)
+         for (i = 0; i < NUM_RTX_CODE && preds[d1->pred].codes[i] != 0; i++)
            if (preds[d1->pred].codes[i] == d2->code)
              break;
 
@@ -599,7 +611,7 @@ not_both_true (d1, d2, toplevel)
 
       else if (d2->pred >= 0)
        {
-         for (i = 0; i < NUM_RTX_CODE && preds[d1->pred].codes[i]; i++)
+         for (i = 0; i < NUM_RTX_CODE && preds[d1->pred].codes[i] != 0; i++)
            {
              for (j = 0; j < NUM_RTX_CODE; j++)
                if (preds[d2->pred].codes[j] == 0
@@ -652,7 +664,7 @@ static int
 position_merit (p, mode, code)
      struct decision *p;
      enum machine_mode mode;
-     RTX_CODE code;
+     enum rtx_code code;
 {
   enum machine_mode p_mode;
 
@@ -792,7 +804,8 @@ merge_trees (oldh, addh)
                      struct decision *split
                        = (struct decision *) xmalloc (sizeof (struct decision));
 
-                     mybcopy (old, split, sizeof (struct decision));
+                     mybcopy ((char *) old, (char *) split,
+                              sizeof (struct decision));
 
                      old->success.first = old->success.last = split;
                      old->c_test = 0;
@@ -810,6 +823,7 @@ merge_trees (oldh, addh)
                      split->test_elt_zero_wide = 0;
                      split->tests = 0;
                      split->pred = -1;
+                     split->dupno = -1;
                    }
 
                  if (add->insn_code_number >= 0 || add->opno >= 0)
@@ -817,7 +831,8 @@ merge_trees (oldh, addh)
                      struct decision *split
                        = (struct decision *) xmalloc (sizeof (struct decision));
 
-                     mybcopy (add, split, sizeof (struct decision));
+                     mybcopy ((char *) add, (char *) split,
+                              sizeof (struct decision));
 
                      add->success.first = add->success.last = split;
                      add->c_test = 0;
@@ -835,6 +850,7 @@ merge_trees (oldh, addh)
                      split->test_elt_zero_wide = 0;
                      split->tests = 0;
                      split->pred = -1;
+                     split->dupno = -1;
                    }
                }
 
@@ -1015,7 +1031,7 @@ static char *indents[]
    resulting function.   We do check for when every test is the same mode
    or code.  */
 
-void
+static void
 write_tree_1 (tree, prevpos, afterward, type)
      struct decision *tree;
      char *prevpos;
@@ -1116,7 +1132,7 @@ write_tree_1 (tree, prevpos, afterward, type)
 
          if (p->pred >= 0)
            {
-             for (i = 0; i < NUM_RTX_CODE && preds[p->pred].codes[i]; i++)
+             for (i = 0; i < NUM_RTX_CODE && preds[p->pred].codes[i] != 0; i++)
                if (codemap[(int) preds[p->pred].codes[i]])
                  break;
 
@@ -1139,7 +1155,7 @@ write_tree_1 (tree, prevpos, afterward, type)
 
              if (code == MATCH_OPERAND)
                {
-                 for (i = 0; i < NUM_RTX_CODE && preds[p->pred].codes[i]; i++)
+                 for (i = 0; i < NUM_RTX_CODE && preds[p->pred].codes[i] != 0; i++)
                    {
                      printf ("%scase ", indents[indent - 2]);
                      print_code (preds[p->pred].codes[i]);
@@ -1438,7 +1454,7 @@ write_tree_1 (tree, prevpos, afterward, type)
 
 static void
 print_code (code)
-     RTX_CODE code;
+     enum rtx_code code;
 {
   register char *p1;
   for (p1 = GET_RTX_NAME (code); *p1; p1++)
@@ -1453,7 +1469,7 @@ print_code (code)
 static int
 same_codes (p, code)
      register struct decision *p;
-     register RTX_CODE code;
+     register enum rtx_code code;
 {
   for (; p; p = p->next)
     if (p->code != code)
@@ -1518,7 +1534,10 @@ write_tree (tree, prevpos, afterward, initial, type)
        {
          printf ("  tem = %s_%d (x0, insn%s);\n",
                  name_prefix, tree->subroutine_number, call_suffix);
-         printf ("  if (tem >= 0) return tem;\n");
+         if (type == SPLIT)
+           printf ("  if (tem != 0) return tem;\n");
+         else
+           printf ("  if (tem >= 0) return tem;\n");
          change_state (tree->position, afterward->position, 2);
          printf ("  goto L%d;\n", afterward->number);
        }
@@ -1646,11 +1665,11 @@ xmalloc (size)
 }
 
 static void
-fatal (s, a1, a2)
+fatal (s)
      char *s;
 {
   fprintf (stderr, "genrecog: ");
-  fprintf (stderr, s, a1, a2);
+  fprintf (stderr, s);
   fprintf (stderr, "\n");
   fprintf (stderr, "after %d definitions\n", next_index);
   exit (FATAL_EXIT_CODE);