typedef StringMap<uint8_t> StringSet;
- void initialize();
void destroyMergedModule();
std::unique_ptr<LLVMContext> OwnedContext;
LLVMContext &Context;
Linker IRLinker;
- TargetMachine *TargetMach;
- bool EmitDwarfDebugInfo;
- bool ScopeRestrictionsDone;
- lto_codegen_model CodeModel;
+ TargetMachine *TargetMach = nullptr;
+ bool EmitDwarfDebugInfo = false;
+ bool ScopeRestrictionsDone = false;
+ lto_codegen_model CodeModel = LTO_CODEGEN_PIC_MODEL_DEFAULT;
StringSet MustPreserveSymbols;
StringSet AsmUndefinedRefs;
std::unique_ptr<MemoryBuffer> NativeObjectFile;
std::string MAttr;
std::string NativeObjectPath;
TargetOptions Options;
- unsigned OptLevel;
- lto_diagnostic_handler_t DiagHandler;
- void *DiagContext;
- LTOModule *OwnedModule;
- bool ShouldInternalize;
+ unsigned OptLevel = 2;
+ lto_diagnostic_handler_t DiagHandler = nullptr;
+ void *DiagContext = nullptr;
+ LTOModule *OwnedModule = nullptr;
+ bool ShouldInternalize = true;
};
}
#endif
LTOCodeGenerator::LTOCodeGenerator()
: Context(getGlobalContext()), IRLinker(new Module("ld-temp.o", Context)) {
- initialize();
+ initializeLTOPasses();
}
LTOCodeGenerator::LTOCodeGenerator(std::unique_ptr<LLVMContext> Context)
: OwnedContext(std::move(Context)), Context(*OwnedContext),
- IRLinker(new Module("ld-temp.o", *OwnedContext)), OptLevel(2) {
- initialize();
-}
-
-void LTOCodeGenerator::initialize() {
- TargetMach = nullptr;
- EmitDwarfDebugInfo = false;
- ScopeRestrictionsDone = false;
- CodeModel = LTO_CODEGEN_PIC_MODEL_DEFAULT;
- DiagHandler = nullptr;
- DiagContext = nullptr;
- OwnedModule = nullptr;
- ShouldInternalize = true;
-
+ IRLinker(new Module("ld-temp.o", *OwnedContext)) {
initializeLTOPasses();
}