[LLVMdev] LLVM and OpenMP

Devang Patel dpatel at apple.com
Thu Nov 29 11:39:45 PST 2007

On Nov 29, 2007, at 9:52 AM, Wojciech Matyjewicz wrote:

> Hi,
> In the beginning I'd like to say I am not very familiar with  
> (llvm-)gcc
> internals, so some of my assumptions and guesses may be wrong. Please,
> correct me, then.
> Anton Korobeynikov wrote:
>> Internally OpenMP lowering in gcc is split into two phases. Funny,  
>> but
>> llvm converter is run between these phases :) It looks like second  
>> phase
>> uses some gcc analysis passes (like dominance info, etc).
>> In order to support OpenMP in llvm-gcc 4.2 we should:
>> 1. Decide at which level we should handle openmp trees in llvm-gcc
>> 2. Define a set of openmp builtins, which will need to be supported  
>> in
>> llc codegen
>> 3. Something I'm not aware of :)
> I've found an interesting paper on the design and implementation of
> OpenMP in GCC: http://people.restadhat.com/dnovillo/Papers/gcc2006.pdf
> It describes how and when OpenMP pragmas are lowered. It seems the
> second phase that Anton wrote about is the most important one. I  
> believe
> it is the "pass_expand_omp" mentioned in the paper. Its aim is to
> extract parallel sections into new functions, expand directives into
> built-in function calls, insert code to calculate iteration-space,  
> etc.
> I guess no GIMPLE codes used by OpenMP are left after this pass. If it
> is possible to do the conversion to LLVM IR at this stage, the only
> thing to do is to handle OpenMP built-ins. The simplest route would be
> to replace them with calls to libgomp (an LGPL library accompanying
> GCC). It is what GCC seems to do.

This is what I referred to.

More information about the llvm-dev mailing list