diff options
Diffstat (limited to 'contrib/llvm/tools/clang/lib/CodeGen/CGOpenCLRuntime.cpp')
-rw-r--r-- | contrib/llvm/tools/clang/lib/CodeGen/CGOpenCLRuntime.cpp | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/contrib/llvm/tools/clang/lib/CodeGen/CGOpenCLRuntime.cpp b/contrib/llvm/tools/clang/lib/CodeGen/CGOpenCLRuntime.cpp index 7c454ac..079ef72 100644 --- a/contrib/llvm/tools/clang/lib/CodeGen/CGOpenCLRuntime.cpp +++ b/contrib/llvm/tools/clang/lib/CodeGen/CGOpenCLRuntime.cpp @@ -33,32 +33,35 @@ llvm::Type *CGOpenCLRuntime::convertOpenCLSpecificType(const Type *T) { assert(T->isOpenCLSpecificType() && "Not an OpenCL specific type!"); + llvm::LLVMContext& Ctx = CGM.getLLVMContext(); + uint32_t ImgAddrSpc = + CGM.getContext().getTargetAddressSpace(LangAS::opencl_global); switch (cast<BuiltinType>(T)->getKind()) { default: llvm_unreachable("Unexpected opencl builtin type!"); - return 0; + return nullptr; case BuiltinType::OCLImage1d: return llvm::PointerType::get(llvm::StructType::create( - CGM.getLLVMContext(), "opencl.image1d_t"), 0); + Ctx, "opencl.image1d_t"), ImgAddrSpc); case BuiltinType::OCLImage1dArray: return llvm::PointerType::get(llvm::StructType::create( - CGM.getLLVMContext(), "opencl.image1d_array_t"), 0); + Ctx, "opencl.image1d_array_t"), ImgAddrSpc); case BuiltinType::OCLImage1dBuffer: return llvm::PointerType::get(llvm::StructType::create( - CGM.getLLVMContext(), "opencl.image1d_buffer_t"), 0); + Ctx, "opencl.image1d_buffer_t"), ImgAddrSpc); case BuiltinType::OCLImage2d: return llvm::PointerType::get(llvm::StructType::create( - CGM.getLLVMContext(), "opencl.image2d_t"), 0); + Ctx, "opencl.image2d_t"), ImgAddrSpc); case BuiltinType::OCLImage2dArray: return llvm::PointerType::get(llvm::StructType::create( - CGM.getLLVMContext(), "opencl.image2d_array_t"), 0); + Ctx, "opencl.image2d_array_t"), ImgAddrSpc); case BuiltinType::OCLImage3d: return llvm::PointerType::get(llvm::StructType::create( - CGM.getLLVMContext(), "opencl.image3d_t"), 0); + Ctx, "opencl.image3d_t"), ImgAddrSpc); case BuiltinType::OCLSampler: - return llvm::IntegerType::get(CGM.getLLVMContext(),32); + return llvm::IntegerType::get(Ctx, 32); case BuiltinType::OCLEvent: return llvm::PointerType::get(llvm::StructType::create( - CGM.getLLVMContext(), "opencl.event_t"), 0); + Ctx, "opencl.event_t"), 0); } } |