[LLVMdev] Adding custom #pragma for clang

David Glanzman gland at seas.upenn.edu
Tue Jul 29 13:42:33 PDT 2014


Thanks Mark,

I'm giving annotation attributes a shot right now:
__attribute__((annotate("my_annotation"))) gets lowered to
llvm.___annotation intrinsics and seems good for what I'm trying to do.
I'll definitely look into the loop pragma as a backup though.

David


On Tue, Jul 29, 2014 at 2:31 PM, Mark Heffernan <meheff at google.com> wrote:

> A number of new pragmas were added recently to clang to support loop
> optimization hints.  The syntax is "#pragma clang loop ..." where "..." is
> a sequence of hints such as "unroll(4)".  These hints result in llvm.loop
> metadata being added to the IR to annotate the loop.  Depending upon what
> you're doing this may be a good model to follow.
>
> Mark
>
>
> On Wed, Jul 23, 2014 at 1:38 PM, David Glanzman <gland at seas.upenn.edu>
> wrote:
>
>> I'd like to add a custom #pragma directive in clang for research
>> purposes.  I'm familiar with the LLVM pass-writing interface but new to the
>> rest of LLVM and clang.  I've looked into Simone Pellegrini's work on a
>> #pragma interface (https://github.com/motonacciu/clomp and
>> http://llvm.org/devmtg/2013-04/pellegrini-slides.pdf), but I'm in no
>> position to determine if this approach is applicable for the latest version
>> of clang, or how to go about updating things.  Any advice would be greatly
>> appreciated.
>>
>> Thanks,
>> David
>>
>> _______________________________________________
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140729/711009ac/attachment.html>


More information about the llvm-dev mailing list