1//===--- Tools.h - Tool 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 LLVM_CLANG_LIB_DRIVER_TOOLS_H 11#define LLVM_CLANG_LIB_DRIVER_TOOLS_H 12 13#include "clang/Driver/Tool.h" 14#include "clang/Driver/Types.h" 15#include "clang/Driver/Util.h" 16#include "llvm/ADT/Triple.h" 17#include "llvm/Option/Option.h" 18#include "llvm/Support/Compiler.h" 19 20namespace clang { 21 class ObjCRuntime; 22 23namespace driver { 24 class Command; 25 class Driver; 26 27namespace toolchains { 28 class MachO; 29} 30 31namespace tools { 32 33namespace visualstudio { 34 class Compile; 35} 36 37using llvm::opt::ArgStringList; 38 39 /// \brief Clang compiler tool. 40 class LLVM_LIBRARY_VISIBILITY Clang : public Tool { 41 public: 42 static const char *getBaseInputName(const llvm::opt::ArgList &Args, 43 const InputInfoList &Inputs); 44 static const char *getBaseInputStem(const llvm::opt::ArgList &Args, 45 const InputInfoList &Inputs); 46 static const char *getDependencyFileName(const llvm::opt::ArgList &Args, 47 const InputInfoList &Inputs); 48 49 private: 50 void AddPreprocessingOptions(Compilation &C, const JobAction &JA, 51 const Driver &D, 52 const llvm::opt::ArgList &Args, 53 llvm::opt::ArgStringList &CmdArgs, 54 const InputInfo &Output, 55 const InputInfoList &Inputs) const; 56 57 void AddAArch64TargetArgs(const llvm::opt::ArgList &Args, 58 llvm::opt::ArgStringList &CmdArgs) const; 59 void AddARMTargetArgs(const llvm::opt::ArgList &Args, 60 llvm::opt::ArgStringList &CmdArgs, 61 bool KernelOrKext) const; 62 void AddARM64TargetArgs(const llvm::opt::ArgList &Args, 63 llvm::opt::ArgStringList &CmdArgs) const; 64 void AddMIPSTargetArgs(const llvm::opt::ArgList &Args, 65 llvm::opt::ArgStringList &CmdArgs) const; 66 void AddPPCTargetArgs(const llvm::opt::ArgList &Args, 67 llvm::opt::ArgStringList &CmdArgs) const; 68 void AddR600TargetArgs(const llvm::opt::ArgList &Args, 69 llvm::opt::ArgStringList &CmdArgs) const; 70 void AddSparcTargetArgs(const llvm::opt::ArgList &Args, 71 llvm::opt::ArgStringList &CmdArgs) const; 72 void AddSystemZTargetArgs(const llvm::opt::ArgList &Args, 73 llvm::opt::ArgStringList &CmdArgs) const; 74 void AddX86TargetArgs(const llvm::opt::ArgList &Args, 75 llvm::opt::ArgStringList &CmdArgs) const; 76 void AddHexagonTargetArgs(const llvm::opt::ArgList &Args, 77 llvm::opt::ArgStringList &CmdArgs) const; 78 79 enum RewriteKind { RK_None, RK_Fragile, RK_NonFragile }; 80 81 ObjCRuntime AddObjCRuntimeArgs(const llvm::opt::ArgList &args, 82 llvm::opt::ArgStringList &cmdArgs, 83 RewriteKind rewrite) const; 84 85 void AddClangCLArgs(const llvm::opt::ArgList &Args, 86 llvm::opt::ArgStringList &CmdArgs) const; 87 88 visualstudio::Compile *getCLFallback() const; 89 90 mutable std::unique_ptr<visualstudio::Compile> CLFallback; 91 92 public: 93 Clang(const ToolChain &TC) : Tool("clang", "clang frontend", TC, RF_Full) {} 94 95 bool hasGoodDiagnostics() const override { return true; } 96 bool hasIntegratedAssembler() const override { return true; } 97 bool hasIntegratedCPP() const override { return true; } 98 bool canEmitIR() const override { return true; } 99 100 void ConstructJob(Compilation &C, const JobAction &JA, 101 const InputInfo &Output, const InputInfoList &Inputs, 102 const llvm::opt::ArgList &TCArgs, 103 const char *LinkingOutput) const override; 104 }; 105 106 /// \brief Clang integrated assembler tool. 107 class LLVM_LIBRARY_VISIBILITY ClangAs : public Tool { 108 public: 109 ClangAs(const ToolChain &TC) : Tool("clang::as", 110 "clang integrated assembler", TC, 111 RF_Full) {} 112 void AddMIPSTargetArgs(const llvm::opt::ArgList &Args, 113 llvm::opt::ArgStringList &CmdArgs) const; 114 bool hasGoodDiagnostics() const override { return true; } 115 bool hasIntegratedAssembler() const override { return false; } 116 bool hasIntegratedCPP() const override { return false; } 117 118 void ConstructJob(Compilation &C, const JobAction &JA, 119 const InputInfo &Output, const InputInfoList &Inputs, 120 const llvm::opt::ArgList &TCArgs, 121 const char *LinkingOutput) const override; 122 }; 123 124 /// \brief Base class for all GNU tools that provide the same behavior when 125 /// it comes to response files support 126 class GnuTool : public Tool { 127 virtual void anchor(); 128 129 public: 130 GnuTool(const char *Name, const char *ShortName, const ToolChain &TC) 131 : Tool(Name, ShortName, TC, RF_Full, llvm::sys::WEM_CurrentCodePage) {} 132 }; 133 134 /// gcc - Generic GCC tool implementations. 135namespace gcc { 136 class LLVM_LIBRARY_VISIBILITY Common : public GnuTool { 137 public: 138 Common(const char *Name, const char *ShortName, 139 const ToolChain &TC) : GnuTool(Name, ShortName, TC) {} 140 141 void ConstructJob(Compilation &C, const JobAction &JA, 142 const InputInfo &Output, 143 const InputInfoList &Inputs, 144 const llvm::opt::ArgList &TCArgs, 145 const char *LinkingOutput) const override; 146 147 /// RenderExtraToolArgs - Render any arguments necessary to force 148 /// the particular tool mode. 149 virtual void 150 RenderExtraToolArgs(const JobAction &JA, 151 llvm::opt::ArgStringList &CmdArgs) const = 0; 152 }; 153 154 class LLVM_LIBRARY_VISIBILITY Preprocess : public Common { 155 public: 156 Preprocess(const ToolChain &TC) : Common("gcc::Preprocess", 157 "gcc preprocessor", TC) {} 158 159 bool hasGoodDiagnostics() const override { return true; } 160 bool hasIntegratedCPP() const override { return false; } 161 162 void RenderExtraToolArgs(const JobAction &JA, 163 llvm::opt::ArgStringList &CmdArgs) const override; 164 }; 165 166 class LLVM_LIBRARY_VISIBILITY Compile : public Common { 167 public: 168 Compile(const ToolChain &TC) : Common("gcc::Compile", 169 "gcc frontend", TC) {} 170 171 bool hasGoodDiagnostics() const override { return true; } 172 bool hasIntegratedCPP() const override { return true; } 173 174 void RenderExtraToolArgs(const JobAction &JA, 175 llvm::opt::ArgStringList &CmdArgs) const override; 176 }; 177 178 class LLVM_LIBRARY_VISIBILITY Link : public Common { 179 public: 180 Link(const ToolChain &TC) : Common("gcc::Link", 181 "linker (via gcc)", TC) {} 182 183 bool hasIntegratedCPP() const override { return false; } 184 bool isLinkJob() const override { return true; } 185 186 void RenderExtraToolArgs(const JobAction &JA, 187 llvm::opt::ArgStringList &CmdArgs) const override; 188 }; 189} // end namespace gcc 190 191namespace hexagon { 192 // For Hexagon, we do not need to instantiate tools for PreProcess, PreCompile and Compile. 193 // We simply use "clang -cc1" for those actions. 194 class LLVM_LIBRARY_VISIBILITY Assemble : public GnuTool { 195 public: 196 Assemble(const ToolChain &TC) : GnuTool("hexagon::Assemble", 197 "hexagon-as", TC) {} 198 199 bool hasIntegratedCPP() const override { return false; } 200 201 void RenderExtraToolArgs(const JobAction &JA, 202 llvm::opt::ArgStringList &CmdArgs) const; 203 void ConstructJob(Compilation &C, const JobAction &JA, 204 const InputInfo &Output, const InputInfoList &Inputs, 205 const llvm::opt::ArgList &TCArgs, 206 const char *LinkingOutput) const override; 207 }; 208 209 class LLVM_LIBRARY_VISIBILITY Link : public GnuTool { 210 public: 211 Link(const ToolChain &TC) : GnuTool("hexagon::Link", 212 "hexagon-ld", TC) {} 213 214 bool hasIntegratedCPP() const override { return false; } 215 bool isLinkJob() const override { return true; } 216 217 virtual void RenderExtraToolArgs(const JobAction &JA, 218 llvm::opt::ArgStringList &CmdArgs) const; 219 void ConstructJob(Compilation &C, const JobAction &JA, 220 const InputInfo &Output, const InputInfoList &Inputs, 221 const llvm::opt::ArgList &TCArgs, 222 const char *LinkingOutput) const override; 223 }; 224} // end namespace hexagon. 225 226namespace arm { 227 StringRef getARMTargetCPU(const llvm::opt::ArgList &Args, 228 const llvm::Triple &Triple); 229 const char* getARMCPUForMArch(const llvm::opt::ArgList &Args, 230 const llvm::Triple &Triple); 231 const char* getLLVMArchSuffixForARM(StringRef CPU); 232 233 void appendEBLinkFlags(const llvm::opt::ArgList &Args, ArgStringList &CmdArgs, const llvm::Triple &Triple); 234} 235 236namespace mips { 237 typedef enum { 238 NanLegacy = 1, 239 Nan2008 = 2 240 } NanEncoding; 241 NanEncoding getSupportedNanEncoding(StringRef &CPU); 242 void getMipsCPUAndABI(const llvm::opt::ArgList &Args, 243 const llvm::Triple &Triple, StringRef &CPUName, 244 StringRef &ABIName); 245 bool hasMipsAbiArg(const llvm::opt::ArgList &Args, const char *Value); 246 bool isUCLibc(const llvm::opt::ArgList &Args); 247 bool isNaN2008(const llvm::opt::ArgList &Args, const llvm::Triple &Triple); 248 bool isFPXXDefault(const llvm::Triple &Triple, StringRef CPUName, 249 StringRef ABIName); 250} 251 252namespace ppc { 253 bool hasPPCAbiArg(const llvm::opt::ArgList &Args, const char *Value); 254} 255 256 /// cloudabi -- Directly call GNU Binutils linker 257namespace cloudabi { 258class LLVM_LIBRARY_VISIBILITY Link : public GnuTool { 259public: 260 Link(const ToolChain &TC) : GnuTool("cloudabi::Link", "linker", TC) {} 261 262 bool hasIntegratedCPP() const override { return false; } 263 bool isLinkJob() const override { return true; } 264 265 void ConstructJob(Compilation &C, const JobAction &JA, 266 const InputInfo &Output, const InputInfoList &Inputs, 267 const llvm::opt::ArgList &TCArgs, 268 const char *LinkingOutput) const override; 269}; 270} // end namespace cloudabi 271 272namespace darwin { 273 llvm::Triple::ArchType getArchTypeForMachOArchName(StringRef Str); 274 void setTripleTypeForMachOArchName(llvm::Triple &T, StringRef Str); 275 276 class LLVM_LIBRARY_VISIBILITY MachOTool : public Tool { 277 virtual void anchor(); 278 protected: 279 void AddMachOArch(const llvm::opt::ArgList &Args, 280 llvm::opt::ArgStringList &CmdArgs) const; 281 282 const toolchains::MachO &getMachOToolChain() const { 283 return reinterpret_cast<const toolchains::MachO&>(getToolChain()); 284 } 285 286 public: 287 MachOTool( 288 const char *Name, const char *ShortName, const ToolChain &TC, 289 ResponseFileSupport ResponseSupport = RF_None, 290 llvm::sys::WindowsEncodingMethod ResponseEncoding = llvm::sys::WEM_UTF8, 291 const char *ResponseFlag = "@") 292 : Tool(Name, ShortName, TC, ResponseSupport, ResponseEncoding, 293 ResponseFlag) {} 294 }; 295 296 class LLVM_LIBRARY_VISIBILITY Assemble : public MachOTool { 297 public: 298 Assemble(const ToolChain &TC) : MachOTool("darwin::Assemble", 299 "assembler", TC) {} 300 301 bool hasIntegratedCPP() const override { return false; } 302 303 void ConstructJob(Compilation &C, const JobAction &JA, 304 const InputInfo &Output, const InputInfoList &Inputs, 305 const llvm::opt::ArgList &TCArgs, 306 const char *LinkingOutput) const override; 307 }; 308 309 class LLVM_LIBRARY_VISIBILITY Link : public MachOTool { 310 bool NeedsTempPath(const InputInfoList &Inputs) const; 311 void AddLinkArgs(Compilation &C, const llvm::opt::ArgList &Args, 312 llvm::opt::ArgStringList &CmdArgs, 313 const InputInfoList &Inputs) const; 314 315 public: 316 Link(const ToolChain &TC) : MachOTool("darwin::Link", "linker", TC, 317 RF_FileList, llvm::sys::WEM_UTF8, 318 "-filelist") {} 319 320 bool hasIntegratedCPP() const override { return false; } 321 bool isLinkJob() const override { return true; } 322 323 void ConstructJob(Compilation &C, const JobAction &JA, 324 const InputInfo &Output, const InputInfoList &Inputs, 325 const llvm::opt::ArgList &TCArgs, 326 const char *LinkingOutput) const override; 327 }; 328 329 class LLVM_LIBRARY_VISIBILITY Lipo : public MachOTool { 330 public: 331 Lipo(const ToolChain &TC) : MachOTool("darwin::Lipo", "lipo", TC) {} 332 333 bool hasIntegratedCPP() const override { return false; } 334 335 void ConstructJob(Compilation &C, const JobAction &JA, 336 const InputInfo &Output, const InputInfoList &Inputs, 337 const llvm::opt::ArgList &TCArgs, 338 const char *LinkingOutput) const override; 339 }; 340 341 class LLVM_LIBRARY_VISIBILITY Dsymutil : public MachOTool { 342 public: 343 Dsymutil(const ToolChain &TC) : MachOTool("darwin::Dsymutil", 344 "dsymutil", TC) {} 345 346 bool hasIntegratedCPP() const override { return false; } 347 bool isDsymutilJob() const override { return true; } 348 349 void ConstructJob(Compilation &C, const JobAction &JA, 350 const InputInfo &Output, 351 const InputInfoList &Inputs, 352 const llvm::opt::ArgList &TCArgs, 353 const char *LinkingOutput) const override; 354 }; 355 356 class LLVM_LIBRARY_VISIBILITY VerifyDebug : public MachOTool { 357 public: 358 VerifyDebug(const ToolChain &TC) : MachOTool("darwin::VerifyDebug", 359 "dwarfdump", TC) {} 360 361 bool hasIntegratedCPP() const override { return false; } 362 363 void ConstructJob(Compilation &C, const JobAction &JA, 364 const InputInfo &Output, const InputInfoList &Inputs, 365 const llvm::opt::ArgList &TCArgs, 366 const char *LinkingOutput) const override; 367 }; 368 369} 370 371 /// openbsd -- Directly call GNU Binutils assembler and linker 372namespace openbsd { 373 class LLVM_LIBRARY_VISIBILITY Assemble : public GnuTool { 374 public: 375 Assemble(const ToolChain &TC) : GnuTool("openbsd::Assemble", "assembler", 376 TC) {} 377 378 bool hasIntegratedCPP() const override { return false; } 379 380 void ConstructJob(Compilation &C, const JobAction &JA, 381 const InputInfo &Output, 382 const InputInfoList &Inputs, 383 const llvm::opt::ArgList &TCArgs, 384 const char *LinkingOutput) const override; 385 }; 386 class LLVM_LIBRARY_VISIBILITY Link : public GnuTool { 387 public: 388 Link(const ToolChain &TC) : GnuTool("openbsd::Link", "linker", TC) {} 389 390 bool hasIntegratedCPP() const override { return false; } 391 bool isLinkJob() const override { return true; } 392 393 void ConstructJob(Compilation &C, const JobAction &JA, 394 const InputInfo &Output, const InputInfoList &Inputs, 395 const llvm::opt::ArgList &TCArgs, 396 const char *LinkingOutput) const override; 397 }; 398} // end namespace openbsd 399 400 /// bitrig -- Directly call GNU Binutils assembler and linker 401namespace bitrig { 402 class LLVM_LIBRARY_VISIBILITY Assemble : public GnuTool { 403 public: 404 Assemble(const ToolChain &TC) : GnuTool("bitrig::Assemble", "assembler", 405 TC) {} 406 407 bool hasIntegratedCPP() const override { return false; } 408 409 void ConstructJob(Compilation &C, const JobAction &JA, 410 const InputInfo &Output, const InputInfoList &Inputs, 411 const llvm::opt::ArgList &TCArgs, 412 const char *LinkingOutput) const override; 413 }; 414 class LLVM_LIBRARY_VISIBILITY Link : public GnuTool { 415 public: 416 Link(const ToolChain &TC) : GnuTool("bitrig::Link", "linker", TC) {} 417 418 bool hasIntegratedCPP() const override { return false; } 419 bool isLinkJob() const override { return true; } 420 421 void ConstructJob(Compilation &C, const JobAction &JA, 422 const InputInfo &Output, const InputInfoList &Inputs, 423 const llvm::opt::ArgList &TCArgs, 424 const char *LinkingOutput) const override; 425 }; 426} // end namespace bitrig 427 428 /// freebsd -- Directly call GNU Binutils assembler and linker 429namespace freebsd { 430 class LLVM_LIBRARY_VISIBILITY Assemble : public GnuTool { 431 public: 432 Assemble(const ToolChain &TC) : GnuTool("freebsd::Assemble", "assembler", 433 TC) {} 434 435 bool hasIntegratedCPP() const override { return false; } 436 437 void ConstructJob(Compilation &C, const JobAction &JA, 438 const InputInfo &Output, const InputInfoList &Inputs, 439 const llvm::opt::ArgList &TCArgs, 440 const char *LinkingOutput) const override; 441 }; 442 class LLVM_LIBRARY_VISIBILITY Link : public GnuTool { 443 public: 444 Link(const ToolChain &TC) : GnuTool("freebsd::Link", "linker", TC) {} 445 446 bool hasIntegratedCPP() const override { return false; } 447 bool isLinkJob() const override { return true; } 448 449 void ConstructJob(Compilation &C, const JobAction &JA, 450 const InputInfo &Output, const InputInfoList &Inputs, 451 const llvm::opt::ArgList &TCArgs, 452 const char *LinkingOutput) const override; 453 }; 454} // end namespace freebsd 455 456 /// netbsd -- Directly call GNU Binutils assembler and linker 457namespace netbsd { 458 class LLVM_LIBRARY_VISIBILITY Assemble : public GnuTool { 459 460 public: 461 Assemble(const ToolChain &TC) 462 : GnuTool("netbsd::Assemble", "assembler", TC) {} 463 464 bool hasIntegratedCPP() const override { return false; } 465 466 void ConstructJob(Compilation &C, const JobAction &JA, 467 const InputInfo &Output, const InputInfoList &Inputs, 468 const llvm::opt::ArgList &TCArgs, 469 const char *LinkingOutput) const override; 470 }; 471 class LLVM_LIBRARY_VISIBILITY Link : public GnuTool { 472 473 public: 474 Link(const ToolChain &TC) 475 : GnuTool("netbsd::Link", "linker", TC) {} 476 477 bool hasIntegratedCPP() const override { return false; } 478 bool isLinkJob() const override { return true; } 479 480 void ConstructJob(Compilation &C, const JobAction &JA, 481 const InputInfo &Output, const InputInfoList &Inputs, 482 const llvm::opt::ArgList &TCArgs, 483 const char *LinkingOutput) const override; 484 }; 485} // end namespace netbsd 486 487 /// Directly call GNU Binutils' assembler and linker. 488namespace gnutools { 489 class LLVM_LIBRARY_VISIBILITY Assemble : public GnuTool { 490 public: 491 Assemble(const ToolChain &TC) : GnuTool("GNU::Assemble", "assembler", TC) {} 492 493 bool hasIntegratedCPP() const override { return false; } 494 495 void ConstructJob(Compilation &C, const JobAction &JA, 496 const InputInfo &Output, 497 const InputInfoList &Inputs, 498 const llvm::opt::ArgList &TCArgs, 499 const char *LinkingOutput) const override; 500 }; 501 class LLVM_LIBRARY_VISIBILITY Link : public GnuTool { 502 public: 503 Link(const ToolChain &TC) : GnuTool("GNU::Link", "linker", TC) {} 504 505 bool hasIntegratedCPP() const override { return false; } 506 bool isLinkJob() const override { return true; } 507 508 void ConstructJob(Compilation &C, const JobAction &JA, 509 const InputInfo &Output, 510 const InputInfoList &Inputs, 511 const llvm::opt::ArgList &TCArgs, 512 const char *LinkingOutput) const override; 513 }; 514} 515 516namespace nacltools { 517 class LLVM_LIBRARY_VISIBILITY AssembleARM : public gnutools::Assemble { 518 public: 519 AssembleARM(const ToolChain &TC) : gnutools::Assemble(TC) {} 520 521 void ConstructJob(Compilation &C, const JobAction &JA, 522 const InputInfo &Output, 523 const InputInfoList &Inputs, 524 const llvm::opt::ArgList &TCArgs, 525 const char *LinkingOutput) const override; 526 }; 527 class LLVM_LIBRARY_VISIBILITY Link : public Tool { 528 public: 529 Link(const ToolChain &TC) : Tool("NaCl::Link", "linker", TC) {} 530 531 bool hasIntegratedCPP() const override { return false; } 532 bool isLinkJob() const override { return true; } 533 534 void ConstructJob(Compilation &C, const JobAction &JA, 535 const InputInfo &Output, 536 const InputInfoList &Inputs, 537 const llvm::opt::ArgList &TCArgs, 538 const char *LinkingOutput) const override; 539 }; 540} 541 542 /// minix -- Directly call GNU Binutils assembler and linker 543namespace minix { 544 class LLVM_LIBRARY_VISIBILITY Assemble : public GnuTool { 545 public: 546 Assemble(const ToolChain &TC) : GnuTool("minix::Assemble", "assembler", 547 TC) {} 548 549 bool hasIntegratedCPP() const override { return false; } 550 551 void ConstructJob(Compilation &C, const JobAction &JA, 552 const InputInfo &Output, 553 const InputInfoList &Inputs, 554 const llvm::opt::ArgList &TCArgs, 555 const char *LinkingOutput) const override; 556 }; 557 class LLVM_LIBRARY_VISIBILITY Link : public GnuTool { 558 public: 559 Link(const ToolChain &TC) : GnuTool("minix::Link", "linker", TC) {} 560 561 bool hasIntegratedCPP() const override { return false; } 562 bool isLinkJob() const override { return true; } 563 564 void ConstructJob(Compilation &C, const JobAction &JA, 565 const InputInfo &Output, 566 const InputInfoList &Inputs, 567 const llvm::opt::ArgList &TCArgs, 568 const char *LinkingOutput) const override; 569 }; 570} // end namespace minix 571 572 /// solaris -- Directly call Solaris assembler and linker 573namespace solaris { 574 class LLVM_LIBRARY_VISIBILITY Assemble : public Tool { 575 public: 576 Assemble(const ToolChain &TC) : Tool("solaris::Assemble", "assembler", 577 TC) {} 578 579 bool hasIntegratedCPP() const override { return false; } 580 581 void ConstructJob(Compilation &C, const JobAction &JA, 582 const InputInfo &Output, const InputInfoList &Inputs, 583 const llvm::opt::ArgList &TCArgs, 584 const char *LinkingOutput) const override; 585 }; 586 class LLVM_LIBRARY_VISIBILITY Link : public Tool { 587 public: 588 Link(const ToolChain &TC) : Tool("solaris::Link", "linker", TC) {} 589 590 bool hasIntegratedCPP() const override { return false; } 591 bool isLinkJob() const override { return true; } 592 593 void ConstructJob(Compilation &C, const JobAction &JA, 594 const InputInfo &Output, const InputInfoList &Inputs, 595 const llvm::opt::ArgList &TCArgs, 596 const char *LinkingOutput) const override; 597 }; 598} // end namespace solaris 599 600 /// dragonfly -- Directly call GNU Binutils assembler and linker 601namespace dragonfly { 602 class LLVM_LIBRARY_VISIBILITY Assemble : public GnuTool { 603 public: 604 Assemble(const ToolChain &TC) : GnuTool("dragonfly::Assemble", "assembler", 605 TC) {} 606 607 bool hasIntegratedCPP() const override { return false; } 608 609 void ConstructJob(Compilation &C, const JobAction &JA, 610 const InputInfo &Output, const InputInfoList &Inputs, 611 const llvm::opt::ArgList &TCArgs, 612 const char *LinkingOutput) const override; 613 }; 614 class LLVM_LIBRARY_VISIBILITY Link : public GnuTool { 615 public: 616 Link(const ToolChain &TC) : GnuTool("dragonfly::Link", "linker", TC) {} 617 618 bool hasIntegratedCPP() const override { return false; } 619 bool isLinkJob() const override { return true; } 620 621 void ConstructJob(Compilation &C, const JobAction &JA, 622 const InputInfo &Output, 623 const InputInfoList &Inputs, 624 const llvm::opt::ArgList &TCArgs, 625 const char *LinkingOutput) const override; 626 }; 627} // end namespace dragonfly 628 629/// Visual studio tools. 630namespace visualstudio { 631 class LLVM_LIBRARY_VISIBILITY Link : public Tool { 632 public: 633 Link(const ToolChain &TC) : Tool("visualstudio::Link", "linker", TC, 634 RF_Full, llvm::sys::WEM_UTF16) {} 635 636 bool hasIntegratedCPP() const override { return false; } 637 bool isLinkJob() const override { return true; } 638 639 void ConstructJob(Compilation &C, const JobAction &JA, 640 const InputInfo &Output, const InputInfoList &Inputs, 641 const llvm::opt::ArgList &TCArgs, 642 const char *LinkingOutput) const override; 643 }; 644 645 class LLVM_LIBRARY_VISIBILITY Compile : public Tool { 646 public: 647 Compile(const ToolChain &TC) : Tool("visualstudio::Compile", "compiler", TC, 648 RF_Full, llvm::sys::WEM_UTF16) {} 649 650 bool hasIntegratedAssembler() const override { return true; } 651 bool hasIntegratedCPP() const override { return true; } 652 bool isLinkJob() const override { return false; } 653 654 void ConstructJob(Compilation &C, const JobAction &JA, 655 const InputInfo &Output, const InputInfoList &Inputs, 656 const llvm::opt::ArgList &TCArgs, 657 const char *LinkingOutput) const override; 658 659 std::unique_ptr<Command> GetCommand(Compilation &C, const JobAction &JA, 660 const InputInfo &Output, 661 const InputInfoList &Inputs, 662 const llvm::opt::ArgList &TCArgs, 663 const char *LinkingOutput) const; 664 }; 665} // end namespace visualstudio 666 667namespace arm { 668 StringRef getARMFloatABI(const Driver &D, const llvm::opt::ArgList &Args, 669 const llvm::Triple &Triple); 670} 671namespace XCore { 672 // For XCore, we do not need to instantiate tools for PreProcess, PreCompile and Compile. 673 // We simply use "clang -cc1" for those actions. 674 class LLVM_LIBRARY_VISIBILITY Assemble : public Tool { 675 public: 676 Assemble(const ToolChain &TC) : Tool("XCore::Assemble", 677 "XCore-as", TC) {} 678 679 bool hasIntegratedCPP() const override { return false; } 680 void ConstructJob(Compilation &C, const JobAction &JA, 681 const InputInfo &Output, const InputInfoList &Inputs, 682 const llvm::opt::ArgList &TCArgs, 683 const char *LinkingOutput) const override; 684 }; 685 686 class LLVM_LIBRARY_VISIBILITY Link : public Tool { 687 public: 688 Link(const ToolChain &TC) : Tool("XCore::Link", 689 "XCore-ld", TC) {} 690 691 bool hasIntegratedCPP() const override { return false; } 692 bool isLinkJob() const override { return true; } 693 void ConstructJob(Compilation &C, const JobAction &JA, 694 const InputInfo &Output, const InputInfoList &Inputs, 695 const llvm::opt::ArgList &TCArgs, 696 const char *LinkingOutput) const override; 697 }; 698} // end namespace XCore. 699 700namespace CrossWindows { 701class LLVM_LIBRARY_VISIBILITY Assemble : public Tool { 702public: 703 Assemble(const ToolChain &TC) : Tool("CrossWindows::Assemble", "as", TC) { } 704 705 bool hasIntegratedCPP() const override { return false; } 706 707 void ConstructJob(Compilation &C, const JobAction &JA, 708 const InputInfo &Output, const InputInfoList &Inputs, 709 const llvm::opt::ArgList &TCArgs, 710 const char *LinkingOutput) const override; 711}; 712 713class LLVM_LIBRARY_VISIBILITY Link : public Tool { 714public: 715 Link(const ToolChain &TC) : Tool("CrossWindows::Link", "ld", TC, RF_Full) {} 716 717 bool hasIntegratedCPP() const override { return false; } 718 bool isLinkJob() const override { return true; } 719 720 void ConstructJob(Compilation &C, const JobAction &JA, 721 const InputInfo &Output, const InputInfoList &Inputs, 722 const llvm::opt::ArgList &TCArgs, 723 const char *LinkingOutput) const override; 724}; 725} 726 727} // end namespace toolchains 728} // end namespace driver 729} // end namespace clang 730 731#endif 732