10#include "llvm/Support/VirtualFileSystem.h"
19 const Driver &D,
const llvm::Triple &HostTriple,
20 const llvm::opt::ArgList &Args)
26 if (HostTriple.isWindowsMSVCEnvironment() ||
27 HostTriple.isWindowsItaniumEnvironment()) {
32 if (Args.hasFlag(options::OPT_fsycl, options::OPT_fno_sycl,
false)) {
34 llvm::sys::path::append(LibDir,
"..",
"lib");
38 llvm::sys::path::append(SYCLLibPath,
"LLVMSYCL.lib");
40 if (D.getVFS().exists(SYCLLibPath))
41 SYCLRTLibPath = LibDir;
46 llvm::sys::path::append(LibPath,
"..",
"lib", HostTriple.str(),
51 llvm::sys::path::append(FlatLibPath,
"..",
"lib",
"libLLVMSYCL.so");
53 if (Args.hasFlag(options::OPT_fsycl, options::OPT_fno_sycl,
false)) {
55 if (D.getVFS().exists(LibPath))
56 llvm::sys::path::append(DriverDir,
"..",
"lib", HostTriple.str());
58 else if (D.getVFS().exists(FlatLibPath))
59 llvm::sys::path::append(DriverDir,
"..",
"lib");
64 SYCLRTLibPath = DriverDir;
70 const ArgList &DriverArgs, ArgStringList &CC1Args)
const {
71 if (DriverArgs.hasArg(options::OPT_nobuiltininc))
77 llvm::sys::path::append(IncludePath,
"..",
"include");
78 CC1Args.push_back(
"-internal-isystem");
79 CC1Args.push_back(DriverArgs.MakeArgString(IncludePath));
85 options::OPT_fsanitize_EQ,
86 options::OPT_fcf_protection_EQ,
87 options::OPT_fprofile_generate,
88 options::OPT_fprofile_generate_EQ,
89 options::OPT_fno_profile_generate,
90 options::OPT_ftest_coverage,
91 options::OPT_fno_test_coverage,
92 options::OPT_fcoverage_mapping,
93 options::OPT_fno_coverage_mapping,
94 options::OPT_coverage,
95 options::OPT_fprofile_instr_generate,
96 options::OPT_fprofile_instr_generate_EQ,
97 options::OPT_fno_profile_instr_generate,
98 options::OPT_fprofile_arcs,
99 options::OPT_fno_profile_arcs,
100 options::OPT_fcreate_profile,
101 options::OPT_fprofile_instr_use,
102 options::OPT_fprofile_instr_use_EQ,
103 options::OPT_fcs_profile_generate,
104 options::OPT_fcs_profile_generate_EQ,
106 return UnsupportedOpts;
110 const ToolChain &HostTC,
const ArgList &Args)
111 :
ToolChain(D, Triple, Args), HostTC(HostTC),
112 SYCLInstallation(D, Triple, Args) {
119 if (
const Arg *A = Args.getLastArg(Opt)) {
120 D.Diag(clang::diag::warn_drv_unsupported_option_for_target)
121 << A->getAsString(Args) <<
getTriple().str();
127 const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args,
129 HostTC.addClangTargetOptions(DriverArgs, CC1Args, BA, DeviceOffloadingKind);
132llvm::opt::DerivedArgList *
136 DerivedArgList *DAL = HostTC.TranslateArgs(Args, BA, DeviceOffloadKind);
138 bool IsNewDAL =
false;
140 DAL =
new DerivedArgList(Args.getBaseArgs());
144 for (Arg *A : Args) {
147 auto Opt(A->getOption());
148 bool Unsupported =
false;
150 if (Opt.matches(UnsupportedOpt)) {
151 if (Opt.getID() == options::OPT_fsanitize_EQ &&
152 A->getValues().size() == 1) {
153 std::string SanitizeVal = A->getValue();
154 if (SanitizeVal ==
"address") {
161 DAL->eraseArg(Opt.getID());
173 DAL->eraseArg(options::OPT_march_EQ);
174 DAL->AddJoinedArg(
nullptr, Opts.getOption(options::OPT_march_EQ),
181 HostTC.addClangWarningOptions(CC1Args);
186 return HostTC.GetCXXStdlibType(Args);
190 ArgStringList &CC1Args)
const {
191 SYCLInstallation.addSYCLIncludeArgs(DriverArgs, CC1Args);
195 ArgStringList &CC1Args)
const {
196 HostTC.AddClangSystemIncludeArgs(DriverArgs, CC1Args);
200 ArgStringList &CC1Args)
const {
201 HostTC.AddClangCXXStdlibIncludeArgs(Args, CC1Args);
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
The JSON file list parser is used to communicate input to InstallAPI.
Represents a bound architecture for offload / multiple architecture compilation.