[PATCH] Sanity check fixed_regs vs. call_used_regs

Roger Sayle roger@eyesopen.com
Mon Aug 16 23:58:00 GMT 2004


The following patch adds some ENABLE_CHECKING sanity tests to regclass.c
as suggested by Giovanni Bajo.  GCC currently requires backends to define
call_used_regs such that it is a strict superset of fixed_regs.  Failing
to do so leads to difficult to analyse failures in reload.  This patch
should catch these backend mistakes earlier.

The following patch has been tested on i686-pc-linux-gnu with a full
"make bootstrap", all default languages, and regression tested with a
top-level "make -k check" with no new failures.

Ok for mainline?


2004-08-16  Roger Sayle  <roger@eyesopen.com>

	* regclass.c (init_reg_sets_1): Add ENABLE_CHECKING sanity tests to
	ensure that call_used_regs is a superset of both fixed_regs and
	call_really_used_regs.


Index: regclass.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/regclass.c,v
retrieving revision 1.192
diff -c -3 -p -r1.192 regclass.c
*** regclass.c	3 Aug 2004 23:37:33 -0000	1.192
--- regclass.c	16 Aug 2004 21:35:07 -0000
*************** init_reg_sets_1 (void)
*** 427,432 ****
--- 427,443 ----

    for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
      {
+ #ifdef ENABLE_CHECKING
+       /* call_used_regs must include fixed_regs.  */
+       if (fixed_regs[i] && !call_used_regs[i])
+ 	abort ();
+ #ifdef CALL_REALLY_USED_REGISTERS
+       /* call_used_regs must include call_really_used_regs.  */
+       if (call_really_used_regs[i] && !call_used_regs[i])
+ 	abort ();
+ #endif
+ #endif
+
        if (fixed_regs[i])
  	SET_HARD_REG_BIT (fixed_reg_set, i);
        else

Roger
--



More information about the Gcc-patches mailing list