[LLVMdev] multiple LLVMContext or just one?

Rick Mann rmann at latencyzero.com
Wed Feb 13 17:36:02 PST 2013


On Feb 13, 2013, at 17:26 , Lang Hames <lhames at gmail.com> wrote:

> LLVMContext was designed to support multithreading by holding the compilation context for each thread in a separate LLVMContext. If you're building modules in parallel you definitely need one LLVMContext per thread.
> 
> If you're talking about compiling multiple modules sequentially with a single context I believe that should work, though I don't know how well tested it is. I think our tools usually create an LLVMContext for each Module to be compiled.
> 
> The llvm-link tool links multiple modules that share an LLVMContext (see tools/llvm-link/llvm-link.cpp), so that use case has at least been tested.

So, are you supposed to have one module and one context per thread when building modules in parallel? Or can you share one module across them all?

What's the linking API?

-- 
Rick







More information about the llvm-dev mailing list