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] ira: Respect HARD_REGNO_CALL_PART_CLOBBERED


On 11/08/2010 11:08 AM, Andreas Krebbel wrote:
Hi Vladimir,

here are updated versions of the patches.

I've verified that the 4.5 as well as the mainline version still fixes
the testcase for me.

Ok for 4.5 and mainline?

Bye,

-Andreas-


2010-11-08 Andreas Krebbel<Andreas.Krebbel@de.ibm.com>


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


For GCC mainline:


Index: gcc/ira-conflicts.c
===================================================================
*** gcc/ira-conflicts.c.orig
--- gcc/ira-conflicts.c
*************** ira_build_conflicts (void)
*** 882,887 ****
--- 882,888 ----
   	  ira_object_t obj = ALLOCNO_OBJECT (a, i);
   	  reg_attrs *attrs = REG_ATTRS (regno_reg_rtx [ALLOCNO_REGNO (a)]);
   	  tree decl;
+ 	  int regno;

   	  if ((! flag_caller_saves&&  ALLOCNO_CALLS_CROSSED_NUM (a) != 0)
   	      /* For debugging purposes don't put user defined variables in
*************** ira_build_conflicts (void)
*** 896,901 ****
--- 897,912 ----
   				call_used_reg_set);
   	      IOR_HARD_REG_SET (OBJECT_CONFLICT_HARD_REGS (obj),
   				call_used_reg_set);
+
+ 	      /* Allocnos bigger than the saved part of call saved
+ 		 regs must conflict with them.  */
+ 	      for (regno = 0; regno<  FIRST_PSEUDO_REGISTER; regno++)
+ 		if (!TEST_HARD_REG_BIT (call_used_reg_set, regno)
+ 		&&   HARD_REGNO_CALL_PART_CLOBBERED (regno, obj->allocno->mode))
+ 		  {
+ 		    SET_HARD_REG_BIT (OBJECT_CONFLICT_HARD_REGS (obj), regno);
+ 		    SET_HARD_REG_BIT (OBJECT_TOTAL_CONFLICT_HARD_REGS (obj), regno);
+ 		  }
   	    }
   	  else if (ALLOCNO_CALLS_CROSSED_NUM (a) != 0)
   	    {

It is close but the code should work independently from -fcaller-saves. So it should look like the patch in the attachment.

And gcc4.5 patch change should be analogous.

With this change, the patch is ok for trunk and gcc4.5.

Thanks for working on the PR.


Attachment: z.patch
Description: Text document


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