diff options
author | Xiuli Pan <xiulipan@outlook.com> | 2016-02-26 03:13:03 +0000 |
---|---|---|
committer | Xiuli Pan <xiulipan@outlook.com> | 2016-02-26 03:13:03 +0000 |
commit | 11e13f60ea8dc595c34da1024121214544b673cb (patch) | |
tree | efded82997a8ba6888d55fb0e8b798beb7c56a0e /clang/lib/CodeGen/CodeGenFunction.cpp | |
parent | 2a610381bcb7289425b693fb84ccec9d0cc94c8d (diff) | |
download | bcm5719-llvm-11e13f60ea8dc595c34da1024121214544b673cb.tar.gz bcm5719-llvm-11e13f60ea8dc595c34da1024121214544b673cb.zip |
[OpenCL] Refine OpenCLImageAccessAttr to OpenCLAccessAttr
Summary:
OpenCL access qualifiers are now not only used for image types, refine it to avoid misleading,
Add semacheck for OpenCL access qualifier as well as test caees.
Reviewers: pekka.jaaskelainen, Anastasia, aaron.ballman
Subscribers: aaron.ballman, cfe-commits
Differential Revision: http://reviews.llvm.org/D16040
llvm-svn: 261961
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index 3d0b17b9246..8e327c2bc4e 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/lib/CodeGen/CodeGenFunction.cpp @@ -561,15 +561,14 @@ static void GenOpenCLArgMetadata(const FunctionDecl *FD, llvm::Function *Fn, argTypeQuals.push_back(llvm::MDString::get(Context, typeQuals)); // Get image and pipe access qualifier: - // FIXME: now image and pipe share the same access qualifier maybe we can - // refine it to OpenCL access qualifier and also handle write_read if (ty->isImageType()|| ty->isPipeType()) { - const OpenCLImageAccessAttr *A = parm->getAttr<OpenCLImageAccessAttr>(); + const OpenCLAccessAttr *A = parm->getAttr<OpenCLAccessAttr>(); if (A && A->isWriteOnly()) accessQuals.push_back(llvm::MDString::get(Context, "write_only")); + else if (A && A->isReadWrite()) + accessQuals.push_back(llvm::MDString::get(Context, "read_write")); else accessQuals.push_back(llvm::MDString::get(Context, "read_only")); - // FIXME: what about read_write? } else accessQuals.push_back(llvm::MDString::get(Context, "none")); |