SIL: Share TypeConverter between SILModules in batch mode

This commit is contained in:
Slava Pestov
2019-08-27 21:58:38 -04:00
parent d434188157
commit 01e65e18c4
16 changed files with 71 additions and 37 deletions

View File

@@ -61,6 +61,7 @@ namespace {
struct IRGenContext {
IRGenOptions IROpts;
SILOptions SILOpts;
Lowering::TypeConverter TC;
std::unique_ptr<SILModule> SILMod;
llvm::LLVMContext LLVMContext;
irgen::IRGenerator IRGen;
@@ -69,7 +70,8 @@ struct IRGenContext {
private:
IRGenContext(ASTContext &ctx, ModuleDecl *module)
: IROpts(createIRGenOptions()),
SILMod(SILModule::createEmptyModule(module, SILOpts)),
TC(*module),
SILMod(SILModule::createEmptyModule(module, TC, SILOpts)),
IRGen(IROpts, *SILMod),
IGM(IRGen, IRGen.createTargetMachine(), LLVMContext) {}