123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- --- a/CMake/FindLLVM.cmake
- +++ b/CMake/FindLLVM.cmake
- @@ -116,6 +116,9 @@ macro(add_one_lib name)
- endmacro()
-
- #Assume clang lib path same as llvm lib path
- +if (LLVM_VERSION_NODOT VERSION_GREATER 80)
- +add_one_lib("clang-cpp")
- +endif (LLVM_VERSION_NODOT VERSION_GREATER 80)
- add_one_lib("clangCodeGen")
- add_one_lib("clangFrontend")
- add_one_lib("clangSerialization")
- --- 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);
- }
|