[cfe-dev] naked attribute

reed kotler rkotler at mips.com
Fri May 3 10:45:00 PDT 2013


On 05/03/2013 10:30 AM, Rafael EspĂ­ndola wrote:
>> I agree. At least in the clang/llvm mode where we don't care about strict
>> compatibility with gcc.
>>
>> For the serious  embedded programmer, this is a life saver and helpful
>> friend.
> OK, so what about:
>
> * On targets where gcc supports this attribute, we support it too, no warnings.
> * An targets where gcc doesn't support it, we get two options.
>    1. Implement it and have a warning that this is a clang extension
>    2. Don't implement it and warn about an ignored attribute (like gcc does).
>
> If a target follows 1 or 2 is mostly dependent of llvm having
> implemented the naked attribute on that target.
>
> Cheers,
> Rafael
The only thing I would add is that we should have a feature like 
-allow-naked on targets where it's decided that the default behavior to 
be as for gcc but still want to implement the option.

In Mips there are already several conflicting opinions on what this 
should be. I already have the patch to fully implement this attribute 
(most is already covered by target independent code in llvm which will 
not call the emit prologue and epilogue methods in the presence of this 
attribute).

My patch adds about 10 lines of code and similar patches for other 
targets already handling the naked attribute are about the same length.

My patch just removes some uneeded pseudos but the real "meat" is 
already handled automatically by llvm, aside from this emitting of the 
unreachable instruction from clang in place of return.






More information about the cfe-dev mailing list