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: [patches] Fix to x8664 vaarg handling


On Thursday 14 March 2002 20:59, Jan Hubicka wrote:
> Thu Mar 14 20:56:09 CET 2002  Jan Hubicka  <jh@suse.cz>
> 	* i386.c (override_options): Disallow preferred_stack_boundary to be
> 	less than 16 bytes
> 	(construct_container): Fix end of array check.
> 	(ix86_va_start): Force alignemnt to be 16 bytes.
>
> Index: config/i386/i386.c
> ===================================================================
> RCS file: /cvsroot/gcc/gcc/gcc/config/i386/i386.c,v
> retrieving revision 1.353.4.3
> diff -c -3 -p -r1.353.4.3 i386.c
> *** config/i386/i386.c	4 Mar 2002 15:45:16 -0000	1.353.4.3
> --- config/i386/i386.c	14 Mar 2002 10:54:39 -0000
> *************** override_options ()
> *** 1085,1098 ****
>        don't want additional code to keep the stack aligned when
>        optimizing for code size.  */
>     ix86_preferred_stack_boundary = (optimize_size
> ! 				   ? TARGET_64BIT ? 64 : 32
>
>   				   : 128);
>
>     if (ix86_preferred_stack_boundary_string)
>       {
>         i = atoi (ix86_preferred_stack_boundary_string);
> !       if (i < (TARGET_64BIT ? 3 : 2) || i > 12)
>   	error ("-mpreferred-stack-boundary=%d is not between %d and 12", i,
> ! 	       TARGET_64BIT ? 3 : 2);
>         else
>   	ix86_preferred_stack_boundary = (1 << i) * BITS_PER_UNIT;
>       }
> --- 1085,1098 ----
>        don't want additional code to keep the stack aligned when
>        optimizing for code size.  */
>     ix86_preferred_stack_boundary = (optimize_size
> ! 				   ? TARGET_64BIT ? 128 : 32
>
>   				   : 128);

This is unnecessary obfuscated :-)

(optimize_size ? (TARGET_64BIT ? 128 : 32) : 128

is logically equivalent to the more readable

!optimize_size || TARGET_64BIT ? 128 : 32

>     if (ix86_preferred_stack_boundary_string)
>       {
>         i = atoi (ix86_preferred_stack_boundary_string);
> !       if (i < (TARGET_64BIT ? 4 : 2) || i > 12)
>   	error ("-mpreferred-stack-boundary=%d is not between %d and 12", i,
> ! 	       TARGET_64BIT ? 4 : 2);
>         else
>   	ix86_preferred_stack_boundary = (1 << i) * BITS_PER_UNIT;
>       }
> *************** construct_container (mode, type, in_retu
> *** 2010,2016 ****
>   	    sse_regno++;
>   	    break;
>   	  case X86_64_SSE_CLASS:
> ! 	    if (i < n && class[i + 1] == X86_64_SSEUP_CLASS)
>   	      tmpmode = TImode, i++;
>   	    else
>   	      tmpmode = DImode;
> --- 2010,2016 ----
>   	    sse_regno++;
>   	    break;
>   	  case X86_64_SSE_CLASS:
> ! 	    if (i < n - 1 && class[i + 1] == X86_64_SSEUP_CLASS)
>   	      tmpmode = TImode, i++;
>   	    else
>   	      tmpmode = DImode;
> *************** ix86_va_start (stdarg_p, valist, nextarg
> *** 2502,2507 ****
> --- 2502,2508 ----
>     t = build (MODIFY_EXPR, TREE_TYPE (sav), sav, t);
>     TREE_SIDE_EFFECTS (t) = 1;
>     expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
> +   cfun->preferred_stack_boundary = 128;
>   }
>
>   /* Implement va_arg.  */


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