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


> 2010/3/20 Dave Korn <dave.korn.cygwin@googlemail>:

>>>        if (lookup_attribute ("fastcall", TYPE_ATTRIBUTES (type)))
>>>       regno = aggr ? DX_REG : CX_REG;
>>> +      else if (lookup_attribute ("thiscall", TYPE_ATTRIBUTES (type)))
>>> +     regno = aggr ? DX_REG : CX_REG;
>>>        else
>>  That's a bit cut-n-pastey, how about one if that ORs the two conditions and
>> only one assignment?  (As I see you did it below in x86_output_mi_thunk.)
> 
> Well, duplicated it here by intention. I am not absolutely sure here,
> if description provided by MS documentation covers here the same
> behavior as for stdcall when aggregate is set.

  Then it would be worth your effort to compile a trivial testcase using MSVC
and take a look at what it does.

>>> +If the number of arguments is variable all arguments are pushed on the
>>> +stack.
>>  There don't appear to be any stdargs function calls in the tests you added?
>>  It sounds like the kind of potentially-buggy corner case that could really
>> use a test just to make sure it stays working.
> 
> Well, this is a second item to be decided. By MS description are
> stdarg-functions not allowed for thiscall (btw as for fastcall), but
> gcc is able to handle them. Should we use current behavior of gcc for
> this, or should error/warn for stdarg functions using
> thiscall/fastcall?

  Well, the patch as you posted it implements the behaviour and documents it,
so I would expect it to be tested.  Since we're able to handle it easily, it
might be nice to add as a GNU extension, but if it's going to be a massive
pain to maintain or introduce lots of buggy corner-cases, erroring out would
be a valid choice.

  If you do decide to keep it in, then you should definitely add a testcase to
"keep us honest"; and it might still be a good idea to have an optional
warning, since it's an extension not compatible with the platform native tools.

    cheers,
      DaveK


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