[cfe-dev] [OpenCL patch] sampler_t as a builtin type

Tanya Lattner lattner at apple.com
Wed Mar 9 16:54:14 PST 2011


This patch adds the OpenCL sampler type as a built in type. The sampler type is defined as follows:

The sampler_t type is a 32-bit unsigned int constant and is interpreted as a bit-field that specifies the following properties:
Addressing Mode, Filter Mode, Normalized Coordinates. These properties control how elements of an image object are read by read_image{f|i|ui}.

We made this a built in type because we needed a way to distinguish it from normal integers when checking for special properties of the sampler type (ie. global samplers are not required to be in the constant address space while global integers are).

A simple test case is included.

I was not sure what to do about these warnings since I'm not familiar with this code. If you have some suggestions, please let me know:

CIndexUSRs.cpp: In member function ‘void<unnamed>::USRGenerator::VisitType(clang::QualType)’:
CIndexUSRs.cpp:526: warning: enumeration value ‘Sampler’ not handled in switch

CIndex.cpp: In member function ‘bool<unnamed>::CursorVisitor::VisitBuiltinTypeLoc(clang::BuiltinTypeLoc)’:
CIndex.cpp:1356: warning: enumeration value ‘Sampler’ not handled in switch

For your review:




Thanks,
Tanya

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110309/98de8c6c/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: samplerTy.patch
Type: application/octet-stream
Size: 14394 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110309/98de8c6c/attachment.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110309/98de8c6c/attachment-0001.html>


More information about the cfe-dev mailing list