Commit 11597bc9 by Kaveh R. Ghazi Committed by Kaveh Ghazi

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.
	Use attr `special' macros in all calls to make_internal_attr.
	* genautomata.c: Likewise.

From-SVN: r69114
parent 084c1779
2003-07-08 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* genattrtab.h: Add new macros for attr `special' flags.
* genattrtab.c (attr_desc): Reorder/resize fields better.
Use attr `special' macros in all calls to make_internal_attr.
* genautomata.c: Likewise.
Wed Jul 9 02:25:39 CEST 2003 Jan Hubicka <jh@suse.cz> Wed Jul 9 02:25:39 CEST 2003 Jan Hubicka <jh@suse.cz>
* c-common.c (c_estimate_num_insns_1): New static function. * c-common.c (c_estimate_num_insns_1): New static function.
......
...@@ -175,6 +175,9 @@ struct attr_desc ...@@ -175,6 +175,9 @@ struct attr_desc
{ {
char *name; /* Name of attribute. */ char *name; /* Name of attribute. */
struct attr_desc *next; /* Next attribute. */ struct attr_desc *next; /* Next attribute. */
struct attr_value *first_value; /* First value of this attribute. */
struct attr_value *default_val; /* Default value for this attribute. */
int lineno : 24; /* Line number. */
unsigned is_numeric : 1; /* Values of this attribute are numeric. */ unsigned is_numeric : 1; /* Values of this attribute are numeric. */
unsigned negative_ok : 1; /* Allow negative numeric values. */ unsigned negative_ok : 1; /* Allow negative numeric values. */
unsigned unsigned_p : 1; /* Make the output function unsigned int. */ unsigned unsigned_p : 1; /* Make the output function unsigned int. */
...@@ -182,9 +185,6 @@ struct attr_desc ...@@ -182,9 +185,6 @@ 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 */
struct attr_value *first_value; /* First value of this attribute. */
struct attr_value *default_val; /* Default value for this attribute. */
int lineno; /* Line number. */
}; };
#define NULL_ATTR (struct attr_desc *) NULL #define NULL_ATTR (struct attr_desc *) NULL
...@@ -1505,7 +1505,7 @@ expand_delays (void) ...@@ -1505,7 +1505,7 @@ expand_delays (void)
= make_numeric_value (XVECLEN (delay->def, 1) / 3); = make_numeric_value (XVECLEN (delay->def, 1) / 3);
} }
make_internal_attr ("*num_delay_slots", condexp, 0); make_internal_attr ("*num_delay_slots", condexp, ATTR_NONE);
/* If more than one delay type, do the same for computing the delay type. */ /* If more than one delay type, do the same for computing the delay type. */
if (num_delays > 1) if (num_delays > 1)
...@@ -1520,7 +1520,7 @@ expand_delays (void) ...@@ -1520,7 +1520,7 @@ expand_delays (void)
XVECEXP (condexp, 0, i + 1) = make_numeric_value (delay->num); XVECEXP (condexp, 0, i + 1) = make_numeric_value (delay->num);
} }
make_internal_attr ("*delay_type", condexp, 1); make_internal_attr ("*delay_type", condexp, ATTR_SPECIAL);
} }
/* For each delay possibility and delay slot, compute an eligibility /* For each delay possibility and delay slot, compute an eligibility
...@@ -1538,7 +1538,7 @@ expand_delays (void) ...@@ -1538,7 +1538,7 @@ expand_delays (void)
p = attr_printf (sizeof "*delay__" + MAX_DIGITS * 2, p = attr_printf (sizeof "*delay__" + MAX_DIGITS * 2,
"*delay_%d_%d", delay->num, i / 3); "*delay_%d_%d", delay->num, i / 3);
make_internal_attr (p, newexp, 1); make_internal_attr (p, newexp, ATTR_SPECIAL);
if (have_annul_true) if (have_annul_true)
{ {
...@@ -1549,7 +1549,7 @@ expand_delays (void) ...@@ -1549,7 +1549,7 @@ expand_delays (void)
make_numeric_value (0)); make_numeric_value (0));
p = attr_printf (sizeof "*annul_true__" + MAX_DIGITS * 2, p = attr_printf (sizeof "*annul_true__" + MAX_DIGITS * 2,
"*annul_true_%d_%d", delay->num, i / 3); "*annul_true_%d_%d", delay->num, i / 3);
make_internal_attr (p, newexp, 1); make_internal_attr (p, newexp, ATTR_SPECIAL);
} }
if (have_annul_false) if (have_annul_false)
...@@ -1561,7 +1561,7 @@ expand_delays (void) ...@@ -1561,7 +1561,7 @@ expand_delays (void)
make_numeric_value (0)); make_numeric_value (0));
p = attr_printf (sizeof "*annul_false__" + MAX_DIGITS * 2, p = attr_printf (sizeof "*annul_false__" + MAX_DIGITS * 2,
"*annul_false_%d_%d", delay->num, i / 3); "*annul_false_%d_%d", delay->num, i / 3);
make_internal_attr (p, newexp, 1); make_internal_attr (p, newexp, ATTR_SPECIAL);
} }
} }
} }
...@@ -1813,7 +1813,7 @@ expand_units (void) ...@@ -1813,7 +1813,7 @@ expand_units (void)
str = attr_printf ((strlen (unit->name) + sizeof "*_cost_" str = attr_printf ((strlen (unit->name) + sizeof "*_cost_"
+ MAX_DIGITS), + MAX_DIGITS),
"*%s_cost_%d", unit->name, op->num); "*%s_cost_%d", unit->name, op->num);
make_internal_attr (str, issue_exp, 1); make_internal_attr (str, issue_exp, ATTR_SPECIAL);
} }
/* Validate the condition. */ /* Validate the condition. */
...@@ -1869,7 +1869,8 @@ expand_units (void) ...@@ -1869,7 +1869,8 @@ expand_units (void)
unitsmask = attr_rtx (FFS, unitsmask); unitsmask = attr_rtx (FFS, unitsmask);
} }
make_internal_attr ("*function_units_used", unitsmask, 10); make_internal_attr ("*function_units_used", unitsmask,
(ATTR_NEGATIVE_OK | ATTR_FUNC_UNITS));
/* Create an array of ops for each unit. Add an extra unit for the /* Create an array of ops for each unit. Add an extra unit for the
result_ready_cost function that has the ops of all other units. */ result_ready_cost function that has the ops of all other units. */
...@@ -2043,7 +2044,7 @@ expand_units (void) ...@@ -2043,7 +2044,7 @@ expand_units (void)
str = attr_printf ((strlen (unit->name) + sizeof "*_block_" str = attr_printf ((strlen (unit->name) + sizeof "*_block_"
+ MAX_DIGITS), + MAX_DIGITS),
"*%s_block_%d", unit->name, op->num); "*%s_block_%d", unit->name, op->num);
make_internal_attr (str, blockage, 1); make_internal_attr (str, blockage, ATTR_SPECIAL);
} }
/* Record MAX (BLOCKAGE (*,*)). */ /* Record MAX (BLOCKAGE (*,*)). */
...@@ -2077,7 +2078,7 @@ expand_units (void) ...@@ -2077,7 +2078,7 @@ 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, 20); make_internal_attr (str, newexp, (ATTR_BLOCKAGE|ATTR_UNSIGNED));
} }
str = attr_printf (strlen (unit->name) + sizeof "*_unit_ready_cost", str = attr_printf (strlen (unit->name) + sizeof "*_unit_ready_cost",
...@@ -2088,7 +2089,7 @@ expand_units (void) ...@@ -2088,7 +2089,7 @@ expand_units (void)
/* 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. */
make_internal_attr (str, readycost, 0); 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
...@@ -2124,7 +2125,7 @@ expand_units (void) ...@@ -2124,7 +2125,7 @@ expand_units (void)
/* Simplifying caseexp with simplify_by_exploding doesn't win. */ /* Simplifying caseexp with simplify_by_exploding doesn't win. */
str = attr_printf (strlen (unit->name) + sizeof "*_cases", str = attr_printf (strlen (unit->name) + sizeof "*_cases",
"*%s_cases", unit->name); "*%s_cases", unit->name);
make_internal_attr (str, caseexp, 1); make_internal_attr (str, caseexp, ATTR_SPECIAL);
} }
} }
...@@ -2366,7 +2367,7 @@ make_length_attrs (void) ...@@ -2366,7 +2367,7 @@ make_length_attrs (void)
make_internal_attr (new_names[i], make_internal_attr (new_names[i],
substitute_address (length_attr->default_val->value, substitute_address (length_attr->default_val->value,
no_address_fn[i], address_fn[i]), no_address_fn[i], address_fn[i]),
0); ATTR_NONE);
new_attr = find_attr (new_names[i], 0); new_attr = find_attr (new_names[i], 0);
for (av = length_attr->first_value; av; av = av->next) for (av = length_attr->first_value; av; av = av->next)
for (ie = av->first_insn; ie; ie = ie->next) for (ie = av->first_insn; ie; ie = ie->next)
...@@ -5612,11 +5613,11 @@ make_internal_attr (const char *name, rtx value, int special) ...@@ -5612,11 +5613,11 @@ make_internal_attr (const char *name, rtx value, int special)
attr->is_numeric = 1; attr->is_numeric = 1;
attr->is_const = 0; attr->is_const = 0;
attr->is_special = (special & 1) != 0; attr->is_special = (special & ATTR_SPECIAL) != 0;
attr->negative_ok = (special & 2) != 0; attr->negative_ok = (special & ATTR_NEGATIVE_OK) != 0;
attr->unsigned_p = (special & 4) != 0; attr->unsigned_p = (special & ATTR_UNSIGNED) != 0;
attr->func_units_p = (special & 8) != 0; attr->func_units_p = (special & ATTR_FUNC_UNITS) != 0;
attr->blockage_p = (special & 16) != 0; attr->blockage_p = (special & ATTR_BLOCKAGE) != 0;
attr->default_val = get_attr_value (value, attr, -2); attr->default_val = get_attr_value (value, attr, -2);
} }
......
...@@ -47,3 +47,11 @@ extern void gen_insn_reserv (rtx); ...@@ -47,3 +47,11 @@ extern void gen_insn_reserv (rtx);
extern void initiate_automaton_gen (int, char **); extern void initiate_automaton_gen (int, char **);
extern void expand_automata (void); extern void expand_automata (void);
extern void write_automata (void); extern void write_automata (void);
/* Flags for make_internal_attr's `special' parameter. */
#define ATTR_NONE 0
#define ATTR_SPECIAL (1 << 0)
#define ATTR_NEGATIVE_OK (1 << 1)
#define ATTR_UNSIGNED (1 << 2)
#define ATTR_FUNC_UNITS (1 << 3)
#define ATTR_BLOCKAGE (1 << 4)
...@@ -9437,7 +9437,7 @@ make_insn_alts_attr (void) ...@@ -9437,7 +9437,7 @@ make_insn_alts_attr (void)
make_internal_attr (attr_printf (sizeof ("*") make_internal_attr (attr_printf (sizeof ("*")
+ strlen (INSN_ALTS_FUNC_NAME) + 1, + strlen (INSN_ALTS_FUNC_NAME) + 1,
"*%s", INSN_ALTS_FUNC_NAME), "*%s", INSN_ALTS_FUNC_NAME),
condexp, 0); condexp, ATTR_NONE);
} }
...@@ -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, 0); condexp, ATTR_NONE);
} }
...@@ -9508,7 +9508,7 @@ make_default_insn_latency_attr (void) ...@@ -9508,7 +9508,7 @@ make_default_insn_latency_attr (void)
make_internal_attr (attr_printf (sizeof ("*") make_internal_attr (attr_printf (sizeof ("*")
+ strlen (INSN_DEFAULT_LATENCY_FUNC_NAME) + strlen (INSN_DEFAULT_LATENCY_FUNC_NAME)
+ 1, "*%s", INSN_DEFAULT_LATENCY_FUNC_NAME), + 1, "*%s", INSN_DEFAULT_LATENCY_FUNC_NAME),
condexp, 0); condexp, ATTR_NONE);
} }
...@@ -9557,7 +9557,7 @@ make_bypass_attr (void) ...@@ -9557,7 +9557,7 @@ make_bypass_attr (void)
make_internal_attr (attr_printf (sizeof ("*") make_internal_attr (attr_printf (sizeof ("*")
+ strlen (BYPASS_P_FUNC_NAME) + 1, + strlen (BYPASS_P_FUNC_NAME) + 1,
"*%s", BYPASS_P_FUNC_NAME), "*%s", BYPASS_P_FUNC_NAME),
result_rtx, 0); result_rtx, ATTR_NONE);
} }
......
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