[LLVMdev] LLVM and threading

Martin C. Martin mmartin at Endeca.com
Wed Aug 18 14:08:34 PDT 2010


Hi all,

 

I'd like to run LLVM in a threaded application, where different threads
will be compiling separate, unrelated code.  I'm compiling using the JIT
so I can execute the code as soon as it's compiled.

 

How should I use LLVM?  Should I create an ExecutionEngine for each
thread, or only a single, global instance?  

 

I noticed that JIT::getPointerToFunction() contains:

 

  MutexGuard locked(lock);

 

and it seems to hold the lock until the method returns.  Does this mean
that lazy compilation will be serialized?  Would non-lazy compilation be
any better?  Can compilation be done in parallel by different threads?

 

Thanks,

Martin

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100818/d7538956/attachment.html>


More information about the llvm-dev mailing list