[PATCH] ira: Respect HARD_REGNO_CALL_PART_CLOBBERED

Andreas Krebbel krebbel@linux.vnet.ibm.com
Sat Oct 30 14:15:00 GMT 2010


> >+      if (!call_used_regs[reg]
> Please use "if (! TEST_HARD_REG_BIT (call_used_reg_set, reg)"  instead.

Ok. Here is an updated patch.

Bye,

-Andreas-


2010-10-30  Andreas Krebbel  <Andreas.Krebbel@de.ibm.com>

	PR rtl-optimization/46237
	* ira-lives.c (process_bb_node_lives): Record conflicts for call
	saved hard regs if they might get partially clobbered.


mainline GCC:


Index: gcc/ira-lives.c
===================================================================
*** gcc/ira-lives.c.orig
--- gcc/ira-lives.c
*************** process_bb_node_lives (ira_loop_tree_nod
*** 1169,1174 ****
--- 1169,1185 ----
  		  ira_object_t obj = ira_object_id_map[i];
  		  ira_allocno_t a = OBJECT_ALLOCNO (obj);
  		  int num = ALLOCNO_NUM (a);
+ 		  int reg;
+ 
+ 		  /* Allocnos bigger than the saved part of call saved
+ 		     regs must conflict with them.  */
+ 		  for (reg = 0; reg < FIRST_PSEUDO_REGISTER; reg++)
+ 		    if (! TEST_HARD_REG_BIT (call_used_reg_set, reg)
+ 			&& HARD_REGNO_CALL_PART_CLOBBERED (reg, obj->allocno->mode))
+ 		      {
+ 			SET_HARD_REG_BIT (OBJECT_CONFLICT_HARD_REGS (obj), reg);
+ 			SET_HARD_REG_BIT (OBJECT_TOTAL_CONFLICT_HARD_REGS (obj), reg);
+ 		      }
  
  		  /* Don't allocate allocnos that cross setjmps or any
  		     call, if this function receives a nonlocal



GCC 4.5 branch:


Index: gcc/ira-lives.c
===================================================================
*** gcc/ira-lives.c.orig
--- gcc/ira-lives.c
*************** process_bb_node_lives (ira_loop_tree_nod
*** 1070,1075 ****
--- 1070,1077 ----
  
  	  if (call_p)
  	    {
+ 	      int reg;
+ 
  	      last_call_num++;
  	      /* The current set of live allocnos are live across the call.  */
  	      EXECUTE_IF_SET_IN_SPARSESET (allocnos_live, i)
*************** process_bb_node_lives (ira_loop_tree_nod
*** 1086,1091 ****
--- 1088,1104 ----
  		  /* Mark it as saved at the next call.  */
  		  allocno_saved_at_call[i] = last_call_num + 1;
  		  ALLOCNO_CALLS_CROSSED_NUM (a)++;
+ 
+  		  /* Allocnos bigger than the saved part of call saved
+  		     regs must conflict with them.  */
+  		  for (reg = 0; reg < FIRST_PSEUDO_REGISTER; reg++)
+  		    if (! TEST_HARD_REG_BIT (call_used_reg_set, reg)
+  			&& HARD_REGNO_CALL_PART_CLOBBERED (reg, a->mode))
+ 		      {
+  			SET_HARD_REG_BIT (ALLOCNO_CONFLICT_HARD_REGS (a), reg);
+  			SET_HARD_REG_BIT (ALLOCNO_TOTAL_CONFLICT_HARD_REGS (a), reg);
+  		      }
+ 
  		  /* Don't allocate allocnos that cross setjmps or any
  		     call, if this function receives a nonlocal
  		     goto.  */



More information about the Gcc-patches mailing list