OSDN Git Service

* genattr.c (function_unit_desc): Constify a char*. Add prototype.
authorghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 24 Aug 1999 13:34:04 +0000 (13:34 +0000)
committerghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 24 Aug 1999 13:34:04 +0000 (13:34 +0000)
(main): Add prototypes.

* genattrtab.c (substitute_address, write_const_num_delay_slots,
attr_eq, attr_numeral, attr_equal_p, attr_copy_rtx): Prototype.
(write_attr_get): Emit prototypes along with function definition.
(write_eligible_delay): Mark a parameter with ATTRIBUTE_UNUSED.
(write_complex_function): Emit static prototype along with
function definition.

* genemit.c (gen_split): Emit prototypes along with function
definition.

* genoutput.c (output_epilogue): Add prototype to `insn_outfun'.
Likewise for predicates and `insn_operand_predicate'.
(process_template): Emit static prototype along with function
definition.

* genrecog.c (make_insn_sequence): Constify a char*.  Add
prototypes for get_split_*().
(write_subroutine): Emit prototypes along with function
definition.

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

gcc/ChangeLog
gcc/genattr.c
gcc/genattrtab.c
gcc/genemit.c
gcc/genoutput.c
gcc/genrecog.c

index 89cbb2b..c7fe011 100644 (file)
@@ -1,3 +1,28 @@
+Tue Aug 24 09:32:07 1999  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+       * genattr.c (function_unit_desc): Constify a char*.  Add prototype.
+       (main): Add prototypes.
+
+       * genattrtab.c (substitute_address, write_const_num_delay_slots,
+       attr_eq, attr_numeral, attr_equal_p, attr_copy_rtx): Prototype.
+       (write_attr_get): Emit prototypes along with function definition.
+       (write_eligible_delay): Mark a parameter with ATTRIBUTE_UNUSED.
+       (write_complex_function): Emit static prototype along with
+       function definition.
+
+       * genemit.c (gen_split): Emit prototypes along with function
+       definition.
+
+       * genoutput.c (output_epilogue): Add prototype to `insn_outfun'.
+       Likewise for predicates and `insn_operand_predicate'.
+       (process_template): Emit static prototype along with function
+       definition.
+
+       * genrecog.c (make_insn_sequence): Constify a char*.  Add
+       prototypes for get_split_*().
+       (write_subroutine): Emit prototypes along with function
+       definition.
+
 Tue Aug 24 12:35:20 1999  Bernd Schmidt  <bernds@cygnus.co.uk>
 
        * tree.h (current_function_calls_setjmp,
index 55d6fb1..86c078f 100644 (file)
@@ -163,17 +163,17 @@ write_units (num_units, multiplicity, simultaneity,
   printf ("extern int function_units_used PROTO((rtx));\n\n");
   printf ("extern struct function_unit_desc\n");
   printf ("{\n");
-  printf ("  char *name;\n");
+  printf ("  const char *name;\n");
   printf ("  int bitmask;\n");
   printf ("  int multiplicity;\n");
   printf ("  int simultaneity;\n");
   printf ("  int default_cost;\n");
   printf ("  int max_issue_delay;\n");
-  printf ("  int (*ready_cost_function) ();\n");
-  printf ("  int (*conflict_cost_function) ();\n");
+  printf ("  int (*ready_cost_function) PROTO ((rtx));\n");
+  printf ("  int (*conflict_cost_function) PROTO ((rtx, rtx));\n");
   printf ("  int max_blockage;\n");
-  printf ("  unsigned int (*blockage_range_function) ();\n");
-  printf ("  int (*blockage_function) ();\n");
+  printf ("  unsigned int (*blockage_range_function) PROTO ((rtx));\n");
+  printf ("  int (*blockage_function) PROTO ((rtx, rtx));\n");
   printf ("} function_units[];\n\n");
   printf ("#define FUNCTION_UNITS_SIZE %d\n", num_units);
   printf ("#define MIN_MULTIPLICITY %d\n", multiplicity->min);
@@ -329,14 +329,14 @@ from the machine description file `md'.  */\n\n");
              if (XVECEXP (desc, 1, i + 1) && ! have_annul_true)
                {
                  printf ("#define ANNUL_IFTRUE_SLOTS\n");
-                 printf ("extern int eligible_for_annul_true ();\n");
+                 printf ("extern int eligible_for_annul_true PROTO ((rtx, int, rtx, int));\n");
                  have_annul_true = 1;
                }
 
              if (XVECEXP (desc, 1, i + 2) && ! have_annul_false)
                {
                  printf ("#define ANNUL_IFFALSE_SLOTS\n");
-                 printf ("extern int eligible_for_annul_false ();\n");
+                 printf ("extern int eligible_for_annul_false PROTO ((rtx, int, rtx, int));\n");
                  have_annul_false = 1;
                }
            }
index 2713789..2aba0b5 100644 (file)
@@ -387,7 +387,7 @@ static rtx simplify_knowing PROTO((rtx, rtx));
 static rtx encode_units_mask   PROTO((rtx));
 static void fill_attr          PROTO((struct attr_desc *));
 /* dpx2 compiler chokes if we specify the arg types of the args.  */
-static rtx substitute_address  PROTO((rtx, rtx (*) (), rtx (*) ()));
+static rtx substitute_address  PROTO((rtx, rtx (*) (rtx), rtx (*) (rtx)));
 static void make_length_attrs  PROTO((void));
 static rtx identity_fn         PROTO((rtx));
 static rtx zero_fn             PROTO((rtx));
@@ -447,6 +447,7 @@ static void write_complex_function PROTO((struct function_unit *, const char *,
                                          const char *));
 static int write_expr_attr_cache PROTO((rtx, struct attr_desc *));
 static void write_toplevel_expr        PROTO((rtx));
+static void write_const_num_delay_slots PROTO ((void));
 static int n_comma_elts                PROTO((char *));
 static char *next_comma_elt    PROTO((char **));
 static struct attr_desc *find_attr PROTO((const char *, int));
@@ -455,6 +456,10 @@ static struct attr_value *find_most_used  PROTO((struct attr_desc *));
 static rtx find_single_value   PROTO((struct attr_desc *));
 static rtx make_numeric_value  PROTO((int));
 static void extend_range       PROTO((struct range *, int, int));
+static rtx attr_eq             PROTO((char *, char *));
+static char *attr_numeral      PROTO((int));
+static int attr_equal_p                PROTO((rtx, rtx));
+static rtx attr_copy_rtx       PROTO((rtx));
 
 #define oballoc(size) obstack_alloc (hash_obstack, size)
 
@@ -757,7 +762,7 @@ attr_printf VPROTO((register int len, const char *fmt, ...))
   return attr_string (str, strlen (str));
 }
 
-rtx
+static rtx
 attr_eq (name, value)
      char *name, *value;
 {
@@ -765,7 +770,7 @@ attr_eq (name, value)
                   attr_string (value, strlen (value)));
 }
 
-char *
+static char *
 attr_numeral (n)
      int n;
 {
@@ -811,7 +816,7 @@ attr_string (str, len)
    taking advantage of the fact that if both are hashed
    then they can't be equal unless they are the same object.  */
 
-int
+static int
 attr_equal_p (x, y)
      rtx x, y;
 {
@@ -823,7 +828,7 @@ attr_equal_p (x, y)
    descending to all depths, but not copying any
    permanent hashed subexpressions.  */
 
-rtx
+static rtx
 attr_copy_rtx (orig)
      register rtx orig;
 {
@@ -2327,8 +2332,8 @@ fill_attr (attr)
 static rtx
 substitute_address (exp, no_address_fn, address_fn)
      rtx exp;
-     rtx (*no_address_fn) ();
-     rtx (*address_fn) ();
+     rtx (*no_address_fn) PROTO ((rtx));
+     rtx (*address_fn) PROTO ((rtx));
 {
   int i;
   rtx newexp;
@@ -4844,6 +4849,21 @@ write_attr_get (attr)
      switch we will generate.  */
   common_av = find_most_used (attr);
 
+  /* Write out prototype of function. */
+  if (!attr->is_numeric)
+    printf ("extern enum attr_%s ", attr->name);
+  else if (attr->unsigned_p)
+    printf ("extern unsigned int ");
+  else
+    printf ("extern int ");
+  /* If the attribute name starts with a star, the remainder is the name of
+     the subroutine to use, instead of `get_attr_...'.  */
+  if (attr->name[0] == '*')
+    printf ("%s PROTO ((rtx));\n", &attr->name[1]);
+  else
+    printf ("get_attr_%s PROTO ((%s));\n", attr->name,
+           (attr->is_const ? "void" : "rtx"));
+
   /* Write out start of function, then all values with explicit `case' lines,
      then a `default', then the value with the most uses.  */
   if (!attr->is_numeric)
@@ -5380,7 +5400,7 @@ write_eligible_delay (kind)
   printf ("     rtx delay_insn;\n");
   printf ("     int slot;\n");
   printf ("     rtx candidate_insn;\n");
-  printf ("     int flags;\n");
+  printf ("     int flags ATTRIBUTE_UNUSED;\n");
   printf ("{\n");
   printf ("  rtx insn;\n");
   printf ("\n");
@@ -5553,6 +5573,7 @@ write_complex_function (unit, name, connection)
   int using_case;
   int i;
 
+  printf ("static int %s_unit_%s PROTO ((rtx, rtx));\n", unit->name, name);
   printf ("static int\n");
   printf ("%s_unit_%s (executing_insn, candidate_insn)\n",
          unit->name, name);
@@ -5919,7 +5940,7 @@ fancy_abort ()
 /* Determine if an insn has a constant number of delay slots, i.e., the
    number of delay slots is not a function of the length of the insn.  */
 
-void
+static void
 write_const_num_delay_slots ()
 {
   struct attr_desc *attr = find_attr ("*num_delay_slots", 0);
index 17f1d5d..aa9bc53 100644 (file)
@@ -539,7 +539,8 @@ gen_split (split)
   max_operand_vec (split, 2);
   operands = MAX (max_opno, max_dup_opno) + 1;
 
-  /* Output the function name and argument declarations.  */
+  /* Output the prototype, the function name and argument declarations.  */
+  printf ("extern rtx gen_split_%d PROTO ((rtx *));\n", insn_code_number);
   printf ("rtx\ngen_split_%d (operands)\n     rtx *operands;\n",
          insn_code_number);
   printf ("{\n");
index d369f31..9118086 100644 (file)
@@ -244,7 +244,7 @@ output_epilogue ()
     }
   printf ("  };\n");
 
-  printf ("\nconst char *(*const insn_outfun[])() =\n  {\n");
+  printf ("\nconst char *(*const insn_outfun[]) PROTO((rtx *, rtx)) =\n  {\n");
   for (d = insn_data; d; d = d->next)
     {
       if (d->outfun)
@@ -398,7 +398,8 @@ output_epilogue ()
 
            if (p == 0)
              {
-               printf ("extern int %s ();\n", d->predicates[i]);
+               printf ("extern int %s PROTO ((rtx, enum machine_mode));\n",
+                       d->predicates[i]);
                p = (struct predicate *) alloca (sizeof (struct predicate));
                p->name = d->predicates[i];
                p->next = predicates;
@@ -406,7 +407,7 @@ output_epilogue ()
              }
          }
     
-    printf ("\nint (*const insn_operand_predicate[][MAX_RECOG_OPERANDS])() =\n  {\n");
+    printf ("\nint (*const insn_operand_predicate[][MAX_RECOG_OPERANDS]) PROTO ((rtx, enum machine_mode)) =\n  {\n");
     for (d = insn_data; d; d = d->next)
       {
        printf ("    {");
@@ -596,6 +597,8 @@ process_template (d, template)
   d->template = 0;
   d->outfun = 1;
 
+  printf ("\nstatic const char *output_%d PROTO ((rtx *, rtx));\n",
+         d->code_number);
   printf ("\nstatic const char *\n");
   printf ("output_%d (operands, insn)\n", d->code_number);
   printf ("     rtx *operands ATTRIBUTE_UNUSED;\n");
index ebe5d30..8fb846b 100644 (file)
@@ -213,7 +213,7 @@ make_insn_sequence (insn, type)
   struct decision_head head;
 
   {
-    static char *last_real_name = "insn";
+    static const char *last_real_name = "insn";
     static int last_real_code = 0;
     char *name;
 
@@ -306,7 +306,7 @@ make_insn_sequence (insn, type)
 
   if (type == SPLIT)
     /* Define the subroutine we will call below and emit in genemit.  */
-    printf ("extern rtx gen_split_%d ();\n", last->insn_code_number);
+    printf ("extern rtx gen_split_%d PROTO ((rtx *));\n", last->insn_code_number);
 
   return head;
 }
@@ -1032,6 +1032,19 @@ write_subroutine (tree, type)
   int i;
 
   if (type == SPLIT)
+    printf ("extern rtx split");
+  else
+    printf ("extern int recog");
+  if (tree != 0 && tree->subroutine_number > 0)
+    printf ("_%d", tree->subroutine_number);
+  else if (type == SPLIT)
+    printf ("_insns");
+  printf (" PROTO ((rtx, rtx");
+  if (type == RECOG)
+    printf (", int *");
+  printf ("));\n");
+
+  if (type == SPLIT)
     printf ("rtx\nsplit");
   else
     printf ("int\nrecog");