[cfe-dev] OpenCL support

Anton Lokhmotov Anton.Lokhmotov at arm.com
Fri Dec 10 10:21:54 PST 2010


Please review our first patch for OpenCL support in Clang.  It covers
several interrelated features that we found hard to break into smaller
patches:
- kernel qualifier
- pragmas
- extensions
This patch will be followed by relevant test cases.

I would like to discuss couple of points.  

1) For kernel functions (with the __kernel qualifier), we insert named
metadata nodes into LLVM-IR.  Other options we have evaluated included:
- Shipping metadata separately from bitcode.  This would be hard to
standardise on and maintain.
- Using imaginative name mangling.  This would be pretty horrible too and
easy to misuse.

The drawback of course is that metadata can be "silently dropped".  However,
we are not aware of any transforms that would do this.  Perhaps the
community should consider defining "sticky metadata"?

2) We've introduced a new function  *getLangOptionsPtrUnsafe(), because the
OpenCL pragmas handler must be able to modify the language options for the
current context, and LangOptions structure is the most natural place to
store the OpenCL EXTENSIONS and FP_CONTRACT states.  Given such a use,
perhaps constness should be taken away from the getLangOptions()?

Please review and comment.

Many thanks,
Anton.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 000100-kernel-extensions-pragmas.patch
Type: application/octet-stream
Size: 18259 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20101210/3ca7fbed/attachment.obj>


More information about the cfe-dev mailing list