Commit 69277eec by Kaveh R. Ghazi Committed by Kaveh Ghazi

genattr.c (function_unit_desc): Constify a char*.

	* 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.

From-SVN: r28822
parent 33f58a4e
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> Tue Aug 24 12:35:20 1999 Bernd Schmidt <bernds@cygnus.co.uk>
* tree.h (current_function_calls_setjmp, * tree.h (current_function_calls_setjmp,
......
...@@ -163,17 +163,17 @@ write_units (num_units, multiplicity, simultaneity, ...@@ -163,17 +163,17 @@ write_units (num_units, multiplicity, simultaneity,
printf ("extern int function_units_used PROTO((rtx));\n\n"); printf ("extern int function_units_used PROTO((rtx));\n\n");
printf ("extern struct function_unit_desc\n"); printf ("extern struct function_unit_desc\n");
printf ("{\n"); printf ("{\n");
printf (" char *name;\n"); printf (" const char *name;\n");
printf (" int bitmask;\n"); printf (" int bitmask;\n");
printf (" int multiplicity;\n"); printf (" int multiplicity;\n");
printf (" int simultaneity;\n"); printf (" int simultaneity;\n");
printf (" int default_cost;\n"); printf (" int default_cost;\n");
printf (" int max_issue_delay;\n"); printf (" int max_issue_delay;\n");
printf (" int (*ready_cost_function) ();\n"); printf (" int (*ready_cost_function) PROTO ((rtx));\n");
printf (" int (*conflict_cost_function) ();\n"); printf (" int (*conflict_cost_function) PROTO ((rtx, rtx));\n");
printf (" int max_blockage;\n"); printf (" int max_blockage;\n");
printf (" unsigned int (*blockage_range_function) ();\n"); printf (" unsigned int (*blockage_range_function) PROTO ((rtx));\n");
printf (" int (*blockage_function) ();\n"); printf (" int (*blockage_function) PROTO ((rtx, rtx));\n");
printf ("} function_units[];\n\n"); printf ("} function_units[];\n\n");
printf ("#define FUNCTION_UNITS_SIZE %d\n", num_units); printf ("#define FUNCTION_UNITS_SIZE %d\n", num_units);
printf ("#define MIN_MULTIPLICITY %d\n", multiplicity->min); printf ("#define MIN_MULTIPLICITY %d\n", multiplicity->min);
...@@ -329,14 +329,14 @@ from the machine description file `md'. */\n\n"); ...@@ -329,14 +329,14 @@ from the machine description file `md'. */\n\n");
if (XVECEXP (desc, 1, i + 1) && ! have_annul_true) if (XVECEXP (desc, 1, i + 1) && ! have_annul_true)
{ {
printf ("#define ANNUL_IFTRUE_SLOTS\n"); 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; have_annul_true = 1;
} }
if (XVECEXP (desc, 1, i + 2) && ! have_annul_false) if (XVECEXP (desc, 1, i + 2) && ! have_annul_false)
{ {
printf ("#define ANNUL_IFFALSE_SLOTS\n"); 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; have_annul_false = 1;
} }
} }
......
...@@ -387,7 +387,7 @@ static rtx simplify_knowing PROTO((rtx, rtx)); ...@@ -387,7 +387,7 @@ static rtx simplify_knowing PROTO((rtx, rtx));
static rtx encode_units_mask PROTO((rtx)); static rtx encode_units_mask PROTO((rtx));
static void fill_attr PROTO((struct attr_desc *)); static void fill_attr PROTO((struct attr_desc *));
/* dpx2 compiler chokes if we specify the arg types of the args. */ /* 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 void make_length_attrs PROTO((void));
static rtx identity_fn PROTO((rtx)); static rtx identity_fn PROTO((rtx));
static rtx zero_fn PROTO((rtx)); static rtx zero_fn PROTO((rtx));
...@@ -447,6 +447,7 @@ static void write_complex_function PROTO((struct function_unit *, const char *, ...@@ -447,6 +447,7 @@ static void write_complex_function PROTO((struct function_unit *, const char *,
const char *)); const char *));
static int write_expr_attr_cache PROTO((rtx, struct attr_desc *)); static int write_expr_attr_cache PROTO((rtx, struct attr_desc *));
static void write_toplevel_expr PROTO((rtx)); static void write_toplevel_expr PROTO((rtx));
static void write_const_num_delay_slots PROTO ((void));
static int n_comma_elts PROTO((char *)); static int n_comma_elts PROTO((char *));
static char *next_comma_elt PROTO((char **)); static char *next_comma_elt PROTO((char **));
static struct attr_desc *find_attr PROTO((const char *, int)); 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 *)); ...@@ -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 find_single_value PROTO((struct attr_desc *));
static rtx make_numeric_value PROTO((int)); static rtx make_numeric_value PROTO((int));
static void extend_range PROTO((struct range *, int, 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) #define oballoc(size) obstack_alloc (hash_obstack, size)
...@@ -757,7 +762,7 @@ attr_printf VPROTO((register int len, const char *fmt, ...)) ...@@ -757,7 +762,7 @@ attr_printf VPROTO((register int len, const char *fmt, ...))
return attr_string (str, strlen (str)); return attr_string (str, strlen (str));
} }
rtx static rtx
attr_eq (name, value) attr_eq (name, value)
char *name, *value; char *name, *value;
{ {
...@@ -765,7 +770,7 @@ attr_eq (name, value) ...@@ -765,7 +770,7 @@ attr_eq (name, value)
attr_string (value, strlen (value))); attr_string (value, strlen (value)));
} }
char * static char *
attr_numeral (n) attr_numeral (n)
int n; int n;
{ {
...@@ -811,7 +816,7 @@ attr_string (str, len) ...@@ -811,7 +816,7 @@ attr_string (str, len)
taking advantage of the fact that if both are hashed taking advantage of the fact that if both are hashed
then they can't be equal unless they are the same object. */ then they can't be equal unless they are the same object. */
int static int
attr_equal_p (x, y) attr_equal_p (x, y)
rtx x, y; rtx x, y;
{ {
...@@ -823,7 +828,7 @@ attr_equal_p (x, y) ...@@ -823,7 +828,7 @@ attr_equal_p (x, y)
descending to all depths, but not copying any descending to all depths, but not copying any
permanent hashed subexpressions. */ permanent hashed subexpressions. */
rtx static rtx
attr_copy_rtx (orig) attr_copy_rtx (orig)
register rtx orig; register rtx orig;
{ {
...@@ -2327,8 +2332,8 @@ fill_attr (attr) ...@@ -2327,8 +2332,8 @@ fill_attr (attr)
static rtx static rtx
substitute_address (exp, no_address_fn, address_fn) substitute_address (exp, no_address_fn, address_fn)
rtx exp; rtx exp;
rtx (*no_address_fn) (); rtx (*no_address_fn) PROTO ((rtx));
rtx (*address_fn) (); rtx (*address_fn) PROTO ((rtx));
{ {
int i; int i;
rtx newexp; rtx newexp;
...@@ -4844,6 +4849,21 @@ write_attr_get (attr) ...@@ -4844,6 +4849,21 @@ write_attr_get (attr)
switch we will generate. */ switch we will generate. */
common_av = find_most_used (attr); 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, /* Write out start of function, then all values with explicit `case' lines,
then a `default', then the value with the most uses. */ then a `default', then the value with the most uses. */
if (!attr->is_numeric) if (!attr->is_numeric)
...@@ -5380,7 +5400,7 @@ write_eligible_delay (kind) ...@@ -5380,7 +5400,7 @@ write_eligible_delay (kind)
printf (" rtx delay_insn;\n"); printf (" rtx delay_insn;\n");
printf (" int slot;\n"); printf (" int slot;\n");
printf (" rtx candidate_insn;\n"); printf (" rtx candidate_insn;\n");
printf (" int flags;\n"); printf (" int flags ATTRIBUTE_UNUSED;\n");
printf ("{\n"); printf ("{\n");
printf (" rtx insn;\n"); printf (" rtx insn;\n");
printf ("\n"); printf ("\n");
...@@ -5553,6 +5573,7 @@ write_complex_function (unit, name, connection) ...@@ -5553,6 +5573,7 @@ write_complex_function (unit, name, connection)
int using_case; int using_case;
int i; int i;
printf ("static int %s_unit_%s PROTO ((rtx, rtx));\n", unit->name, name);
printf ("static int\n"); printf ("static int\n");
printf ("%s_unit_%s (executing_insn, candidate_insn)\n", printf ("%s_unit_%s (executing_insn, candidate_insn)\n",
unit->name, name); unit->name, name);
...@@ -5919,7 +5940,7 @@ fancy_abort () ...@@ -5919,7 +5940,7 @@ fancy_abort ()
/* Determine if an insn has a constant number of delay slots, i.e., the /* 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. */ number of delay slots is not a function of the length of the insn. */
void static void
write_const_num_delay_slots () write_const_num_delay_slots ()
{ {
struct attr_desc *attr = find_attr ("*num_delay_slots", 0); struct attr_desc *attr = find_attr ("*num_delay_slots", 0);
......
...@@ -539,7 +539,8 @@ gen_split (split) ...@@ -539,7 +539,8 @@ gen_split (split)
max_operand_vec (split, 2); max_operand_vec (split, 2);
operands = MAX (max_opno, max_dup_opno) + 1; 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", printf ("rtx\ngen_split_%d (operands)\n rtx *operands;\n",
insn_code_number); insn_code_number);
printf ("{\n"); printf ("{\n");
......
...@@ -244,7 +244,7 @@ output_epilogue () ...@@ -244,7 +244,7 @@ output_epilogue ()
} }
printf (" };\n"); 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) for (d = insn_data; d; d = d->next)
{ {
if (d->outfun) if (d->outfun)
...@@ -398,7 +398,8 @@ output_epilogue () ...@@ -398,7 +398,8 @@ output_epilogue ()
if (p == 0) 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 = (struct predicate *) alloca (sizeof (struct predicate));
p->name = d->predicates[i]; p->name = d->predicates[i];
p->next = predicates; p->next = predicates;
...@@ -406,7 +407,7 @@ output_epilogue () ...@@ -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) for (d = insn_data; d; d = d->next)
{ {
printf (" {"); printf (" {");
...@@ -596,6 +597,8 @@ process_template (d, template) ...@@ -596,6 +597,8 @@ process_template (d, template)
d->template = 0; d->template = 0;
d->outfun = 1; d->outfun = 1;
printf ("\nstatic const char *output_%d PROTO ((rtx *, rtx));\n",
d->code_number);
printf ("\nstatic const char *\n"); printf ("\nstatic const char *\n");
printf ("output_%d (operands, insn)\n", d->code_number); printf ("output_%d (operands, insn)\n", d->code_number);
printf (" rtx *operands ATTRIBUTE_UNUSED;\n"); printf (" rtx *operands ATTRIBUTE_UNUSED;\n");
......
...@@ -213,7 +213,7 @@ make_insn_sequence (insn, type) ...@@ -213,7 +213,7 @@ make_insn_sequence (insn, type)
struct decision_head head; struct decision_head head;
{ {
static char *last_real_name = "insn"; static const char *last_real_name = "insn";
static int last_real_code = 0; static int last_real_code = 0;
char *name; char *name;
...@@ -306,7 +306,7 @@ make_insn_sequence (insn, type) ...@@ -306,7 +306,7 @@ make_insn_sequence (insn, type)
if (type == SPLIT) if (type == SPLIT)
/* Define the subroutine we will call below and emit in genemit. */ /* 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; return head;
} }
...@@ -1032,6 +1032,19 @@ write_subroutine (tree, type) ...@@ -1032,6 +1032,19 @@ write_subroutine (tree, type)
int i; int i;
if (type == SPLIT) 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"); printf ("rtx\nsplit");
else else
printf ("int\nrecog"); printf ("int\nrecog");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment