]> git.pld-linux.org Git - packages/beignet.git/blame - beignet-llvm9-support.patch
- added dirty llvm11-support patch, now at least builds with llvm 11
[packages/beignet.git] / beignet-llvm9-support.patch
CommitLineData
7d3d7cb5
JB
1Description: Fix build with LLVM/Clang 9
2
3Origin: (mostly) FreeBSD https://svnweb.freebsd.org/ports/head/lang/beignet/files/patch-llvm9?view=markup
4Author: Jan Beich, Rebecca N. Palmer
5
6--- a/CMake/FindLLVM.cmake
7+++ b/CMake/FindLLVM.cmake
8@@ -126,6 +126,9 @@ macro(add_one_lib name)
9 add_one_lib("clangStaticAnalyzerCore")
10 add_one_lib("clangAnalysis")
11 add_one_lib("clangEdit")
12+if (LLVM_VERSION_NODOT VERSION_GREATER 80)
13+add_one_lib("clangASTMatchers")
14+endif (LLVM_VERSION_NODOT VERSION_GREATER 80)
15 add_one_lib("clangAST")
16 add_one_lib("clangParse")
17 add_one_lib("clangSema")
18--- a/backend/src/llvm/llvm_intrinsic_lowering.cpp
19+++ b/backend/src/llvm/llvm_intrinsic_lowering.cpp
20@@ -77,7 +77,11 @@ namespace gbe {
21 std::vector<Type *> ParamTys;
22 for (Value** I = ArgBegin; I != ArgEnd; ++I)
23 ParamTys.push_back((*I)->getType());
24+#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
25+ FunctionCallee FCache = M->getOrInsertFunction(NewFn,
26+#else
27 Constant* FCache = M->getOrInsertFunction(NewFn,
28+#endif
29 FunctionType::get(RetTy, ParamTys, false));
30
31 IRBuilder<> Builder(CI->getParent(), BasicBlock::iterator(CI));
32--- a/backend/src/llvm/llvm_sampler_fix.cpp
33+++ b/backend/src/llvm/llvm_sampler_fix.cpp
34@@ -82,7 +82,11 @@ namespace gbe {
35 #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 40
36 Module *M = I->getParent()->getParent()->getParent();
37 #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 50
38+#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
39+ FunctionCallee samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType());
40+#else
41 Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType());
42+#endif
43 #else
44 Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType(), nullptr);
45 #endif
46@@ -124,7 +128,11 @@ namespace gbe {
47 #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 40
48 Module *M = I->getParent()->getParent()->getParent();
49 #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 50
50+#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
51+ FunctionCallee samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType());
52+#else
53 Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType());
54+#endif
55 #else
56 Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType(), nullptr);
57 #endif
58--- a/backend/src/llvm/llvm_profiling.cpp
59+++ b/backend/src/llvm/llvm_profiling.cpp
60@@ -163,10 +163,18 @@ namespace gbe
61 // __gen_ocl_store_timestamp(int nth, int type);
62 Value *Args[2] = {ConstantInt::get(intTy, pointNum++), ConstantInt::get(intTy, profilingType)};
63 #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 50
64+#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
65+ builder->CreateCall(module->getOrInsertFunction(
66+#else
67 builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunction(
68+#endif
69 "__gen_ocl_calc_timestamp", Type::getVoidTy(module->getContext()),
70 IntegerType::getInt32Ty(module->getContext()),
71+#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
72+ IntegerType::getInt32Ty(module->getContext())),
73+#else
74 IntegerType::getInt32Ty(module->getContext()))),
75+#endif
76 ArrayRef<Value*>(Args));
77 #else
78 builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunction(
79@@ -185,10 +193,18 @@ namespace gbe
80 Value *Args2[2] = {profilingBuf, ConstantInt::get(intTy, profilingType)};
81
82 #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 50
83+#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
84+ builder->CreateCall(module->getOrInsertFunction(
85+#else
86 builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunction(
87+#endif
88 "__gen_ocl_store_profiling", Type::getVoidTy(module->getContext()),
89 ptrTy,
90+#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
91+ IntegerType::getInt32Ty(module->getContext())),
92+#else
93 IntegerType::getInt32Ty(module->getContext()))),
94+#endif
95 ArrayRef<Value*>(Args2));
96 #else
97 builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunction(
98--- a/backend/src/llvm/llvm_device_enqueue.cpp
99+++ b/backend/src/llvm/llvm_device_enqueue.cpp
100@@ -398,8 +398,13 @@ namespace gbe {
101 std::vector<Type *> ParamTys;
102 for (Value** iter = args.begin(); iter != args.end(); ++iter)
103 ParamTys.push_back((*iter)->getType());
104+#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
105+ CallInst* newCI = builder.CreateCall(mod->getOrInsertFunction(
106+ "__gen_enqueue_kernel_slm", FunctionType::get(intTy, ParamTys, false)), args);
107+#else
108 CallInst* newCI = builder.CreateCall(cast<llvm::Function>(mod->getOrInsertFunction(
109 "__gen_enqueue_kernel_slm", FunctionType::get(intTy, ParamTys, false))), args);
110+#endif
111 CI->replaceAllUsesWith(newCI);
112 deadInsnSet.insert(CI);
113 }
This page took 0.065194 seconds and 4 git commands to generate.