[cfe-dev] Matching 'OMPThreadPrivateDecl'( like #pragma omp threadprivate(var))

Deepak Rajendrakumaran deepak3 at vt.edu
Wed Feb 25 22:43:13 PST 2015


Hello,

Yes, that seems to work while printing out the AST. So I should be able to
get it working for libtooling as well. Thank you.

Regards,
Deepak

On Thu, Feb 26, 2015 at 12:47 AM, Bataev, Alexey <a.bataev at hotmail.com>
wrote:

>  Deepack,
> Yes, it's enough to have "vanilla clang/LLVM" for parsing OpenMP code.
> But you have to porovide proper driver options to parse OpenMP nodes. In
> your case these options are (for clang built from trunk):
>
> clang -c -Xclang -ast-dump -Xclang -fopenmp=libiomp5 <FileName>
>
> Try this.
>
> Best regards,
> Alexey Bataev
> =============
> Software Engineer
> Intel Compiler Team
>
> 26.02.2015 8:40, Deepak Rajendrakumaran пишет:
>
> Hello,
>
>  Thank you for replying.
>
>  Yes,you are right. I am not getting the OMPThreadPrivateDecl nodes at
> all.
>
>  I tried printing out the AST for a small microbenchmark with OpenMP
> calls using ' clang -Xclang -ast-dump -fopenmp <FileName>".  And if I
> have omp.h header file included, it throws an error. Now I dug around a
> little bit more, and have a couple  of questions. Based on what I see here-
> http://llvm.org/devmtg/2014-10/Slides/Bataev-OpenMP.pdf, you seem to be
> the right person to ask. Hope you do not mind.
>
>  I have build llvm from trunk(version 3.6.0).  Now to parse nodes, is the
> normal vanilla llvm enough or do I need to make any omp specific
> changes/build(like http://clang-omp.github.io/)??
>
>  p.s. My llvm build is fine for all other purposes. i have been using it
> for a source-to-source compiler with libtooling and I have been running the
> tool on NAS benchmarks(OpenMP NPB-C version). The only issue I am seeing is
> with openMP pragmas.So what I am trying to say is that the llvm build works
> fine for other cases and it is tested.
>
>  Regards,
> Deepak
>
>
> On Wed, Feb 25, 2015 at 3:54 AM, Bataev, Alexey <a.bataev at hotmail.com>
> wrote:
>
>>  Hi,
>> are you sure that you have OMPThreadPrivateDecl nodes at all? Check that
>> the code is compiled with -Xclang -fopenmp=libiomp5 option.
>>
>> Best regards,
>> Alexey Bataev
>> =============
>> Software Engineer
>> Intel Compiler Team
>> Intel Corp.
>>
>> 25.02.2015 5:00, Deepak Rajendrakumaran пишет:
>>
>> This might sound silly. But I have been trying to
>> match OMPThreadPrivateDecl' nodes using ASTMatcher. But I have been running
>> into deadends.
>>
>>  What I am doing now is using ASTMatcher to match 'Decl' nodes and check
>> if its a 'OMPThreadPrivateDecl'  by using a dyn_cast. But this does not
>> work.
>>
>>  Alternatively I tried with isa<OMPThreadPrivateDecl>(*D) (which kind of
>> does the same thing)
>>
>>   Can anyone point out how I can access the 'OMPThreadPrivateDecl nodes
>> using ASTMAtcher or what I am doing wrong?
>>
>>  -Deepak
>>
>>
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150226/7fdcaa58/attachment.html>


More information about the cfe-dev mailing list