This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Make sure that all insn codes are in (0, LAST_INSN_CODE)

The patches I posted to cache recog_op_alt and the set of enabled
alternatives both relied on having an array of LAST_INSN_CODE elements.
It turns out that LAST_INSN_CODE is only 1+ the last _named_ insn,
rather than 1+ the last used insn code.

The only users of LAST_INSN_CODE I can see are LRA, which also uses it
for a per-insn-code cache, and tree-vect-stmts.c, which uses it as a
code that no insn can have.  In both cases I think we want LAST_INSN_CODE
to account for unnamed insns too.

Tested on x86_64-linux-gnu.  OK to install?


	* gencodes.c (main): Make LAST_INSN_CODE higher than any insn code,
	rather than any named insn's code.

Index: gcc/gencodes.c
--- gcc/gencodes.c	2014-05-25 14:07:53.024841792 +0100
+++ gcc/gencodes.c	2014-05-25 14:17:28.905958781 +0100
@@ -50,6 +50,7 @@ gen_insn (rtx insn, int code)
 main (int argc, char **argv)
   rtx desc;
+  int last = 1;
   progname = "gencodes";
@@ -82,13 +83,16 @@ enum insn_code {\n\
       if (GET_CODE (desc) == DEFINE_INSN || GET_CODE (desc) == DEFINE_EXPAND)
-	gen_insn (desc, insn_code_number);
+	{
+	  gen_insn (desc, insn_code_number);
+	  last = insn_code_number + 1;
+	}
-  puts ("  LAST_INSN_CODE\n\
+  printf ("  LAST_INSN_CODE = %d\n\
-#endif /* GCC_INSN_CODES_H */");
+#endif /* GCC_INSN_CODES_H */", last);
   if (ferror (stdout) || fflush (stdout) || fclose (stdout))
     return FATAL_EXIT_CODE;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]