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: Fix Set reg_attrs for function parameters passed in registers


> > +       for (i = 0; i < XVECLEN (parm_rtx, 0); i++)
> > + 	{
> > + 	  rtx x = XVECEXP (parm_rtx, 0, i);
> 
> The first entry of the parallel may be null; 
> see emit_group_load.

OK with this change?

Josef

Index: emit-rtl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/emit-rtl.c,v
retrieving revision 1.311
diff -c -3 -p -r1.311 emit-rtl.c
*** emit-rtl.c	14 Feb 2003 05:42:29 -0000	1.311
--- emit-rtl.c	27 Feb 2003 22:01:01 -0000
*************** set_reg_attrs_from_mem (reg, mem)
*** 931,936 ****
--- 931,962 ----
        = get_reg_attrs (MEM_EXPR (mem), INTVAL (MEM_OFFSET (mem)));
  }
  
+ /* Set the register attributes for registers contained in PARM_RTX.
+    Use needed values from memory attributes of MEM.  */
+ 
+ void
+ set_reg_attrs_for_parm (parm_rtx, mem)
+      rtx parm_rtx;
+      rtx mem;
+ {
+   if (GET_CODE (parm_rtx) == REG)
+     set_reg_attrs_from_mem (parm_rtx, mem);
+   else if (GET_CODE (parm_rtx) == PARALLEL)
+     {
+       /* Check for a NULL entry in the first slot, used to indicate that the
+ 	 parameter goes both on the stack and in registers.  */
+       int i = XEXP (XVECEXP (parm_rtx, 0, 0), 0) ? 0 : 1;
+       for (; i < XVECLEN (parm_rtx, 0); i++)
+ 	{
+ 	  rtx x = XVECEXP (parm_rtx, 0, i);
+ 	  if (GET_CODE (XEXP (x, 0)) == REG)
+ 	    REG_ATTRS (XEXP (x, 0))
+ 	      = get_reg_attrs (MEM_EXPR (mem),
+ 			       INTVAL (XEXP (x, 1)));
+ 	}
+     }
+ }
+ 
  /* Assign the RTX X to declaration T.  */
  void
  set_decl_rtl (t, x)
Index: function.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/function.c,v
retrieving revision 1.403
diff -c -3 -p -r1.403 function.c
*** function.c	26 Feb 2003 23:06:34 -0000	1.403
--- function.c	27 Feb 2003 22:01:02 -0000
*************** assign_parms (fndecl)
*** 4460,4466 ****
  
  	/* Set also REG_ATTRS if parameter was passed in a register.  */
  	if (entry_parm)
! 	  set_reg_attrs_from_mem (entry_parm, stack_parm);
        }
  
        /* If this parameter was passed both in registers and in the stack,
--- 4460,4466 ----
  
  	/* Set also REG_ATTRS if parameter was passed in a register.  */
  	if (entry_parm)
! 	  set_reg_attrs_for_parm (entry_parm, stack_parm);
        }
  
        /* If this parameter was passed both in registers and in the stack,
Index: rtl.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/rtl.h,v
retrieving revision 1.385
diff -c -3 -p -r1.385 rtl.h
*** rtl.h	20 Feb 2003 20:56:52 -0000	1.385
--- rtl.h	27 Feb 2003 22:01:02 -0000
*************** extern rtx gen_int_mode			PARAMS ((HOST_
*** 1378,1383 ****
--- 1378,1384 ----
  extern rtx emit_copy_of_insn_after	PARAMS ((rtx, rtx));
  extern void set_reg_attrs_from_mem	PARAMS ((rtx, rtx));
  extern void set_mem_attrs_from_reg	PARAMS ((rtx, rtx));
+ extern void set_reg_attrs_for_parm	PARAMS ((rtx, rtx));
  
  /* In rtl.c */
  extern rtx rtx_alloc			PARAMS ((RTX_CODE));


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