Commit ec049fdb by Kaveh R. Ghazi Committed by Kaveh Ghazi

genattr.c (internal_dfa_insn_code): Don't prototype.

	* genattr.c (internal_dfa_insn_code): Don't prototype.
	* genattrtab.c (attr_desc): Add `static_p' field.
	(expand_units): Make blockage range and ready cost functions
	static.
	(write_attr_get): Don't add extern prototypes in C file.  Mark
	static functions as appropriate.
	(find_attr, make_internal_attr): Initialize static_p.
	* genattrtab.h (ATTR_STATIC): New macro.
	* genautomata.c (output_internal_reset_func): Mark output function
	as inline.
	(make_internal_dfa_insn_code_attr): Mark output function as static.

From-SVN: r69116
parent 9e7facfd
2003-07-08 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 2003-07-08 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* genattr.c (internal_dfa_insn_code): Don't prototype.
* genattrtab.c (attr_desc): Add `static_p' field.
(expand_units): Make blockage range and ready cost functions
static.
(write_attr_get): Don't add extern prototypes in C file. Mark
static functions as appropriate.
(find_attr, make_internal_attr): Initialize static_p.
* genattrtab.h (ATTR_STATIC): New macro.
* genautomata.c (output_internal_reset_func): Mark output function
as inline.
(make_internal_dfa_insn_code_attr): Mark output function as static.
2003-07-08 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* genattrtab.h: Add new macros for attr `special' flags. * genattrtab.h: Add new macros for attr `special' flags.
* genattrtab.c (attr_desc): Reorder/resize fields better. * genattrtab.c (attr_desc): Reorder/resize fields better.
Use attr `special' macros in all calls to make_internal_attr. Use attr `special' macros in all calls to make_internal_attr.
......
...@@ -379,7 +379,6 @@ main (int argc, char **argv) ...@@ -379,7 +379,6 @@ main (int argc, char **argv)
printf (" insns scheduling heuristics. */\n"); printf (" insns scheduling heuristics. */\n");
printf ("extern int insn_alts (rtx);\n\n"); printf ("extern int insn_alts (rtx);\n\n");
printf ("#endif\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 ("/* Maximal possible number of insns waiting results being\n");
printf (" produced by insns whose execution is not finished. */\n"); printf (" produced by insns whose execution is not finished. */\n");
printf ("extern int max_insn_queue_index;\n\n"); printf ("extern int max_insn_queue_index;\n\n");
......
...@@ -185,6 +185,7 @@ struct attr_desc ...@@ -185,6 +185,7 @@ struct attr_desc
unsigned is_special : 1; /* Don't call `write_attr_set'. */ unsigned is_special : 1; /* Don't call `write_attr_set'. */
unsigned func_units_p : 1; /* this is the function_units attribute */ unsigned func_units_p : 1; /* this is the function_units attribute */
unsigned blockage_p : 1; /* this is the blockage range function */ unsigned blockage_p : 1; /* this is the blockage range function */
unsigned static_p : 1; /* Make the output function static. */
}; };
#define NULL_ATTR (struct attr_desc *) NULL #define NULL_ATTR (struct attr_desc *) NULL
...@@ -2078,18 +2079,20 @@ expand_units (void) ...@@ -2078,18 +2079,20 @@ expand_units (void)
str = attr_printf ((strlen (unit->name) str = attr_printf ((strlen (unit->name)
+ sizeof "*_unit_blockage_range"), + sizeof "*_unit_blockage_range"),
"*%s_unit_blockage_range", unit->name); "*%s_unit_blockage_range", unit->name);
make_internal_attr (str, newexp, (ATTR_BLOCKAGE|ATTR_UNSIGNED)); make_internal_attr (str, newexp, (ATTR_STATIC|ATTR_BLOCKAGE|ATTR_UNSIGNED));
} }
str = attr_printf (strlen (unit->name) + sizeof "*_unit_ready_cost", str = attr_printf (strlen (unit->name) + sizeof "*_unit_ready_cost",
"*%s_unit_ready_cost", unit->name); "*%s_unit_ready_cost", unit->name);
make_internal_attr (str, readycost, ATTR_STATIC);
} }
else else
str = "*result_ready_cost"; {
/* Make an attribute for the ready_cost function. Simplifying
/* Make an attribute for the ready_cost function. Simplifying further with simplify_by_exploding doesn't win. */
further with simplify_by_exploding doesn't win. */ str = "*result_ready_cost";
make_internal_attr (str, readycost, ATTR_NONE); make_internal_attr (str, readycost, ATTR_NONE);
}
} }
/* For each unit that requires a conflict cost function, make an attribute /* For each unit that requires a conflict cost function, make an attribute
...@@ -4766,23 +4769,10 @@ write_attr_get (struct attr_desc *attr) ...@@ -4766,23 +4769,10 @@ write_attr_get (struct attr_desc *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 (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, /* 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->static_p)
printf ("static ");
if (!attr->is_numeric) if (!attr->is_numeric)
printf ("enum attr_%s\n", attr->name); printf ("enum attr_%s\n", attr->name);
else if (attr->unsigned_p) else if (attr->unsigned_p)
...@@ -5593,7 +5583,7 @@ find_attr (const char *name, int create) ...@@ -5593,7 +5583,7 @@ find_attr (const char *name, int create)
attr->name = attr_string (name, strlen (name)); attr->name = attr_string (name, strlen (name));
attr->first_value = attr->default_val = NULL; attr->first_value = attr->default_val = NULL;
attr->is_numeric = attr->negative_ok = attr->is_const = attr->is_special = 0; attr->is_numeric = attr->negative_ok = attr->is_const = attr->is_special = 0;
attr->unsigned_p = attr->func_units_p = attr->blockage_p = 0; attr->unsigned_p = attr->func_units_p = attr->blockage_p = attr->static_p = 0;
attr->next = attrs[index]; attr->next = attrs[index];
attrs[index] = attr; attrs[index] = attr;
...@@ -5618,6 +5608,7 @@ make_internal_attr (const char *name, rtx value, int special) ...@@ -5618,6 +5608,7 @@ make_internal_attr (const char *name, rtx value, int special)
attr->unsigned_p = (special & ATTR_UNSIGNED) != 0; attr->unsigned_p = (special & ATTR_UNSIGNED) != 0;
attr->func_units_p = (special & ATTR_FUNC_UNITS) != 0; attr->func_units_p = (special & ATTR_FUNC_UNITS) != 0;
attr->blockage_p = (special & ATTR_BLOCKAGE) != 0; attr->blockage_p = (special & ATTR_BLOCKAGE) != 0;
attr->static_p = (special & ATTR_STATIC) != 0;
attr->default_val = get_attr_value (value, attr, -2); attr->default_val = get_attr_value (value, attr, -2);
} }
......
...@@ -55,3 +55,4 @@ extern void write_automata (void); ...@@ -55,3 +55,4 @@ extern void write_automata (void);
#define ATTR_UNSIGNED (1 << 2) #define ATTR_UNSIGNED (1 << 2)
#define ATTR_FUNC_UNITS (1 << 3) #define ATTR_FUNC_UNITS (1 << 3)
#define ATTR_BLOCKAGE (1 << 4) #define ATTR_BLOCKAGE (1 << 4)
#define ATTR_STATIC (1 << 5)
...@@ -8572,7 +8572,7 @@ output_dead_lock_func (void) ...@@ -8572,7 +8572,7 @@ output_dead_lock_func (void)
static void static void
output_internal_reset_func (void) output_internal_reset_func (void)
{ {
fprintf (output_file, "static void\n%s (struct %s *%s)\n", fprintf (output_file, "static inline void\n%s (struct %s *%s)\n",
INTERNAL_RESET_FUNC_NAME, CHIP_NAME, CHIP_PARAMETER_NAME); INTERNAL_RESET_FUNC_NAME, CHIP_NAME, CHIP_PARAMETER_NAME);
fprintf (output_file, "{\n memset (%s, 0, sizeof (struct %s));\n}\n\n", fprintf (output_file, "{\n memset (%s, 0, sizeof (struct %s));\n}\n\n",
CHIP_PARAMETER_NAME, CHIP_NAME); CHIP_PARAMETER_NAME, CHIP_NAME);
...@@ -9474,7 +9474,7 @@ make_internal_dfa_insn_code_attr (void) ...@@ -9474,7 +9474,7 @@ make_internal_dfa_insn_code_attr (void)
(attr_printf (sizeof ("*") (attr_printf (sizeof ("*")
+ strlen (INTERNAL_DFA_INSN_CODE_FUNC_NAME) + 1, + strlen (INTERNAL_DFA_INSN_CODE_FUNC_NAME) + 1,
"*%s", INTERNAL_DFA_INSN_CODE_FUNC_NAME), "*%s", INTERNAL_DFA_INSN_CODE_FUNC_NAME),
condexp, ATTR_NONE); condexp, ATTR_STATIC);
} }
......
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