[patch i386]: For 4.6 add support of thiscall calling convention attribute for x86

Kai Tietz ktietz70@googlemail.com
Sat Mar 20 12:22:00 GMT 2010


Hello,

this patch adds for x86 (and for x64) windows targets the new
attribute thiscall. It is a calling convention described at
http://msdn.microsoft.com/en-us/library/ek8tkfbw%28VS.80%29.aspx.
Mainly it is the same as fastcall calling convention, but there are
two differences. First it passes just the first argument in ECX
register (intendent for C++ member-functions for passing the
this-pointer). Second difference is, that no explicit name-decoration
exist for it.

ChangeLog gcc/

2010-03-20  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-03-20  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 i686-pc-mingw32, i686-pc-cygwin, and x86_64-pc-mingw32. It
needs review by an i386 maintainer and if there are no objections I
want to apply it as soon as 4.6 is open for commit.

Regards,
Kai


-- 
|  (\_/) This is Bunny. Copy and paste
| (='.'=) Bunny into your signature to help
| (")_(") him gain world domination
-------------- next part --------------
A non-text attachment was scrubbed...
Name: thiscall.diff
Type: application/octet-stream
Size: 12035 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20100320/244738aa/attachment.obj>


More information about the Gcc-patches mailing list