diff --git a/src/abi_ppc64le.cpp b/src/abi_ppc64le.cpp index a35223c8dde32..c47621bf80862 100644 --- a/src/abi_ppc64le.cpp +++ b/src/abi_ppc64le.cpp @@ -106,11 +106,7 @@ bool needPassByRef(jl_datatype_t *dt, AttrBuilder &ab, LLVMContext &ctx, Type *T jl_datatype_t *ty0 = NULL; bool hva = false; if (jl_datatype_size(dt) > 64 && isHFA(dt, &ty0, &hva) > 8) { -#if JL_LLVM_VERSION < 120000 - ab.addAttribute(Attribute::ByVal); -#else ab.addByValAttr(Ty); -#endif return true; } return false; diff --git a/src/abi_win32.cpp b/src/abi_win32.cpp index fa1cfe2225427..078d9b6df4e44 100644 --- a/src/abi_win32.cpp +++ b/src/abi_win32.cpp @@ -53,11 +53,7 @@ bool needPassByRef(jl_datatype_t *dt, AttrBuilder &ab, LLVMContext &ctx, Type *T { // Use pass by reference for all structs if (dt->layout->nfields > 0) { -#if JL_LLVM_VERSION < 120000 - ab.addAttribute(Attribute::ByVal); -#else ab.addByValAttr(Ty); -#endif return true; } return false; diff --git a/src/abi_win64.cpp b/src/abi_win64.cpp index c87e3434f1c1f..ec97203eee5ff 100644 --- a/src/abi_win64.cpp +++ b/src/abi_win64.cpp @@ -63,11 +63,7 @@ bool needPassByRef(jl_datatype_t *dt, AttrBuilder &ab, LLVMContext &ctx, Type *T if (win64_reg_size(size)) return false; if (nargs <= 4) { -#if JL_LLVM_VERSION < 120000 - ab.addAttribute(Attribute::ByVal); -#else ab.addByValAttr(Ty); -#endif } return true; } diff --git a/src/abi_x86.cpp b/src/abi_x86.cpp index fe23bdc9ab8ae..0939fbebc108b 100644 --- a/src/abi_x86.cpp +++ b/src/abi_x86.cpp @@ -72,11 +72,7 @@ bool needPassByRef(jl_datatype_t *dt, AttrBuilder &ab, LLVMContext &ctx, Type *T size_t size = jl_datatype_size(dt); if (is_complex64(dt) || is_complex128(dt) || (jl_is_primitivetype(dt) && size <= 8)) return false; -#if JL_LLVM_VERSION < 120000 - ab.addAttribute(Attribute::ByVal); -#else ab.addByValAttr(Ty); -#endif return true; } diff --git a/src/abi_x86_64.cpp b/src/abi_x86_64.cpp index e5beffce39b0d..2a06ee6be36a6 100644 --- a/src/abi_x86_64.cpp +++ b/src/abi_x86_64.cpp @@ -182,11 +182,7 @@ bool needPassByRef(jl_datatype_t *dt, AttrBuilder &ab, LLVMContext &ctx, Type *T { Classification cl = classify(dt); if (cl.isMemory) { -#if JL_LLVM_VERSION < 120000 - ab.addAttribute(Attribute::ByVal); -#else ab.addByValAttr(Ty); -#endif return true; } @@ -206,12 +202,8 @@ bool needPassByRef(jl_datatype_t *dt, AttrBuilder &ab, LLVMContext &ctx, Type *T else if (jl_is_structtype(dt)) { // spill to memory even though we would ordinarily pass // it in registers -#if JL_LLVM_VERSION < 120000 - ab.addAttribute(Attribute::ByVal); -#else Type* Ty = preferred_llvm_type(dt, false, ctx); ab.addByValAttr(Ty); -#endif return true; } return false; diff --git a/src/ccall.cpp b/src/ccall.cpp index 647735edb37d8..f6d3dd5e8b1f9 100644 --- a/src/ccall.cpp +++ b/src/ccall.cpp @@ -1031,11 +1031,7 @@ std::string generate_func_sig(const char *fname) else if (abi->use_sret((jl_datatype_t*)rt, jl_LLVMContext)) { AttrBuilder retattrs = AttrBuilder(); #if !defined(_OS_WINDOWS_) // llvm used to use the old mingw ABI, skipping this marking works around that difference -#if JL_LLVM_VERSION < 120000 - retattrs.addAttribute(Attribute::StructRet); -#else retattrs.addStructRetAttr(lrt); -#endif #endif retattrs.addAttribute(Attribute::NoAlias); paramattrs.push_back(std::move(retattrs)); diff --git a/src/codegen.cpp b/src/codegen.cpp index 588d992dca9a7..28c4301fd3f76 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -70,9 +70,7 @@ // for configuration options #include #include -#if JL_LLVM_VERSION >= 120000 #include -#endif #include #if defined(_CPU_ARM_) || defined(_CPU_AARCH64_) @@ -8088,11 +8086,7 @@ extern "C" void jl_init_llvm(void) // This is the only way I can find to print the help message once. // It'll be nice if we can iterate through the features and print our own help // message... -#if JL_LLVM_VERSION >= 120000 MSTI->setDefaultFeatures("help", "", ""); -#else - MSTI->setDefaultFeatures("help", ""); -#endif } } // Package up features to be passed to target/subtarget diff --git a/src/jitlayers.cpp b/src/jitlayers.cpp index ba8072afa31fa..b8bc39362291e 100644 --- a/src/jitlayers.cpp +++ b/src/jitlayers.cpp @@ -481,22 +481,12 @@ JL_DLLEXPORT void ORCNotifyObjectEmitted(JITEventListener *Listener, const RuntimeDyld::LoadedObjectInfo &L, RTDyldMemoryManager *memmgr); -#if JL_LLVM_VERSION >= 120000 template void JuliaOJIT::registerObject(const ObjT &Obj, const LoadResult &LO) { const ObjT* Object = &Obj; ORCNotifyObjectEmitted(JuliaListener.get(), *Object, *LO, MemMgr.get()); } -#else -template -void JuliaOJIT::registerObject(RTDyldObjHandleT H, const ObjT &Obj, const LoadResult &LO) -{ - const ObjT* Object = &Obj; - NotifyFinalizer(H, *Object, *LO); - ORCNotifyObjectEmitted(JuliaListener.get(), *Object, *LO, MemMgr.get()); -} -#endif CodeGenOpt::Level CodeGenOptLevelFor(int optlevel) { @@ -636,21 +626,12 @@ JuliaOJIT::JuliaOJIT(TargetMachine &TM, LLVMContext *LLVMCtx) ), CompileLayer(ES, ObjectLayer, std::make_unique(this)) { -#if JL_LLVM_VERSION >= 120000 ObjectLayer.setNotifyLoaded( [this](orc::MaterializationResponsibility &MR, const object::ObjectFile &Object, const RuntimeDyld::LoadedObjectInfo &LOS) { registerObject(Object, &LOS); }); -#else - ObjectLayer.setNotifyLoaded( - [this](RTDyldObjHandleT H, - const object::ObjectFile &Object, - const RuntimeDyld::LoadedObjectInfo &LOS) { - registerObject(H, Object, &LOS); - }); -#endif for (int i = 0; i < 4; i++) { TMs[i] = TM.getTarget().createTargetMachine(TM.getTargetTriple().getTriple(), TM.getTargetCPU(), TM.getTargetFeatureString(), TM.Options, Reloc::Static, TM.getCodeModel(), @@ -734,14 +715,8 @@ void JuliaOJIT::addModule(std::unique_ptr M) } } #endif -#if JL_LLVM_VERSION >= 120000 // TODO: what is the performance characteristics of this? cantFail(CompileLayer.add(JD, orc::ThreadSafeModule(std::move(M), TSCtx))); -#else - auto key = ES.allocateVModule(); - // TODO: what is the performance characteristics of this? - cantFail(CompileLayer.add(JD, orc::ThreadSafeModule(std::move(M), TSCtx), key)); -#endif // force eager compilation (for now), due to memory management specifics // (can't handle compilation recursion) for (auto Name : NewExports) @@ -749,13 +724,6 @@ void JuliaOJIT::addModule(std::unique_ptr M) } -#if JL_LLVM_VERSION < 120000 -void JuliaOJIT::removeModule(ModuleHandleT H) -{ - //(void)CompileLayer.remove(H); -} -#endif - JL_JITSymbol JuliaOJIT::findSymbol(StringRef Name, bool ExportedSymbolsOnly) { orc::JITDylib* SearchOrders[2] = {&GlobalJD, &JD}; @@ -825,22 +793,8 @@ void JuliaOJIT::RegisterJITEventListener(JITEventListener *L) { if (!L) return; -#if JL_LLVM_VERSION >= 120000 this->ObjectLayer.registerJITEventListener(*L); -#else - EventListeners.push_back(L); -#endif -} - -#if JL_LLVM_VERSION < 120000 -void JuliaOJIT::NotifyFinalizer(RTDyldObjHandleT Key, - const object::ObjectFile &Obj, - const RuntimeDyld::LoadedObjectInfo &LoadedObjectInfo) -{ - for (auto &Listener : EventListeners) - Listener->notifyObjectLoaded(Key, Obj, LoadedObjectInfo); } -#endif const DataLayout& JuliaOJIT::getDataLayout() const { diff --git a/src/jitlayers.h b/src/jitlayers.h index 70a017b4f720b..d550170f32508 100644 --- a/src/jitlayers.h +++ b/src/jitlayers.h @@ -143,10 +143,6 @@ typedef JITSymbol JL_JITSymbol; // is expected. typedef JITSymbol JL_SymbolInfo; -#if JL_LLVM_VERSION < 120000 -using RTDyldObjHandleT = orc::VModuleKey; -#endif - using CompilerResultT = Expected>; class JuliaOJIT { @@ -158,38 +154,21 @@ class JuliaOJIT { private: JuliaOJIT &jit; }; -#if JL_LLVM_VERSION >= 120000 // Custom object emission notification handler for the JuliaOJIT template void registerObject(const ObjT &Obj, const LoadResult &LO); -#else - // Custom object emission notification handler for the JuliaOJIT - template - void registerObject(RTDyldObjHandleT H, const ObjT &Obj, const LoadResult &LO); -#endif public: typedef orc::RTDyldObjectLinkingLayer ObjLayerT; typedef orc::IRCompileLayer CompileLayerT; -#if JL_LLVM_VERSION < 120000 - typedef RTDyldObjHandleT ModuleHandleT; -#endif typedef object::OwningBinary OwningObj; JuliaOJIT(TargetMachine &TM, LLVMContext *Ctx); void RegisterJITEventListener(JITEventListener *L); -#if JL_LLVM_VERSION < 120000 - std::vector EventListeners; - void NotifyFinalizer(RTDyldObjHandleT Key, - const object::ObjectFile &Obj, - const RuntimeDyld::LoadedObjectInfo &LoadedObjectInfo); -#endif void addGlobalMapping(StringRef Name, uint64_t Addr); void addModule(std::unique_ptr M); -#if JL_LLVM_VERSION < 120000 - void removeModule(ModuleHandleT H); -#endif + JL_JITSymbol findSymbol(StringRef Name, bool ExportedSymbolsOnly); JL_JITSymbol findUnmangledSymbol(StringRef Name); uint64_t getGlobalValueAddress(StringRef Name); diff --git a/src/llvm-late-gc-lowering.cpp b/src/llvm-late-gc-lowering.cpp index 533ea8f5b145e..e8fdb24138de8 100644 --- a/src/llvm-late-gc-lowering.cpp +++ b/src/llvm-late-gc-lowering.cpp @@ -397,12 +397,8 @@ CountTrackedPointers::CountTrackedPointers(Type *T) { if (isa(T)) count *= cast(T)->getNumElements(); else if (isa(T)) { -#if JL_LLVM_VERSION >= 120000 ElementCount EC = cast(T)->getElementCount(); count *= EC.getKnownMinValue(); -#else - count *= cast(T)->getNumElements(); -#endif } } if (count == 0) @@ -415,12 +411,8 @@ unsigned getCompositeNumElements(Type *T) { else if (auto *AT = dyn_cast(T)) return AT->getNumElements(); else { -#if JL_LLVM_VERSION >= 120000 ElementCount EC = cast(T)->getElementCount(); return EC.getKnownMinValue(); -#else - return cast(T)->getNumElements(); -#endif } } @@ -649,12 +641,8 @@ void LateLowerGCFrame::LiftSelect(State &S, SelectInst *SI) { std::vector Numbers; unsigned NumRoots = 1; if (auto VTy = dyn_cast(SI->getType())) { -#if JL_LLVM_VERSION >= 120000 ElementCount EC = VTy->getElementCount(); Numbers.resize(EC.getKnownMinValue(), -1); -#else - Numbers.resize(VTy->getNumElements(), -1); -#endif } else assert(isa(SI->getType()) && "unimplemented"); @@ -715,12 +703,8 @@ void LateLowerGCFrame::LiftSelect(State &S, SelectInst *SI) { assert(NumRoots == 1); int Number = Numbers[0]; Numbers.resize(0); -#if JL_LLVM_VERSION >= 120000 ElementCount EC = VTy->getElementCount(); Numbers.resize(EC.getKnownMinValue(), Number); -#else - Numbers.resize(VTy->getNumElements(), Number); -#endif } } if (!isa(SI->getType())) diff --git a/src/llvm-version.h b/src/llvm-version.h index 94576cd42895e..6d79abdf271f1 100644 --- a/src/llvm-version.h +++ b/src/llvm-version.h @@ -9,8 +9,8 @@ #define JL_LLVM_VERSION (LLVM_VERSION_MAJOR * 10000 + LLVM_VERSION_MINOR * 100 \ + LLVM_VERSION_PATCH) -#if JL_LLVM_VERSION < 110000 - #error Only LLVM versions >= 11.0.0 are supported by Julia +#if JL_LLVM_VERSION < 120000 + #error Only LLVM versions >= 12.0.0 are supported by Julia #endif #ifdef __cplusplus