summaryrefslogtreecommitdiff
path: root/backend/src/llvm/llvm_profiling.cpp
diff options
context:
space:
mode:
authorYang Rong <rong.r.yang@intel.com>2017-09-20 16:17:50 +0800
committerYang Rong <rong.r.yang@intel.com>2017-09-21 17:43:12 +0800
commit269c230fbd8ad1e524abe169af88fadc405e5056 (patch)
tree95243f9c5df450d244b1a8388130cbc3e95eba04 /backend/src/llvm/llvm_profiling.cpp
parent4aa4acc7a2ae7530dec031fa27cbd675eeb4dfb2 (diff)
downloadbeignet-269c230fbd8ad1e524abe169af88fadc405e5056.tar.gz
GBE: enable llvm5.0 support.
1. getOrInsertFunction without nullptr. 2. handle f16 rounding. 3. remove llvm value dump. 4. handle AddrSpaceCastInst when parsing block info. V2: use stripPointerCasts instead of BitCast and AddrSpaceCast. Signed-off-by: Yang Rong <rong.r.yang@intel.com> Reviewed-by: Ruiling Song <ruiling.song@intel.com>
Diffstat (limited to 'backend/src/llvm/llvm_profiling.cpp')
-rw-r--r--backend/src/llvm/llvm_profiling.cpp20
1 files changed, 17 insertions, 3 deletions
diff --git a/backend/src/llvm/llvm_profiling.cpp b/backend/src/llvm/llvm_profiling.cpp
index f7e4cc53..2d2ee119 100644
--- a/backend/src/llvm/llvm_profiling.cpp
+++ b/backend/src/llvm/llvm_profiling.cpp
@@ -162,12 +162,19 @@ namespace gbe
/* Add the timestamp store function call. */
// __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
builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunction(
"__gen_ocl_calc_timestamp", Type::getVoidTy(module->getContext()),
IntegerType::getInt32Ty(module->getContext()),
+ IntegerType::getInt32Ty(module->getContext()))),
+ ArrayRef<Value*>(Args));
+#else
+ builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunction(
+ "__gen_ocl_calc_timestamp", Type::getVoidTy(module->getContext()),
IntegerType::getInt32Ty(module->getContext()),
- NULL)),
+ IntegerType::getInt32Ty(module->getContext()), nullptr)),
ArrayRef<Value*>(Args));
+#endif
}
/* We insert one store_profiling at the end of the last block to hold the place. */
llvm::Function::iterator BE = F.end();
@@ -177,12 +184,19 @@ namespace gbe
builder->SetInsertPoint(&*retInst);
Value *Args2[2] = {profilingBuf, ConstantInt::get(intTy, profilingType)};
+#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 50
builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunction(
"__gen_ocl_store_profiling", Type::getVoidTy(module->getContext()),
ptrTy,
- IntegerType::getInt32Ty(module->getContext()),
- NULL)),
+ IntegerType::getInt32Ty(module->getContext()))),
ArrayRef<Value*>(Args2));
+#else
+ builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunction(
+ "__gen_ocl_store_profiling", Type::getVoidTy(module->getContext()),
+ ptrTy,
+ IntegerType::getInt32Ty(module->getContext()), nullptr)),
+ ArrayRef<Value*>(Args2));
+#endif
delete builder;
return changed;