[clang] [llvm] [Driver][SYCL] Add initial SYCL offload compilation support (PR #107493)
Tom Honermann via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 17 13:57:28 PDT 2024
================
@@ -979,6 +1000,44 @@ void Driver::CreateOffloadingDeviceToolChains(Compilation &C,
return;
}
+ //
+ // SYCL
+ //
+ // We need to generate a SYCL toolchain if the user specified -fsycl.
+ // If -fsycl is supplied we will assume SPIR-V.
+ bool IsSYCL =
+ C.getInputArgs().hasFlag(options::OPT_fsycl, options::OPT_fno_sycl,
+ false);
+
+ auto argSYCLIncompatible = [&](OptSpecifier OptId) {
+ if (!IsSYCL)
+ return;
+ if (Arg *IncompatArg = C.getInputArgs().getLastArg(OptId))
+ Diag(clang::diag::err_drv_argument_not_allowed_with)
+ << IncompatArg->getSpelling() << "-fsycl";
+ };
+ // -static-libstdc++ is not compatible with -fsycl.
+ argSYCLIncompatible(options::OPT_static_libstdcxx);
+ // -ffreestanding cannot be used with -fsycl
+ argSYCLIncompatible(options::OPT_ffreestanding);
+
+ llvm::SmallVector<llvm::Triple, 4> UniqueSYCLTriplesVec;
+
+ // If -fsycl is supplied we will assume SPIR-V.
----------------
tahonermann wrote:
Actually, this comment doesn't seem all that helpful here either. Perhaps it would be better colocated with `addSYCLDefaultTriple()`. Hmm, no, perhaps `getDefaultSYCLArch()` then?
https://github.com/llvm/llvm-project/pull/107493
More information about the cfe-commits
mailing list