diff options
| author | Alexey Bader <alexey.bader@intel.com> | 2019-02-25 11:48:48 +0000 |
|---|---|---|
| committer | Alexey Bader <alexey.bader@intel.com> | 2019-02-25 11:48:48 +0000 |
| commit | 3f62fa69a7200821969c0a026bdbdfa268f8bb75 (patch) | |
| tree | 7bac1159fba0a14208859e14de814558d5678d54 /clang/lib/Frontend | |
| parent | 478cd32bcb7accbbe956597252700e3ba2e25457 (diff) | |
| download | bcm5719-llvm-3f62fa69a7200821969c0a026bdbdfa268f8bb75.tar.gz bcm5719-llvm-3f62fa69a7200821969c0a026bdbdfa268f8bb75.zip | |
[SYCL] Add clang front-end option to enable SYCL device compilation flow.
Patch by Mariya Podchishchaeva <mariya.podchishchaeva@intel.com>
llvm-svn: 354773
Diffstat (limited to 'clang/lib/Frontend')
| -rw-r--r-- | clang/lib/Frontend/CompilerInvocation.cpp | 2 | ||||
| -rw-r--r-- | clang/lib/Frontend/InitPreprocessor.cpp | 6 |
2 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index 3c4196d3ddc..b1a886241ad 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -2879,6 +2879,8 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK, << Opts.OMPHostIRFile; } + Opts.SYCLIsDevice = Args.hasArg(options::OPT_fsycl_is_device); + // Set CUDA mode for OpenMP target NVPTX if specified in options Opts.OpenMPCUDAMode = Opts.OpenMPIsDevice && T.isNVPTX() && Args.hasArg(options::OPT_fopenmp_cuda_mode); diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp index c9f9f644f37..b0fb124251e 100644 --- a/clang/lib/Frontend/InitPreprocessor.cpp +++ b/clang/lib/Frontend/InitPreprocessor.cpp @@ -1057,6 +1057,12 @@ static void InitializePredefinedMacros(const TargetInfo &TI, Builder.defineMacro("__CLANG_CUDA_APPROX_TRANSCENDENTALS__"); } + // Define a macro indicating that the source file is being compiled with a + // SYCL device compiler which doesn't produce host binary. + if (LangOpts.SYCLIsDevice) { + Builder.defineMacro("__SYCL_DEVICE_ONLY__", "1"); + } + // OpenCL definitions. if (LangOpts.OpenCL) { #define OPENCLEXT(Ext) \ |

