@@ -666,7 +666,8 @@ static void initLLVMModule(const IRGenModule &IGM) {
666
666
667
667
std::pair<IRGenerator *, IRGenModule *>
668
668
swift::irgen::createIRGenModule (SILModule *SILMod,
669
- const PrimarySpecificPaths &PSPs,
669
+ StringRef OutputFilename,
670
+ StringRef MainInputFilenameForDebugInfo,
670
671
llvm::LLVMContext &LLVMContext) {
671
672
672
673
IRGenOptions Opts;
@@ -678,7 +679,7 @@ swift::irgen::createIRGenModule(SILModule *SILMod,
678
679
// Create the IR emitter.
679
680
IRGenModule *IGM =
680
681
new IRGenModule (*irgen, std::move (targetMachine), nullptr , LLVMContext,
681
- " " , PSPs );
682
+ " " , OutputFilename, MainInputFilenameForDebugInfo );
682
683
683
684
initLLVMModule (*IGM);
684
685
@@ -731,8 +732,9 @@ static std::unique_ptr<llvm::Module> performIRGeneration(IRGenOptions &Opts,
731
732
if (!targetMachine) return nullptr ;
732
733
733
734
// Create the IR emitter.
734
- IRGenModule IGM (irgen, std::move (targetMachine), nullptr ,
735
- LLVMContext, ModuleName, PSPs);
735
+ IRGenModule IGM (irgen, std::move (targetMachine), nullptr , LLVMContext,
736
+ ModuleName, PSPs.OutputFilename ,
737
+ PSPs.MainInputFilenameForDebugInfo );
736
738
737
739
initLLVMModule (IGM);
738
740
@@ -832,7 +834,7 @@ static std::unique_ptr<llvm::Module> performIRGeneration(IRGenOptions &Opts,
832
834
if (performLLVM (Opts, &IGM.Context .Diags , nullptr , IGM.ModuleHash ,
833
835
IGM.getModule (), IGM.TargetMachine .get (),
834
836
IGM.Context .LangOpts .EffectiveLanguageVersion ,
835
- IGM.PSPs . OutputFilename , IGM.Context .Stats ))
837
+ IGM.OutputFilename , IGM.Context .Stats ))
836
838
return nullptr ;
837
839
}
838
840
@@ -842,17 +844,14 @@ static std::unique_ptr<llvm::Module> performIRGeneration(IRGenOptions &Opts,
842
844
static void ThreadEntryPoint (IRGenerator *irgen,
843
845
llvm::sys::Mutex *DiagMutex, int ThreadIdx) {
844
846
while (IRGenModule *IGM = irgen->fetchFromQueue ()) {
845
- DEBUG (
846
- DiagMutex->lock ();
847
- dbgs () << " thread " << ThreadIdx << " : fetched " <<
848
- IGM->PSPs .OutputFilename << " \n " ;
849
- DiagMutex->unlock ();
850
- );
847
+ DEBUG (DiagMutex->lock (); dbgs () << " thread " << ThreadIdx << " : fetched "
848
+ << IGM->OutputFilename << " \n " ;
849
+ DiagMutex->unlock (););
851
850
embedBitcode (IGM->getModule (), irgen->Opts );
852
851
performLLVM (irgen->Opts , &IGM->Context .Diags , DiagMutex, IGM->ModuleHash ,
853
852
IGM->getModule (), IGM->TargetMachine .get (),
854
853
IGM->Context .LangOpts .EffectiveLanguageVersion ,
855
- IGM->PSPs . OutputFilename , IGM->Context .Stats );
854
+ IGM->OutputFilename , IGM->Context .Stats );
856
855
if (IGM->Context .Diags .hadAnyError ())
857
856
return ;
858
857
}
@@ -867,7 +866,6 @@ static void ThreadEntryPoint(IRGenerator *irgen,
867
866
// / All this is done in multiple threads.
868
867
static void performParallelIRGeneration (
869
868
IRGenOptions &Opts, swift::ModuleDecl *M, std::unique_ptr<SILModule> SILMod,
870
- const SupplementaryOutputPaths &supplementaryOutputPathsForFirstInput,
871
869
StringRef ModuleName, int numThreads,
872
870
ArrayRef<std::string> outputFilenames) {
873
871
@@ -914,12 +912,9 @@ static void performParallelIRGeneration(
914
912
auto Context = new LLVMContext ();
915
913
916
914
// Create the IR emitter.
917
- const bool isFirst = OutputIter == outputFilenames.begin ();
918
- IRGenModule *IGM = new IRGenModule (
919
- irgen, std::move (targetMachine), nextSF, *Context, ModuleName,
920
- PrimarySpecificPaths (*OutputIter++, nextSF->getFilename (),
921
- isFirst ? supplementaryOutputPathsForFirstInput
922
- : SupplementaryOutputPaths ()));
915
+ IRGenModule *IGM =
916
+ new IRGenModule (irgen, std::move (targetMachine), nextSF, *Context,
917
+ ModuleName, *OutputIter++, nextSF->getFilename ());
923
918
IGMcreated = true ;
924
919
925
920
initLLVMModule (*IGM);
@@ -1088,8 +1083,7 @@ std::unique_ptr<llvm::Module> swift::performIRGeneration(
1088
1083
if (SILMod->getOptions ().shouldPerformIRGenerationInParallel () &&
1089
1084
!parallelOutputFilenames.empty ()) {
1090
1085
auto NumThreads = SILMod->getOptions ().NumThreads ;
1091
- ::performParallelIRGeneration (Opts, M, std::move(SILMod),
1092
- PSPs.SupplementaryOutputs, ModuleName,
1086
+ ::performParallelIRGeneration (Opts, M, std::move(SILMod), ModuleName,
1093
1087
NumThreads, parallelOutputFilenames);
1094
1088
// TODO: Parallel LLVM compilation cannot be used if a (single) module is
1095
1089
// needed as return value.
@@ -1127,9 +1121,8 @@ swift::createSwiftModuleObjectFile(SILModule &SILMod, StringRef Buffer,
1127
1121
auto targetMachine = irgen.createTargetMachine ();
1128
1122
if (!targetMachine) return ;
1129
1123
1130
- PrimarySpecificPaths PSPs (OutputPath);
1131
1124
IRGenModule IGM (irgen, std::move (targetMachine), nullptr , VMContext,
1132
- OutputPath, PSPs );
1125
+ OutputPath, OutputPath, " " );
1133
1126
initLLVMModule (IGM);
1134
1127
auto *Ty = llvm::ArrayType::get (IGM.Int8Ty , Buffer.size ());
1135
1128
auto *Data =
0 commit comments