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