/* Generate code from machine description to compute values of attributes.
Copyright (C) 1991, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2000, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+ 1999, 2000, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
This file is part of GCC.
int lineno; /* Line number. */
};
+struct attr_value_list
+{
+ struct attr_value *av;
+ struct insn_ent *ie;
+ struct attr_desc *attr;
+ struct attr_value_list *next;
+};
+
/* Listheads of above structures. */
/* This one is indexed by the first character of the attribute name. */
static struct attr_desc *attrs[MAX_ATTRS_INDEX];
static struct insn_def *defs;
static struct delay_desc *delays;
+struct attr_value_list **insn_code_values;
/* Other variables. */
struct attr_desc *attr;
struct attr_value *av;
struct insn_ent *ie;
+ struct attr_value_list *iv;
int i;
rtx newexp = exp;
bool left_alt, right_alt;
would give this insn the values being tested for. */
if (insn_code >= 0
&& (attr = find_attr (&XSTR (exp, 0), 0)) != NULL)
- for (av = attr->first_value; av; av = av->next)
- for (ie = av->first_insn; ie; ie = ie->next)
- if (ie->def->insn_code == insn_code)
- {
- rtx x;
- x = evaluate_eq_attr (exp, av->value, insn_code, insn_index);
- x = SIMPLIFY_TEST_EXP (x, insn_code, insn_index);
- if (attr_rtx_cost(x) < 20)
- return x;
- }
+ {
+ rtx x;
+
+ av = NULL;
+ if (insn_code_values)
+ {
+ for (iv = insn_code_values[insn_code]; iv; iv = iv->next)
+ if (iv->attr == attr)
+ {
+ av = iv->av;
+ break;
+ }
+ }
+ else
+ {
+ for (av = attr->first_value; av; av = av->next)
+ for (ie = av->first_insn; ie; ie = ie->next)
+ if (ie->def->insn_code == insn_code)
+ goto got_av;
+ }
+
+ if (av)
+ {
+ got_av:
+ x = evaluate_eq_attr (exp, av->value, insn_code, insn_index);
+ x = SIMPLIFY_TEST_EXP (x, insn_code, insn_index);
+ if (attr_rtx_cost(x) < 20)
+ return x;
+ }
+ }
break;
default:
struct insn_ent *ie;
rtx newexp;
int i;
- struct attr_value_list
- {
- struct attr_value *av;
- struct insn_ent *ie;
- struct attr_desc *attr;
- struct attr_value_list *next;
- };
- struct attr_value_list **insn_code_values;
struct attr_value_list *ivbuf;
struct attr_value_list *iv;
free (ivbuf);
free (insn_code_values - 2);
+ insn_code_values = NULL;
}
/* Clear the ATTR_CURR_SIMPLIFIED_P flag in EXP and its subexpressions. */