clang  6.0.0svn
Hexagon.cpp
Go to the documentation of this file.
1 //===--- Hexagon.cpp - Hexagon ToolChain Implementations --------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #include "Hexagon.h"
11 #include "InputInfo.h"
12 #include "CommonArgs.h"
14 #include "clang/Config/config.h"
16 #include "clang/Driver/Driver.h"
18 #include "clang/Driver/Options.h"
19 #include "llvm/ADT/StringExtras.h"
20 #include "llvm/Option/ArgList.h"
21 #include "llvm/Support/FileSystem.h"
22 #include "llvm/Support/Path.h"
23 
24 using namespace clang::driver;
25 using namespace clang::driver::tools;
26 using namespace clang::driver::toolchains;
27 using namespace clang;
28 using namespace llvm::opt;
29 
30 // Default hvx-length for various versions.
31 static StringRef getDefaultHvxLength(StringRef Cpu) {
32  return llvm::StringSwitch<StringRef>(Cpu)
33  .Case("v60", "64b")
34  .Case("v62", "64b")
35  .Default("128b");
36 }
37 
38 static void handleHVXWarnings(const Driver &D, const ArgList &Args) {
39  // Handle deprecated HVX double warnings.
40  if (Arg *A = Args.getLastArg(options::OPT_mhexagon_hvx_double))
41  D.Diag(diag::warn_drv_deprecated_arg)
42  << A->getAsString(Args) << "-mhvx-length=128B";
43  if (Arg *A = Args.getLastArg(options::OPT_mno_hexagon_hvx_double))
44  D.Diag(diag::warn_drv_deprecated_arg) << A->getAsString(Args) << "-mno-hvx";
45  // Handle the unsupported values passed to mhvx-length.
46  if (Arg *A = Args.getLastArg(options::OPT_mhexagon_hvx_length_EQ)) {
47  StringRef Val = A->getValue();
48  if (Val != "64B" && Val != "128B")
49  D.Diag(diag::err_drv_unsupported_option_argument)
50  << A->getOption().getName() << Val;
51  }
52 }
53 
54 // Handle hvx target features explicitly.
55 static void handleHVXTargetFeatures(const Driver &D, const ArgList &Args,
56  std::vector<StringRef> &Features,
57  bool &HasHVX) {
58  // Handle HVX warnings.
59  handleHVXWarnings(D, Args);
60 
61  // Add the +hvx* features based on commandline flags.
62  StringRef HVXFeature, HVXLength;
64 
65  // Handle -mhvx, -mhvx=, -mno-hvx, -mno-hvx-double.
66  if (Arg *A = Args.getLastArg(
67  options::OPT_mno_hexagon_hvx, options::OPT_mno_hexagon_hvx_double,
68  options::OPT_mhexagon_hvx, options::OPT_mhexagon_hvx_EQ)) {
69  if (A->getOption().matches(options::OPT_mno_hexagon_hvx) ||
70  A->getOption().matches(options::OPT_mno_hexagon_hvx_double)) {
71  return;
72  } else if (A->getOption().matches(options::OPT_mhexagon_hvx_EQ)) {
73  HasHVX = true;
74  HVXFeature = Cpu = A->getValue();
75  HVXFeature = Args.MakeArgString(llvm::Twine("+hvx") + HVXFeature.lower());
76  } else if (A->getOption().matches(options::OPT_mhexagon_hvx)) {
77  HasHVX = true;
78  HVXFeature = Args.MakeArgString(llvm::Twine("+hvx") + Cpu);
79  }
80  Features.push_back(HVXFeature);
81  }
82 
83  // Handle -mhvx-length=, -mhvx-double.
84  if (Arg *A = Args.getLastArg(options::OPT_mhexagon_hvx_length_EQ,
85  options::OPT_mhexagon_hvx_double)) {
86  // These falgs are valid only if HVX in enabled.
87  if (!HasHVX)
88  D.Diag(diag::err_drv_invalid_hvx_length);
89  else if (A->getOption().matches(options::OPT_mhexagon_hvx_length_EQ))
90  HVXLength = A->getValue();
91  else if (A->getOption().matches(options::OPT_mhexagon_hvx_double))
92  HVXLength = "128b";
93  }
94  // Default hvx-length based on Cpu.
95  else if (HasHVX)
96  HVXLength = getDefaultHvxLength(Cpu);
97 
98  if (!HVXLength.empty()) {
99  HVXFeature =
100  Args.MakeArgString(llvm::Twine("+hvx-length") + HVXLength.lower());
101  Features.push_back(HVXFeature);
102  }
103 }
104 
105 // Hexagon target features.
106 void hexagon::getHexagonTargetFeatures(const Driver &D, const ArgList &Args,
107  std::vector<StringRef> &Features) {
108  handleTargetFeaturesGroup(Args, Features,
109  options::OPT_m_hexagon_Features_Group);
110 
111  bool UseLongCalls = false;
112  if (Arg *A = Args.getLastArg(options::OPT_mlong_calls,
113  options::OPT_mno_long_calls)) {
114  if (A->getOption().matches(options::OPT_mlong_calls))
115  UseLongCalls = true;
116  }
117 
118  Features.push_back(UseLongCalls ? "+long-calls" : "-long-calls");
119 
120  bool HasHVX(false);
121  handleHVXTargetFeatures(D, Args, Features, HasHVX);
122 }
123 
124 // Hexagon tools start.
126  ArgStringList &CmdArgs) const {
127 }
128 
130  const InputInfo &Output,
131  const InputInfoList &Inputs,
132  const ArgList &Args,
133  const char *LinkingOutput) const {
134  claimNoWarnArgs(Args);
135 
136  auto &HTC = static_cast<const toolchains::HexagonToolChain&>(getToolChain());
137  const Driver &D = HTC.getDriver();
138  ArgStringList CmdArgs;
139 
140  std::string MArchString = "-march=hexagon";
141  CmdArgs.push_back(Args.MakeArgString(MArchString));
142 
143  RenderExtraToolArgs(JA, CmdArgs);
144 
145  std::string AsName = "hexagon-llvm-mc";
146  std::string MCpuString = "-mcpu=hexagon" +
148  CmdArgs.push_back("-filetype=obj");
149  CmdArgs.push_back(Args.MakeArgString(MCpuString));
150 
151  if (Output.isFilename()) {
152  CmdArgs.push_back("-o");
153  CmdArgs.push_back(Output.getFilename());
154  } else {
155  assert(Output.isNothing() && "Unexpected output");
156  CmdArgs.push_back("-fsyntax-only");
157  }
158 
160  std::string N = llvm::utostr(G.getValue());
161  CmdArgs.push_back(Args.MakeArgString(std::string("-gpsize=") + N));
162  }
163 
164  Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA, options::OPT_Xassembler);
165 
166  // Only pass -x if gcc will understand it; otherwise hope gcc
167  // understands the suffix correctly. The main use case this would go
168  // wrong in is for linker inputs if they happened to have an odd
169  // suffix; really the only way to get this to happen is a command
170  // like '-x foobar a.c' which will treat a.c like a linker input.
171  //
172  // FIXME: For the linker case specifically, can we safely convert
173  // inputs into '-Wl,' options?
174  for (const auto &II : Inputs) {
175  // Don't try to pass LLVM or AST inputs to a generic gcc.
176  if (types::isLLVMIR(II.getType()))
177  D.Diag(clang::diag::err_drv_no_linker_llvm_support)
178  << HTC.getTripleString();
179  else if (II.getType() == types::TY_AST)
180  D.Diag(clang::diag::err_drv_no_ast_support)
181  << HTC.getTripleString();
182  else if (II.getType() == types::TY_ModuleFile)
183  D.Diag(diag::err_drv_no_module_support)
184  << HTC.getTripleString();
185 
186  if (II.isFilename())
187  CmdArgs.push_back(II.getFilename());
188  else
189  // Don't render as input, we need gcc to do the translations.
190  // FIXME: What is this?
191  II.getInputArg().render(Args, CmdArgs);
192  }
193 
194  auto *Exec = Args.MakeArgString(HTC.GetProgramPath(AsName.c_str()));
195  C.addCommand(llvm::make_unique<Command>(JA, *this, Exec, CmdArgs, Inputs));
196 }
197 
199  ArgStringList &CmdArgs) const {
200 }
201 
202 static void
204  const toolchains::HexagonToolChain &HTC,
205  const InputInfo &Output, const InputInfoList &Inputs,
206  const ArgList &Args, ArgStringList &CmdArgs,
207  const char *LinkingOutput) {
208 
209  const Driver &D = HTC.getDriver();
210 
211  //----------------------------------------------------------------------------
212  //
213  //----------------------------------------------------------------------------
214  bool IsStatic = Args.hasArg(options::OPT_static);
215  bool IsShared = Args.hasArg(options::OPT_shared);
216  bool IsPIE = Args.hasArg(options::OPT_pie);
217  bool IncStdLib = !Args.hasArg(options::OPT_nostdlib);
218  bool IncStartFiles = !Args.hasArg(options::OPT_nostartfiles);
219  bool IncDefLibs = !Args.hasArg(options::OPT_nodefaultlibs);
220  bool UseG0 = false;
221  bool UseShared = IsShared && !IsStatic;
222 
223  //----------------------------------------------------------------------------
224  // Silence warnings for various options
225  //----------------------------------------------------------------------------
226  Args.ClaimAllArgs(options::OPT_g_Group);
227  Args.ClaimAllArgs(options::OPT_emit_llvm);
228  Args.ClaimAllArgs(options::OPT_w); // Other warning options are already
229  // handled somewhere else.
230  Args.ClaimAllArgs(options::OPT_static_libgcc);
231 
232  //----------------------------------------------------------------------------
233  //
234  //----------------------------------------------------------------------------
235  if (Args.hasArg(options::OPT_s))
236  CmdArgs.push_back("-s");
237 
238  if (Args.hasArg(options::OPT_r))
239  CmdArgs.push_back("-r");
240 
241  for (const auto &Opt : HTC.ExtraOpts)
242  CmdArgs.push_back(Opt.c_str());
243 
244  CmdArgs.push_back("-march=hexagon");
245  std::string CpuVer =
247  std::string MCpuString = "-mcpu=hexagon" + CpuVer;
248  CmdArgs.push_back(Args.MakeArgString(MCpuString));
249 
250  if (IsShared) {
251  CmdArgs.push_back("-shared");
252  // The following should be the default, but doing as hexagon-gcc does.
253  CmdArgs.push_back("-call_shared");
254  }
255 
256  if (IsStatic)
257  CmdArgs.push_back("-static");
258 
259  if (IsPIE && !IsShared)
260  CmdArgs.push_back("-pie");
261 
263  std::string N = llvm::utostr(G.getValue());
264  CmdArgs.push_back(Args.MakeArgString(std::string("-G") + N));
265  UseG0 = G.getValue() == 0;
266  }
267 
268  //----------------------------------------------------------------------------
269  //
270  //----------------------------------------------------------------------------
271  CmdArgs.push_back("-o");
272  CmdArgs.push_back(Output.getFilename());
273 
274  //----------------------------------------------------------------------------
275  // moslib
276  //----------------------------------------------------------------------------
277  std::vector<std::string> OsLibs;
278  bool HasStandalone = false;
279 
280  for (const Arg *A : Args.filtered(options::OPT_moslib_EQ)) {
281  A->claim();
282  OsLibs.emplace_back(A->getValue());
283  HasStandalone = HasStandalone || (OsLibs.back() == "standalone");
284  }
285  if (OsLibs.empty()) {
286  OsLibs.push_back("standalone");
287  HasStandalone = true;
288  }
289 
290  //----------------------------------------------------------------------------
291  // Start Files
292  //----------------------------------------------------------------------------
293  const std::string MCpuSuffix = "/" + CpuVer;
294  const std::string MCpuG0Suffix = MCpuSuffix + "/G0";
295  const std::string RootDir =
297  const std::string StartSubDir =
298  "hexagon/lib" + (UseG0 ? MCpuG0Suffix : MCpuSuffix);
299 
300  auto Find = [&HTC] (const std::string &RootDir, const std::string &SubDir,
301  const char *Name) -> std::string {
302  std::string RelName = SubDir + Name;
303  std::string P = HTC.GetFilePath(RelName.c_str());
304  if (llvm::sys::fs::exists(P))
305  return P;
306  return RootDir + RelName;
307  };
308 
309  if (IncStdLib && IncStartFiles) {
310  if (!IsShared) {
311  if (HasStandalone) {
312  std::string Crt0SA = Find(RootDir, StartSubDir, "/crt0_standalone.o");
313  CmdArgs.push_back(Args.MakeArgString(Crt0SA));
314  }
315  std::string Crt0 = Find(RootDir, StartSubDir, "/crt0.o");
316  CmdArgs.push_back(Args.MakeArgString(Crt0));
317  }
318  std::string Init = UseShared
319  ? Find(RootDir, StartSubDir + "/pic", "/initS.o")
320  : Find(RootDir, StartSubDir, "/init.o");
321  CmdArgs.push_back(Args.MakeArgString(Init));
322  }
323 
324  //----------------------------------------------------------------------------
325  // Library Search Paths
326  //----------------------------------------------------------------------------
327  const ToolChain::path_list &LibPaths = HTC.getFilePaths();
328  for (const auto &LibPath : LibPaths)
329  CmdArgs.push_back(Args.MakeArgString(StringRef("-L") + LibPath));
330 
331  //----------------------------------------------------------------------------
332  //
333  //----------------------------------------------------------------------------
334  Args.AddAllArgs(CmdArgs,
335  {options::OPT_T_Group, options::OPT_e, options::OPT_s,
336  options::OPT_t, options::OPT_u_Group});
337 
338  AddLinkerInputs(HTC, Inputs, Args, CmdArgs, JA);
339 
340  //----------------------------------------------------------------------------
341  // Libraries
342  //----------------------------------------------------------------------------
343  if (IncStdLib && IncDefLibs) {
344  if (D.CCCIsCXX()) {
345  if (HTC.ShouldLinkCXXStdlib(Args))
346  HTC.AddCXXStdlibLibArgs(Args, CmdArgs);
347  CmdArgs.push_back("-lm");
348  }
349 
350  CmdArgs.push_back("--start-group");
351 
352  if (!IsShared) {
353  for (const std::string &Lib : OsLibs)
354  CmdArgs.push_back(Args.MakeArgString("-l" + Lib));
355  CmdArgs.push_back("-lc");
356  }
357  CmdArgs.push_back("-lgcc");
358 
359  CmdArgs.push_back("--end-group");
360  }
361 
362  //----------------------------------------------------------------------------
363  // End files
364  //----------------------------------------------------------------------------
365  if (IncStdLib && IncStartFiles) {
366  std::string Fini = UseShared
367  ? Find(RootDir, StartSubDir + "/pic", "/finiS.o")
368  : Find(RootDir, StartSubDir, "/fini.o");
369  CmdArgs.push_back(Args.MakeArgString(Fini));
370  }
371 }
372 
374  const InputInfo &Output,
375  const InputInfoList &Inputs,
376  const ArgList &Args,
377  const char *LinkingOutput) const {
378  auto &HTC = static_cast<const toolchains::HexagonToolChain&>(getToolChain());
379 
380  ArgStringList CmdArgs;
381  constructHexagonLinkArgs(C, JA, HTC, Output, Inputs, Args, CmdArgs,
382  LinkingOutput);
383 
384  std::string Linker = HTC.GetProgramPath("hexagon-link");
385  C.addCommand(llvm::make_unique<Command>(JA, *this, Args.MakeArgString(Linker),
386  CmdArgs, Inputs));
387 }
388 // Hexagon tools end.
389 
390 /// Hexagon Toolchain
391 
392 std::string HexagonToolChain::getHexagonTargetDir(
393  const std::string &InstalledDir,
394  const SmallVectorImpl<std::string> &PrefixDirs) const {
395  std::string InstallRelDir;
396  const Driver &D = getDriver();
397 
398  // Locate the rest of the toolchain ...
399  for (auto &I : PrefixDirs)
400  if (D.getVFS().exists(I))
401  return I;
402 
403  if (getVFS().exists(InstallRelDir = InstalledDir + "/../target"))
404  return InstallRelDir;
405 
406  return InstalledDir;
407 }
408 
409 Optional<unsigned> HexagonToolChain::getSmallDataThreshold(
410  const ArgList &Args) {
411  StringRef Gn = "";
412  if (Arg *A = Args.getLastArg(options::OPT_G)) {
413  Gn = A->getValue();
414  } else if (Args.getLastArg(options::OPT_shared, options::OPT_fpic,
415  options::OPT_fPIC)) {
416  Gn = "0";
417  }
418 
419  unsigned G;
420  if (!Gn.getAsInteger(10, G))
421  return G;
422 
423  return None;
424 }
425 
426 void HexagonToolChain::getHexagonLibraryPaths(const ArgList &Args,
427  ToolChain::path_list &LibPaths) const {
428  const Driver &D = getDriver();
429 
430  //----------------------------------------------------------------------------
431  // -L Args
432  //----------------------------------------------------------------------------
433  for (Arg *A : Args.filtered(options::OPT_L))
434  for (const char *Value : A->getValues())
435  LibPaths.push_back(Value);
436 
437  //----------------------------------------------------------------------------
438  // Other standard paths
439  //----------------------------------------------------------------------------
440  std::vector<std::string> RootDirs;
441  std::copy(D.PrefixDirs.begin(), D.PrefixDirs.end(),
442  std::back_inserter(RootDirs));
443 
444  std::string TargetDir = getHexagonTargetDir(D.getInstalledDir(),
445  D.PrefixDirs);
446  if (std::find(RootDirs.begin(), RootDirs.end(), TargetDir) == RootDirs.end())
447  RootDirs.push_back(TargetDir);
448 
449  bool HasPIC = Args.hasArg(options::OPT_fpic, options::OPT_fPIC);
450  // Assume G0 with -shared.
451  bool HasG0 = Args.hasArg(options::OPT_shared);
452  if (auto G = getSmallDataThreshold(Args))
453  HasG0 = G.getValue() == 0;
454 
455  const std::string CpuVer = GetTargetCPUVersion(Args).str();
456  for (auto &Dir : RootDirs) {
457  std::string LibDir = Dir + "/hexagon/lib";
458  std::string LibDirCpu = LibDir + '/' + CpuVer;
459  if (HasG0) {
460  if (HasPIC)
461  LibPaths.push_back(LibDirCpu + "/G0/pic");
462  LibPaths.push_back(LibDirCpu + "/G0");
463  }
464  LibPaths.push_back(LibDirCpu);
465  LibPaths.push_back(LibDir);
466  }
467 }
468 
469 HexagonToolChain::HexagonToolChain(const Driver &D, const llvm::Triple &Triple,
470  const llvm::opt::ArgList &Args)
471  : Linux(D, Triple, Args) {
472  const std::string TargetDir = getHexagonTargetDir(D.getInstalledDir(),
473  D.PrefixDirs);
474 
475  // Note: Generic_GCC::Generic_GCC adds InstalledDir and getDriver().Dir to
476  // program paths
477  const std::string BinDir(TargetDir + "/bin");
478  if (D.getVFS().exists(BinDir))
479  getProgramPaths().push_back(BinDir);
480 
481  ToolChain::path_list &LibPaths = getFilePaths();
482 
483  // Remove paths added by Linux toolchain. Currently Hexagon_TC really targets
484  // 'elf' OS type, so the Linux paths are not appropriate. When we actually
485  // support 'linux' we'll need to fix this up
486  LibPaths.clear();
487  getHexagonLibraryPaths(Args, LibPaths);
488 }
489 
491 
493  return new tools::hexagon::Assembler(*this);
494 }
495 
497  return new tools::hexagon::Linker(*this);
498 }
499 
501  const llvm::opt::ArgList &DriverArgs) const {
502  // Copied in large part from lib/Frontend/CompilerInvocation.cpp.
503  Arg *A = DriverArgs.getLastArg(options::OPT_O_Group);
504  if (!A)
505  return 0;
506 
507  if (A->getOption().matches(options::OPT_O0))
508  return 0;
509  if (A->getOption().matches(options::OPT_Ofast) ||
510  A->getOption().matches(options::OPT_O4))
511  return 3;
512  assert(A->getNumValues() != 0);
513  StringRef S(A->getValue());
514  if (S == "s" || S == "z" || S.empty())
515  return 2;
516  if (S == "g")
517  return 1;
518 
519  unsigned OptLevel;
520  if (S.getAsInteger(10, OptLevel))
521  return 0;
522  return OptLevel;
523 }
524 
525 void HexagonToolChain::addClangTargetOptions(const ArgList &DriverArgs,
526  ArgStringList &CC1Args,
527  Action::OffloadKind) const {
528  if (DriverArgs.hasArg(options::OPT_ffp_contract))
529  return;
530  unsigned OptLevel = getOptimizationLevel(DriverArgs);
531  if (OptLevel >= 3)
532  CC1Args.push_back("-ffp-contract=fast");
533 }
534 
535 void HexagonToolChain::AddClangSystemIncludeArgs(const ArgList &DriverArgs,
536  ArgStringList &CC1Args) const {
537  if (DriverArgs.hasArg(options::OPT_nostdinc) ||
538  DriverArgs.hasArg(options::OPT_nostdlibinc))
539  return;
540 
541  const Driver &D = getDriver();
542  std::string TargetDir = getHexagonTargetDir(D.getInstalledDir(),
543  D.PrefixDirs);
544  addExternCSystemInclude(DriverArgs, CC1Args, TargetDir + "/hexagon/include");
545 }
546 
547 
549  const llvm::opt::ArgList &DriverArgs,
550  llvm::opt::ArgStringList &CC1Args) const {
551  const Driver &D = getDriver();
552  std::string TargetDir = getHexagonTargetDir(D.InstalledDir, D.PrefixDirs);
553  addLibStdCXXIncludePaths(TargetDir, "/hexagon/include/c++", "", "", "", "",
554  DriverArgs, CC1Args);
555 }
556 
558 HexagonToolChain::GetCXXStdlibType(const ArgList &Args) const {
559  Arg *A = Args.getLastArg(options::OPT_stdlib_EQ);
560  if (!A)
562 
563  StringRef Value = A->getValue();
564  if (Value != "libstdc++")
565  getDriver().Diag(diag::err_drv_invalid_stdlib_name) << A->getAsString(Args);
566 
568 }
569 
570 //
571 // Returns the default CPU for Hexagon. This is the default compilation target
572 // if no Hexagon processor is selected at the command-line.
573 //
575  return "hexagonv60";
576 }
577 
578 const StringRef HexagonToolChain::GetTargetCPUVersion(const ArgList &Args) {
579  Arg *CpuArg = nullptr;
580  if (Arg *A = Args.getLastArg(options::OPT_mcpu_EQ, options::OPT_march_EQ))
581  CpuArg = A;
582 
583  StringRef CPU = CpuArg ? CpuArg->getValue() : GetDefaultCPU();
584  if (CPU.startswith("hexagon"))
585  return CPU.substr(sizeof("hexagon") - 1);
586  return CPU;
587 }
static void addExternCSystemInclude(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args, const Twine &Path)
Utility function to add a system include directory with extern "C" semantics to CC1 arguments...
Definition: ToolChain.cpp:679
void handleTargetFeaturesGroup(const llvm::opt::ArgList &Args, std::vector< StringRef > &Features, llvm::opt::OptSpecifier Group)
SmallVector< std::string, 16 > path_list
Definition: ToolChain.h:75
prefix_list PrefixDirs
Definition: Driver.h:146
StringRef P
DiagnosticBuilder Diag(unsigned DiagID) const
Definition: Driver.h:116
const char * getFilename() const
Definition: InputInfo.h:84
virtual void RenderExtraToolArgs(const JobAction &JA, llvm::opt::ArgStringList &CmdArgs) const
Definition: Hexagon.cpp:198
path_list & getProgramPaths()
Definition: ToolChain.h:205
InputInfo - Wrapper for information about an input source.
Definition: InputInfo.h:23
std::string GetFilePath(const char *Name) const
Definition: ToolChain.cpp:391
void addClangTargetOptions(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args, Action::OffloadKind DeviceOffloadKind) const override
Add options that need to be passed to cc1 for this target.
Definition: Hexagon.cpp:525
path_list & getFilePaths()
Definition: ToolChain.h:202
Driver - Encapsulate logic for constructing compilation processes from a set of gcc-driver-like comma...
Definition: Driver.h:65
static void constructHexagonLinkArgs(Compilation &C, const JobAction &JA, const toolchains::HexagonToolChain &HTC, const InputInfo &Output, const InputInfoList &Inputs, const ArgList &Args, ArgStringList &CmdArgs, const char *LinkingOutput)
Definition: Hexagon.cpp:203
void addLibStdCxxIncludePaths(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const override
Definition: Hexagon.cpp:548
void getHexagonLibraryPaths(const llvm::opt::ArgList &Args, ToolChain::path_list &LibPaths) const
Definition: Hexagon.cpp:426
void RenderExtraToolArgs(const JobAction &JA, llvm::opt::ArgStringList &CmdArgs) const
Definition: Hexagon.cpp:125
static const StringRef GetTargetCPUVersion(const llvm::opt::ArgList &Args)
Definition: Hexagon.cpp:578
void addCommand(std::unique_ptr< Command > C)
Definition: Compilation.h:189
std::string getHexagonTargetDir(const std::string &InstalledDir, const SmallVectorImpl< std::string > &PrefixDirs) const
Hexagon Toolchain.
Definition: Hexagon.cpp:392
void AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const override
Add the clang cc1 arguments for system include paths.
Definition: Hexagon.cpp:535
vfs::FileSystem & getVFS() const
Definition: Driver.h:284
const Driver & getDriver() const
Definition: ToolChain.h:167
std::string InstalledDir
The path to the installed clang directory, if any.
Definition: Driver.h:136
bool CCCIsCXX() const
Whether the driver should follow g++ like behavior.
Definition: Driver.h:174
static void handleHVXTargetFeatures(const Driver &D, const ArgList &Args, std::vector< StringRef > &Features, bool &HasHVX)
Definition: Hexagon.cpp:55
unsigned getOptimizationLevel(const llvm::opt::ArgList &DriverArgs) const
Definition: Hexagon.cpp:500
Tool * buildAssembler() const override
Definition: Hexagon.cpp:492
CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const override
Definition: Hexagon.cpp:558
bool ShouldLinkCXXStdlib(const llvm::opt::ArgList &Args) const
Returns if the C++ standard library should be linked in.
Definition: ToolChain.cpp:717
Dataflow Directional Tag Classes.
void AddLinkerInputs(const ToolChain &TC, const InputInfoList &Inputs, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs, const JobAction &JA)
void getHexagonTargetFeatures(const Driver &D, const llvm::opt::ArgList &Args, std::vector< StringRef > &Features)
Tool - Information on a specific compilation tool.
Definition: Tool.h:34
Defines the virtual file system interface vfs::FileSystem.
void claimNoWarnArgs(const llvm::opt::ArgList &Args)
const char * getInstalledDir() const
Get the path to where the clang executable was installed.
Definition: Driver.h:301
bool exists(const Twine &Path)
Check whether a file exists. Provided for convenience.
Compilation - A set of tasks to perform for a single driver invocation.
Definition: Compilation.h:34
static Optional< unsigned > getSmallDataThreshold(const llvm::opt::ArgList &Args)
Definition: Hexagon.cpp:409
static StringRef getDefaultHvxLength(StringRef Cpu)
Definition: Hexagon.cpp:31
void ConstructJob(Compilation &C, const JobAction &JA, const InputInfo &Output, const InputInfoList &Inputs, const llvm::opt::ArgList &TCArgs, const char *LinkingOutput) const override
ConstructJob - Construct jobs to perform the action JA, writing to Output and with Inputs...
Definition: Hexagon.cpp:129
bool isNothing() const
Definition: InputInfo.h:75
bool isFilename() const
Definition: InputInfo.h:76
static const StringRef GetDefaultCPU()
Definition: Hexagon.cpp:574
bool addLibStdCXXIncludePaths(Twine Base, Twine Suffix, StringRef GCCTriple, StringRef GCCMultiarchTriple, StringRef TargetMultiarchTriple, Twine IncludeSuffix, const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const
Helper to add the variant paths of a libstdc++ installation.
Definition: Gnu.cpp:2294
static void handleHVXWarnings(const Driver &D, const ArgList &Args)
Definition: Hexagon.cpp:38
std::vector< std::string > ExtraOpts
Definition: Linux.h:46
bool isLLVMIR(ID Id)
Is this LLVM IR.
Definition: Types.cpp:148
virtual void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs) const
AddCXXStdlibLibArgs - Add the system specific linker arguments to use for the given C++ standard libr...
Definition: ToolChain.cpp:723
void ConstructJob(Compilation &C, const JobAction &JA, const InputInfo &Output, const InputInfoList &Inputs, const llvm::opt::ArgList &TCArgs, const char *LinkingOutput) const override
ConstructJob - Construct jobs to perform the action JA, writing to Output and with Inputs...
Definition: Hexagon.cpp:373