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] Re: Your assign_parms changes


>>>>> Richard Kenner writes:

Richard> shouldn't you also be setting the value of parm_reg_stack_loc
Richard> for that register?

	I originally thought that stack_parm always would be zero because
we're focussing on parameters in regs, but that assumption is not valid.
Corrected with the following version.

David

	* function.c (assign_parms): Update max_parm_reg and
	parm_reg_stack_loc when adding new parm reg.

Index: function.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/function.c,v
retrieving revision 1.478
diff -c -p -r1.478 function.c
*** function.c	16 Dec 2003 00:06:33 -0000	1.478
--- function.c	18 Dec 2003 04:25:57 -0000
*************** assign_parms (tree fndecl)
*** 4740,4748 ****
--- 4740,4767 ----
  
  	  if (REG_P (parmreg))
  	    {
+ 	      int regno = REGNO (parmreg);
+ 
  	      emit_group_store (parmreg, entry_parm, TREE_TYPE (parm),
  				int_size_in_bytes (TREE_TYPE (parm)));
  	      SET_DECL_RTL (parm, parmreg);
+ 
+ 	      if (regno >= max_parm_reg)
+ 		{
+ 		  rtx *new;
+ 		  int old_max_parm_reg = max_parm_reg;
+ 
+ 		  /* It's slow to expand this one register at a time,
+ 		     but it's also rare and we need max_parm_reg to be
+ 		     precisely correct.  */
+ 		  max_parm_reg = regno + 1;
+ 		  new = ggc_realloc (parm_reg_stack_loc,
+ 				     max_parm_reg * sizeof (rtx));
+ 		  memset (new + old_max_parm_reg, 0,
+ 			  (max_parm_reg - old_max_parm_reg) * sizeof (rtx));
+ 		  parm_reg_stack_loc = new;
+ 		  parm_reg_stack_loc[regno] = stack_parm;
+ 		}
  	    }
  	}
  


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