ToolChains.h revision 263508
1//===--- ToolChains.h - 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#ifndef CLANG_LIB_DRIVER_TOOLCHAINS_H_ 11#define CLANG_LIB_DRIVER_TOOLCHAINS_H_ 12 13#include "Tools.h" 14#include "clang/Basic/VersionTuple.h" 15#include "clang/Driver/Action.h" 16#include "clang/Driver/ToolChain.h" 17#include "llvm/ADT/DenseMap.h" 18#include "llvm/Support/Compiler.h" 19#include <vector> 20#include <set> 21 22namespace clang { 23namespace driver { 24namespace toolchains { 25 26/// Generic_GCC - A tool chain using the 'gcc' command to perform 27/// all subcommands; this relies on gcc translating the majority of 28/// command line options. 29class LLVM_LIBRARY_VISIBILITY Generic_GCC : public ToolChain { 30protected: 31 /// \brief Struct to store and manipulate GCC versions. 32 /// 33 /// We rely on assumptions about the form and structure of GCC version 34 /// numbers: they consist of at most three '.'-separated components, and each 35 /// component is a non-negative integer except for the last component. For 36 /// the last component we are very flexible in order to tolerate release 37 /// candidates or 'x' wildcards. 38 /// 39 /// Note that the ordering established among GCCVersions is based on the 40 /// preferred version string to use. For example we prefer versions without 41 /// a hard-coded patch number to those with a hard coded patch number. 42 /// 43 /// Currently this doesn't provide any logic for textual suffixes to patches 44 /// in the way that (for example) Debian's version format does. If that ever 45 /// becomes necessary, it can be added. 46 struct GCCVersion { 47 /// \brief The unparsed text of the version. 48 std::string Text; 49 50 /// \brief The parsed major, minor, and patch numbers. 51 int Major, Minor, Patch; 52 53 /// \brief The text of the parsed major, and major+minor versions. 54 std::string MajorStr, MinorStr; 55 56 /// \brief Any textual suffix on the patch number. 57 std::string PatchSuffix; 58 59 static GCCVersion Parse(StringRef VersionText); 60 bool isOlderThan(int RHSMajor, int RHSMinor, int RHSPatch, 61 StringRef RHSPatchSuffix = StringRef()) const; 62 bool operator<(const GCCVersion &RHS) const { 63 return isOlderThan(RHS.Major, RHS.Minor, RHS.Patch, RHS.PatchSuffix); 64 } 65 bool operator>(const GCCVersion &RHS) const { return RHS < *this; } 66 bool operator<=(const GCCVersion &RHS) const { return !(*this > RHS); } 67 bool operator>=(const GCCVersion &RHS) const { return !(*this < RHS); } 68 }; 69 70 71 /// \brief This is a class to find a viable GCC installation for Clang to 72 /// use. 73 /// 74 /// This class tries to find a GCC installation on the system, and report 75 /// information about it. It starts from the host information provided to the 76 /// Driver, and has logic for fuzzing that where appropriate. 77 class GCCInstallationDetector { 78 bool IsValid; 79 const Driver &D; 80 llvm::Triple GCCTriple; 81 82 // FIXME: These might be better as path objects. 83 std::string GCCInstallPath; 84 std::string GCCBiarchSuffix; 85 std::string GCCParentLibPath; 86 std::string GCCMIPSABIDirSuffix; 87 88 GCCVersion Version; 89 90 // We retain the list of install paths that were considered and rejected in 91 // order to print out detailed information in verbose mode. 92 std::set<std::string> CandidateGCCInstallPaths; 93 94 public: 95 GCCInstallationDetector(const Driver &D) : IsValid(false), D(D) {} 96 void init(const llvm::Triple &TargetTriple, const llvm::opt::ArgList &Args); 97 98 /// \brief Check whether we detected a valid GCC install. 99 bool isValid() const { return IsValid; } 100 101 /// \brief Get the GCC triple for the detected install. 102 const llvm::Triple &getTriple() const { return GCCTriple; } 103 104 /// \brief Get the detected GCC installation path. 105 StringRef getInstallPath() const { return GCCInstallPath; } 106 107 /// \brief Get the detected GCC installation path suffix for the bi-arch 108 /// target variant. 109 StringRef getBiarchSuffix() const { return GCCBiarchSuffix; } 110 111 /// \brief Get the detected GCC parent lib path. 112 StringRef getParentLibPath() const { return GCCParentLibPath; } 113 114 /// \brief Get the detected GCC MIPS ABI directory suffix. 115 /// 116 /// This is used as a suffix both to the install directory of GCC and as 117 /// a suffix to its parent lib path in order to select a MIPS ABI-specific 118 /// subdirectory. 119 /// 120 /// This will always be empty for any non-MIPS target. 121 /// 122 // FIXME: This probably shouldn't exist at all, and should be factored 123 // into the multiarch and/or biarch support. Please don't add more uses of 124 // this interface, it is meant as a legacy crutch for the MIPS driver 125 // logic. 126 StringRef getMIPSABIDirSuffix() const { return GCCMIPSABIDirSuffix; } 127 128 /// \brief Get the detected GCC version string. 129 const GCCVersion &getVersion() const { return Version; } 130 131 /// \brief Print information about the detected GCC installation. 132 void print(raw_ostream &OS) const; 133 134 private: 135 static void 136 CollectLibDirsAndTriples(const llvm::Triple &TargetTriple, 137 const llvm::Triple &BiarchTriple, 138 SmallVectorImpl<StringRef> &LibDirs, 139 SmallVectorImpl<StringRef> &TripleAliases, 140 SmallVectorImpl<StringRef> &BiarchLibDirs, 141 SmallVectorImpl<StringRef> &BiarchTripleAliases); 142 143 void ScanLibDirForGCCTriple(llvm::Triple::ArchType TargetArch, 144 const llvm::opt::ArgList &Args, 145 const std::string &LibDir, 146 StringRef CandidateTriple, 147 bool NeedsBiarchSuffix = false); 148 149 void findMIPSABIDirSuffix(std::string &Suffix, 150 llvm::Triple::ArchType TargetArch, StringRef Path, 151 const llvm::opt::ArgList &Args); 152 }; 153 154 GCCInstallationDetector GCCInstallation; 155 156public: 157 Generic_GCC(const Driver &D, const llvm::Triple &Triple, 158 const llvm::opt::ArgList &Args); 159 ~Generic_GCC(); 160 161 virtual void printVerboseInfo(raw_ostream &OS) const; 162 163 virtual bool IsUnwindTablesDefault() const; 164 virtual bool isPICDefault() const; 165 virtual bool isPIEDefault() const; 166 virtual bool isPICDefaultForced() const; 167 168protected: 169 virtual Tool *getTool(Action::ActionClass AC) const; 170 virtual Tool *buildAssembler() const; 171 virtual Tool *buildLinker() const; 172 173 /// \name ToolChain Implementation Helper Functions 174 /// @{ 175 176 /// \brief Check whether the target triple's architecture is 64-bits. 177 bool isTarget64Bit() const { return getTriple().isArch64Bit(); } 178 179 /// \brief Check whether the target triple's architecture is 32-bits. 180 bool isTarget32Bit() const { return getTriple().isArch32Bit(); } 181 182 /// @} 183 184private: 185 mutable OwningPtr<tools::gcc::Preprocess> Preprocess; 186 mutable OwningPtr<tools::gcc::Precompile> Precompile; 187 mutable OwningPtr<tools::gcc::Compile> Compile; 188}; 189 190 /// Darwin - The base Darwin tool chain. 191class LLVM_LIBRARY_VISIBILITY Darwin : public ToolChain { 192public: 193 /// The host version. 194 unsigned DarwinVersion[3]; 195 196protected: 197 virtual Tool *buildAssembler() const; 198 virtual Tool *buildLinker() const; 199 virtual Tool *getTool(Action::ActionClass AC) const; 200 201private: 202 mutable OwningPtr<tools::darwin::Lipo> Lipo; 203 mutable OwningPtr<tools::darwin::Dsymutil> Dsymutil; 204 mutable OwningPtr<tools::darwin::VerifyDebug> VerifyDebug; 205 206 /// Whether the information on the target has been initialized. 207 // 208 // FIXME: This should be eliminated. What we want to do is make this part of 209 // the "default target for arguments" selection process, once we get out of 210 // the argument translation business. 211 mutable bool TargetInitialized; 212 213 /// Whether we are targeting iPhoneOS target. 214 mutable bool TargetIsIPhoneOS; 215 216 /// Whether we are targeting the iPhoneOS simulator target. 217 mutable bool TargetIsIPhoneOSSimulator; 218 219 /// The OS version we are targeting. 220 mutable VersionTuple TargetVersion; 221 222private: 223 /// The default macosx-version-min of this tool chain; empty until 224 /// initialized. 225 std::string MacosxVersionMin; 226 227 /// The default ios-version-min of this tool chain; empty until 228 /// initialized. 229 std::string iOSVersionMin; 230 231private: 232 void AddDeploymentTarget(llvm::opt::DerivedArgList &Args) const; 233 234public: 235 Darwin(const Driver &D, const llvm::Triple &Triple, 236 const llvm::opt::ArgList &Args); 237 ~Darwin(); 238 239 std::string ComputeEffectiveClangTriple(const llvm::opt::ArgList &Args, 240 types::ID InputType) const; 241 242 /// @name Darwin Specific Toolchain API 243 /// { 244 245 // FIXME: Eliminate these ...Target functions and derive separate tool chains 246 // for these targets and put version in constructor. 247 void setTarget(bool IsIPhoneOS, unsigned Major, unsigned Minor, 248 unsigned Micro, bool IsIOSSim) const { 249 assert((!IsIOSSim || IsIPhoneOS) && "Unexpected deployment target!"); 250 251 // FIXME: For now, allow reinitialization as long as values don't 252 // change. This will go away when we move away from argument translation. 253 if (TargetInitialized && TargetIsIPhoneOS == IsIPhoneOS && 254 TargetIsIPhoneOSSimulator == IsIOSSim && 255 TargetVersion == VersionTuple(Major, Minor, Micro)) 256 return; 257 258 assert(!TargetInitialized && "Target already initialized!"); 259 TargetInitialized = true; 260 TargetIsIPhoneOS = IsIPhoneOS; 261 TargetIsIPhoneOSSimulator = IsIOSSim; 262 TargetVersion = VersionTuple(Major, Minor, Micro); 263 } 264 265 bool isTargetIPhoneOS() const { 266 assert(TargetInitialized && "Target not initialized!"); 267 return TargetIsIPhoneOS; 268 } 269 270 bool isTargetIOSSimulator() const { 271 assert(TargetInitialized && "Target not initialized!"); 272 return TargetIsIPhoneOSSimulator; 273 } 274 275 bool isTargetMacOS() const { 276 return !isTargetIOSSimulator() && !isTargetIPhoneOS(); 277 } 278 279 bool isTargetInitialized() const { return TargetInitialized; } 280 281 VersionTuple getTargetVersion() const { 282 assert(TargetInitialized && "Target not initialized!"); 283 return TargetVersion; 284 } 285 286 /// getDarwinArchName - Get the "Darwin" arch name for a particular compiler 287 /// invocation. For example, Darwin treats different ARM variations as 288 /// distinct architectures. 289 StringRef getDarwinArchName(const llvm::opt::ArgList &Args) const; 290 291 bool isIPhoneOSVersionLT(unsigned V0, unsigned V1=0, unsigned V2=0) const { 292 assert(isTargetIPhoneOS() && "Unexpected call for OS X target!"); 293 return TargetVersion < VersionTuple(V0, V1, V2); 294 } 295 296 bool isMacosxVersionLT(unsigned V0, unsigned V1=0, unsigned V2=0) const { 297 assert(!isTargetIPhoneOS() && "Unexpected call for iPhoneOS target!"); 298 return TargetVersion < VersionTuple(V0, V1, V2); 299 } 300 301 /// AddLinkARCArgs - Add the linker arguments to link the ARC runtime library. 302 virtual void AddLinkARCArgs(const llvm::opt::ArgList &Args, 303 llvm::opt::ArgStringList &CmdArgs) const = 0; 304 305 /// AddLinkRuntimeLibArgs - Add the linker arguments to link the compiler 306 /// runtime library. 307 virtual void 308 AddLinkRuntimeLibArgs(const llvm::opt::ArgList &Args, 309 llvm::opt::ArgStringList &CmdArgs) const = 0; 310 311 /// } 312 /// @name ToolChain Implementation 313 /// { 314 315 virtual types::ID LookupTypeForExtension(const char *Ext) const; 316 317 virtual bool HasNativeLLVMSupport() const; 318 319 virtual ObjCRuntime getDefaultObjCRuntime(bool isNonFragile) const; 320 virtual bool hasBlocksRuntime() const; 321 322 virtual llvm::opt::DerivedArgList * 323 TranslateArgs(const llvm::opt::DerivedArgList &Args, 324 const char *BoundArch) const; 325 326 virtual bool IsBlocksDefault() const { 327 // Always allow blocks on Darwin; users interested in versioning are 328 // expected to use /usr/include/Blocks.h. 329 return true; 330 } 331 virtual bool IsIntegratedAssemblerDefault() const { 332 // Default integrated assembler to on for Darwin. 333 return true; 334 } 335 336 virtual bool IsMathErrnoDefault() const { 337 return false; 338 } 339 340 virtual bool IsEncodeExtendedBlockSignatureDefault() const { 341 return true; 342 } 343 344 virtual bool IsObjCNonFragileABIDefault() const { 345 // Non-fragile ABI is default for everything but i386. 346 return getTriple().getArch() != llvm::Triple::x86; 347 } 348 349 virtual bool UseObjCMixedDispatch() const { 350 // This is only used with the non-fragile ABI and non-legacy dispatch. 351 352 // Mixed dispatch is used everywhere except OS X before 10.6. 353 return !(!isTargetIPhoneOS() && isMacosxVersionLT(10, 6)); 354 } 355 virtual bool IsUnwindTablesDefault() const; 356 virtual unsigned GetDefaultStackProtectorLevel(bool KernelOrKext) const { 357 // Stack protectors default to on for user code on 10.5, 358 // and for everything in 10.6 and beyond 359 return isTargetIPhoneOS() || 360 (!isMacosxVersionLT(10, 6) || 361 (!isMacosxVersionLT(10, 5) && !KernelOrKext)); 362 } 363 virtual RuntimeLibType GetDefaultRuntimeLibType() const { 364 return ToolChain::RLT_CompilerRT; 365 } 366 virtual bool isPICDefault() const; 367 virtual bool isPIEDefault() const; 368 virtual bool isPICDefaultForced() const; 369 370 virtual bool SupportsProfiling() const; 371 372 virtual bool SupportsObjCGC() const; 373 374 virtual void CheckObjCARC() const; 375 376 virtual bool UseDwarfDebugFlags() const; 377 378 virtual bool UseSjLjExceptions() const; 379 380 /// } 381}; 382 383/// DarwinClang - The Darwin toolchain used by Clang. 384class LLVM_LIBRARY_VISIBILITY DarwinClang : public Darwin { 385public: 386 DarwinClang(const Driver &D, const llvm::Triple &Triple, 387 const llvm::opt::ArgList &Args); 388 389 /// @name Darwin ToolChain Implementation 390 /// { 391 392 virtual void AddLinkRuntimeLibArgs(const llvm::opt::ArgList &Args, 393 llvm::opt::ArgStringList &CmdArgs) const; 394 void AddLinkRuntimeLib(const llvm::opt::ArgList &Args, 395 llvm::opt::ArgStringList &CmdArgs, 396 const char *DarwinStaticLib, 397 bool AlwaysLink = false) const; 398 399 virtual void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args, 400 llvm::opt::ArgStringList &CmdArgs) const; 401 402 virtual void AddCCKextLibArgs(const llvm::opt::ArgList &Args, 403 llvm::opt::ArgStringList &CmdArgs) const; 404 405 virtual void AddLinkARCArgs(const llvm::opt::ArgList &Args, 406 llvm::opt::ArgStringList &CmdArgs) const; 407 /// } 408}; 409 410/// Darwin_Generic_GCC - Generic Darwin tool chain using gcc. 411class LLVM_LIBRARY_VISIBILITY Darwin_Generic_GCC : public Generic_GCC { 412public: 413 Darwin_Generic_GCC(const Driver &D, const llvm::Triple &Triple, 414 const llvm::opt::ArgList &Args) 415 : Generic_GCC(D, Triple, Args) {} 416 417 std::string ComputeEffectiveClangTriple(const llvm::opt::ArgList &Args, 418 types::ID InputType) const; 419 420 virtual bool isPICDefault() const { return false; } 421}; 422 423class LLVM_LIBRARY_VISIBILITY Generic_ELF : public Generic_GCC { 424 virtual void anchor(); 425public: 426 Generic_ELF(const Driver &D, const llvm::Triple &Triple, 427 const llvm::opt::ArgList &Args) 428 : Generic_GCC(D, Triple, Args) {} 429 430 virtual bool IsIntegratedAssemblerDefault() const { 431 // Default integrated assembler to on for x86. 432 return (getTriple().getArch() == llvm::Triple::aarch64 || 433 getTriple().getArch() == llvm::Triple::x86 || 434 getTriple().getArch() == llvm::Triple::x86_64); 435 } 436}; 437 438class LLVM_LIBRARY_VISIBILITY AuroraUX : public Generic_GCC { 439public: 440 AuroraUX(const Driver &D, const llvm::Triple &Triple, 441 const llvm::opt::ArgList &Args); 442 443protected: 444 virtual Tool *buildAssembler() const; 445 virtual Tool *buildLinker() const; 446}; 447 448class LLVM_LIBRARY_VISIBILITY Solaris : public Generic_GCC { 449public: 450 Solaris(const Driver &D, const llvm::Triple &Triple, 451 const llvm::opt::ArgList &Args); 452 453 virtual bool IsIntegratedAssemblerDefault() const { return true; } 454protected: 455 virtual Tool *buildAssembler() const; 456 virtual Tool *buildLinker() const; 457 458}; 459 460 461class LLVM_LIBRARY_VISIBILITY OpenBSD : public Generic_ELF { 462public: 463 OpenBSD(const Driver &D, const llvm::Triple &Triple, 464 const llvm::opt::ArgList &Args); 465 466 virtual bool IsMathErrnoDefault() const { return false; } 467 virtual bool IsObjCNonFragileABIDefault() const { return true; } 468 virtual bool isPIEDefault() const { return true; } 469 470 virtual unsigned GetDefaultStackProtectorLevel(bool KernelOrKext) const { 471 return 1; 472 } 473 474protected: 475 virtual Tool *buildAssembler() const; 476 virtual Tool *buildLinker() const; 477}; 478 479class LLVM_LIBRARY_VISIBILITY Bitrig : public Generic_ELF { 480public: 481 Bitrig(const Driver &D, const llvm::Triple &Triple, 482 const llvm::opt::ArgList &Args); 483 484 virtual bool IsMathErrnoDefault() const { return false; } 485 virtual bool IsObjCNonFragileABIDefault() const { return true; } 486 virtual bool IsObjCLegacyDispatchDefault() const { return false; } 487 488 virtual void 489 AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList &DriverArgs, 490 llvm::opt::ArgStringList &CC1Args) const; 491 virtual void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args, 492 llvm::opt::ArgStringList &CmdArgs) const; 493 virtual unsigned GetDefaultStackProtectorLevel(bool KernelOrKext) const { 494 return 1; 495 } 496 497protected: 498 virtual Tool *buildAssembler() const; 499 virtual Tool *buildLinker() const; 500}; 501 502class LLVM_LIBRARY_VISIBILITY FreeBSD : public Generic_ELF { 503public: 504 FreeBSD(const Driver &D, const llvm::Triple &Triple, 505 const llvm::opt::ArgList &Args); 506 virtual bool HasNativeLLVMSupport() const; 507 508 virtual bool IsMathErrnoDefault() const { return false; } 509 virtual bool IsObjCNonFragileABIDefault() const { return true; } 510 511 virtual CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const; 512 virtual void 513 AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList &DriverArgs, 514 llvm::opt::ArgStringList &CC1Args) const; 515 virtual bool IsIntegratedAssemblerDefault() const { 516 if (getTriple().getArch() == llvm::Triple::ppc || 517 getTriple().getArch() == llvm::Triple::ppc64) 518 return true; 519 return Generic_ELF::IsIntegratedAssemblerDefault(); 520 } 521 522 virtual bool UseSjLjExceptions() const; 523protected: 524 virtual Tool *buildAssembler() const; 525 virtual Tool *buildLinker() const; 526}; 527 528class LLVM_LIBRARY_VISIBILITY NetBSD : public Generic_ELF { 529public: 530 NetBSD(const Driver &D, const llvm::Triple &Triple, 531 const llvm::opt::ArgList &Args); 532 533 virtual bool IsMathErrnoDefault() const { return false; } 534 virtual bool IsObjCNonFragileABIDefault() const { return true; } 535 536 virtual CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const; 537 538 virtual void 539 AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList &DriverArgs, 540 llvm::opt::ArgStringList &CC1Args) const; 541 virtual bool IsUnwindTablesDefault() const { 542 return true; 543 } 544 virtual bool IsIntegratedAssemblerDefault() const { 545 if (getTriple().getArch() == llvm::Triple::ppc) 546 return true; 547 return Generic_ELF::IsIntegratedAssemblerDefault(); 548 } 549 550protected: 551 virtual Tool *buildAssembler() const; 552 virtual Tool *buildLinker() const; 553}; 554 555class LLVM_LIBRARY_VISIBILITY Minix : public Generic_ELF { 556public: 557 Minix(const Driver &D, const llvm::Triple &Triple, 558 const llvm::opt::ArgList &Args); 559 560protected: 561 virtual Tool *buildAssembler() const; 562 virtual Tool *buildLinker() const; 563}; 564 565class LLVM_LIBRARY_VISIBILITY DragonFly : public Generic_ELF { 566public: 567 DragonFly(const Driver &D, const llvm::Triple &Triple, 568 const llvm::opt::ArgList &Args); 569 570 virtual bool IsMathErrnoDefault() const { return false; } 571 572protected: 573 virtual Tool *buildAssembler() const; 574 virtual Tool *buildLinker() const; 575}; 576 577class LLVM_LIBRARY_VISIBILITY Linux : public Generic_ELF { 578public: 579 Linux(const Driver &D, const llvm::Triple &Triple, 580 const llvm::opt::ArgList &Args); 581 582 virtual bool HasNativeLLVMSupport() const; 583 584 virtual void 585 AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs, 586 llvm::opt::ArgStringList &CC1Args) const; 587 virtual void addClangTargetOptions(const llvm::opt::ArgList &DriverArgs, 588 llvm::opt::ArgStringList &CC1Args) const; 589 virtual void 590 AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList &DriverArgs, 591 llvm::opt::ArgStringList &CC1Args) const; 592 virtual bool isPIEDefault() const; 593 594 std::string Linker; 595 std::vector<std::string> ExtraOpts; 596 597protected: 598 virtual Tool *buildAssembler() const; 599 virtual Tool *buildLinker() const; 600 601private: 602 static bool addLibStdCXXIncludePaths(Twine Base, Twine Suffix, 603 Twine TargetArchDir, 604 Twine BiarchSuffix, 605 Twine MIPSABIDirSuffix, 606 const llvm::opt::ArgList &DriverArgs, 607 llvm::opt::ArgStringList &CC1Args); 608 static bool addLibStdCXXIncludePaths(Twine Base, Twine TargetArchDir, 609 const llvm::opt::ArgList &DriverArgs, 610 llvm::opt::ArgStringList &CC1Args); 611 612 std::string computeSysRoot() const; 613}; 614 615class LLVM_LIBRARY_VISIBILITY Hexagon_TC : public Linux { 616protected: 617 GCCVersion GCCLibAndIncVersion; 618 virtual Tool *buildAssembler() const; 619 virtual Tool *buildLinker() const; 620 621public: 622 Hexagon_TC(const Driver &D, const llvm::Triple &Triple, 623 const llvm::opt::ArgList &Args); 624 ~Hexagon_TC(); 625 626 virtual void 627 AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs, 628 llvm::opt::ArgStringList &CC1Args) const; 629 virtual void 630 AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList &DriverArgs, 631 llvm::opt::ArgStringList &CC1Args) const; 632 virtual CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const; 633 634 StringRef GetGCCLibAndIncVersion() const { return GCCLibAndIncVersion.Text; } 635 636 static std::string GetGnuDir(const std::string &InstalledDir); 637 638 static StringRef GetTargetCPU(const llvm::opt::ArgList &Args); 639}; 640 641/// TCEToolChain - A tool chain using the llvm bitcode tools to perform 642/// all subcommands. See http://tce.cs.tut.fi for our peculiar target. 643class LLVM_LIBRARY_VISIBILITY TCEToolChain : public ToolChain { 644public: 645 TCEToolChain(const Driver &D, const llvm::Triple &Triple, 646 const llvm::opt::ArgList &Args); 647 ~TCEToolChain(); 648 649 bool IsMathErrnoDefault() const; 650 bool isPICDefault() const; 651 bool isPIEDefault() const; 652 bool isPICDefaultForced() const; 653}; 654 655class LLVM_LIBRARY_VISIBILITY Windows : public ToolChain { 656public: 657 Windows(const Driver &D, const llvm::Triple &Triple, 658 const llvm::opt::ArgList &Args); 659 660 virtual bool IsIntegratedAssemblerDefault() const; 661 virtual bool IsUnwindTablesDefault() const; 662 virtual bool isPICDefault() const; 663 virtual bool isPIEDefault() const; 664 virtual bool isPICDefaultForced() const; 665 666 virtual void 667 AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs, 668 llvm::opt::ArgStringList &CC1Args) const; 669 virtual void 670 AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList &DriverArgs, 671 llvm::opt::ArgStringList &CC1Args) const; 672 673protected: 674 virtual Tool *buildLinker() const; 675 virtual Tool *buildAssembler() const; 676}; 677 678 679class LLVM_LIBRARY_VISIBILITY XCore : public ToolChain { 680public: 681 XCore(const Driver &D, const llvm::Triple &Triple, 682 const llvm::opt::ArgList &Args); 683protected: 684 virtual Tool *buildAssembler() const; 685 virtual Tool *buildLinker() const; 686public: 687 virtual bool isPICDefault() const; 688 virtual bool isPIEDefault() const; 689 virtual bool isPICDefaultForced() const; 690 virtual bool SupportsProfiling() const; 691 virtual bool hasBlocksRuntime() const; 692 virtual void AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs, 693 llvm::opt::ArgStringList &CC1Args) const; 694 virtual void addClangTargetOptions(const llvm::opt::ArgList &DriverArgs, 695 llvm::opt::ArgStringList &CC1Args) const; 696 virtual void AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList &DriverArgs, 697 llvm::opt::ArgStringList &CC1Args) const; 698 virtual void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args, 699 llvm::opt::ArgStringList &CmdArgs) const; 700}; 701 702} // end namespace toolchains 703} // end namespace driver 704} // end namespace clang 705 706#endif 707