diff mbox

Speed up genattrtab

Message ID 20100617120803.GV7811@tyan-ft48-01.lab.bos.redhat.com
State New
Headers show

Commit Message

Jakub Jelinek June 17, 2010, 12:08 p.m. UTC
On Wed, Jun 16, 2010 at 09:09:24PM +0200, Jakub Jelinek wrote:
> Except for a few expected differences (insn-attrtab.o, files including
> insn-attr.h and *checksum* gcc/*.o had no differences on stripped objects).

FYI, I've just finished --enable-checking=yes,rtl bootstraps of
this patch with an extra checking patch on top of it (below) on x86_64-linux
and i686-linux to verify that the old and new internal_dfa_insn_code and
insn_default_latency give the same return values.


	Jakub
diff mbox

Patch

--- gcc/genattrtab.c.jj	2010-06-17 10:59:05.000000000 +0200
+++ gcc/genattrtab.c	2010-06-17 11:51:23.000000000 +0200
@@ -4467,9 +4467,29 @@  make_automaton_attrs (void)
 		  XSTR (val->value, 0), XSTR (val->value, 0));
 	}
 
+      printf ("static int internal_dfa_insn_code_ (rtx);\n");
+      printf ("static int insn_default_latency_ (rtx);\n");
+      printf ("static int (*ptr_internal_dfa_insn_code) (rtx);\n");
+      printf ("static int (*ptr_insn_default_latency) (rtx);\n");
       printf ("\n");
-      printf ("int (*internal_dfa_insn_code) (rtx);\n");
-      printf ("int (*insn_default_latency) (rtx);\n");
+      printf ("static int\n");
+      printf ("internal_dfa_insn_code_test_ (rtx insn)\n");
+      printf ("{\n");
+      printf ("  int ret = internal_dfa_insn_code_ (insn);\n");
+      printf ("  gcc_assert (ret == ptr_internal_dfa_insn_code (insn));\n");
+      printf ("  return ret;\n");
+      printf ("}\n");
+      printf ("static int\n");
+      printf ("insn_default_latency_test_ (rtx insn)\n");
+      printf ("{\n");
+      printf ("  int ret = insn_default_latency_ (insn);\n");
+      printf ("  gcc_assert (ret == ptr_insn_default_latency (insn));\n");
+      printf ("  return ret;\n");
+      printf ("}\n");
+      printf ("\n");
+      printf ("\n");
+      printf ("int (*internal_dfa_insn_code) (rtx) = internal_dfa_insn_code_test_;\n");
+      printf ("int (*insn_default_latency) (rtx) = insn_default_latency_test_;\n");
       printf ("\n");
       printf ("void\n");
       printf ("init_sched_attrs (void)\n");
@@ -4550,10 +4570,10 @@  make_automaton_attrs (void)
 	  write_test_expr (test, 0);
 	  printf (")\n");
 	  printf ("    {\n");
-	  printf ("      internal_dfa_insn_code\n");
+	  printf ("      ptr_internal_dfa_insn_code\n");
 	  printf ("        = internal_dfa_insn_code_%s;\n",
 		  XSTR (val->value, 0));
-	  printf ("      insn_default_latency\n");
+	  printf ("      ptr_insn_default_latency\n");
 	  printf ("        = insn_default_latency_%s;\n",
 		  XSTR (val->value, 0));
 	  printf ("    }\n");
@@ -4566,7 +4586,7 @@  make_automaton_attrs (void)
 
       XDELETEVEC (condexps);
     }
-  else
+  if (1)
     {
       code_exp = rtx_alloc (COND);
       lats_exp = rtx_alloc (COND);
@@ -4588,8 +4608,16 @@  make_automaton_attrs (void)
 	  XVECEXP (lats_exp, 0, i+1)
 	    = make_numeric_value (decl->default_latency);
 	}
-      make_internal_attr ("*internal_dfa_insn_code", code_exp, ATTR_NONE);
-      make_internal_attr ("*insn_default_latency",   lats_exp, ATTR_NONE);
+      if (tune_attr != NULL)
+	{
+	  make_internal_attr ("*internal_dfa_insn_code_", code_exp, ATTR_NONE);
+	  make_internal_attr ("*insn_default_latency_",   lats_exp, ATTR_NONE);
+	}
+      else
+	{
+	  make_internal_attr ("*internal_dfa_insn_code", code_exp, ATTR_NONE);
+	  make_internal_attr ("*insn_default_latency",   lats_exp, ATTR_NONE);
+	}
     }
 
   if (n_bypasses == 0)