[patch] Preparations for SYSV/MS ABI attributes in middle-backend may before stage 3 and implementation in i386

Kai Tietz Kai.Tietz@onevision.com
Tue Sep 18 13:05:00 GMT 2007


Mark Mitchell wrote on 17.09.2007 20:56:10:

> Kai Tietz wrote:
> 
> >> I'm sorry -- that doesn't really answer the question I was trying to
> >> ask.  To be clear, if we're calling through a function pointer, we 
still
> >> need to be able to do the right thing, and in that case we don't have 
a
> >> FUNCTION_DECL.  So, I don't understand how you can have a macro to
> >> control the calling convention that accepts a FUNCTION_DECL; I would
> >> think it would have to accept a FUNCTION_TYPE.
> > 
> > Sorry, I think I missed your question. To make the macro 
> > OUTGOING_REG_PARM_STACK_SPACE accepting a FUNCTION_DECL, there is no 
> > special reason for it. I deceided this to make it accepting a 
> > FUNCTION_DECL to avoid the fndecl to fntype conversion in 
middle-backend. 
> 
> > If this is a serious
> > problem, of course I can move this to a FUNCTION_TYPE. Are there some 
> > special needs to have here FUNCTION_TYPE ?
> 
> Yes, I think this -- and any other macros/hooks that affect calling
> convention -- must be based on FUNCTION_TYPEs, not FUNCTION_DECLs.
> Otherwise, we cannot properly support calling through a function 
pointer.
> 
> >From (one) type-theoretic perspective, types tell you what set of
> operations you can perform.  You can't perform the operation "call this
> function, putting its parameters in the usual place" if the function
> doesn't want its parameters there; ergo, this must be a property of the
> type.
> 
> Furthermore, I would argue that the attributes here should be recorded
> *only* on the type, in order to avoid duplication.  That's not strictly
> speaking necessary, but calling conventions are certainly properly
> thought of as a property of types, not of declarations.

Ok, I changed documentation and implementation for this patch (see 
attachment).
Now, OUTGOING_REG_PARM_STACK_SPACE has a FUNCTION_TYPE as argument.
Additionally, I attached the updated second part of this patch for Jan to 
this e-mail, too.

ChangeLog /gcc/gcc (part 1)

2007-08-19  Kai Tietz   <kai.tietz@onevision.com>

        * gcc/config/alpha/unicosmk.h, gcc/config/arm/arm.c,
        gcc/config/arm/arm.h, gcc/config/bfin/bfin.h, 
gcc/config/cris/cris.h,
        gcc/config/i386/cygming.h, gcc/config/i386/i386-interix.h, 
gcc/config/i386/i386.h,
        gcc/config/i386/i386elf.h, gcc/config/i386/ptx4-i.h, 
gcc/config/i386/sol2-10.h,
        gcc/config/i386/sysv4.h, gcc/config/i386/vx-common.h, 
gcc/config/iq2000/iq2000.h,
        gcc/config/m68hc11/m68hc11.h, gcc/config/mips/mips.h, 
gcc/config/mn10300/mn10300.h,
        gcc/config/mt/mt.h, gcc/config/pa/pa.h, 
gcc/config/rs6000/rs6000.h,
        gcc/config/score/score.h, gcc/config/spu/spu.h, 
gcc/config/v850/v850.h,
        gcc/defaults.h,
        (OUTGOING_REG_PARM_STACK_SPACE): Add fndecl parm.
        (RETURN_IN_MEMORY): Add fntype parm.
        * gcc/calls.c: (finalize_must_preallocate): Add fndecl parm.
        (expand_call): Adjust OUTGOING_REG_PARM_STACK_SPACE parm.
        (emit_library_call_value_1): Likewise.
        * gcc/expr.c: (block_move_libcall_safe_for_call_parm): Adjust
        OUTGOING_REG_PARM_STACK_SPACE parm.
        * gcc/function.c: (STACK_DYNAMIC_OFFSET): Adjust
        OUTGOING_REG_PARM_STACK_SPACE parm.
        (allocate_struct_function): Add new optional hook 
OVERRIDE_ABI_FORMAT.
        * gcc/targhooks.c: (default_return_in_memory): Pass additonal parm
        to RETURN_IN_MEMORY.
        * gcc/doc/tm.texi: (OUTGOING_REG_PARM_STACK_SPACE): Adjust 
documentation
        about new parameter.


ChangeLog /gcc/gcc (for part2)

2007-08-19  Kai Tietz   <kai.tietz@onevision.com>

        * gcc/config/i386/cygming.h: (TARGET_64BIT_MS_ABI): Redefine using
        calling abi attributes.
        (STACK_BOUNDARY): Likewise.
        (DEFAULT_ABI): New macro specifying default abi to use.
        (REG_PARM_STACK_SPACE, OUTGOING_REG_PARM_STACK_SPACE): Removed.
        * gcc/config/i386/i386-protos.h: (ix86_return_in_memory): Add 
fntype argument.
        (ix86_cfun_abi, ix86_function_abi, ix86_function_type_abi): New.
        * gcc/config/i386/i386.c: (X86_64_VARARGS_SIZE): Make it use SYSV 
constants.
        May a todo, defining abi related constants in i386.h for better 
reading.
        (ix86_cfun_abi, ix86_function_abi, ix86_function_type_abi,
        ix86_reg_parm_stack_space): New.
        (TARGET_64BIT_MS_ABI): Replace them by using default or function 
specific
        calling abi definitions.
        * gcc/config/i386/i386.h: (TARGET_64BIT_MS_ABI): Redefine unsigned
        calling abi attributes.
        (STACK_BOUNDARY): Likewise.
        (REG_PARM_STACK_SPACE): Likewise.
        (OVERRIDE_ABI_FORMAT): New.
        (SYSV_ABI, MS_ABI): New enum constants.
        (DEFAULT_ABI): New.
        (TARGET_64BIT_MS_ABI): Replace them by using default or function 
specific
        calling abi definitions.
        (RETURN_IN_MEMORY): Add new fntype argument.
        (ix86_args): New member call_abi.
        (machine_function): New member call_abi.
        * gcc/config/i386/mingw32.h:  (TARGET_64BIT_MS_ABI): Replace them 
by using default
        calling abi definitions.
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

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: amd64_abis_part2.txt
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20070918/5841517f/attachment.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: amd64_abis_part1.txt
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20070918/5841517f/attachment-0001.txt>


More information about the Gcc-patches mailing list