Always enable -maccumulate-outgoing-args for w64

Jan Hubicka hubicka@ucw.cz
Sun Jan 4 14:14:00 GMT 2009


Hi,
it seems to be wording of x86-64 windows ABI that require functions to keep
stack frame aligned to 16bytes with exception of prologues and epilogues.  This
imply accumulate-outgoing-args sicne toehrwise we can momentarily misalign
stack.  Additionally we don't really support properly function calls with
preallocating stack space in -mno-accumulate-outgoing-args leading in various
ICEs on misaligned stack.  I think I can fix the second, but not for this release
so this patch enables ACCUMULATE_OUTGOING_ARGS and cause sorry on msabi calls
in sysv function compiled with !ACCUMULATE_OUTGOING_ARGS.

Botstrapped/regtested i686-linux, will commit it tomorrow if there are no complains.

Honza

	* i386.h (ACCUMULATE_OUTGOING_ARGS): Enable for MSABI
	* i386.c (init_cumulative_args): Disallow calls of MSABI functions when
	accumulate outgoing args is off.
Index: config/i386/i386.h
===================================================================
*** config/i386/i386.h	(revision 142998)
--- config/i386/i386.h	(working copy)
*************** enum reg_class
*** 1509,1517 ****
     be computed and placed into the variable
     `crtl->outgoing_args_size'.  No space will be pushed onto the
     stack for each call; instead, the function prologue should increase the stack
!    frame size by this amount.  */
  
! #define ACCUMULATE_OUTGOING_ARGS TARGET_ACCUMULATE_OUTGOING_ARGS
  
  /* If defined, a C expression whose value is nonzero when we want to use PUSH
     instructions to pass outgoing arguments.  */
--- 1513,1525 ----
     be computed and placed into the variable
     `crtl->outgoing_args_size'.  No space will be pushed onto the
     stack for each call; instead, the function prologue should increase the stack
!    frame size by this amount.  
!    
!    MS ABI seem to require 16 byte alignment everywhere except for function
!    prologue and apilogue.  This is not possible without
!    ACCUMULATE_OUTGOING_ARGS.  */
  
! #define ACCUMULATE_OUTGOING_ARGS (TARGET_ACCUMULATE_OUTGOING_ARGS || ix86_cfun_abi () == MS_ABI)
  
  /* If defined, a C expression whose value is nonzero when we want to use PUSH
     instructions to pass outgoing arguments.  */
Index: config/i386/i386.c
===================================================================
*** config/i386/i386.c	(revision 142998)
--- config/i386/i386.c	(working copy)
*************** init_cumulative_args (CUMULATIVE_ARGS *c
*** 4639,4644 ****
--- 4645,4653 ----
    else
     cum->call_abi = ix86_function_type_abi (fntype);
    /* Set up the number of registers to use for passing arguments.  */
+ 
+   if (cum->call_abi == MS_ABI && !ACCUMULATE_OUTGOING_ARGS)
+     sorry ("ms_abi attribute require -maccumulate-outgoing-args or subtarget optimization implying it");
    cum->nregs = ix86_regparm;
    if (TARGET_64BIT)
      {



More information about the Gcc-patches mailing list