[LLVMdev] "Multithreaded LLVM" in "Writing an LLVM Pass"
geek4civic at gmail.com
Tue Oct 9 01:04:46 PDT 2012
2012/10/9 陳韋任 (Wei-Ren Chen) <chenwj at iis.sinica.edu.tw>:
> On Tue, Oct 09, 2012 at 08:35:57AM +0100, David Chisnall wrote:
>> On 8 Oct 2012, at 18:26, Lu Mitnick wrote:
>> > 1. Multiple threads handle different modules (Thread : Module = 1 : 1)
>> > or
>> For ModulePasses, yes.
>> > 2. Multiple threads handle one module (Thread : Module = N : 1)
>> For FunctionPasses, yes.
>> Note that this part is in the future work section, meaning that no one has done it yet. FunctionPasses are independent of each other when running on different functions, so it would be fairly simple to use something like libdispatch to optimise every function within a module independently. FunctionPasses are not (in theory) allowed to modify any module state outside of a function, so they should be able to be run concurrently.
> No one has done it yet? From , it seems parallel JIT is workable.
> Or I just misread the question?
MachinePasses don't change llvm::Module nor llvm::Function. I think
CodeGen could be prallelized.
In contrast, as Chandler mentions, Modifying Instruction(s) might
affect *hidden* state of globals, use-ref chain and refcount.
I think "transaction" might be useful here, too. See also
More information about the llvm-dev