Setting readnone attribute for function declaration

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Setting readnone attribute for function declaration

adamhusar
Hello,

   I would like to ask, if there is a way how to set  readnone attribute for a function declaration.
(http://llvm.org/docs/LangRef.html#fnattrs)

Lets say I would like to have such function:

short __attribute__((readnone)) fun(short a, short b, int c);

However, the clang frontend (v.1.0), does print a warning, that the readnone attribute is ignored.
I looked in the newest revision sources, but it does not seem that it is supported either.
Do you know whether it is possible to convince the frontend, that this function should have the
readnone attribute (I need this to allow optimizations over this function call boundary to happen)?

Thank you
   Adam H.

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Setting readnone attribute for function declaration

Chris Lattner

On Aug 27, 2010, at 7:17 AM, ihusar wrote:

> Hello,
>
>   I would like to ask, if there is a way how to set  readnone attribute for a function declaration.
> (http://llvm.org/docs/LangRef.html#fnattrs)
>
> Lets say I would like to have such function:
>
> short __attribute__((readnone)) fun(short a, short b, int c);
>
> However, the clang frontend (v.1.0), does print a warning, that the readnone attribute is ignored.
> I looked in the newest revision sources, but it does not seem that it is supported either.
> Do you know whether it is possible to convince the frontend, that this function should have the
> readnone attribute (I need this to allow optimizations over this function call boundary to happen)?

In C code, we follow the GCC naming of the attributes, so readnone = attribute(const) and readonly = attribute(pure).

-Chris
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Setting readnone attribute for function declaration

adamhusar
At 27.08.2010, 18:06, wrote Chris Lattner <[hidden email]>:

>
> On Aug 27, 2010, at 7:17 AM, ihusar wrote:
>
>> Hello,
>>
>>   I would like to ask, if there is a way how to set  readnone attribute for a function declaration.
>> (http://llvm.org/docs/LangRef.html#fnattrs)
>>
>> Lets say I would like to have such function:
>>
>> short __attribute__((readnone)) fun(short a, short b, int c);
>>
>> However, the clang frontend (v.1.0), does print a warning, that the readnone attribute is ignored.
>> I looked in the newest revision sources, but it does not seem that it is supported either.
>> Do you know whether it is possible to convince the frontend, that this function should have the
>> readnone attribute (I need this to allow optimizations over this function call boundary to happen)?
>
> In C code, we follow the GCC naming of the attributes, so readnone = attribute(const) and readonly = attribute(pure).
>
> -Chris
>


It works perfectly, thank you for your answer.
   Adam H.
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev