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

Pekka Jääskeläinen pekka.jaaskelainen at tut.fi
Wed Jan 11 06:51:23 PST 2012


Could this be implemented by poking only the following parts of

* ASTContext::InitBuiltinTypes()

In case the current language is OpenCL (LangOpts.OpenCL),
init the integer types as fixed width (and fixed alignment) types.

Might need to define new BuiltinTypes for (U)Int32 etc.

For now it's enough to ensure the 'long' is defined to a 64 bit
type in the target. For starters, it could check if the LongLong of
the target is 64 bits and use that (if Long is not 64 bits).
'long long' of OpenCL is reserved for 128 bit types (6.1.4).

* ASTContext::getTypeInfo.

Detect the fixed-width OCL types here. Return the widths and the
alignment which are dictated by the standard.

After ensuring in Clang that correct fixed width integer types
are used in OpenCL C compilation, one can use typedefs for uint,
ulong, ushort and uchar (like we do currently in pocl). This would
avoid the need to touch the Lex/Parse to support these types.

On 01/10/2012 04:42 PM, Pekka Jääskeläinen wrote:
> 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.


More information about the cfe-dev mailing list