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: [patch] Preparations for SYSV/MS ABI attributes in middle-backend may before stage 3 and implementation in i386


> Jan,
> 
> Jan Hubicka wrote on 26.09.2007 23:34:28:
> 
> > Hi,
> > 
> > -#define TARGET_64BIT_MS_ABI TARGET_64BIT
> > +#define TARGET_64BIT_MS_ABI (!cfun ? DEFAULT_ABI == MS_ABI : 
> > TARGET_64BIT && cfun->machine->call_abi == MS_ABI)
> > 
> > I am not quite ahppy about the TARGET_64BIT_MS_ABI changing behaviour on
> > cfun.  How many uses of TARGET_64BIT_MS_ABI are left where cfun is
> > always NULL?  I would preffer to replace them with DEFAULT_ABI==MS_ABI
> > and have TARGET_64BIT_MS_ABI renamed and ix86_cfun_abi or DEFAULT_ABI
> > used instead.
> The reason for the changing of TARGET_64BIT_MS_ABI is the use in i386.md. 
> Otherwise it could be replaced completly, AFAICS.

The i386.md should all be used only with cfun set, or does some of the
startup code query them without even fake cfun structure?
> >  /* Size of the register save area.  */
> > -#define X86_64_VARARGS_SIZE (REGPARM_MAX * UNITS_PER_WORD + 
> > SSE_REGPARM_MAX * 16)
> > +/* $$$$ X86_64_REGPARM_MAX 6 X86_64_SSE_REGPARM_MAX 8 */
> > +#define X86_64_VARARGS_SIZE (6 * UNITS_PER_WORD + 8 * 16)
> > 
> > Thinking about this a bit more, I don't think varargs function with
> > non-default ABI has chance to work - the stdarg type depends on ABI and
> > it is defined just once for compilation unit.
> > I guess we should just sorry in va_start emiting and have the default
> > x86_64_VARARGS_SIZE here.
> Hmm, but as far as I can see, just the sysv_abi uses this macro, isn't it 
> ?

Yep, that is true too.  Still we probably ought to prohibit the variadic
functions compiled with foreign ABI (calling them should work, just
defining them should break on mismatch of stdarg definition).
> Yes the following part is missing in the preparation patch:

I see, please send this as separate patch too, this needs middleend
maintainer (and also update to tm.texi)

Thanks,
Honza
> 
> Index: gcc/function.c
> ===================================================================
> --- gcc.orig/function.c
> +++ gcc/function.c
> @@ -3814,12 +3814,15 @@ allocate_struct_function (tree fndecl)
>    if (init_machine_status)
>      cfun->machine = (*init_machine_status) ();
>  
> +#ifdef OVERRIDE_ABI_FORM
> +  OVERRIDE_ABI_FORMAT (fndecl);
> +#endif
> +
>    if (fndecl == NULL)
>      return;
>  
>    DECL_STRUCT_FUNCTION (fndecl) = cfun;
>    cfun->decl = fndecl;
> -
>    result = DECL_RESULT (fndecl);
>    if (aggregate_value_p (result, fndecl))
>      {
> 
> The use of the OVERRIDE_ABI_FORMAT was missing. Sorry for that.
> 
> Cheers,
>  i.A. Kai Tietz
> 
> |  (\_/)  This is Bunny. Copy and paste Bunny
> | (='.'=) into your signature to help him gain
> | (")_(") world domination.
> 
> ------------------------------------------------------------------------------------------
>   OneVision Software Entwicklungs GmbH & Co. KG
>   Dr.-Leo-Ritter-Straße 9 - 93049 Regensburg
>   Tel: +49.(0)941.78004.0 - Fax: +49.(0)941.78004.489 - www.OneVision.com
>   Commerzbank Regensburg - BLZ 750 400 62 - Konto 6011050
>   Handelsregister: HRA 6744, Amtsgericht Regensburg
>   Komplementärin: OneVision Software Entwicklungs Verwaltungs GmbH
>   Dr.-Leo-Ritter-Straße 9 ??? 93049 Regensburg
>   Handelsregister: HRB 8932, Amtsgericht Regensburg - Geschäftsführer: 
> Ulrike Döhler, Manuela Kluger
> 


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