[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 06:20:56 PST 2020
bader created this revision.
bader added a reviewer: ABataev.
Herald added subscribers: cfe-commits, Anastasia, ebevhan.
Herald added a project: clang.
As a first step this implementation enables compilation of the offload
code.
Repository:
rG LLVM Github Monorepo
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,5 @@
+// RUN: %clang -### -fsycl -c %s 2>&1 | FileCheck %s --check-prefix=DEFAULT
+// RUN: %clang -### -fsycl %s 2>&1 | FileCheck %s --check-prefix=DEFAULT
+// RUN: %clangxx -### -fsycl %s 2>&1 | FileCheck %s --check-prefix=DEFAULT
+
+// DEFAULT: "-fsycl-is-device"
Index: clang/lib/Driver/ToolChains/Clang.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -4010,6 +4010,11 @@
CmdArgs.push_back(Args.MakeArgString(NormalizedTriple));
}
+ bool IsSYCL = Args.hasArg(options::OPT_fsycl);
+ if (IsSYCL) {
+ 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">;
@@ -3405,6 +3408,9 @@
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">;
include "CC1Options.td"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74048.242587.patch
Type: text/x-patch
Size: 1871 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200205/b2673bdb/attachment-0001.bin>
More information about the cfe-commits
mailing list