11#include "llvm/Support/VirtualFileSystem.h"
20 const Driver &D,
const llvm::Triple &HostTriple,
21 const llvm::opt::ArgList &Args)
27 if (HostTriple.isWindowsMSVCEnvironment() ||
28 HostTriple.isWindowsItaniumEnvironment()) {
33 if (Args.hasFlag(options::OPT_fsycl, options::OPT_fno_sycl,
false)) {
35 llvm::sys::path::append(LibDir,
"..",
"lib");
39 llvm::sys::path::append(SYCLLibPath,
"LLVMSYCL.lib");
41 if (D.getVFS().exists(SYCLLibPath))
42 SYCLRTLibPath = LibDir;
47 llvm::sys::path::append(LibPath,
"..",
"lib", HostTriple.str(),
52 llvm::sys::path::append(FlatLibPath,
"..",
"lib",
"libLLVMSYCL.so");
54 if (Args.hasFlag(options::OPT_fsycl, options::OPT_fno_sycl,
false)) {
56 if (D.getVFS().exists(LibPath))
57 llvm::sys::path::append(DriverDir,
"..",
"lib", HostTriple.str());
59 else if (D.getVFS().exists(FlatLibPath))
60 llvm::sys::path::append(DriverDir,
"..",
"lib");
65 SYCLRTLibPath = DriverDir;
71 const ArgList &DriverArgs, ArgStringList &CC1Args)
const {
72 if (DriverArgs.hasArg(options::OPT_nobuiltininc))
78 llvm::sys::path::append(IncludePath,
"..",
"include");
79 CC1Args.push_back(
"-internal-isystem");
80 CC1Args.push_back(DriverArgs.MakeArgString(IncludePath));
86 options::OPT_fsanitize_EQ,
87 options::OPT_fcf_protection_EQ,
88 options::OPT_fprofile_generate,
89 options::OPT_fprofile_generate_EQ,
90 options::OPT_fno_profile_generate,
91 options::OPT_ftest_coverage,
92 options::OPT_fno_test_coverage,
93 options::OPT_fcoverage_mapping,
94 options::OPT_fno_coverage_mapping,
95 options::OPT_coverage,
96 options::OPT_fprofile_instr_generate,
97 options::OPT_fprofile_instr_generate_EQ,
98 options::OPT_fno_profile_instr_generate,
99 options::OPT_fprofile_arcs,
100 options::OPT_fno_profile_arcs,
101 options::OPT_fcreate_profile,
102 options::OPT_fprofile_instr_use,
103 options::OPT_fprofile_instr_use_EQ,
104 options::OPT_fcs_profile_generate,
105 options::OPT_fcs_profile_generate_EQ,
107 return UnsupportedOpts;
111 const ToolChain &HostTC,
const ArgList &Args)
112 :
ToolChain(D, Triple, Args), HostTC(HostTC),
113 SYCLInstallation(D, Triple, Args) {
120 if (
const Arg *A = Args.getLastArg(Opt)) {
121 D.Diag(clang::diag::warn_drv_unsupported_option_for_target)
122 << A->getAsString(Args) <<
getTriple().str();
128 const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args,
130 HostTC.addClangTargetOptions(DriverArgs, CC1Args, BA, DeviceOffloadingKind);
133llvm::opt::DerivedArgList *
137 DerivedArgList *DAL = HostTC.TranslateArgs(Args, BA, DeviceOffloadKind);
139 bool IsNewDAL =
false;
141 DAL =
new DerivedArgList(Args.getBaseArgs());
145 for (Arg *A : Args) {
148 auto Opt(A->getOption());
149 bool Unsupported =
false;
151 if (Opt.matches(UnsupportedOpt)) {
152 if (Opt.getID() == options::OPT_fsanitize_EQ &&
153 A->getValues().size() == 1) {
154 std::string SanitizeVal = A->getValue();
155 if (SanitizeVal ==
"address") {
162 DAL->eraseArg(Opt.getID());
174 DAL->eraseArg(options::OPT_march_EQ);
175 DAL->AddJoinedArg(
nullptr, Opts.getOption(options::OPT_march_EQ),
182 HostTC.addClangWarningOptions(CC1Args);
192 return HostTC.GetCXXStdlibType(Args);
196 ArgStringList &CC1Args)
const {
197 SYCLInstallation.addSYCLIncludeArgs(DriverArgs, CC1Args);
201 ArgStringList &CC1Args)
const {
202 HostTC.AddClangSystemIncludeArgs(DriverArgs, CC1Args);
206 ArgStringList &CC1Args)
const {
207 HostTC.AddClangCXXStdlibIncludeArgs(Args, CC1Args);
211 const ArgList &Args)
const {
212 return HostTC.computeMSVCVersion(D, Args);
static ArrayRef< options::ID > getUnsupportedOpts()
Driver - Encapsulate logic for constructing compilation processes from a set of gcc-driver-like comma...
const llvm::opt::OptTable & getOpts() const
SYCLInstallationDetector(const Driver &D, const llvm::Triple &HostTriple, const llvm::opt::ArgList &Args)
void addSYCLIncludeArgs(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const
Top level wrappers for InstallAPI frontend operations.
Represents a bound architecture for offload / multiple architecture compilation.