[cfe-dev] OpenCL types mangling.

Bader, Alexey via cfe-dev cfe-dev at lists.llvm.org
Thu Nov 26 02:59:28 PST 2015


Hi,

I'd like to discuss current mangling rules for OpenCL built-in types.

OpenCL specification defines number of built-in types:

-          Vector types e.g. int4, half8, etc.

-          Image types e.g. image2d_t, image

-          Sampler type - sampler_t

-          ...

All those types are mangled by clang using Itanium C++ ABI<https://mentorembedded.github.io/cxx-abi/abi.html>, which doesn't describe mangling of OpenCL types, but if we extend it naturally, OpenCL built-in types should be excluded from substitution as built-in type. BTW, it's the way how SPIR 1.2 defines it (appending A of https://www.khronos.org/registry/spir/specs/spir_spec-1.2.pdf).

Clang 3.6+ substitutes OpenCL built-in types although they were not compressed before this commit<https://github.com/llvm-mirror/clang/commit/76742aedda1189059fbc0a4c6af6d0285dbec9da>. This looks like unintentional change.
Unfortunately recovering original behavior will solve the problem only partially.
OpenCL built-in vector types are implemented not as Clang's built-in types, but as vector extension types, so they will require special case in mangler.

I'd like to have an agreement within clang community on how to handle substitution of OpenCL built-in types since it's not part of the OpenCL specification, but rather internal compiler design. Is it OK to disable OpenCL built-in type compression? The only con of this approach is the length of mangled types. If I get it correctly built-in types are exceptions because their compression will not reduce the size of the mangled name and for some types even increase.

Does it worth documenting mangling rules for OpenCL built-in types?

- Alexey


--------------------------------------------------------------------
Joint Stock Company Intel A/O
Registered legal address: Krylatsky Hills Business Park,
17 Krylatskaya Str., Bldg 4, Moscow 121614,
Russian Federation

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20151126/6c39c814/attachment.html>


More information about the cfe-dev mailing list