* recog.h: Remove NO_MD_PROTOTYPES ifdefs.
authorzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 5 Feb 2000 04:56:11 +0000 (04:56 +0000)
committerzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 5 Feb 2000 04:56:11 +0000 (04:56 +0000)
  * genflags.c: Use the max_operand_1 logic from genemit.c to
  calculate how many arguments gen_insn prototypes have.  Remove
  NO_MD_PROTOTYPES ifdefs from the generated file.
  * genoutput.c: Don't define NO_MD_PROTOTYPES in the generated
  file.  Cast gen_insn initializers to insn_gen_fn.
  * config/alpha/vms.h: Don't define NO_MD_PROTOTYPES.
  * gcc.texi: Remove documentation of NO_MD_PROTOTYPES.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@31801 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/alpha/vms.h
gcc/gcc.texi
gcc/genflags.c
gcc/genoutput.c
gcc/recog.h

index 5a5f7ba..e74ee16 100644 (file)
@@ -1,3 +1,14 @@
+2000-02-04  Zack Weinberg  <zack@wolery.cumb.org>
+
+       * recog.h: Remove NO_MD_PROTOTYPES ifdefs.
+       * genflags.c: Use the max_operand_1 logic from genemit.c to
+       calculate how many arguments gen_insn prototypes have.  Remove
+       NO_MD_PROTOTYPES ifdefs from the generated file.
+       * genoutput.c: Don't define NO_MD_PROTOTYPES in the generated
+       file.  Cast gen_insn initializers to insn_gen_fn.
+       * config/alpha/vms.h: Don't define NO_MD_PROTOTYPES.
+       * gcc.texi: Remove documentation of NO_MD_PROTOTYPES.
+
 2000-02-04  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * fixinc/Makefile.in (HDR): Add machname.h.
index 1baaf7e..b40a391 100644 (file)
@@ -366,7 +366,6 @@ do {                                                                        \
   fprintf ((FILE), ",%u,%u\n", (SIZE), (ALIGN) / BITS_PER_UNIT);       \
 } while (0)
 
-#define NO_MD_PROTOTYPES
 \f
 /* Output assembler code for a block containing the constant parts
    of a trampoline, leaving space for the variable parts.
index 8585259..5e29909 100644 (file)
@@ -3782,24 +3782,14 @@ GCC.  If @samp{USE_PROTOTYPES} is not defined, it will be
 determined automatically whether your compiler supports
 prototypes by checking if @samp{__STDC__} is defined.
 
-@findex NO_MD_PROTOTYPES
-@item NO_MD_PROTOTYPES
-Define this if you wish suppression of prototypes generated from
-the machine description file, but to use other prototypes within
-GCC.  If @samp{USE_PROTOTYPES} is defined to be 0, or the
-host compiler does not support prototypes, this macro has no
-effect.
-
 @findex MD_CALL_PROTOTYPES
 @item MD_CALL_PROTOTYPES
-Define this if you wish to generate prototypes for the
-@code{gen_call} or @code{gen_call_value} functions generated from
-the machine description file.  If @samp{USE_PROTOTYPES} is
-defined to be 0, or the host compiler does not support
-prototypes, or @samp{NO_MD_PROTOTYPES} is defined, this macro has
-no effect.  As soon as all of the machine descriptions are
-modified to have the appropriate number of arguments, this macro
-will be removed.
+Define this if you wish to generate prototypes for the @code{gen_call}
+or @code{gen_call_value} functions generated from the machine
+description file.  If @samp{USE_PROTOTYPES} is defined to be 0, or the
+host compiler does not support prototypes, this macro has no effect.  As
+soon as all of the machine descriptions are modified to have the
+appropriate number of arguments, this macro will be removed.
 
 @findex PATH_SEPARATOR
 @item PATH_SEPARATOR
index f801b57..4c37660 100644 (file)
@@ -39,48 +39,63 @@ static struct obstack call_obstack, normal_obstack;
 /* Max size of names encountered.  */
 static int max_id_len;
 
-static int num_operands PARAMS ((rtx));
-static void gen_proto PARAMS ((rtx));
-static void gen_nonproto PARAMS ((rtx));
-static void gen_insn PARAMS ((rtx));
+/* Max operand encountered in a scan over some insn.  */
+static int max_opno;
 
+static void max_operand_1      PARAMS ((rtx));
+static int num_operands                PARAMS ((rtx));
+static void gen_proto          PARAMS ((rtx));
+static void gen_nonproto       PARAMS ((rtx));
+static void gen_insn           PARAMS ((rtx));
 
 /* Count the number of match_operand's found.  */
 
