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]

[PATCH] Fix problem with EH regs in global register allocation


Hello,

that attached patch fixes the greg problem with eh regs described in:
http://gcc.gnu.org/ml/gcc-patches/2007-12/msg00611.html

Bootstrapped on x86_64, s390 and s390x.
No testsuite regressions.

Ok for mainline?

Bye,

-Andreas-


2007-12-17  Andreas Krebbel  <krebbel1@de.ibm.com>

	* global.c (find_reg): Mark the eh regs as used if necessary.
	* ra-conflict.c (global_conflicts): Set no_eh_reg flag.
	* ra.h (struct allocno): no_eh_reg field added.  Changed
	no_stack_reg type to bitfield.


Index: gcc/global.c
===================================================================
*** gcc/global.c.orig	2007-12-17 10:39:38.000000000 +0100
--- gcc/global.c	2007-12-17 10:41:04.000000000 +0100
*************** find_reg (int num, HARD_REG_SET losers, 
*** 1010,1015 ****
--- 1010,1025 ----
      IOR_HARD_REG_SET (used1, losers);
  
    IOR_COMPL_HARD_REG_SET (used1, reg_class_contents[(int) class]);
+ 
+ #ifdef EH_RETURN_DATA_REGNO
+   if (allocno[num].no_eh_reg)
+     {
+       unsigned int j;
+       for (j = 0; EH_RETURN_DATA_REGNO (j) != INVALID_REGNUM; j++)
+ 	SET_HARD_REG_BIT (used1, EH_RETURN_DATA_REGNO (j));
+     }
+ #endif
+ 
    COPY_HARD_REG_SET (used2, used1);
  
    IOR_HARD_REG_SET (used1, allocno[num].hard_reg_conflicts);
Index: gcc/ra-conflict.c
===================================================================
*** gcc/ra-conflict.c.orig	2007-12-17 10:39:38.000000000 +0100
--- gcc/ra-conflict.c	2007-12-17 10:40:17.000000000 +0100
*************** global_conflicts (void)
*** 1184,1189 ****
--- 1184,1194 ----
  		break;
  	      record_one_conflict (allocnos_live, &hard_regs_live, regno);
  	    }
+ 
+ 	  EXECUTE_IF_SET_IN_SPARSESET (allocnos_live, i)
+ 	    {
+ 	      allocno[i].no_eh_reg = 1;
+ 	    }
  	}
  #endif
  
Index: gcc/ra.h
===================================================================
*** gcc/ra.h.orig	2007-12-17 10:39:38.000000000 +0100
--- gcc/ra.h	2007-12-17 10:40:17.000000000 +0100
*************** struct allocno
*** 72,80 ****
  
    HARD_REG_SET regs_someone_prefers;
  
  #ifdef STACK_REGS
    /* Set to true if allocno can't be allocated in the stack register.  */
!   bool no_stack_reg;
  #endif
  };
  extern struct allocno *allocno;
--- 72,85 ----
  
    HARD_REG_SET regs_someone_prefers;
  
+ #ifdef EH_RETURN_DATA_REGNO
+   /* Set to true if allocno can't be allocated in an eh register.  */
+   unsigned int no_eh_reg:1;
+ #endif
+ 
  #ifdef STACK_REGS
    /* Set to true if allocno can't be allocated in the stack register.  */
!   unsigned int no_stack_reg:1;
  #endif
  };
  extern struct allocno *allocno;


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