summarylogtreecommitdiffstats
path: root/llvm9.patch
blob: 5bcb516d5a41d30b105e73007cb67aade9bee847 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
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);
             }