[PATCH] D51544: [OpenCL] Split opencl-c.h header
Andrew Savonichev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 7 08:02:55 PDT 2018
asavonic added a comment.
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.
Repository:
rC Clang
https://reviews.llvm.org/D51544
More information about the cfe-commits
mailing list