[PATCH] D140769: [lld-link] Add /lto-newpm-passes & /load-pass-plugin to CLI
cursey via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 29 19:08:38 PST 2022
cursey created this revision.
Herald added subscribers: ormris, steven_wu, hiraditya, inglorion.
Herald added a project: All.
cursey edited the summary of this revision.
cursey added a reviewer: ruiu.
cursey added a project: lld.
cursey published this revision for review.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
This change adds /lto-newpm-passes and /load-pass-plugin command line arguments to lld-link. These are basically exactly the same arguments lld already has (--lto-newpm-passes and --load-pass-plugin) to enable loading custom LTO passes.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D140769
Files:
lld/COFF/Config.h
lld/COFF/Driver.cpp
lld/COFF/LTO.cpp
lld/COFF/Options.td
Index: lld/COFF/Options.td
===================================================================
--- lld/COFF/Options.td
+++ lld/COFF/Options.td
@@ -282,6 +282,9 @@
def vfsoverlay : P<"vfsoverlay", "Path to a vfsoverlay yaml file to optionally look for /defaultlib's in">;
+def lto_newpm_passes: P<"lto-newpm-passes", "Passes to run during LTO">;
+def load_pass_plugins: P<"load-pass-plugin", "Load passes from plugin library">;
+
// Flags for debugging
def lldmap : F<"lldmap">;
def lldmap_file : P_priv<"lldmap">;
Index: lld/COFF/LTO.cpp
===================================================================
--- lld/COFF/LTO.cpp
+++ lld/COFF/LTO.cpp
@@ -93,6 +93,10 @@
c.CSIRProfile = std::string(config->ltoCSProfileFile);
c.RunCSIRInstr = config->ltoCSProfileGenerate;
c.PGOWarnMismatch = config->ltoPGOWarnMismatch;
+ c.OptPipeline = std::string(config->ltoNewPmPasses);
+
+ for (StringRef pluginFn : config->passPlugins)
+ c.PassPlugins.push_back(std::string(pluginFn));
if (config->saveTemps)
checkError(c.addSaveTemps(std::string(config->outputFile) + ".",
Index: lld/COFF/Driver.cpp
===================================================================
--- lld/COFF/Driver.cpp
+++ lld/COFF/Driver.cpp
@@ -1919,6 +1919,9 @@
args.hasFlag(OPT_stdcall_fixup, OPT_stdcall_fixup_no, config->mingw);
config->warnStdcallFixup = !args.hasArg(OPT_stdcall_fixup);
+ config->ltoNewPmPasses = args.getLastArgValue(OPT_lto_newpm_passes);
+ config->passPlugins = args::getStrings(args, OPT_load_pass_plugins);
+
// Don't warn about long section names, such as .debug_info, for mingw or
// when -debug:dwarf is requested.
if (config->mingw || config->debugDwarf)
Index: lld/COFF/Config.h
===================================================================
--- lld/COFF/Config.h
+++ lld/COFF/Config.h
@@ -289,6 +289,9 @@
bool autoImport = false;
bool pseudoRelocs = false;
bool stdcallFixup = false;
+
+ llvm::StringRef ltoNewPmPasses;
+ llvm::SmallVector<llvm::StringRef, 0> passPlugins;
};
extern std::unique_ptr<Configuration> config;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D140769.485659.patch
Type: text/x-patch
Size: 2094 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221230/261beacc/attachment.bin>
More information about the llvm-commits
mailing list