[LLVMdev] Available code-generation parallism
clattner at apple.com
Mon Nov 3 23:59:49 PST 2008
On Nov 3, 2008, at 3:55 PM, heisenbug wrote:
> What about "inventing" pseudo-constants (which point to the right
> thing) and build the piece of IR with them. When done, grab mutex and
> RAUW it in. Alternatively, submit to a privileged thread that performs
> the RAUW.
> The trick is to prepare the def/use chain(s) to a degree that the
> mutex is only held a minimal time. If only IR-builder threads are
> running concurrently there is no danger that a real constant vanishes,
> leaving behind a stale reference from a pseudo-constant.
That could work. It would also have to be done for global values as
well, and inline asm objects etc. However, I don't see any show-
stoppers. The implementation could be tricky, but a nice property of
your approach is that the single threaded case could be made
particularly fast (instead of doing atomic ops or locking always).
More information about the llvm-dev