mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-07 14:33:15 +00:00
LTO: Simplify code generator initialization
Simplify `LTOCodeGenerator` initialization by initializing simple fields at their definition. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235939 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
5d3a9d6339
commit
ae51ba7ea1
@ -155,15 +155,14 @@ private:
|
|||||||
|
|
||||||
typedef StringMap<uint8_t> StringSet;
|
typedef StringMap<uint8_t> StringSet;
|
||||||
|
|
||||||
void initialize();
|
|
||||||
void destroyMergedModule();
|
void destroyMergedModule();
|
||||||
std::unique_ptr<LLVMContext> OwnedContext;
|
std::unique_ptr<LLVMContext> OwnedContext;
|
||||||
LLVMContext &Context;
|
LLVMContext &Context;
|
||||||
Linker IRLinker;
|
Linker IRLinker;
|
||||||
TargetMachine *TargetMach;
|
TargetMachine *TargetMach = nullptr;
|
||||||
bool EmitDwarfDebugInfo;
|
bool EmitDwarfDebugInfo = false;
|
||||||
bool ScopeRestrictionsDone;
|
bool ScopeRestrictionsDone = false;
|
||||||
lto_codegen_model CodeModel;
|
lto_codegen_model CodeModel = LTO_CODEGEN_PIC_MODEL_DEFAULT;
|
||||||
StringSet MustPreserveSymbols;
|
StringSet MustPreserveSymbols;
|
||||||
StringSet AsmUndefinedRefs;
|
StringSet AsmUndefinedRefs;
|
||||||
std::unique_ptr<MemoryBuffer> NativeObjectFile;
|
std::unique_ptr<MemoryBuffer> NativeObjectFile;
|
||||||
@ -172,11 +171,11 @@ private:
|
|||||||
std::string MAttr;
|
std::string MAttr;
|
||||||
std::string NativeObjectPath;
|
std::string NativeObjectPath;
|
||||||
TargetOptions Options;
|
TargetOptions Options;
|
||||||
unsigned OptLevel;
|
unsigned OptLevel = 2;
|
||||||
lto_diagnostic_handler_t DiagHandler;
|
lto_diagnostic_handler_t DiagHandler = nullptr;
|
||||||
void *DiagContext;
|
void *DiagContext = nullptr;
|
||||||
LTOModule *OwnedModule;
|
LTOModule *OwnedModule = nullptr;
|
||||||
bool ShouldInternalize;
|
bool ShouldInternalize = true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -65,25 +65,12 @@ const char* LTOCodeGenerator::getVersionString() {
|
|||||||
|
|
||||||
LTOCodeGenerator::LTOCodeGenerator()
|
LTOCodeGenerator::LTOCodeGenerator()
|
||||||
: Context(getGlobalContext()), IRLinker(new Module("ld-temp.o", Context)) {
|
: Context(getGlobalContext()), IRLinker(new Module("ld-temp.o", Context)) {
|
||||||
initialize();
|
initializeLTOPasses();
|
||||||
}
|
}
|
||||||
|
|
||||||
LTOCodeGenerator::LTOCodeGenerator(std::unique_ptr<LLVMContext> Context)
|
LTOCodeGenerator::LTOCodeGenerator(std::unique_ptr<LLVMContext> Context)
|
||||||
: OwnedContext(std::move(Context)), Context(*OwnedContext),
|
: OwnedContext(std::move(Context)), Context(*OwnedContext),
|
||||||
IRLinker(new Module("ld-temp.o", *OwnedContext)), OptLevel(2) {
|
IRLinker(new Module("ld-temp.o", *OwnedContext)) {
|
||||||
initialize();
|
|
||||||
}
|
|
||||||
|
|
||||||
void LTOCodeGenerator::initialize() {
|
|
||||||
TargetMach = nullptr;
|
|
||||||
EmitDwarfDebugInfo = false;
|
|
||||||
ScopeRestrictionsDone = false;
|
|
||||||
CodeModel = LTO_CODEGEN_PIC_MODEL_DEFAULT;
|
|
||||||
DiagHandler = nullptr;
|
|
||||||
DiagContext = nullptr;
|
|
||||||
OwnedModule = nullptr;
|
|
||||||
ShouldInternalize = true;
|
|
||||||
|
|
||||||
initializeLTOPasses();
|
initializeLTOPasses();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user