@@ -99,10 +99,15 @@ cl::list<std::string> AdditionalThinLTODistributorArgs(
9999 " thinlto-distributor-arg" ,
100100 cl::desc (" Additional arguments to pass to the ThinLTO distributor" ));
101101
102+ cl::opt<std::string>
103+ ThinLTORemoteCompiler (" thinlto-remote-compiler" ,
104+ cl::desc (" Additional arguments to pass to the "
105+ " ThinLTO remote optimization tool" ));
106+
102107cl::list<std::string>
103- ThinLTORemoteOptToolArgs (" thinlto-remote-opt-tool -arg" ,
104- cl::desc (" Additional arguments to pass to the "
105- " ThinLTO remote optimization tool " ));
108+ ThinLTORemoteCompilerArgs (" thinlto-remote-compiler -arg" ,
109+ cl::desc (" Additional arguments to pass to the "
110+ " ThinLTO remote compiler " ));
106111} // namespace llvm
107112
108113// Computes a unique hash for the Module considering the current list of
@@ -2207,7 +2212,6 @@ class OutOfProcessThinBackend : public CGThinBackend {
22072212 StringSaver Saver{Alloc};
22082213
22092214 SString LinkerOutputFile;
2210- SString RemoteOptTool;
22112215 SString DistributorPath;
22122216 bool SaveTemps;
22132217
@@ -2240,13 +2244,12 @@ class OutOfProcessThinBackend : public CGThinBackend {
22402244 AddStreamFn AddStream, AddBufferFn AddBuffer,
22412245 lto::IndexWriteCallback OnWrite, bool ShouldEmitIndexFiles,
22422246 bool ShouldEmitImportsFiles, StringRef LinkerOutputFile,
2243- StringRef RemoteOptTool, StringRef Distributor, bool SaveTemps)
2247+ StringRef Distributor, bool SaveTemps)
22442248 : CGThinBackend(Conf, CombinedIndex, ModuleToDefinedGVSummaries, OnWrite,
22452249 ShouldEmitIndexFiles, ShouldEmitImportsFiles,
22462250 ThinLTOParallelism),
22472251 AddBuffer (std::move(AddBuffer)), LinkerOutputFile(LinkerOutputFile),
2248- RemoteOptTool(RemoteOptTool), DistributorPath(Distributor),
2249- SaveTemps(SaveTemps) {}
2252+ DistributorPath(Distributor), SaveTemps(SaveTemps) {}
22502253
22512254 virtual void setup (unsigned MaxTasks, unsigned ReservedTasks) override {
22522255 UID = itostr (sys::Process::getProcessId ());
@@ -2311,7 +2314,7 @@ class OutOfProcessThinBackend : public CGThinBackend {
23112314 // approaches should be considered, such as:
23122315 // - A serialization/deserialization format for LTO configuration.
23132316 // - Modifying LLD to be the tool that performs the backend compilations.
2314- void buildCommonRemoteOptToolOptions () {
2317+ void buildCommonRemoteCompilerOptions () {
23152318 const lto::Config &C = Conf;
23162319 auto &Ops = CodegenOptions;
23172320 llvm::Triple TT{Jobs.front ().Triple };
@@ -2349,8 +2352,8 @@ class OutOfProcessThinBackend : public CGThinBackend {
23492352 Ops.push_back (" -Wno-unused-command-line-argument" );
23502353
23512354 // Forward any supplied options.
2352- if (!ThinLTORemoteOptToolArgs .empty ())
2353- for (auto &a : ThinLTORemoteOptToolArgs )
2355+ if (!ThinLTORemoteCompilerArgs .empty ())
2356+ for (auto &a : ThinLTORemoteCompilerArgs )
23542357 Ops.push_back (a);
23552358 }
23562359
@@ -2372,7 +2375,7 @@ class OutOfProcessThinBackend : public CGThinBackend {
23722375
23732376 // Common command line template.
23742377 JOS.attributeArray (" args" , [&]() {
2375- JOS.value (RemoteOptTool );
2378+ JOS.value (ThinLTORemoteCompiler );
23762379
23772380 // Reference to Job::NativeObjectPath.
23782381 JOS.value (" -o" );
@@ -2454,7 +2457,7 @@ class OutOfProcessThinBackend : public CGThinBackend {
24542457 return make_error<StringError>(BCError + " all triples must be consistent" ,
24552458 inconvertibleErrorCode ());
24562459
2457- buildCommonRemoteOptToolOptions ();
2460+ buildCommonRemoteCompilerOptions ();
24582461
24592462 SString JsonFile = sys::path::parent_path (LinkerOutputFile);
24602463 sys::path::append (JsonFile, sys::path::stem (LinkerOutputFile) + " ." + UID +
@@ -2502,17 +2505,15 @@ class OutOfProcessThinBackend : public CGThinBackend {
25022505ThinBackend lto::createOutOfProcessThinBackend (
25032506 ThreadPoolStrategy Parallelism, lto::IndexWriteCallback OnWrite,
25042507 bool ShouldEmitIndexFiles, bool ShouldEmitImportsFiles,
2505- StringRef LinkerOutputFile, StringRef RemoteOptTool, StringRef Distributor,
2506- bool SaveTemps) {
2508+ StringRef LinkerOutputFile, StringRef Distributor, bool SaveTemps) {
25072509 auto Func =
25082510 [=](const Config &Conf, ModuleSummaryIndex &CombinedIndex,
25092511 const DenseMap<StringRef, GVSummaryMapTy> &ModuleToDefinedGVSummaries,
25102512 AddStreamFn AddStream, AddBufferFn AddBuffer, FileCache /* Cache*/ ) {
25112513 return std::make_unique<OutOfProcessThinBackend>(
25122514 Conf, CombinedIndex, Parallelism, ModuleToDefinedGVSummaries,
25132515 AddStream, AddBuffer, OnWrite, ShouldEmitIndexFiles,
2514- ShouldEmitImportsFiles, LinkerOutputFile, RemoteOptTool,
2515- Distributor, SaveTemps);
2516+ ShouldEmitImportsFiles, LinkerOutputFile, Distributor, SaveTemps);
25162517 };
25172518 return ThinBackend (Func, Parallelism);
25182519}
0 commit comments