@@ -128,7 +128,7 @@ Error Config::addSaveTemps(std::string OutputFileName,
128
128
namespace {
129
129
130
130
std::unique_ptr<TargetMachine>
131
- createTargetMachine (Config &Conf, const Target *TheTarget, Module &M) {
131
+ createTargetMachine (const Config &Conf, const Target *TheTarget, Module &M) {
132
132
StringRef TheTriple = M.getTargetTriple ();
133
133
SubtargetFeatures Features;
134
134
Features.getDefaultSubtargetFeatures (Triple (TheTriple));
@@ -153,7 +153,7 @@ createTargetMachine(Config &Conf, const Target *TheTarget, Module &M) {
153
153
CodeModel, Conf.CGOptLevel ));
154
154
}
155
155
156
- static void runNewPMPasses (Config &Conf, Module &Mod, TargetMachine *TM,
156
+ static void runNewPMPasses (const Config &Conf, Module &Mod, TargetMachine *TM,
157
157
unsigned OptLevel, bool IsThinLTO,
158
158
ModuleSummaryIndex *ExportSummary,
159
159
const ModuleSummaryIndex *ImportSummary) {
@@ -269,7 +269,7 @@ static void runNewPMCustomPasses(Module &Mod, TargetMachine *TM,
269
269
MPM.run (Mod, MAM);
270
270
}
271
271
272
- static void runOldPMPasses (Config &Conf, Module &Mod, TargetMachine *TM,
272
+ static void runOldPMPasses (const Config &Conf, Module &Mod, TargetMachine *TM,
273
273
bool IsThinLTO, ModuleSummaryIndex *ExportSummary,
274
274
const ModuleSummaryIndex *ImportSummary) {
275
275
legacy::PassManager passes;
@@ -300,7 +300,7 @@ static void runOldPMPasses(Config &Conf, Module &Mod, TargetMachine *TM,
300
300
passes.run (Mod);
301
301
}
302
302
303
- bool opt (Config &Conf, TargetMachine *TM, unsigned Task, Module &Mod,
303
+ bool opt (const Config &Conf, TargetMachine *TM, unsigned Task, Module &Mod,
304
304
bool IsThinLTO, ModuleSummaryIndex *ExportSummary,
305
305
const ModuleSummaryIndex *ImportSummary) {
306
306
// FIXME: Plumb the combined index into the new pass manager.
@@ -319,7 +319,7 @@ static cl::opt<bool> EmbedBitcode(
319
319
" lto-embed-bitcode" , cl::init(false ),
320
320
cl::desc(" Embed LLVM bitcode in object files produced by LTO" ));
321
321
322
- static void EmitBitcodeSection (Module &M, Config &Conf) {
322
+ static void EmitBitcodeSection (Module &M, const Config &Conf) {
323
323
if (!EmbedBitcode)
324
324
return ;
325
325
SmallVector<char , 0 > Buffer;
@@ -332,7 +332,7 @@ static void EmitBitcodeSection(Module &M, Config &Conf) {
332
332
/* EmbedMarker*/ false , /* CmdArgs*/ nullptr );
333
333
}
334
334
335
- void codegen (Config &Conf, TargetMachine *TM, AddStreamFn AddStream,
335
+ void codegen (const Config &Conf, TargetMachine *TM, AddStreamFn AddStream,
336
336
unsigned Task, Module &Mod) {
337
337
if (Conf.PreCodeGenModuleHook && !Conf.PreCodeGenModuleHook (Task, Mod))
338
338
return ;
@@ -372,7 +372,7 @@ void codegen(Config &Conf, TargetMachine *TM, AddStreamFn AddStream,
372
372
DwoOut->keep ();
373
373
}
374
374
375
- void splitCodeGen (Config &C, TargetMachine *TM, AddStreamFn AddStream,
375
+ void splitCodeGen (const Config &C, TargetMachine *TM, AddStreamFn AddStream,
376
376
unsigned ParallelCodeGenParallelismLevel,
377
377
std::unique_ptr<Module> Mod) {
378
378
ThreadPool CodegenThreadPool (ParallelCodeGenParallelismLevel);
@@ -420,7 +420,7 @@ void splitCodeGen(Config &C, TargetMachine *TM, AddStreamFn AddStream,
420
420
CodegenThreadPool.wait ();
421
421
}
422
422
423
- Expected<const Target *> initAndLookupTarget (Config &C, Module &Mod) {
423
+ Expected<const Target *> initAndLookupTarget (const Config &C, Module &Mod) {
424
424
if (!C.OverrideTriple .empty ())
425
425
Mod.setTargetTriple (C.OverrideTriple );
426
426
else if (Mod.getTargetTriple ().empty ())
@@ -432,7 +432,6 @@ Expected<const Target *> initAndLookupTarget(Config &C, Module &Mod) {
432
432
return make_error<StringError>(Msg, inconvertibleErrorCode ());
433
433
return T;
434
434
}
435
-
436
435
}
437
436
438
437
static Error
@@ -446,7 +445,7 @@ finalizeOptimizationRemarks(std::unique_ptr<ToolOutputFile> DiagOutputFile) {
446
445
return Error::success ();
447
446
}
448
447
449
- Error lto::backend (Config &C, AddStreamFn AddStream,
448
+ Error lto::backend (const Config &C, AddStreamFn AddStream,
450
449
unsigned ParallelCodeGenParallelismLevel,
451
450
std::unique_ptr<Module> Mod,
452
451
ModuleSummaryIndex &CombinedIndex) {
@@ -500,7 +499,7 @@ static void dropDeadSymbols(Module &Mod, const GVSummaryMapTy &DefinedGlobals,
500
499
}
501
500
}
502
501
503
- Error lto::thinBackend (Config &Conf, unsigned Task, AddStreamFn AddStream,
502
+ Error lto::thinBackend (const Config &Conf, unsigned Task, AddStreamFn AddStream,
504
503
Module &Mod, const ModuleSummaryIndex &CombinedIndex,
505
504
const FunctionImporter::ImportMapTy &ImportList,
506
505
const GVSummaryMapTy &DefinedGlobals,
0 commit comments