llvm::LinkedCodeGen is a function that implements the core of parallel LTO
code generation. It uses llvm::SplitModule to split the module into linkable
partitions and spawning one code generation thread per partition. The function
produces multiple object files which can be linked in the usual way.
This has been threaded through to LTOCodeGenerator (and llvm-lto for testing
purposes). Separate patches will add parallel LTO support to the gold plugin
and lld.
Although this API takes an array of stream pointers, all current clients (llvm-lto, gold-plugin D12308, lld D12309) own their streams, making this API a little awkward to use. Probably a better choice of argument type here would be ArrayRef<std::unique_ptr<raw_pwrite_stream>>. This would mean a few extra allocations, but the cost would be dwarfed by that of LTO.