[LLVMdev] LLVM and OpenMP

Devang Patel dpatel at apple.com
Tue Nov 27 09:54:43 PST 2007

On Nov 27, 2007, at 4:48 AM, Pertti Kellomäki wrote:

> I am involved in a project where one of the aims is to
> study the effects of different parallelization strategies
> on efficiency, power consumption etc. The idea is to
> do automated design space exploration by varying some
> parameters (e.g. number of tasks) and measuring their effect.
> Since we are already using LLVM for other purposes,

cool. Is it listed at http://llvm.org/Users.html ?

> we thought
> about using LLVM for analysis and then OpenMP for compilation.
> The idea was to use the LLVM back end to spit out C code with
> OpenMP directives. However, looking at the C code that llc
> produces, it seems that this might be a non-starter, as loops
> have already been turned into gotos in the generated C.
> I suspect we may need to do something else, but if anyone has
> any bright ideas on how to use LLVM for this purpose, I'd be
> very grateful.

If you're using llvm-gcc-4.0 to get llvm bitcode for analysis then  
front-end is ignoring OpenMP pragmas. if you're trying to use llvm- 
gcc-4.2 then most likely it won't work, because llvm bitcode emitter  
has not been updated to handle OpenMP.  If you're getting  llvm  
bitcode (without going through llvm-gcc) and somehow annotating it  
with OpenMP instructions (I don't know how) then also I CBackend,  
which is used by llc, won't be able to handle it at the moment. In  
simple words, LLVM is not OpenMP ready yet.

The easiest route would be to update llvm bitcode converter in llvm- 
gcc-4.2 such that llvm bitcode converter operates on GCC trees after  
OpenMP lowering phase is executed.

If you're interested, we welcome contribution on OpenMP front.

More information about the llvm-dev mailing list