This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch i386} Fix PR 55171 - [4.7/4.8 Regression] incorrect virtual thunk on mingw
On 11/28/2012 09:53 AM, Kai Tietz wrote:
> 2012/11/28 Richard Henderson <rth@redhat.com>:
>> On 11/25/2012 07:26 AM, Kai Tietz wrote:
>>> - if ((ccvt & (IX86_CALLCVT_FASTCALL | IX86_CALLCVT_THISCALL)) != 0)
>>> + if ((ccvt & IX86_CALLCVT_FASTCALL) != 0)
>>> {
>>> /* Fastcall functions use ecx/edx for arguments, which leaves
>>> us with EAX for the static chain.
>>> @@ -25142,6 +25160,12 @@ ix86_static_chain (const_tree fndecl, bo
>>> leaves us with EAX for the static chain. */
>>> regno = AX_REG;
>>> }
>>> + else if ((ccvt & IX86_CALLCVT_THISCALL) != 0)
>>> + {
>>> + /* Thiscall functions use ecx for arguments, which leaves
>>> + us with EDX for the static chain. */
>>> + regno = DX_REG;
>>> + }
>>
>> How is this not abi breakage? Why not leave eax as the static chain?
>>
>>
>> r~
>
> Well, interesting function here is get_scratch_register_on_entry,
> where for thiscall (it uses just ecx) we have by this %eax remaining
> as scratch. Well, we could switch that here and make scratch %edx for
> thiscall?
Certainly we can.
r~