How to detect and work on OpenMP pragmas in llvm /clang

Hi,

I’m trying to work on transform passes in LLVM aimed at every OpenMP parallel section which are mentioned using ‘omp pragmas’.

I’m thinking something like: Module level, Function level and basic block level, can I write any passes at a parallel loop level. If yes, any directions on this would be really helpful.

Cheers.

chris

From: "techie tawa" <techie.tawa@gmail.com>
To: "llvmdev" <llvmdev@cs.uiuc.edu>, "cfe-dev" <cfe-dev@cs.uiuc.edu>
Sent: Friday, March 14, 2014 5:38:51 AM
Subject: [cfe-dev] How to detect and work on OpenMP pragmas in llvm /clang

Hi,

I'm trying to work on transform passes in LLVM aimed at every OpenMP
parallel section which are mentioned using 'omp pragmas'.

I'm thinking something like: Module level, Function level and basic
block level, can I write any passes at a parallel loop level. If
yes, any directions on this would be really helpful.

Because OpenMP is 'outlined' early -- specifically all pragmas are turned into calls to the runtime library in the frontend -- we don't have any particular infrastructure for this in LLVM. You'd need to run a pass to look at calls to the OpenMP runtime and then go from there. If you can provide further details about what you'd like to accomplish, then I might be able to provide more specific advice.

-Hal