[LTO] Implement parallel Codegen for LTO using splitCodeGen.
Parallelism level can be chosen using the new --lto-jobs=K option
where K is the number of threads used for CodeGen. It currently
defaults to 1.
llvm-svn: 266484
diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp
index f8d5b10..c71cfca 100644
--- a/lld/ELF/Driver.cpp
+++ b/lld/ELF/Driver.cpp
@@ -321,6 +321,9 @@
Config->LtoO = getInteger(Args, OPT_lto_O, 2);
if (Config->LtoO > 3)
error("invalid optimization level for LTO: " + getString(Args, OPT_lto_O));
+ Config->LtoJobs = getInteger(Args, OPT_lto_jobs, 1);
+ if (Config->LtoJobs == 0)
+ error("number of threads must be > 0");
Config->ZExecStack = hasZOption(Args, "execstack");
Config->ZNodelete = hasZOption(Args, "nodelete");