genrecog.c (write_subroutine): Careful for null trees.
authorRichard Henderson <rth@cygnus.com>
Wed, 13 Oct 1999 17:22:40 +0000 (10:22 -0700)
committerRichard Henderson <rth@gcc.gnu.org>
Wed, 13 Oct 1999 17:22:40 +0000 (10:22 -0700)
        * genrecog.c (write_subroutine): Careful for null trees.
        (process_tree): Don't elide empty functions.

From-SVN: r29948

gcc/ChangeLog
gcc/genrecog.c

index de10c4b613983e0a83d63e51fb34fff9d70dd342..6a7151a35eb4078889357a05a90602c4c815e728 100644 (file)
@@ -1,3 +1,8 @@
+Wed Oct 13 10:20:58 1999  Richard Henderson  <rth@cygnus.com>
+
+       * genrecog.c (write_subroutine): Careful for null trees.
+       (process_tree): Don't elide empty functions.
+
 Wed Oct 13 10:07:54 1999  Richard Henderson  <rth@cygnus.com>
 
        * Makefile.in (genrtl.o): Depend on ggc.h.
index bc49d45a770642a0c920d281001589eb2edfdb97..0114bc17533c56acc3b25636b00195829c42b808 100644 (file)
@@ -1859,7 +1859,7 @@ peephole2%s (x0, insn, _plast_insn)\n\
      rtx *_plast_insn ATTRIBUTE_UNUSED;\n"
   };
      
-  int subfunction = head->first->subroutine_number;
+  int subfunction = head->first ? head->first->subroutine_number : 0;
   const char *s_or_e;
   char extension[32];
   int i;
@@ -1884,7 +1884,10 @@ peephole2%s (x0, insn, _plast_insn)\n\
     printf ("  register rtx _last_insn = insn;\n");
   printf ("  %s tem ATTRIBUTE_UNUSED;\n", IS_SPLIT (type) ? "rtx" : "int");
 
-  write_tree (head, "", type, 1);
+  if (head->first)
+    write_tree (head, "", type, 1);
+  else
+    printf ("  goto ret0;\n");
 
   if (type == PEEPHOLE2)
     printf (" ret1:\n  *_plast_insn = _last_insn;\n  return tem;\n");
@@ -2128,17 +2131,17 @@ process_tree (head, subroutine_type)
      struct decision_head *head;
      enum routine_type subroutine_type;
 {
-  if (head->first == NULL)
-    return;
-
-  factor_tests (head);
-  simplify_tests (head);
+  if (head->first != NULL)
+    {
+      factor_tests (head);
+      simplify_tests (head);
 
-  next_subroutine_number = 0;
-  break_out_subroutines (head, 1);
-  find_afterward (head, NULL);
+      next_subroutine_number = 0;
+      break_out_subroutines (head, 1);
+      find_afterward (head, NULL);
 
-  write_subroutines (head, subroutine_type);
+      write_subroutines (head, subroutine_type);
+    }
   write_subroutine (head, subroutine_type);
 }
 \f