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]

Fix Set reg_attrs for function parameters passed in registers


Hi,

this patch fixes a bug introduced by my last patch to function.c
which appeared when bootstraping with --enable-checking=rtl on x86-64.
The problem was that entry_parm may be a PARALLEL on x86-64.

Bootstrapped x86-64.

Josef

2003-02-27  Josef Zlomek  <zlomekj at suse dot cz>

	* emit-rtl.c (set_reg_attrs_for_parm): New function.
	* rtl.h (set_reg_attrs_for_parm): New exported function.
	* function.c (assign_parms): Use set_reg_attrs_for_parm instead of
	set_reg_attrs_from_mem.

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 17:15:00 -0000
*************** set_reg_attrs_from_mem (reg, mem)
*** 931,936 ****
--- 931,960 ----
        = 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)
+     {
+       int i;
+       for (i = 0; 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 17:15:00 -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 17:14:59 -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]