-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[DTLTO][LLD] Tidy up DTLTO related options (NFC) #161675
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Change LLD DTLTO option definitions to match actual option name.
@llvm/pr-subscribers-lld-elf @llvm/pr-subscribers-lld-coff Author: Andrew Ng (nga888) ChangesChange LLD DTLTO option definitions to match actual option name. Full diff: https://github.com/llvm/llvm-project/pull/161675.diff 4 Files Affected:
diff --git a/lld/COFF/Driver.cpp b/lld/COFF/Driver.cpp
index a59cc06d51836..3676b8881016b 100644
--- a/lld/COFF/Driver.cpp
+++ b/lld/COFF/Driver.cpp
@@ -2104,18 +2104,18 @@ void LinkerDriver::linkerMain(ArrayRef<const char *> argsArr) {
config->dtltoDistributor = args.getLastArgValue(OPT_thinlto_distributor);
// Handle /thinlto-distributor-arg:<arg>
- for (auto *arg : args.filtered(OPT_thinlto_distributor_arg))
- config->dtltoDistributorArgs.push_back(arg->getValue());
+ config->dtltoDistributorArgs =
+ args::getStrings(args, OPT_thinlto_distributor_arg);
// Handle /thinlto-remote-compiler:<path>
- config->dtltoCompiler = args.getLastArgValue(OPT_thinlto_compiler);
+ config->dtltoCompiler = args.getLastArgValue(OPT_thinlto_remote_compiler);
if (!config->dtltoDistributor.empty() && config->dtltoCompiler.empty())
Err(ctx) << "A value must be specified for /thinlto-remote-compiler if "
"/thinlto-distributor is specified.";
// Handle /thinlto-remote-compiler-arg:<arg>
- for (auto *arg : args.filtered(OPT_thinlto_compiler_arg))
- config->dtltoCompilerArgs.push_back(arg->getValue());
+ config->dtltoCompilerArgs =
+ args::getStrings(args, OPT_thinlto_remote_compiler_arg);
// Handle /dwodir
config->dwoDir = args.getLastArgValue(OPT_dwodir);
diff --git a/lld/COFF/Options.td b/lld/COFF/Options.td
index 485db5a8b21c1..f3d0eb3356200 100644
--- a/lld/COFF/Options.td
+++ b/lld/COFF/Options.td
@@ -289,10 +289,10 @@ def thinlto_distributor : P<"thinlto-distributor",
"backend compilations will be distributed">;
def thinlto_distributor_arg : P<"thinlto-distributor-arg",
"Arguments to pass to the ThinLTO distributor">;
-def thinlto_compiler : P<"thinlto-remote-compiler",
+def thinlto_remote_compiler : P<"thinlto-remote-compiler",
"Compiler for the ThinLTO distributor to invoke for ThinLTO backend "
"compilations">;
-def thinlto_compiler_arg : P<"thinlto-remote-compiler-arg",
+def thinlto_remote_compiler_arg : P<"thinlto-remote-compiler-arg",
"Compiler arguments for the ThinLTO distributor to pass for ThinLTO backend "
"compilations">;
def lto_obj_path : P<
diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp
index 1beab8d33f4ba..62f7fffce7dbe 100644
--- a/lld/ELF/Driver.cpp
+++ b/lld/ELF/Driver.cpp
@@ -1399,8 +1399,9 @@ static void readConfigs(Ctx &ctx, opt::InputArgList &args) {
ctx.arg.dtltoDistributor = args.getLastArgValue(OPT_thinlto_distributor_eq);
ctx.arg.dtltoDistributorArgs =
args::getStrings(args, OPT_thinlto_distributor_arg);
- ctx.arg.dtltoCompiler = args.getLastArgValue(OPT_thinlto_compiler_eq);
- ctx.arg.dtltoCompilerArgs = args::getStrings(args, OPT_thinlto_compiler_arg);
+ ctx.arg.dtltoCompiler = args.getLastArgValue(OPT_thinlto_remote_compiler_eq);
+ ctx.arg.dtltoCompilerArgs =
+ args::getStrings(args, OPT_thinlto_remote_compiler_arg);
ctx.arg.dwoDir = args.getLastArgValue(OPT_plugin_opt_dwo_dir_eq);
ctx.arg.dynamicLinker = getDynamicLinker(ctx, args);
ctx.arg.ehFrameHdr =
diff --git a/lld/ELF/Options.td b/lld/ELF/Options.td
index f0523185a0a31..0d6dda4b60d3a 100644
--- a/lld/ELF/Options.td
+++ b/lld/ELF/Options.td
@@ -722,11 +722,11 @@ def thinlto_distributor_eq: JJ<"thinlto-distributor=">,
"ThinLTO backend compilations will be distributed">;
defm thinlto_distributor_arg: EEq<"thinlto-distributor-arg", "Arguments to "
"pass to the ThinLTO distributor">;
-def thinlto_compiler_eq: JJ<"thinlto-remote-compiler=">,
+def thinlto_remote_compiler_eq: JJ<"thinlto-remote-compiler=">,
HelpText<"Compiler for the ThinLTO distributor to invoke for ThinLTO backend "
"compilations">;
-defm thinlto_compiler_arg: EEq<"thinlto-remote-compiler-arg", "Compiler "
- "arguments for the ThinLTO distributor to pass for ThinLTO backend "
+defm thinlto_remote_compiler_arg: EEq<"thinlto-remote-compiler-arg",
+ "Compiler arguments for the ThinLTO distributor to pass for ThinLTO backend "
"compilations">;
defm fat_lto_objects: BB<"fat-lto-objects",
"Use the .llvm.lto section, which contains LLVM bitcode, in fat LTO object files to perform LTO.",
|
@llvm/pr-subscribers-platform-windows Author: Andrew Ng (nga888) ChangesChange LLD DTLTO option definitions to match actual option name. Full diff: https://github.com/llvm/llvm-project/pull/161675.diff 4 Files Affected:
diff --git a/lld/COFF/Driver.cpp b/lld/COFF/Driver.cpp
index a59cc06d51836..3676b8881016b 100644
--- a/lld/COFF/Driver.cpp
+++ b/lld/COFF/Driver.cpp
@@ -2104,18 +2104,18 @@ void LinkerDriver::linkerMain(ArrayRef<const char *> argsArr) {
config->dtltoDistributor = args.getLastArgValue(OPT_thinlto_distributor);
// Handle /thinlto-distributor-arg:<arg>
- for (auto *arg : args.filtered(OPT_thinlto_distributor_arg))
- config->dtltoDistributorArgs.push_back(arg->getValue());
+ config->dtltoDistributorArgs =
+ args::getStrings(args, OPT_thinlto_distributor_arg);
// Handle /thinlto-remote-compiler:<path>
- config->dtltoCompiler = args.getLastArgValue(OPT_thinlto_compiler);
+ config->dtltoCompiler = args.getLastArgValue(OPT_thinlto_remote_compiler);
if (!config->dtltoDistributor.empty() && config->dtltoCompiler.empty())
Err(ctx) << "A value must be specified for /thinlto-remote-compiler if "
"/thinlto-distributor is specified.";
// Handle /thinlto-remote-compiler-arg:<arg>
- for (auto *arg : args.filtered(OPT_thinlto_compiler_arg))
- config->dtltoCompilerArgs.push_back(arg->getValue());
+ config->dtltoCompilerArgs =
+ args::getStrings(args, OPT_thinlto_remote_compiler_arg);
// Handle /dwodir
config->dwoDir = args.getLastArgValue(OPT_dwodir);
diff --git a/lld/COFF/Options.td b/lld/COFF/Options.td
index 485db5a8b21c1..f3d0eb3356200 100644
--- a/lld/COFF/Options.td
+++ b/lld/COFF/Options.td
@@ -289,10 +289,10 @@ def thinlto_distributor : P<"thinlto-distributor",
"backend compilations will be distributed">;
def thinlto_distributor_arg : P<"thinlto-distributor-arg",
"Arguments to pass to the ThinLTO distributor">;
-def thinlto_compiler : P<"thinlto-remote-compiler",
+def thinlto_remote_compiler : P<"thinlto-remote-compiler",
"Compiler for the ThinLTO distributor to invoke for ThinLTO backend "
"compilations">;
-def thinlto_compiler_arg : P<"thinlto-remote-compiler-arg",
+def thinlto_remote_compiler_arg : P<"thinlto-remote-compiler-arg",
"Compiler arguments for the ThinLTO distributor to pass for ThinLTO backend "
"compilations">;
def lto_obj_path : P<
diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp
index 1beab8d33f4ba..62f7fffce7dbe 100644
--- a/lld/ELF/Driver.cpp
+++ b/lld/ELF/Driver.cpp
@@ -1399,8 +1399,9 @@ static void readConfigs(Ctx &ctx, opt::InputArgList &args) {
ctx.arg.dtltoDistributor = args.getLastArgValue(OPT_thinlto_distributor_eq);
ctx.arg.dtltoDistributorArgs =
args::getStrings(args, OPT_thinlto_distributor_arg);
- ctx.arg.dtltoCompiler = args.getLastArgValue(OPT_thinlto_compiler_eq);
- ctx.arg.dtltoCompilerArgs = args::getStrings(args, OPT_thinlto_compiler_arg);
+ ctx.arg.dtltoCompiler = args.getLastArgValue(OPT_thinlto_remote_compiler_eq);
+ ctx.arg.dtltoCompilerArgs =
+ args::getStrings(args, OPT_thinlto_remote_compiler_arg);
ctx.arg.dwoDir = args.getLastArgValue(OPT_plugin_opt_dwo_dir_eq);
ctx.arg.dynamicLinker = getDynamicLinker(ctx, args);
ctx.arg.ehFrameHdr =
diff --git a/lld/ELF/Options.td b/lld/ELF/Options.td
index f0523185a0a31..0d6dda4b60d3a 100644
--- a/lld/ELF/Options.td
+++ b/lld/ELF/Options.td
@@ -722,11 +722,11 @@ def thinlto_distributor_eq: JJ<"thinlto-distributor=">,
"ThinLTO backend compilations will be distributed">;
defm thinlto_distributor_arg: EEq<"thinlto-distributor-arg", "Arguments to "
"pass to the ThinLTO distributor">;
-def thinlto_compiler_eq: JJ<"thinlto-remote-compiler=">,
+def thinlto_remote_compiler_eq: JJ<"thinlto-remote-compiler=">,
HelpText<"Compiler for the ThinLTO distributor to invoke for ThinLTO backend "
"compilations">;
-defm thinlto_compiler_arg: EEq<"thinlto-remote-compiler-arg", "Compiler "
- "arguments for the ThinLTO distributor to pass for ThinLTO backend "
+defm thinlto_remote_compiler_arg: EEq<"thinlto-remote-compiler-arg",
+ "Compiler arguments for the ThinLTO distributor to pass for ThinLTO backend "
"compilations">;
defm fat_lto_objects: BB<"fat-lto-objects",
"Use the .llvm.lto section, which contains LLVM bitcode, in fat LTO object files to perform LTO.",
|
// Handle /thinlto-distributor-arg:<arg> | ||
for (auto *arg : args.filtered(OPT_thinlto_distributor_arg)) | ||
config->dtltoDistributorArgs.push_back(arg->getValue()); | ||
config->dtltoDistributorArgs = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks!
Change LLD DTLTO option definitions to match actual option name.
Change LLD DTLTO option definitions to match actual option name.