This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch i386]: For 4.6 add support of thiscall calling convention attribute for x86
- From: Uros Bizjak <ubizjak at gmail dot com>
- To: Kai Tietz <ktietz70 at googlemail dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Dave Korn <dave dot korn dot cygwin at googlemail dot com>, Gerald Pfeifer <gerald at pfeifer dot com>
- Date: Tue, 06 Apr 2010 20:55:58 +0200
- Subject: Re: [patch i386]: For 4.6 add support of thiscall calling convention attribute for x86
- References: <90baa01f1003200254x49d705fbl5e4cf0f45700d9d1@mail.gmail.com> <4BA4C266.1090209@gmail.com> <90baa01f1003200529i7a7c98f3r64fe5add7fe2c9eb@mail.gmail.com> <4BA4CB96.8090305@gmail.com> <90baa01f1003200610s5ba14ed1hd336fd3f243a020c@mail.gmail.com> <4BA4D646.3030708@gmail.com> <90baa01f1003261237j7fa7b26fg8fb4fb9d0c0c60@mail.gmail.com> <v2v90baa01f1004061118k8fdceb8h84f28c9a86dc85f2@mail.gmail.com>
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.