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 i386]: For 4.6 add support of thiscall calling convention attribute for x86


On 04/06/2010 08:18 PM, Kai Tietz wrote:
Hello,

this is updated patch for thiscall calling calling-convention. For
pedantic mode this patch warns about usage of this attribute on
none-class-methods. As extension it allows the use for standard
functions too.
I need approval by an i386 maintainer for this.

ChangeLog gcc/

2010-04-06 Kai Tietz<kai.tietz@onevision.com>

        * config/i386/cygming.h (): Add
        __thiscall and _thiscall as predefined macros.
        * config/i386/i386.c (ix86_handle_cconv_attribute): Add
        thiscall attribute handling.
        (ix86_comp_type_attributes): Likewise.
        (ix86_function_regparm): Likewise.
        (ix86_return_pops_args): Likewise.
        (init_cumulative_args): Likewise.
        (find_drap_reg): Likewise.
        (ix86_static_chain): Likewise.
        (x86_this_parameter): Likewise.
        (x86_output_mi_thunk): Likewise.
        (ix86_attribute_table): Add description for thiscall attribute.
        * config/i386/i386.h (ix86_args): Adjust comment for member
        fastcall.
        * doc/extend.texi: Add documentation for thiscall.

ChangeLog testsuite/

2010-04-06 Kai Tietz<kai.tietz@onevision.com>

        * g++.dg/other/pr35504.C: Add check for thiscall.
        * g++.dg/torture/stackalign/eh-thiscall-1.C: New.
        * gcc.dg/torture/stackalign/thiscall-1.c: New.


Tested for x86_64-pc-mingw32, i686-pc-mingw32, and i686-pc-cygwin.

+ if (TREE_CODE (*node) != METHOD_TYPE && pedantic)
+ warning (OPT_Wattributes, "%qE attribute is used for none class-method using this",
+ name);


I don't think the wording is correct in the above. Please also watch column limits and use tabs instead of space in a couple of places.

+      /* To be verified. It is not absolutely clear how aggregates
+         have to be treated for thiscall.  We assume that they are
+     identical to fastcall.  */

Add ???: or FIXME: or TODO: here.

+@item thiscall
+@cindex functions that pop the argument stack on the 386
+On the Intel 386, the @code{thiscall} attribute causes the compiler to
+pass the first argument (if of integral type) in the register ECX.
+Subsequent and other typed arguments are passed on the stack. The called
+function will pop the arguments off the stack.
+If the number of arguments is variable all arguments are pushed on the
+stack.
+The @code{thiscall} attribute is intended for C++ member this-methods.
+As gcc extension this calling convention can be used for C-functions
+and for static member methods.
+

I have CC'd Gerald, so he can say something about the grammar in the above text.

Otherwise, the patch looks good. I will leave the final OK to Dave, since the patch is intended for cyg/mingw.

Thanks,
Uros.


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