[PATCH] D18369: [OpenCL] Upstreaming khronos OpenCL header file.

Xiuli PAN via cfe-commits cfe-commits at lists.llvm.org
Sun May 8 20:33:46 PDT 2016


pxli168 added a comment.

In http://reviews.llvm.org/D18369#422367, @yaxunl wrote:

> In http://reviews.llvm.org/D18369#421963, @pxli168 wrote:
>
> > If we want to save some space, could we use some macro to expand the gentype or some script to expand the gentype into each types when the clang is build?
>
>
> We need to balance between space and readability. When I absorbed __attribute__((overloadable)) into __const_func to save space, it did not sacrifice readability. However using macro with gentype will cause the header file more difficult to read.


But I don't think this kind of so long header is easy to read, it contains full pages of the same function with different types and it is hard to see if anyone is missing or find where these functions end. In spec builtin functions can be represented by

> gentype ctz (gentype x)

>  gentype max (gentype x, gentype y)

>  gentype max (gentype x, sgentype y)


If we could use some macro or script to generate the actual builtin functions, it seems more likely spec and clear to read, also will avoid missing or typo.


http://reviews.llvm.org/D18369





More information about the cfe-commits mailing list