mirror of
https://github.com/Gericom/teak-llvm.git
synced 2025-06-21 04:25:45 -04:00
[Orc][LLJIT] Use JITLink even if a custom JITTargetMachineBuilder is supplied.
LLJITBuilder will now use JITLink on supported platforms even if a custom JITTargetMachineBuilder is supplied, provided that neither the code model, nor the relocation model, nor the ObjectLinkingLayerCreator is set.
This commit is contained in:
parent
3ced23976a
commit
298e183e81
@ -79,12 +79,18 @@ public:
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Get the relocation model.
|
||||||
|
const Optional<Reloc::Model> &getRelocationModel() const { return RM; }
|
||||||
|
|
||||||
/// Set the code model.
|
/// Set the code model.
|
||||||
JITTargetMachineBuilder &setCodeModel(Optional<CodeModel::Model> CM) {
|
JITTargetMachineBuilder &setCodeModel(Optional<CodeModel::Model> CM) {
|
||||||
this->CM = std::move(CM);
|
this->CM = std::move(CM);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Get the code model.
|
||||||
|
const Optional<CodeModel::Model> &getCodeModel() const { return CM; }
|
||||||
|
|
||||||
/// Set the LLVM CodeGen optimization level.
|
/// Set the LLVM CodeGen optimization level.
|
||||||
JITTargetMachineBuilder &setCodeGenOptLevel(CodeGenOpt::Level OptLevel) {
|
JITTargetMachineBuilder &setCodeGenOptLevel(CodeGenOpt::Level OptLevel) {
|
||||||
this->OptLevel = OptLevel;
|
this->OptLevel = OptLevel;
|
||||||
|
@ -24,11 +24,15 @@ Error LLJITBuilderState::prepareForConstruction() {
|
|||||||
JTMB = std::move(*JTMBOrErr);
|
JTMB = std::move(*JTMBOrErr);
|
||||||
else
|
else
|
||||||
return JTMBOrErr.takeError();
|
return JTMBOrErr.takeError();
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the client didn't configure any linker options then auto-configure the
|
||||||
|
// JIT linker.
|
||||||
|
if (!CreateObjectLinkingLayer && JTMB->getCodeModel() == None &&
|
||||||
|
JTMB->getRelocationModel() == None) {
|
||||||
|
|
||||||
// If no ObjectLinkingLayer creator was set and the target supports JITLink
|
|
||||||
// then configure for JITLink.
|
|
||||||
auto &TT = JTMB->getTargetTriple();
|
auto &TT = JTMB->getTargetTriple();
|
||||||
if (!CreateObjectLinkingLayer && TT.isOSBinFormatMachO() &&
|
if (TT.isOSBinFormatMachO() &&
|
||||||
(TT.getArch() == Triple::aarch64 || TT.getArch() == Triple::x86_64)) {
|
(TT.getArch() == Triple::aarch64 || TT.getArch() == Triple::x86_64)) {
|
||||||
|
|
||||||
JTMB->setRelocationModel(Reloc::PIC_);
|
JTMB->setRelocationModel(Reloc::PIC_);
|
||||||
|
Loading…
Reference in New Issue
Block a user