mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-15 07:34:33 +00:00
libLTO: Allow LTOCodeGenerator to own a context
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221726 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
d54a2bf8e1
commit
bce40075a9
@ -61,6 +61,7 @@ struct LTOCodeGenerator {
|
|||||||
static const char *getVersionString();
|
static const char *getVersionString();
|
||||||
|
|
||||||
LTOCodeGenerator();
|
LTOCodeGenerator();
|
||||||
|
LTOCodeGenerator(std::unique_ptr<LLVMContext> Context);
|
||||||
~LTOCodeGenerator();
|
~LTOCodeGenerator();
|
||||||
|
|
||||||
// Merge given module, return true on success.
|
// Merge given module, return true on success.
|
||||||
@ -137,6 +138,8 @@ private:
|
|||||||
|
|
||||||
typedef StringMap<uint8_t> StringSet;
|
typedef StringMap<uint8_t> StringSet;
|
||||||
|
|
||||||
|
void initialize();
|
||||||
|
std::unique_ptr<LLVMContext> OwnedContext;
|
||||||
LLVMContext &Context;
|
LLVMContext &Context;
|
||||||
Linker IRLinker;
|
Linker IRLinker;
|
||||||
TargetMachine *TargetMach;
|
TargetMachine *TargetMach;
|
||||||
|
@ -64,10 +64,24 @@ 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)) {
|
||||||
TargetMach(nullptr), EmitDwarfDebugInfo(false),
|
initialize();
|
||||||
ScopeRestrictionsDone(false), CodeModel(LTO_CODEGEN_PIC_MODEL_DEFAULT),
|
}
|
||||||
DiagHandler(nullptr), DiagContext(nullptr) {
|
|
||||||
|
LTOCodeGenerator::LTOCodeGenerator(std::unique_ptr<LLVMContext> Context)
|
||||||
|
: OwnedContext(std::move(Context)), Context(*OwnedContext),
|
||||||
|
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;
|
||||||
|
|
||||||
initializeLTOPasses();
|
initializeLTOPasses();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user