This is the mail archive of the gcc-patches@gcc.gnu.org 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]

Re: [PATCH] Fix bootstrap fail on spu vs. ira.c/genpreds


Dave Korn wrote:
Hello all,


As discussed on the main list earlier today[*], there is currently an implicit assumption in ira.c that every backend implements at least one define_register_constraint; when the backend doesn't, genpreds does not output any definition for regclass_for_constraint and then ira.c (which refers to it unguarded) fails to link.


gcc/ChangeLog


	* ira.c (setup_cover_and_important_classes):  Use safe macro
	REG_CLASS_FOR_CONSTRAINT instead of calling regclass_for_constraint
	directly.
	* genpreds.c (write_tm_preds_h):  Output suitable definition of
	REG_CLASS_FOR_CONSTRAINT.

  The attached patch fixes the reported bug according to Revital; I'm putting
it through a bootstrap right now (all languages except for Ada), on
i686-pc-cygwin, which is a platform that won't hit the new code paths, so can
I skip running the testsuites?  Ok for trunk?

The patch posted in

http://gcc.gnu.org/ml/gcc/2009-04/msg00698.html

is done for older version of ira.c. In the change context for ira.c instead of

#ifdef CONSTRAINT__LIMIT

should be

#ifdef CONSTRAINT_NUM_DEFINED_P


Other than that the patch is ok. Although, personally, I'd prefer the following patch (because it does not create a new macro which is used only in one place of the compiler):

2009-04-27 Vladimir Makarov <vmakarov@redhat.com>

	* genpreds.c (write_enum_constraint_num): Output
	REG_CONSTRAINT_DEFINED_P instead of CONSTRAINT_NUM_DEFINED_P and
	only if there are register constraints.
	* ira.c (setup_cover_and_important_classes): Use
	REG_CONSTRAINT_DEFINED_P instead of CONSTRAINT_NUM_DEFINED_P.

Index: genpreds.c
===================================================================
--- genpreds.c	(revision 146793)
+++ genpreds.c	(working copy)
@@ -954,7 +954,8 @@ write_enum_constraint_num (void)
{
  struct constraint_data *c;

-  fputs ("#define CONSTRAINT_NUM_DEFINED_P 1\n", stdout);
+  if (have_register_constraints)
+    fputs ("#define REG_CONSTRAINT_DEFINED_P 1\n", stdout);
  fputs ("enum constraint_num\n"
	 "{\n"
	 "  CONSTRAINT__UNKNOWN = 0", stdout);
Index: ira.c
===================================================================
--- ira.c	(revision 146793)
+++ ira.c	(working copy)
@@ -754,7 +754,7 @@ setup_cover_and_important_classes (void)
	{
	  if (i == NO_REGS)
	    continue;
-#ifdef CONSTRAINT_NUM_DEFINED_P
+#ifdef REG_CONSTRAINT_DEFINED_P
	  for (j = 0; j < CONSTRAINT__LIMIT; j++)
	    if ((int) regclass_for_constraint ((enum constraint_num) j) == i)
	      break;




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