-static int
-num_operands (x)
+static void
+max_operand_1 (x)
      rtx x;
 {
-  int count = 0;
-  int i, j;
-  enum rtx_code code = GET_CODE (x);
-  const char *format_ptr = GET_RTX_FORMAT (code);
+  register RTX_CODE code;
+  register int i;
+  register int len;
+  register const char *fmt;
 
-  if (code == MATCH_OPERAND)
-    return 1;
+  if (x == 0)
+    return;
 
-  if (code == MATCH_OPERATOR || code == MATCH_PARALLEL)
-    count++;
+  code = GET_CODE (x);
 
-  for (i = 0; i < GET_RTX_LENGTH (code); i++)
+  if (code == MATCH_OPERAND || code == MATCH_OPERATOR
+      || code == MATCH_PARALLEL)
+    max_opno = MAX (max_opno, XINT (x, 0));
+
+  fmt = GET_RTX_FORMAT (code);
+  len = GET_RTX_LENGTH (code);
+  for (i = 0; i < len; i++)
     {
-      switch (*format_ptr++)
+      if (fmt[i] == 'e' || fmt[i] == 'u')
+       max_operand_1 (XEXP (x, i));
+      else if (fmt[i] == 'E')
        {
-       case 'u':
-       case 'e':
-         count += num_operands (XEXP (x, i));
-         break;
-
-       case 'E':
-         if (XVEC (x, i) != NULL)
-           for (j = 0; j < XVECLEN (x, i); j++)
-             count += num_operands (XVECEXP (x, i, j));
-
-         break;
+         int j;
+         for (j = 0; j < XVECLEN (x, i); j++)
+           max_operand_1 (XVECEXP (x, i, j));
        }
     }
+}
 
-  return count;
+static int
+num_operands (insn)
+     rtx insn;
+{
+  register int len = XVECLEN (insn, 1);
+  register int i;
+
+  max_opno = -1;
+
+  for (i = 0; i < len; i++)
+    max_operand_1 (XVECEXP (insn, 1, i));
+
+  return max_opno + 1;
 }
 
 /* Print out prototype information for a function.  */
@@ -251,7 +266,6 @@ from the machine description file `md'.  */\n\n");
   obstack_grow (&normal_obstack, &dummy, sizeof (rtx));
   normal_insns = (rtx *) obstack_finish (&normal_obstack);
 
-  printf ("\n#ifndef NO_MD_PROTOTYPES\n");
   for (insn_ptr = normal_insns; *insn_ptr; insn_ptr++)
     gen_proto (*insn_ptr);
 
@@ -264,14 +278,6 @@ from the machine description file `md'.  */\n\n");
     gen_nonproto (*insn_ptr);
 
   printf ("#endif /* !MD_CALL_PROTOTYPES */\n");
-  printf ("\n#else  /* NO_MD_PROTOTYPES */\n");
-  for (insn_ptr = normal_insns; *insn_ptr; insn_ptr++)
-    gen_nonproto (*insn_ptr);
-
-  for (insn_ptr = call_insns; *insn_ptr; insn_ptr++)
-    gen_nonproto (*insn_ptr);
-
-  printf ("#endif  /* NO_MD_PROTOTYPES */\n");
 
   fflush (stdout);
   return (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE);
index 5fd472d..ecac9c9 100644 (file)
@@ -221,7 +221,6 @@ output_prologue ()
   printf ("/* Generated automatically by the program `genoutput'\n\
 from the machine description file `md'.  */\n\n");
 
-  printf ("#define NO_MD_PROTOTYPES\n");
   printf ("#include \"config.h\"\n");
   printf ("#include \"system.h\"\n");
   printf ("#include \"flags.h\"\n");
@@ -369,7 +368,7 @@ output_insn_data ()
        }
 
       if (d->name && d->name[0] != '*')
-       printf ("    gen_%s,\n", d->name);
+       printf ("    (insn_gen_fn) gen_%s,\n", d->name);
       else
        printf ("    0,\n");
 
index a19e6a6..d9ca87a 100644 (file)
@@ -190,11 +190,7 @@ extern struct operand_alternative recog_op_alt[MAX_RECOG_OPERANDS][MAX_RECOG_ALT
 
 typedef int (*insn_operand_predicate_fn) PARAMS ((rtx, enum machine_mode));
 typedef const char * (*insn_output_fn) PARAMS ((rtx *, rtx));
-#ifndef NO_MD_PROTOTYPES
 typedef rtx (*insn_gen_fn) PARAMS ((rtx, ...));
-#else
-typedef rtx (*insn_gen_fn) ();
-#endif
 
 struct insn_operand_data
 {