]> git.pld-linux.org Git - packages/beignet.git/blobdiff - beignet-llvm9-support.patch
- merged some Debian patches
[packages/beignet.git] / beignet-llvm9-support.patch
diff --git a/beignet-llvm9-support.patch b/beignet-llvm9-support.patch
new file mode 100644 (file)
index 0000000..5bcb516
--- /dev/null
@@ -0,0 +1,113 @@
+Description: Fix build with LLVM/Clang 9
+
+Origin: (mostly) FreeBSD https://svnweb.freebsd.org/ports/head/lang/beignet/files/patch-llvm9?view=markup
+Author: Jan Beich, Rebecca N. Palmer
+
+--- a/CMake/FindLLVM.cmake
++++ b/CMake/FindLLVM.cmake
+@@ -126,6 +126,9 @@ macro(add_one_lib name)
+ add_one_lib("clangStaticAnalyzerCore")
+ add_one_lib("clangAnalysis")
+ add_one_lib("clangEdit")
++if (LLVM_VERSION_NODOT VERSION_GREATER 80)
++add_one_lib("clangASTMatchers")
++endif (LLVM_VERSION_NODOT VERSION_GREATER 80)
+ add_one_lib("clangAST")
+ add_one_lib("clangParse")
+ add_one_lib("clangSema")
+--- a/backend/src/llvm/llvm_intrinsic_lowering.cpp
++++ b/backend/src/llvm/llvm_intrinsic_lowering.cpp
+@@ -77,7 +77,11 @@ namespace gbe {
+         std::vector<Type *> ParamTys;
+         for (Value** I = ArgBegin; I != ArgEnd; ++I)
+           ParamTys.push_back((*I)->getType());
++#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
++        FunctionCallee FCache = M->getOrInsertFunction(NewFn,
++#else
+         Constant* FCache = M->getOrInsertFunction(NewFn,
++#endif
+                                         FunctionType::get(RetTy, ParamTys, false));
+         IRBuilder<> Builder(CI->getParent(), BasicBlock::iterator(CI));
+--- a/backend/src/llvm/llvm_sampler_fix.cpp
++++ b/backend/src/llvm/llvm_sampler_fix.cpp
+@@ -82,7 +82,11 @@ namespace gbe {
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 40
+           Module *M = I->getParent()->getParent()->getParent();
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 50
++#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
++          FunctionCallee samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType());
++#else
+           Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType());
++#endif
+ #else
+           Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType(), nullptr);
+ #endif
+@@ -124,7 +128,11 @@ namespace gbe {
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 40
+           Module *M = I->getParent()->getParent()->getParent();
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 50
++#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
++          FunctionCallee samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType());
++#else
+           Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType());
++#endif
+ #else
+           Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType(), nullptr);
+ #endif
+--- a/backend/src/llvm/llvm_profiling.cpp
++++ b/backend/src/llvm/llvm_profiling.cpp
+@@ -163,10 +163,18 @@ namespace gbe
+       // __gen_ocl_store_timestamp(int nth, int type);
+       Value *Args[2] = {ConstantInt::get(intTy, pointNum++), ConstantInt::get(intTy, profilingType)};
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 50
++#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
++      builder->CreateCall(module->getOrInsertFunction(
++#else
+       builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunction(
++#endif
+               "__gen_ocl_calc_timestamp", Type::getVoidTy(module->getContext()),
+               IntegerType::getInt32Ty(module->getContext()),
++#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
++              IntegerType::getInt32Ty(module->getContext())),
++#else
+               IntegerType::getInt32Ty(module->getContext()))),
++#endif
+               ArrayRef<Value*>(Args));
+ #else
+       builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunction(
+@@ -185,10 +193,18 @@ namespace gbe
+     Value *Args2[2] = {profilingBuf, ConstantInt::get(intTy, profilingType)};
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 50
++#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
++    builder->CreateCall(module->getOrInsertFunction(
++#else
+     builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunction(
++#endif
+             "__gen_ocl_store_profiling", Type::getVoidTy(module->getContext()),
+             ptrTy,
++#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
++            IntegerType::getInt32Ty(module->getContext())),
++#else
+             IntegerType::getInt32Ty(module->getContext()))),
++#endif
+             ArrayRef<Value*>(Args2));
+ #else
+     builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunction(
+--- a/backend/src/llvm/llvm_device_enqueue.cpp
++++ b/backend/src/llvm/llvm_device_enqueue.cpp
+@@ -398,8 +398,13 @@ namespace gbe {
+               std::vector<Type *> ParamTys;
+               for (Value** iter = args.begin(); iter != args.end(); ++iter)
+                 ParamTys.push_back((*iter)->getType());
++#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
++              CallInst* newCI = builder.CreateCall(mod->getOrInsertFunction(
++                              "__gen_enqueue_kernel_slm", FunctionType::get(intTy, ParamTys, false)), args);
++#else
+               CallInst* newCI = builder.CreateCall(cast<llvm::Function>(mod->getOrInsertFunction(
+                               "__gen_enqueue_kernel_slm", FunctionType::get(intTy, ParamTys, false))), args);
++#endif
+               CI->replaceAllUsesWith(newCI);
+               deadInsnSet.insert(CI);
+             }
This page took 0.058734 seconds and 4 git commands to generate.