Commit 6906ba40 by Kaveh R. Ghazi Committed by Kaveh Ghazi

genattr.c (internal_dfa_insn_code): Output prototype.

	* genattr.c (internal_dfa_insn_code): Output prototype.
	* genattrtab.c: Don't output unnecessary decls, output in ISO C.
	* genautomata.c: Likewise.
	* genconditions.c: Likewise.
	* genemit.c: Likewise.
	* genextract.c: Likewise.
	* gengenrtl.c: Likewise.
	* gengtype.c: Likewise.
	* genopinit.c: Likewise.
	* genoutput.c: Likewise.
	* genpeep.c: Likewise.
	* genrecog.c: Likewise.

From-SVN: r68959
parent 3d7c150e
2003-07-05 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* genattr.c (internal_dfa_insn_code): Output prototype.
* genattrtab.c: Don't output unnecessary decls, output in ISO C.
* genautomata.c: Likewise.
* genconditions.c: Likewise.
* genemit.c: Likewise.
* genextract.c: Likewise.
* gengenrtl.c: Likewise.
* gengtype.c: Likewise.
* genopinit.c: Likewise.
* genoutput.c: Likewise.
* genpeep.c: Likewise.
* genrecog.c: Likewise.
2003-07-04 Zack Weinberg <zack@codesourcery.com>
* cpplib.h (CPP_AT_NAME, CPP_OBJC_STRING): New token types.
......
......@@ -379,6 +379,7 @@ main (int argc, char **argv)
printf (" insns scheduling heuristics. */\n");
printf ("extern int insn_alts (rtx);\n\n");
printf ("#endif\n\n");
printf ("extern int internal_dfa_insn_code (rtx);\n\n");
printf ("/* Maximal possible number of insns waiting results being\n");
printf (" produced by insns whose execution is not finished. */\n");
printf ("extern int max_insn_queue_index;\n\n");
......
......@@ -4765,21 +4765,6 @@ write_attr_get (struct attr_desc *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 (rtx);\n", &attr->name[1]);
else
printf ("get_attr_%s (%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)
......@@ -4792,12 +4777,12 @@ write_attr_get (struct attr_desc *attr)
/* 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 (insn)\n", &attr->name[1]);
printf ("%s (rtx insn ATTRIBUTE_UNUSED)\n", &attr->name[1]);
else if (attr->is_const == 0)
printf ("get_attr_%s (insn)\n", attr->name);
printf ("get_attr_%s (rtx insn ATTRIBUTE_UNUSED)\n", attr->name);
else
{
printf ("get_attr_%s ()\n", attr->name);
printf ("get_attr_%s (void)\n", attr->name);
printf ("{\n");
for (av = attr->first_value; av; av = av->next)
......@@ -4810,7 +4795,6 @@ write_attr_get (struct attr_desc *attr)
return;
}
printf (" rtx insn ATTRIBUTE_UNUSED;\n");
printf ("{\n");
if (GET_CODE (common_av->value) == FFS)
......@@ -5284,12 +5268,8 @@ write_eligible_delay (const char *kind)
/* Write function prelude. */
printf ("int\n");
printf ("eligible_for_%s (delay_insn, slot, candidate_insn, flags)\n",
printf ("eligible_for_%s (rtx delay_insn ATTRIBUTE_UNUSED, int slot, rtx candidate_insn, int flags ATTRIBUTE_UNUSED)\n",
kind);
printf (" rtx delay_insn ATTRIBUTE_UNUSED;\n");
printf (" int slot;\n");
printf (" rtx candidate_insn;\n");
printf (" int flags ATTRIBUTE_UNUSED;\n");
printf ("{\n");
printf (" rtx insn;\n");
printf ("\n");
......@@ -5467,11 +5447,9 @@ write_complex_function (struct function_unit *unit,
int using_case;
int i;
printf ("static int %s_unit_%s (rtx, rtx);\n", unit->name, name);
printf ("static int\n");
printf ("%s_unit_%s (executing_insn, candidate_insn)\n", unit->name, name);
printf (" rtx executing_insn;\n");
printf (" rtx candidate_insn;\n");
printf ("%s_unit_%s (rtx executing_insn, rtx candidate_insn)\n",
unit->name, name);
printf ("{\n");
printf (" rtx insn;\n");
printf (" int casenum;\n\n");
......@@ -5723,8 +5701,7 @@ write_const_num_delay_slots (void)
if (attr)
{
printf ("int\nconst_num_delay_slots (insn)\n");
printf (" rtx insn;\n");
printf ("int\nconst_num_delay_slots (rtx insn)\n");
printf ("{\n");
printf (" switch (recog_memoized (insn))\n");
printf (" {\n");
......
......@@ -118,8 +118,7 @@ write_header (void)
/* Dummy external declarations. */\n\
extern rtx insn;\n\
extern rtx ins1;\n\
extern rtx operands[];\n\
extern int next_insn_tests_no_inequality (rtx);\n");
extern rtx operands[];\n");
puts ("\
/* If we don't have __builtin_constant_p, or it's not acceptable in\n\
......
......@@ -386,14 +386,15 @@ gen_insn (rtx insn, int lineno)
/* Output the function name and argument declarations. */
printf ("rtx\ngen_%s (", XSTR (insn, 0));
for (i = 0; i < operands; i++)
if (i)
printf (", operand%d", i);
else
printf ("operand%d", i);
if (operands)
for (i = 0; i < operands; i++)
if (i)
printf (",\n\trtx operand%d ATTRIBUTE_UNUSED", i);
else
printf ("rtx operand%d ATTRIBUTE_UNUSED", i);
else
printf ("void");
printf (")\n");
for (i = 0; i < operands; i++)
printf (" rtx operand%d ATTRIBUTE_UNUSED;\n", i);
printf ("{\n");
/* Output code to construct and return the rtl for the instruction body */
......@@ -439,14 +440,15 @@ gen_expand (rtx expand)
/* Output the function name and argument declarations. */
printf ("rtx\ngen_%s (", XSTR (expand, 0));
for (i = 0; i < operands; i++)
if (i)
printf (", operand%d", i);
else
printf ("operand%d", i);
if (operands)
for (i = 0; i < operands; i++)
if (i)
printf (",\n\trtx operand%d", i);
else
printf ("rtx operand%d", i);
else
printf ("void");
printf (")\n");
for (i = 0; i < operands; i++)
printf (" rtx operand%d;\n", i);
printf ("{\n");
/* If we don't have any C code to write, only one insn is being written,
......@@ -585,16 +587,13 @@ gen_split (rtx split)
{
printf ("extern rtx gen_%s_%d (rtx, rtx *);\n",
name, insn_code_number);
printf ("rtx\ngen_%s_%d (curr_insn, operands)\n",
printf ("rtx\ngen_%s_%d (rtx curr_insn ATTRIBUTE_UNUSED, rtx *operands)\n",
name, insn_code_number);
printf (" rtx curr_insn ATTRIBUTE_UNUSED;\n");
printf (" rtx *operands%s;\n", unused);
}
else
{
printf ("extern rtx gen_split_%d (rtx *);\n", insn_code_number);
printf ("rtx\ngen_%s_%d (operands)\n", name, insn_code_number);
printf (" rtx *operands%s;\n", unused);
printf ("rtx\ngen_%s_%d (rtx *operands)\n", name, insn_code_number);
}
printf ("{\n");
......@@ -678,8 +677,7 @@ output_add_clobbers ()
struct clobber_ent *ent;
int i;
printf ("\n\nvoid\nadd_clobbers (pattern, insn_code_number)\n");
printf (" rtx pattern ATTRIBUTE_UNUSED;\n int insn_code_number;\n");
printf ("\n\nvoid\nadd_clobbers (rtx pattern ATTRIBUTE_UNUSED, int insn_code_number)\n");
printf ("{\n");
printf (" switch (insn_code_number)\n");
printf (" {\n");
......@@ -717,8 +715,7 @@ output_added_clobbers_hard_reg_p (void)
struct clobber_ent *ent;
int clobber_p, used;
printf ("\n\nint\nadded_clobbers_hard_reg_p (insn_code_number)\n");
printf (" int insn_code_number;\n");
printf ("\n\nint\nadded_clobbers_hard_reg_p (int insn_code_number)\n");
printf ("{\n");
printf (" switch (insn_code_number)\n");
printf (" {\n");
......
......@@ -381,8 +381,7 @@ from the machine description file `md'. */\n\n");
of any missing operand whose numbers are skipped by a given pattern. */
printf ("static rtx junk ATTRIBUTE_UNUSED;\n");
printf ("void\ninsn_extract (insn)\n");
printf (" rtx insn;\n");
printf ("void\ninsn_extract (rtx insn)\n");
printf ("{\n");
printf (" rtx *ro = recog_data.operand;\n");
printf (" rtx **ro_loc = recog_data.operand_loc;\n");
......
......@@ -259,15 +259,12 @@ gendef (const char *format)
/* Start by writing the definition of the function name and the types
of the arguments. */
printf ("rtx\ngen_rtx_fmt_%s (code, mode", format);
printf ("rtx\ngen_rtx_fmt_%s (RTX_CODE code, enum machine_mode mode", format);
for (p = format, i = 0; *p != 0; p++)
if (*p != '0')
printf (", arg%d", i++);
printf (",\n\t%sarg%d", type_from_format (*p), i++);
puts (")\n RTX_CODE code;\n enum machine_mode mode;");
for (p = format, i = 0; *p != 0; p++)
if (*p != '0')
printf (" %sarg%d;\n", type_from_format (*p), i++);
puts (")");
/* Now write out the body of the function itself, which allocates
the memory and initializes it. */
......
......@@ -1960,8 +1960,7 @@ write_func_for_structure (type_p orig_s, type_p s, type_p *param,
oprintf (d.of, "gt_%s_", wtd->prefix);
output_mangled_typename (d.of, orig_s);
}
oprintf (d.of, " (x_p)\n");
oprintf (d.of, " void *x_p;\n");
oprintf (d.of, " (void *x_p)\n");
oprintf (d.of, "{\n");
oprintf (d.of, " %s %s * %sx = (%s %s *)x_p;\n",
s->kind == TYPE_UNION ? "union" : "struct", s->u.s.tag,
......@@ -2209,11 +2208,7 @@ write_local_func_for_structure (type_p orig_s, type_p s, type_p *param)
oprintf (d.of, "void\n");
oprintf (d.of, "gt_pch_p_");
output_mangled_typename (d.of, orig_s);
oprintf (d.of, " (this_obj, x_p, op, cookie)\n");
oprintf (d.of, " void *this_obj ATTRIBUTE_UNUSED;\n");
oprintf (d.of, " void *x_p;\n");
oprintf (d.of, " gt_pointer_operator op ATTRIBUTE_UNUSED;\n");
oprintf (d.of, " void *cookie ATTRIBUTE_UNUSED;\n");
oprintf (d.of, " (void *this_obj ATTRIBUTE_UNUSED,\n\tvoid *x_p,\n\tgt_pointer_operator op ATTRIBUTE_UNUSED,\n\tvoid *cookie ATTRIBUTE_UNUSED)\n");
oprintf (d.of, "{\n");
oprintf (d.of, " %s %s * const x ATTRIBUTE_UNUSED = (%s %s *)x_p;\n",
s->kind == TYPE_UNION ? "union" : "struct", s->u.s.tag,
......
......@@ -352,7 +352,7 @@ from the machine description file `md'. */\n\n");
printf ("#include \"optabs.h\"\n");
printf ("#include \"reload.h\"\n\n");
printf ("void\ninit_all_optabs ()\n{\n");
printf ("void\ninit_all_optabs (void)\n{\n");
/* Read the machine description. */
......
......@@ -174,7 +174,6 @@ struct data
static struct data *idata, **idata_end = &idata;
static void output_prologue (void);
static void output_predicate_decls (void);
static void output_operand_data (void);
static void output_insn_data (void);
static void output_get_insn_name (void);
......@@ -243,45 +242,6 @@ output_prologue (void)
printf ("#include \"target.h\"\n");
}
/* We need to define all predicates used. Keep a list of those we
have defined so far. There normally aren't very many predicates
used, so a linked list should be fast enough. */
struct predicate { const char *name; struct predicate *next; };
static void
output_predicate_decls (void)
{
struct predicate *predicates = 0;
struct operand_data *d;
struct predicate *p, *next;
for (d = odata; d; d = d->next)
if (d->predicate && d->predicate[0])
{
for (p = predicates; p; p = p->next)
if (strcmp (p->name, d->predicate) == 0)
break;
if (p == 0)
{
printf ("extern int %s (rtx, enum machine_mode);\n",
d->predicate);
p = (struct predicate *) xmalloc (sizeof (struct predicate));
p->name = d->predicate;
p->next = predicates;
predicates = p;
}
}
printf ("\n\n");
for (p = predicates; p; p = next)
{
next = p->next;
free (p);
}
}
static void
output_operand_data (void)
{
......@@ -415,8 +375,7 @@ static void
output_get_insn_name (void)
{
printf ("const char *\n");
printf ("get_insn_name (code)\n");
printf (" int code;\n");
printf ("get_insn_name (int code)\n");
printf ("{\n");
printf (" if (code == NOOP_MOVE_INSN_CODE)\n");
printf (" return \"NOOP_MOVE\";\n");
......@@ -678,12 +637,9 @@ process_template (struct data *d, const char *template)
d->template = 0;
d->output_format = INSN_OUTPUT_FORMAT_FUNCTION;
printf ("\nstatic const char *output_%d (rtx *, rtx);\n",
d->code_number);
puts ("\nstatic const char *");
printf ("output_%d (operands, insn)\n", d->code_number);
puts (" rtx *operands ATTRIBUTE_UNUSED;");
puts (" rtx insn ATTRIBUTE_UNUSED;");
printf ("output_%d (rtx *operands ATTRIBUTE_UNUSED, rtx insn ATTRIBUTE_UNUSED)\n",
d->code_number);
puts ("{");
puts (template + 1);
......@@ -1023,7 +979,6 @@ main (int argc, char **argv)
}
printf("\n\n");
output_predicate_decls ();
output_operand_data ();
output_insn_data ();
output_get_insn_name ();
......
......@@ -386,7 +386,7 @@ from the machine description file `md'. */\n\n");
printf ("extern rtx peep_operand[];\n\n");
printf ("#define operands peep_operand\n\n");
printf ("rtx\npeephole (ins1)\n rtx ins1;\n{\n");
printf ("rtx\npeephole (rtx ins1)\n{\n");
printf (" rtx insn ATTRIBUTE_UNUSED, x ATTRIBUTE_UNUSED, pat ATTRIBUTE_UNUSED;\n\n");
/* Early out: no peepholes for insns followed by barriers. */
......
......@@ -2272,28 +2272,18 @@ write_subroutine (struct decision_head *head, enum routine_type type)
switch (type)
{
case RECOG:
printf ("%sint recog%s (rtx, rtx, int *);\n", s_or_e, extension);
printf ("%sint\n\
recog%s (x0, insn, pnum_clobbers)\n\
rtx x0 ATTRIBUTE_UNUSED;\n\
rtx insn ATTRIBUTE_UNUSED;\n\
int *pnum_clobbers ATTRIBUTE_UNUSED;\n", s_or_e, extension);
recog%s (rtx x0 ATTRIBUTE_UNUSED,\n\trtx insn ATTRIBUTE_UNUSED,\n\tint *pnum_clobbers ATTRIBUTE_UNUSED)\n", s_or_e, extension);
break;
case SPLIT:
printf ("%srtx split%s (rtx, rtx);\n", s_or_e, extension);
printf ("%srtx\n\
split%s (x0, insn)\n\
rtx x0 ATTRIBUTE_UNUSED;\n\
rtx insn ATTRIBUTE_UNUSED;\n", s_or_e, extension);
split%s (rtx x0 ATTRIBUTE_UNUSED, rtx insn ATTRIBUTE_UNUSED)\n",
s_or_e, extension);
break;
case PEEPHOLE2:
printf ("%srtx peephole2%s (rtx, rtx, int *);\n",
s_or_e, extension);
printf ("%srtx\n\
peephole2%s (x0, insn, _pmatch_len)\n\
rtx x0 ATTRIBUTE_UNUSED;\n\
rtx insn ATTRIBUTE_UNUSED;\n\
int *_pmatch_len ATTRIBUTE_UNUSED;\n", s_or_e, extension);
peephole2%s (rtx x0 ATTRIBUTE_UNUSED,\n\trtx insn ATTRIBUTE_UNUSED,\n\tint *_pmatch_len ATTRIBUTE_UNUSED)\n",
s_or_e, extension);
break;
}
......
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