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 execute/20020412-1.c


To be clear, the following patch is what I had in mind.
If yall could test this on PA and SH, I'd appreciate it.


r~


	* calls.c (store_one_arg): Rename default_align to parm_align;
	always adjust parm_align for downward padding.

Index: calls.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/calls.c,v
retrieving revision 1.235
diff -c -p -d -r1.235 calls.c
*** calls.c	17 Sep 2002 03:30:35 -0000	1.235
--- calls.c	17 Sep 2002 05:12:25 -0000
*************** store_one_arg (arg, argblock, flags, var
*** 4491,4497 ****
      {
        /* BLKmode, at least partly to be pushed.  */
  
!       unsigned int default_align = PARM_BOUNDARY;
        int excess;
        rtx size_rtx;
  
--- 4491,4497 ----
      {
        /* BLKmode, at least partly to be pushed.  */
  
!       unsigned int parm_align;
        int excess;
        rtx size_rtx;
  
*************** store_one_arg (arg, argblock, flags, var
*** 4499,4511 ****
  	 If part is passed in registers, PARTIAL says how much
  	 and emit_push_insn will take care of putting it there.  */
  
- #ifdef ARGS_GROW_DOWNWARD
-       /* When an argument is padded down, the block is not aligned to
- 	 PARM_BOUNDARY.  */
-       if (FUNCTION_ARG_PADDING (arg->mode, TREE_TYPE (pval)) == downward)
- 	default_align = BITS_PER_UNIT;
- #endif
- 
        /* Round its size up to a multiple
  	 of the allocation unit for arguments.  */
  
--- 4499,4504 ----
*************** store_one_arg (arg, argblock, flags, var
*** 4524,4529 ****
--- 4517,4539 ----
  				  NULL_RTX, TYPE_MODE (sizetype), 0);
  	}
  
+       /* Some types will require stricter alignment, which will be
+ 	 provided for elsewhere in argument layout.  */
+       parm_align = MAX (PARM_BOUNDARY, TYPE_ALIGN (TREE_TYPE (pval)));
+ 
+       /* When an argument is padded down, the block is aligned to
+ 	 PARM_BOUNDARY, but the actual argument isn't.  */
+       if (FUNCTION_ARG_PADDING (arg->mode, TREE_TYPE (pval)) == downward)
+ 	{
+ 	  if (arg->size.var)
+ 	    parm_align = BITS_PER_UNIT;
+ 	  else if (excess)
+ 	    {
+ 	      int excess_align = (excess & -excess) * BITS_PER_UNIT;
+ 	      parm_align = MIN (parm_align, excess_align);
+ 	    }
+ 	}
+ 
        if ((flags & ECF_SIBCALL) && GET_CODE (arg->value) == MEM)
  	{
  	  /* emit_push_insn might not work properly if arg->value and
*************** store_one_arg (arg, argblock, flags, var
*** 4581,4588 ****
            {
  	    rtx size_rtx1 = GEN_INT (reg_parm_stack_space - arg->offset.constant);
  	    emit_push_insn (arg->value, arg->mode, TREE_TYPE (pval), size_rtx1,
! 		            MAX (default_align, TYPE_ALIGN (TREE_TYPE (pval))),
! 			    partial, reg, excess, argblock,
  			    ARGS_SIZE_RTX (arg->offset), reg_parm_stack_space,
  		            ARGS_SIZE_RTX (arg->alignment_pad));
  	  }
--- 4591,4597 ----
            {
  	    rtx size_rtx1 = GEN_INT (reg_parm_stack_space - arg->offset.constant);
  	    emit_push_insn (arg->value, arg->mode, TREE_TYPE (pval), size_rtx1,
! 		            parm_align, partial, reg, excess, argblock,
  			    ARGS_SIZE_RTX (arg->offset), reg_parm_stack_space,
  		            ARGS_SIZE_RTX (arg->alignment_pad));
  	  }
*************** store_one_arg (arg, argblock, flags, var
*** 4590,4597 ****
  	
  
        emit_push_insn (arg->value, arg->mode, TREE_TYPE (pval), size_rtx,
! 		      MAX (default_align, TYPE_ALIGN (TREE_TYPE (pval))),
! 		      partial, reg, excess, argblock,
  		      ARGS_SIZE_RTX (arg->offset), reg_parm_stack_space,
  		      ARGS_SIZE_RTX (arg->alignment_pad));
  
--- 4599,4605 ----
  	
  
        emit_push_insn (arg->value, arg->mode, TREE_TYPE (pval), size_rtx,
! 		      parm_align, partial, reg, excess, argblock,
  		      ARGS_SIZE_RTX (arg->offset), reg_parm_stack_space,
  		      ARGS_SIZE_RTX (arg->alignment_pad));
  


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