Extended Description
When doing parallel CodeGen we currently have to create a TargetMachine per-thread because TargetMachine is not thread-safe.
This is a waste, and it would be nice if it can be avoided.
Also, having an immutable TargetMachine is a preliminary step needed if we want at some point parallelize the backend.
Eric pointed out the least amount of work needed:
- Handle resetTargetOptions first (at least)
- An optional lock on getSubtarget
The subtarget itself should be fine, and if not, it should be fixed.