[PATCH] Bug 14984 - Implement __attribute__((ms_abi))

Reid Kleckner rnk at google.com
Wed Jul 24 22:13:22 PDT 2013


Sounds good mostly, but I happen to be in the middle of untangling the mess
of CC_Default != CC_C.

One thing that should probably work here is if I'm targeting a platform
where sysv_abi is equivalent to the default cc, a sysv_abi function should
be compatible with a normal function pointer.  Similarly when targeting
Windows, an ms_abi function is probably compatible with a normal function
pointer.  Please see what gcc does and add tests that show that we match it.

Hm, now I worry if we have a bug in LLVM.  LLVM will replace calls with the
wrong cc with unreachable, I think, and it may not know that x86_64_sysv_cc
is compatible with ccc on non-Windows OSs.

Also, what does ms_abi do on x86_32?  Is it stdcall or cdecl?  Add a test
for i686.


On Wed, Jul 24, 2013 at 10:50 PM, Charles Davis <cdavis5x at gmail.com> wrote:

>
> On Jul 12, 2013, at 5:48 AM, Reid Kleckner wrote:
>
> On Tue, Jun 18, 2013 at 6:25 AM, Benno Rice <benno at freebsd.org> wrote:
>
>>
>> On 12/06/2013, at 10:40 PM, Reid Kleckner <rnk at google.com> wrote:
>>
>> On Wed, Jun 12, 2013 at 7:13 AM, Charles Davis <cdavis5x at gmail.com>wrote:
>>
>>>
>>> You mean like in my patch here:
>>>
>>> http://llvm-reviews.chandlerc.com/D729
>>>
>>> ?
>>>
>>
>> Yeah, that looks good to me.  :)
>>
>> From the docs, it seems attr(ms_abi) just maps to x86_64_win64cc and
>> x86_stdcallcc depending on the architecture:
>>
>> http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html#index-g_t_0040code_007bsysv_005fabi_007d-attribute-2670
>> gcc also appears to support a sysv_abi attribute, which lets you use the
>> sysv CCs when targeting Windows.
>>
>>
>> So what's in the way of this being committed? Is there anything I can do
>> that would accelerate things?
>>
>
> Benno, Charles added explicit sysv and win64 CCs to LLVM.  Feel free to
> update your clang patch based on that and resend.
>
> I can wait no longer...
>
> I've taken the Clang side of Benno's patch, updated it against my LLVM
> patch, and rebased it against trunk. I also added the complementary
> sysv_abi attribute.
>
> OK to commit?
>
> Chip
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130725/683f6769/attachment.html>


More information about the cfe-commits mailing list