[cfe-dev] OpenCL C: Widths of the integer scalar data types

Pekka Jääskeläinen pekka.jaaskelainen at tut.fi
Tue Jan 10 06:42:40 PST 2012


Hi,

One of the differences between OpenCL C and ISO C99 is that
OpenCL C defines fixed widths for its integer scalar data
types while in ISO C99 they are platform dependent.

In the practical targets of today, this is a problem only with the
long int data type which, e.g., for x86_32 is 32 bits and for
x86_64 is 64 bits of width.

It seems Clang doesn't yet detect the basic scalar data types of
OpenCL C (compiling code with, e.g., ulong or ushort fails) but
strictly relies on the C data types which assumes the implementation
should resort to typedef/macro trickery to get the correct
width type names imported to the OpenCL C kernels.

I think that the data types of OpenCL C should be recognized in Clang
when it compiles OpenCL C code. As their widths are dictated by
the standard, it should generate the fixed width integer datatypes of
the LLVM IR when it encounters an integer data type, right?

I can implement this but as I'm not very familiar with the Clang
code base, I'd appreciate any pointers on where to start poking.

-- 
Pekka



More information about the cfe-dev mailing list