[LLVMdev] LLVM multithreading

David Chisnall David.Chisnall at cl.cam.ac.uk
Fri May 30 03:01:45 PDT 2014


On 30 May 2014, at 10:52, Jasmin Jahic <jasmin.jahic at gmail.com> wrote:

> What I want to know is following: Imagine that I create threads in some way. I want threads to execute the same BC, while using the same memory space. I know that LLVM IR has a nice structure: Context - Module - Execution engine. Is there a way to run several instances of LLVM (using threads for example) with the same memory space?

I think your question is a result of misunderstanding the nature of LLVM.  It is not a virtual machine, it is an abstract machine and a set of tools implementing compilers for that abstract machine.  You don't run the bitcode (well, you can interpret it, but you don't usually), you compile the bitcode and then run the resulting code.  If you want to run the same code on all threads, then you just use the LLVM [MC]JIT to compile it once and then you call the generated functions from different threads.

David





More information about the llvm-dev mailing list