[PATCH] D51544: [OpenCL] Split opencl-c.h header
Anastasia Stulova via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 10 08:32:08 PDT 2018
Anastasia added a comment.
In https://reviews.llvm.org/D51544#1227336, @asavonic wrote:
> In https://reviews.llvm.org/D51544#1227313, @Anastasia wrote:
>
> > Currently the main header still contains everything, so the size of the PCH won't change.
>
>
> The idea is that we don't pre-compile the whole opencl-c.h, we split
> it into several headers (3 of them are target independent) and
> pre-compile them instead.
>
> With this approach, we can reuse target-independent PCHs (common,
> fp16, fp64) and only duplicate target-specific PCHs if needed
> (opencl-c-platform.h).
>
> The idea is basically:
>
> 1. Compile target-independent headers into modules:
> - opencl-c-common.h -> opencl-c-common.pcm
> - opencl-c-fp16.h -> opencl-c-fp16.pcm
> - opencl-c-fp64.h -> opencl-c-fp64.pcm
> 2. Implicitly include opencl-c.h (plain header), which has the following content:
>
>
>
> #include "opencl-c-common.h"
> #if cl_khr_fp16
> #include "opencl-c-fp16.h"
> #endif
> #if cl_khr_fp64
> #include "opencl-c-fp16.h"
> #endif
> #include "opencl-c-platform.h"
>
>
> When compiler reaches an #include statement in opencl-c.h, it loads a
> corresponding PCH. Headers that were not pre-compiled are included as
> usual.
Ok, I see. It seems reasonable. I am not sure if `opencl-c-platform` is the right name, since it seems some of the bits are just version/extension dependent there and not the platform? But perhaps if you add some description with guidelines on what should be put in each header, it should be fine.
Repository:
rC Clang
https://reviews.llvm.org/D51544
More information about the cfe-commits
mailing list