Skip to content

Commit

Permalink
Drop support for LLVM 14 (JuliaLang#53094)
Browse files Browse the repository at this point in the history
  • Loading branch information
giordano committed Jan 29, 2024
1 parent 741b5da commit 9669eec
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 47 deletions.
2 changes: 0 additions & 2 deletions src/cgutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3489,10 +3489,8 @@ static Value *emit_allocobj(jl_codectx_t &ctx, size_t static_size, Value *jt,
if (static_size > 0)
call->addRetAttr(Attribute::getWithDereferenceableBytes(call->getContext(), static_size));
call->addRetAttr(Attribute::getWithAlignment(call->getContext(), Align(align)));
#if JL_LLVM_VERSION >= 150000
if (fully_initialized)
call->addFnAttr(Attribute::get(call->getContext(), Attribute::AllocKind, uint64_t(AllocFnKind::Alloc | AllocFnKind::Uninitialized)));
#endif
return call;
}

Expand Down
9 changes: 0 additions & 9 deletions src/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1051,9 +1051,7 @@ static const auto jl_alloc_obj_func = new JuliaFunction<TypeFnContextAndSizeT>{
[](LLVMContext &C) {
auto FnAttrs = AttrBuilder(C);
FnAttrs.addAllocSizeAttr(1, None); // returns %1 bytes
#if JL_LLVM_VERSION >= 150000
FnAttrs.addAllocKindAttr(AllocFnKind::Alloc);
#endif
#if JL_LLVM_VERSION >= 160000
FnAttrs.addMemoryAttr(MemoryEffects::argMemOnly(ModRefInfo::Ref) | MemoryEffects::inaccessibleMemOnly(ModRefInfo::ModRef));
#endif
Expand Down Expand Up @@ -2628,11 +2626,7 @@ static void jl_init_function(Function *F, const Triple &TT)
attr.addStackAlignmentAttr(16);
}
if (TT.isOSWindows() && TT.getArch() == Triple::x86_64) {
#if JL_LLVM_VERSION < 150000
attr.addAttribute(Attribute::UWTable); // force NeedsWinEH
#else
attr.addUWTableAttr(llvm::UWTableKind::Default); // force NeedsWinEH
#endif
}
if (jl_fpo_disabled(TT))
attr.addAttribute("frame-pointer", "all");
Expand Down Expand Up @@ -9580,9 +9574,6 @@ extern "C" void jl_init_llvm(void)
// Initialize passes
PassRegistry &Registry = *PassRegistry::getPassRegistry();
initializeCore(Registry);
#if JL_LLVM_VERSION < 150000
initializeCoroutines(Registry);
#endif
initializeScalarOpts(Registry);
initializeVectorization(Registry);
initializeAnalysis(Registry);
Expand Down
19 changes: 0 additions & 19 deletions src/disasm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -797,11 +797,7 @@ static const char *SymbolLookup(void *DisInfo, uint64_t ReferenceValue, uint64_t

static int OpInfoLookup(void *DisInfo, uint64_t PC,
uint64_t Offset,
#if JL_LLVM_VERSION < 150000
uint64_t Size,
#else
uint64_t OpSize, uint64_t InstSize,
#endif
int TagType, void *TagBuf)
{
// SymbolTable *SymTab = (SymbolTable*)DisInfo;
Expand Down Expand Up @@ -910,11 +906,7 @@ static void jl_dump_asm_internal(
std::unique_ptr<MCCodeEmitter> CE;
std::unique_ptr<MCAsmBackend> MAB;
if (ShowEncoding) {
#if JL_LLVM_VERSION >= 150000
CE.reset(TheTarget->createMCCodeEmitter(*MCII, Ctx));
#else
CE.reset(TheTarget->createMCCodeEmitter(*MCII, *MRI, Ctx));
#endif
MAB.reset(TheTarget->createMCAsmBackend(*STI, *MRI, Options));
}

Expand All @@ -929,11 +921,7 @@ static void jl_dump_asm_internal(
IP.release(),
std::move(CE), std::move(MAB),
/*ShowInst*/ false));
#if JL_LLVM_VERSION >= 140000
Streamer->initSections(true, *STI);
#else
Streamer->InitSections(true);
#endif

// Make the MemoryObject wrapper
ArrayRef<uint8_t> memoryObject(const_cast<uint8_t*>((const uint8_t*)Fptr),Fsize);
Expand Down Expand Up @@ -1049,9 +1037,6 @@ static void jl_dump_asm_internal(
MCInst Inst;
MCDisassembler::DecodeStatus S;
FuncMCView view = memoryObject.slice(Index);
#if JL_LLVM_VERSION < 150000
#define getCommentOS() GetCommentOS()
#endif
S = DisAsm->getInstruction(Inst, insSize, view, 0,
/*CStream*/ pass != 0 ? Streamer->getCommentOS () : nulls());
if (pass != 0 && Streamer->getCommentOS ().tell() > 0)
Expand Down Expand Up @@ -1256,11 +1241,7 @@ jl_value_t *jl_dump_function_asm_impl(jl_llvmf_dump_t* dump, char emit_mc, const
STI, MRI, TM->Options.MCOptions));
std::unique_ptr<MCCodeEmitter> MCE;
if (binary) { // enable MCAsmStreamer::AddEncodingComment printing
#if JL_LLVM_VERSION >= 150000
MCE.reset(TM->getTarget().createMCCodeEmitter(MII, *Context));
#else
MCE.reset(TM->getTarget().createMCCodeEmitter(MII, MRI, *Context));
#endif
}
auto FOut = std::make_unique<formatted_raw_ostream>(asmfile);
std::unique_ptr<MCStreamer> S(TM->getTarget().createAsmStreamer(
Expand Down
6 changes: 1 addition & 5 deletions src/jitlayers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ using namespace llvm;
# include <llvm/ExecutionEngine/Orc/DebuggerSupportPlugin.h>
# include <llvm/ExecutionEngine/JITLink/EHFrameSupport.h>
# include <llvm/ExecutionEngine/JITLink/JITLinkMemoryManager.h>
# if JL_LLVM_VERSION >= 150000
# include <llvm/ExecutionEngine/Orc/MapperJITLinkMemoryManager.h>
# endif
# include <llvm/ExecutionEngine/SectionMemoryManager.h>

#define DEBUG_TYPE "julia_jitlayers"
Expand Down Expand Up @@ -1006,9 +1004,7 @@ class JLMemoryUsagePlugin : public ObjectLinkingLayer::Plugin {
// TODO: Port our memory management optimisations to JITLink instead of using the
// default InProcessMemoryManager.
std::unique_ptr<jitlink::JITLinkMemoryManager> createJITLinkMemoryManager() {
#if JL_LLVM_VERSION < 150000
return cantFail(jitlink::InProcessMemoryManager::Create());
#elif JL_LLVM_VERSION < 160000
#if JL_LLVM_VERSION < 160000
return cantFail(orc::MapperJITLinkMemoryManager::CreateWithMapper<orc::InProcessMemoryMapper>());
#else
return cantFail(orc::MapperJITLinkMemoryManager::CreateWithMapper<orc::InProcessMemoryMapper>(/*Reservation Granularity*/ 16 * 1024 * 1024));
Expand Down
10 changes: 1 addition & 9 deletions src/jitlayers.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,8 @@
#endif
// The sanitizers don't play well with our memory manager

#if defined(JL_FORCE_JITLINK) || JL_LLVM_VERSION >= 150000 && defined(HAS_SANITIZER)
#if defined(JL_FORCE_JITLINK) || defined(_CPU_AARCH64_) || defined(HAS_SANITIZER)
# define JL_USE_JITLINK
#else
# if defined(_CPU_AARCH64_)
# if defined(_OS_LINUX_) && JL_LLVM_VERSION < 150000
# pragma message("On aarch64-gnu-linux, LLVM version >= 15 is required for JITLink; fallback suffers from occasional segfaults")
# else
# define JL_USE_JITLINK
# endif
# endif
#endif

# include <llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h>
Expand Down
3 changes: 0 additions & 3 deletions src/pipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,6 @@ namespace {
// .sinkCommonInsts(true)
;
}
#if JL_LLVM_VERSION < 150000
#define LICMOptions()
#endif

// At any given time exactly one of each pair of overloads is strictly unused
#ifdef _COMPILER_GCC_
Expand Down

0 comments on commit 9669eec

Please sign in to comment.