OSDN Git Service

* genattrtab.c (struct attr_value_list, insn_code_values): Move to
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 26 Jan 2007 23:15:08 +0000 (23:15 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 26 Jan 2007 23:15:08 +0000 (23:15 +0000)
file scope from optimize_attrs.
(simplify_test_exp): If insn_code_values is not NULL, use it to speed
up search.
(optimize_attrs): Clear insn_code_values after freeing it.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@121216 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/genattrtab.c

index 034e2f3..55a4046 100644 (file)
@@ -1,3 +1,11 @@
+2007-01-27  Jakub Jelinek  <jakub@redhat.com>
+
+       * genattrtab.c (struct attr_value_list, insn_code_values): Move to
+       file scope from optimize_attrs.
+       (simplify_test_exp): If insn_code_values is not NULL, use it to speed
+       up search.
+       (optimize_attrs): Clear insn_code_values after freeing it.
+
 2007-01-26  Zdenek Dvorak <dvorakz@suse.cz>
 
        * tree-ssa-address.c (create_mem_ref): Remove ", bsi" from
index 3e0fd9e..6442324 100644 (file)
@@ -1,6 +1,6 @@
 /* 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.
@@ -189,6 +189,14 @@ struct delay_desc
   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.  */
@@ -196,6 +204,7 @@ struct delay_desc
 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.  */
 
@@ -2448,6 +2457,7 @@ simplify_test_exp (rtx exp, int insn_code, int insn_index)
   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;
@@ -2718,16 +2728,36 @@ simplify_test_exp (rtx exp, int insn_code, int insn_index)
         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:
@@ -2756,14 +2786,6 @@ optimize_attrs (void)
   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;
 
@@ -2840,6 +2862,7 @@ optimize_attrs (void)
 
   free (ivbuf);
   free (insn_code_values - 2);
+  insn_code_values = NULL;
 }
 
 /* Clear the ATTR_CURR_SIMPLIFIED_P flag in EXP and its subexpressions.  */