[cfe-dev] intptr_t type in OpenCL programs

Sahasrabuddhe, Sameer Sameer.Sahasrabuddhe at amd.com
Tue Mar 4 22:46:34 PST 2014


Hi Albert,

The "intptr_t" type does not need special handling in Clang, since it can be created using other types. For example, the Khronos version of Clang uses the following definition in an implicit header:


                   typedef ptrdiff_t intptr_t;

where ptrdiff_t itself is typedef'd to something else:

https://github.com/KhronosGroup/SPIR-Tools/blob/master/headers/opencl_spir.h#L83

The general idea is to put such declarations in a separate header, and use the "-include" argument for Clang to include this header at the beginning of the OpenCL file being compiled.

Also, have you checked out the Khronos SPIR generator, which is based on Clang? It is maintained in a separate github repository, but most of the changes there are being merged into upstream Clang. This frontend can be combined with the SPIR-Tools header mentioned above to get almost complete support for OpenCL 1.2

https://github.com/KhronosGroup/SPIR/tree/spir_12

Sameer.

From: cfe-dev-bounces at cs.uiuc.edu [mailto:cfe-dev-bounces at cs.uiuc.edu] On Behalf Of Dorrington, Albert
Sent: Friday, February 28, 2014 1:05 AM
To: cfe-dev at cs.uiuc.edu
Subject: [cfe-dev] intptr_t type in OpenCL programs

When trying to compile a kernel that uses the 'intptr_t' type, I am getting an error for 'use of undeclared identifier'

Is the intptr_t implemented in Clang for OpenCL?
Where would I look in the code to find out?

Thanks!

Al Dorrington
Software Engineer Sr
Lockheed Martin, Mission Systems and Training

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140305/c69e6fcf/attachment.html>


More information about the cfe-dev mailing list