[PATCH] D74048: [SYCL][Driver] Add clang driver option to enable SYCL compilation mode
Alexey Bader via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 5 08:49:52 PST 2020
bader updated this revision to Diff 242640.
bader added a comment.
Applied clang-format.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D74048/new/
https://reviews.llvm.org/D74048
Files:
clang/include/clang/Driver/Options.td
clang/lib/Driver/ToolChains/Clang.cpp
clang/test/Driver/sycl.c
Index: clang/test/Driver/sycl.c
===================================================================
--- /dev/null
+++ clang/test/Driver/sycl.c
@@ -0,0 +1,10 @@
+// RUN: %clang -### -fsycl -c %s 2>&1 | FileCheck %s --check-prefix=ENABLED
+// RUN: %clang -### -fsycl %s 2>&1 | FileCheck %s --check-prefix=ENABLED
+// RUN: %clang -### -fno-sycl -fsycl %s 2>&1 | FileCheck %s --check-prefix=ENABLED
+// RUN: %clangxx -### -fsycl %s 2>&1 | FileCheck %s --check-prefix=ENABLED
+// RUN: %clangxx -### -fno-sycl %s 2>&1 | FileCheck %s --check-prefix=DISABLED
+// RUN: %clangxx -### -fsycl -fno-sycl %s 2>&1 | FileCheck %s --check-prefix=DISABLED
+// RUN: %clangxx -### %s 2>&1 | FileCheck %s --check-prefix=DISABLED
+
+// ENABLED: "-cc1"{{.*}} "-fsycl-is-device"
+// DISABLED-NOT: "-fsycl-is-device"
Index: clang/lib/Driver/ToolChains/Clang.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -4023,6 +4023,9 @@
CmdArgs.push_back(Args.MakeArgString(NormalizedTriple));
}
+ if (Args.hasFlag(options::OPT_fsycl, options::OPT_fno_sycl, false))
+ CmdArgs.push_back("-fsycl-is-device");
+
if (IsOpenMPDevice) {
// We have to pass the triple of the host if compiling for an OpenMP device.
std::string NormalizedTriple =
Index: clang/include/clang/Driver/Options.td
===================================================================
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -124,6 +124,9 @@
def opencl_Group : OptionGroup<"<opencl group>">, Group<f_Group>,
DocName<"OpenCL flags">;
+def sycl_Group : OptionGroup<"<SYCL group>">, Group<f_Group>,
+ DocName<"SYCL flags">;
+
def m_Group : OptionGroup<"<m group>">, Group<CompileOnly_Group>,
DocName<"Target-dependent compilation options">;
@@ -3407,6 +3410,11 @@
defm underscoring : BooleanFFlag<"underscoring">, Group<gfortran_Group>;
defm whole_file : BooleanFFlag<"whole-file">, Group<gfortran_Group>;
+// C++ SYCL options
+def fsycl : Flag<["-"], "fsycl">, Group<sycl_Group>,
+ HelpText<"Enable SYCL kernels compilation for device">;
+def fno_sycl : Flag<["-"], "fno-sycl">, Group<sycl_Group>,
+ HelpText<"Disable SYCL kernels compilation for device">;
include "CC1Options.td"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74048.242640.patch
Type: text/x-patch
Size: 2362 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200205/7e6039b9/attachment.bin>
More information about the cfe-commits
mailing list