| Daniel Dunbar | 5903d8c | 2009-03-17 22:07:58 +0000 | [diff] [blame] | 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 | |
| Benjamin Kramer | 2f5db8b | 2014-08-13 16:25:19 +0000 | [diff] [blame] | 10 | #ifndef LLVM_CLANG_LIB_DRIVER_TOOLS_H |
| 11 | #define LLVM_CLANG_LIB_DRIVER_TOOLS_H |
| Daniel Dunbar | 5903d8c | 2009-03-17 22:07:58 +0000 | [diff] [blame] | 12 | |
| Paul Robinson | b3cd79b | 2016-02-05 21:54:42 +0000 | [diff] [blame] | 13 | #include "clang/Basic/DebugInfoOptions.h" |
| David Majnemer | e11d373 | 2015-06-08 00:22:46 +0000 | [diff] [blame] | 14 | #include "clang/Basic/VersionTuple.h" |
| Daniel Dunbar | 5903d8c | 2009-03-17 22:07:58 +0000 | [diff] [blame] | 15 | #include "clang/Driver/Tool.h" |
| Daniel Dunbar | e6adeee | 2009-03-29 17:08:39 +0000 | [diff] [blame] | 16 | #include "clang/Driver/Types.h" |
| Daniel Dunbar | a3246a0 | 2009-03-18 08:07:30 +0000 | [diff] [blame] | 17 | #include "clang/Driver/Util.h" |
| Joerg Sonnenberger | 637603a | 2011-05-16 13:35:02 +0000 | [diff] [blame] | 18 | #include "llvm/ADT/Triple.h" |
| Reid Kleckner | 898229a | 2013-06-14 17:17:23 +0000 | [diff] [blame] | 19 | #include "llvm/Option/Option.h" |
| Daniel Dunbar | 5903d8c | 2009-03-17 22:07:58 +0000 | [diff] [blame] | 20 | #include "llvm/Support/Compiler.h" |
| 21 | |
| 22 | namespace clang { |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 23 | class ObjCRuntime; |
| John McCall | 5fb5df9 | 2012-06-20 06:18:46 +0000 | [diff] [blame] | 24 | |
| Daniel Dunbar | 5903d8c | 2009-03-17 22:07:58 +0000 | [diff] [blame] | 25 | namespace driver { |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 26 | class Command; |
| 27 | class Driver; |
| Douglas Gregor | 111af7d | 2009-04-18 00:34:01 +0000 | [diff] [blame] | 28 | |
| Daniel Dunbar | c196421 | 2009-03-26 16:23:12 +0000 | [diff] [blame] | 29 | namespace toolchains { |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 30 | class MachO; |
| Daniel Dunbar | c196421 | 2009-03-26 16:23:12 +0000 | [diff] [blame] | 31 | } |
| 32 | |
| Daniel Dunbar | 15abb2e | 2009-03-17 22:18:43 +0000 | [diff] [blame] | 33 | namespace tools { |
| Hans Wennborg | 1da044a | 2014-06-26 19:59:02 +0000 | [diff] [blame] | 34 | |
| 35 | namespace visualstudio { |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 36 | class Compiler; |
| Hans Wennborg | 1da044a | 2014-06-26 19:59:02 +0000 | [diff] [blame] | 37 | } |
| 38 | |
| Reid Kleckner | 898229a | 2013-06-14 17:17:23 +0000 | [diff] [blame] | 39 | using llvm::opt::ArgStringList; |
| Daniel Dunbar | 5903d8c | 2009-03-17 22:07:58 +0000 | [diff] [blame] | 40 | |
| Saleem Abdulrasool | d44901f | 2015-09-26 03:26:44 +0000 | [diff] [blame] | 41 | SmallString<128> getCompilerRT(const ToolChain &TC, |
| 42 | const llvm::opt::ArgList &Args, |
| 43 | StringRef Component, bool Shared = false); |
| Peter Collingbourne | 581f438 | 2015-07-02 01:48:12 +0000 | [diff] [blame] | 44 | |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 45 | /// \brief Clang compiler tool. |
| 46 | class LLVM_LIBRARY_VISIBILITY Clang : public Tool { |
| 47 | public: |
| 48 | static const char *getBaseInputName(const llvm::opt::ArgList &Args, |
| 49 | const InputInfo &Input); |
| 50 | static const char *getBaseInputStem(const llvm::opt::ArgList &Args, |
| 51 | const InputInfoList &Inputs); |
| 52 | static const char *getDependencyFileName(const llvm::opt::ArgList &Args, |
| 53 | const InputInfoList &Inputs); |
| Bob Wilson | decc03e | 2012-11-23 06:14:39 +0000 | [diff] [blame] | 54 | |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 55 | private: |
| 56 | void AddPreprocessingOptions(Compilation &C, const JobAction &JA, |
| 57 | const Driver &D, const llvm::opt::ArgList &Args, |
| 58 | llvm::opt::ArgStringList &CmdArgs, |
| 59 | const InputInfo &Output, |
| Artem Belevich | fa11ab5 | 2015-11-17 22:28:46 +0000 | [diff] [blame] | 60 | const InputInfoList &Inputs, |
| 61 | const ToolChain *AuxToolChain) const; |
| Daniel Dunbar | d067f7f | 2009-04-08 23:54:23 +0000 | [diff] [blame] | 62 | |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 63 | void AddAArch64TargetArgs(const llvm::opt::ArgList &Args, |
| Tim Northover | a2ee433 | 2014-03-29 15:09:45 +0000 | [diff] [blame] | 64 | llvm::opt::ArgStringList &CmdArgs) const; |
| Saleem Abdulrasool | ce63ce9 | 2015-09-19 18:19:44 +0000 | [diff] [blame] | 65 | void AddARMTargetArgs(const llvm::Triple &Triple, |
| 66 | const llvm::opt::ArgList &Args, |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 67 | llvm::opt::ArgStringList &CmdArgs, |
| 68 | bool KernelOrKext) const; |
| 69 | void AddARM64TargetArgs(const llvm::opt::ArgList &Args, |
| Ulrich Weigand | 8afad61 | 2014-07-28 13:17:52 +0000 | [diff] [blame] | 70 | llvm::opt::ArgStringList &CmdArgs) const; |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 71 | void AddMIPSTargetArgs(const llvm::opt::ArgList &Args, |
| 72 | llvm::opt::ArgStringList &CmdArgs) const; |
| 73 | void AddPPCTargetArgs(const llvm::opt::ArgList &Args, |
| Hans Wennborg | 75958c4 | 2013-08-08 00:17:41 +0000 | [diff] [blame] | 74 | llvm::opt::ArgStringList &CmdArgs) const; |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 75 | void AddR600TargetArgs(const llvm::opt::ArgList &Args, |
| 76 | llvm::opt::ArgStringList &CmdArgs) const; |
| 77 | void AddSparcTargetArgs(const llvm::opt::ArgList &Args, |
| 78 | llvm::opt::ArgStringList &CmdArgs) const; |
| 79 | void AddSystemZTargetArgs(const llvm::opt::ArgList &Args, |
| 80 | llvm::opt::ArgStringList &CmdArgs) const; |
| 81 | void AddX86TargetArgs(const llvm::opt::ArgList &Args, |
| 82 | llvm::opt::ArgStringList &CmdArgs) const; |
| 83 | void AddHexagonTargetArgs(const llvm::opt::ArgList &Args, |
| 84 | llvm::opt::ArgStringList &CmdArgs) const; |
| Jacques Pienaar | d964cc2 | 2016-03-28 21:02:54 +0000 | [diff] [blame] | 85 | void AddLanaiTargetArgs(const llvm::opt::ArgList &Args, |
| 86 | llvm::opt::ArgStringList &CmdArgs) const; |
| Dan Gohman | e3d71e1 | 2016-01-07 01:00:21 +0000 | [diff] [blame] | 87 | void AddWebAssemblyTargetArgs(const llvm::opt::ArgList &Args, |
| 88 | llvm::opt::ArgStringList &CmdArgs) const; |
| Hans Wennborg | 75958c4 | 2013-08-08 00:17:41 +0000 | [diff] [blame] | 89 | |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 90 | enum RewriteKind { RK_None, RK_Fragile, RK_NonFragile }; |
| Hans Wennborg | 1da044a | 2014-06-26 19:59:02 +0000 | [diff] [blame] | 91 | |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 92 | ObjCRuntime AddObjCRuntimeArgs(const llvm::opt::ArgList &args, |
| 93 | llvm::opt::ArgStringList &cmdArgs, |
| 94 | RewriteKind rewrite) const; |
| Hans Wennborg | 1da044a | 2014-06-26 19:59:02 +0000 | [diff] [blame] | 95 | |
| David Majnemer | cd5855e | 2016-02-29 01:40:36 +0000 | [diff] [blame] | 96 | void AddClangCLArgs(const llvm::opt::ArgList &Args, types::ID InputType, |
| Douglas Katzman | 3459ce2 | 2015-10-08 04:24:12 +0000 | [diff] [blame] | 97 | llvm::opt::ArgStringList &CmdArgs, |
| Benjamin Kramer | 8c30592 | 2016-02-02 11:06:51 +0000 | [diff] [blame] | 98 | codegenoptions::DebugInfoKind *DebugInfoKind, |
| Douglas Katzman | 3459ce2 | 2015-10-08 04:24:12 +0000 | [diff] [blame] | 99 | bool *EmitCodeView) const; |
| Daniel Dunbar | 5903d8c | 2009-03-17 22:07:58 +0000 | [diff] [blame] | 100 | |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 101 | visualstudio::Compiler *getCLFallback() const; |
| Daniel Dunbar | 1a093d2 | 2009-03-18 06:00:36 +0000 | [diff] [blame] | 102 | |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 103 | mutable std::unique_ptr<visualstudio::Compiler> CLFallback; |
| Daniel Dunbar | 5903d8c | 2009-03-17 22:07:58 +0000 | [diff] [blame] | 104 | |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 105 | public: |
| 106 | // CAUTION! The first constructor argument ("clang") is not arbitrary, |
| 107 | // as it is for other tools. Some operations on a Tool actually test |
| 108 | // whether that tool is Clang based on the Tool's Name as a string. |
| 109 | Clang(const ToolChain &TC) : Tool("clang", "clang frontend", TC, RF_Full) {} |
| Daniel Dunbar | 4f5e79c | 2010-05-20 21:30:13 +0000 | [diff] [blame] | 110 | |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 111 | bool hasGoodDiagnostics() const override { return true; } |
| 112 | bool hasIntegratedAssembler() const override { return true; } |
| 113 | bool hasIntegratedCPP() const override { return true; } |
| 114 | bool canEmitIR() const override { return true; } |
| Daniel Dunbar | 4f5e79c | 2010-05-20 21:30:13 +0000 | [diff] [blame] | 115 | |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 116 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 117 | const InputInfo &Output, const InputInfoList &Inputs, |
| 118 | const llvm::opt::ArgList &TCArgs, |
| 119 | const char *LinkingOutput) const override; |
| 120 | }; |
| Reid Kleckner | 0290c9c | 2014-09-15 17:45:39 +0000 | [diff] [blame] | 121 | |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 122 | /// \brief Clang integrated assembler tool. |
| 123 | class LLVM_LIBRARY_VISIBILITY ClangAs : public Tool { |
| 124 | public: |
| 125 | ClangAs(const ToolChain &TC) |
| 126 | : Tool("clang::as", "clang integrated assembler", TC, RF_Full) {} |
| 127 | void AddMIPSTargetArgs(const llvm::opt::ArgList &Args, |
| 128 | llvm::opt::ArgStringList &CmdArgs) const; |
| 129 | bool hasGoodDiagnostics() const override { return true; } |
| 130 | bool hasIntegratedAssembler() const override { return false; } |
| 131 | bool hasIntegratedCPP() const override { return false; } |
| Reid Kleckner | 0290c9c | 2014-09-15 17:45:39 +0000 | [diff] [blame] | 132 | |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 133 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 134 | const InputInfo &Output, const InputInfoList &Inputs, |
| 135 | const llvm::opt::ArgList &TCArgs, |
| 136 | const char *LinkingOutput) const override; |
| 137 | }; |
| 138 | |
| 139 | /// \brief Base class for all GNU tools that provide the same behavior when |
| 140 | /// it comes to response files support |
| 141 | class LLVM_LIBRARY_VISIBILITY GnuTool : public Tool { |
| 142 | virtual void anchor(); |
| 143 | |
| 144 | public: |
| 145 | GnuTool(const char *Name, const char *ShortName, const ToolChain &TC) |
| 146 | : Tool(Name, ShortName, TC, RF_Full, llvm::sys::WEM_CurrentCodePage) {} |
| 147 | }; |
| 148 | |
| 149 | /// gcc - Generic GCC tool implementations. |
| Daniel Dunbar | 82116f8 | 2009-03-17 22:45:24 +0000 | [diff] [blame] | 150 | namespace gcc { |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 151 | class LLVM_LIBRARY_VISIBILITY Common : public GnuTool { |
| 152 | public: |
| 153 | Common(const char *Name, const char *ShortName, const ToolChain &TC) |
| 154 | : GnuTool(Name, ShortName, TC) {} |
| Daniel Dunbar | a3246a0 | 2009-03-18 08:07:30 +0000 | [diff] [blame] | 155 | |
| Eric Christopher | 29a50bc | 2016-01-06 07:24:45 +0000 | [diff] [blame] | 156 | // A gcc tool has an "integrated" assembler that it will call to produce an |
| 157 | // object. Let it use that assembler so that we don't have to deal with |
| 158 | // assembly syntax incompatibilities. |
| 159 | bool hasIntegratedAssembler() const override { return true; } |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 160 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 161 | const InputInfo &Output, const InputInfoList &Inputs, |
| 162 | const llvm::opt::ArgList &TCArgs, |
| 163 | const char *LinkingOutput) const override; |
| Daniel Dunbar | a3246a0 | 2009-03-18 08:07:30 +0000 | [diff] [blame] | 164 | |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 165 | /// RenderExtraToolArgs - Render any arguments necessary to force |
| 166 | /// the particular tool mode. |
| 167 | virtual void RenderExtraToolArgs(const JobAction &JA, |
| 168 | llvm::opt::ArgStringList &CmdArgs) const = 0; |
| 169 | }; |
| Daniel Dunbar | a3246a0 | 2009-03-18 08:07:30 +0000 | [diff] [blame] | 170 | |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 171 | class LLVM_LIBRARY_VISIBILITY Preprocessor : public Common { |
| 172 | public: |
| 173 | Preprocessor(const ToolChain &TC) |
| 174 | : Common("gcc::Preprocessor", "gcc preprocessor", TC) {} |
| Daniel Dunbar | 5903d8c | 2009-03-17 22:07:58 +0000 | [diff] [blame] | 175 | |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 176 | bool hasGoodDiagnostics() const override { return true; } |
| 177 | bool hasIntegratedCPP() const override { return false; } |
| Daniel Dunbar | 1a093d2 | 2009-03-18 06:00:36 +0000 | [diff] [blame] | 178 | |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 179 | void RenderExtraToolArgs(const JobAction &JA, |
| 180 | llvm::opt::ArgStringList &CmdArgs) const override; |
| 181 | }; |
| Daniel Dunbar | 5903d8c | 2009-03-17 22:07:58 +0000 | [diff] [blame] | 182 | |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 183 | class LLVM_LIBRARY_VISIBILITY Compiler : public Common { |
| 184 | public: |
| 185 | Compiler(const ToolChain &TC) : Common("gcc::Compiler", "gcc frontend", TC) {} |
| Daniel Dunbar | 5903d8c | 2009-03-17 22:07:58 +0000 | [diff] [blame] | 186 | |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 187 | bool hasGoodDiagnostics() const override { return true; } |
| 188 | bool hasIntegratedCPP() const override { return true; } |
| Daniel Dunbar | 1a093d2 | 2009-03-18 06:00:36 +0000 | [diff] [blame] | 189 | |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 190 | void RenderExtraToolArgs(const JobAction &JA, |
| 191 | llvm::opt::ArgStringList &CmdArgs) const override; |
| 192 | }; |
| Daniel Dunbar | 5903d8c | 2009-03-17 22:07:58 +0000 | [diff] [blame] | 193 | |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 194 | class LLVM_LIBRARY_VISIBILITY Linker : public Common { |
| 195 | public: |
| 196 | Linker(const ToolChain &TC) : Common("gcc::Linker", "linker (via gcc)", TC) {} |
| Daniel Dunbar | 5903d8c | 2009-03-17 22:07:58 +0000 | [diff] [blame] | 197 | |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 198 | bool hasIntegratedCPP() const override { return false; } |
| 199 | bool isLinkJob() const override { return true; } |
| Daniel Dunbar | 1a093d2 | 2009-03-18 06:00:36 +0000 | [diff] [blame] | 200 | |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 201 | void RenderExtraToolArgs(const JobAction &JA, |
| 202 | llvm::opt::ArgStringList &CmdArgs) const override; |
| 203 | }; |
| Daniel Dunbar | 82116f8 | 2009-03-17 22:45:24 +0000 | [diff] [blame] | 204 | } // end namespace gcc |
| Daniel Dunbar | 5903d8c | 2009-03-17 22:07:58 +0000 | [diff] [blame] | 205 | |
| Tony Linthicum | 76329bf | 2011-12-12 21:14:55 +0000 | [diff] [blame] | 206 | namespace hexagon { |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 207 | // For Hexagon, we do not need to instantiate tools for PreProcess, PreCompile |
| 208 | // and Compile. |
| 209 | // We simply use "clang -cc1" for those actions. |
| 210 | class LLVM_LIBRARY_VISIBILITY Assembler : public GnuTool { |
| 211 | public: |
| 212 | Assembler(const ToolChain &TC) |
| 213 | : GnuTool("hexagon::Assembler", "hexagon-as", TC) {} |
| Tony Linthicum | 76329bf | 2011-12-12 21:14:55 +0000 | [diff] [blame] | 214 | |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 215 | bool hasIntegratedCPP() const override { return false; } |
| Tony Linthicum | 76329bf | 2011-12-12 21:14:55 +0000 | [diff] [blame] | 216 | |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 217 | 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; |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 223 | }; |
| Tony Linthicum | 76329bf | 2011-12-12 21:14:55 +0000 | [diff] [blame] | 224 | |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 225 | class LLVM_LIBRARY_VISIBILITY Linker : public GnuTool { |
| 226 | public: |
| 227 | Linker(const ToolChain &TC) : GnuTool("hexagon::Linker", "hexagon-ld", TC) {} |
| Tony Linthicum | 76329bf | 2011-12-12 21:14:55 +0000 | [diff] [blame] | 228 | |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 229 | bool hasIntegratedCPP() const override { return false; } |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 230 | bool isLinkJob() const override { return true; } |
| Tony Linthicum | 76329bf | 2011-12-12 21:14:55 +0000 | [diff] [blame] | 231 | |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 232 | virtual void RenderExtraToolArgs(const JobAction &JA, |
| 233 | llvm::opt::ArgStringList &CmdArgs) const; |
| 234 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 235 | const InputInfo &Output, const InputInfoList &Inputs, |
| 236 | const llvm::opt::ArgList &TCArgs, |
| 237 | const char *LinkingOutput) const override; |
| 238 | }; |
| Tony Linthicum | 76329bf | 2011-12-12 21:14:55 +0000 | [diff] [blame] | 239 | } // end namespace hexagon. |
| 240 | |
| Tom Stellard | 8fa3309 | 2015-07-18 01:49:05 +0000 | [diff] [blame] | 241 | namespace amdgpu { |
| 242 | |
| 243 | class LLVM_LIBRARY_VISIBILITY Linker : public GnuTool { |
| 244 | public: |
| Konstantin Zhuravlyov | 6568711 | 2016-03-29 15:54:09 +0000 | [diff] [blame] | 245 | Linker(const ToolChain &TC) : GnuTool("amdgpu::Linker", "amdphdrs", TC) {} |
| Tom Stellard | 8fa3309 | 2015-07-18 01:49:05 +0000 | [diff] [blame] | 246 | bool isLinkJob() const override { return true; } |
| 247 | bool hasIntegratedCPP() const override { return false; } |
| 248 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 249 | const InputInfo &Output, const InputInfoList &Inputs, |
| 250 | const llvm::opt::ArgList &TCArgs, |
| 251 | const char *LinkingOutput) const override; |
| 252 | }; |
| 253 | |
| 254 | } // end namespace amdgpu |
| 255 | |
| Dan Gohman | 5281686 | 2015-12-16 23:30:41 +0000 | [diff] [blame] | 256 | namespace wasm { |
| 257 | |
| 258 | class LLVM_LIBRARY_VISIBILITY Linker : public GnuTool { |
| 259 | public: |
| 260 | explicit Linker(const ToolChain &TC); |
| 261 | bool isLinkJob() const override; |
| 262 | bool hasIntegratedCPP() const override; |
| 263 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 264 | const InputInfo &Output, const InputInfoList &Inputs, |
| 265 | const llvm::opt::ArgList &TCArgs, |
| 266 | const char *LinkingOutput) const override; |
| 267 | }; |
| 268 | |
| 269 | } // end namespace wasm |
| 270 | |
| Bernard Ogden | 3156176 | 2013-12-12 13:27:11 +0000 | [diff] [blame] | 271 | namespace arm { |
| Renato Golin | e17c580 | 2015-07-27 23:44:42 +0000 | [diff] [blame] | 272 | std::string getARMTargetCPU(StringRef CPU, StringRef Arch, |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 273 | const llvm::Triple &Triple); |
| Renato Golin | e17c580 | 2015-07-27 23:44:42 +0000 | [diff] [blame] | 274 | const std::string getARMArch(StringRef Arch, |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 275 | const llvm::Triple &Triple); |
| Chandler Carruth | d96f37a | 2015-08-30 07:51:18 +0000 | [diff] [blame] | 276 | StringRef getARMCPUForMArch(StringRef Arch, const llvm::Triple &Triple); |
| Vladimir Sukharev | 64f6824 | 2015-09-23 09:29:32 +0000 | [diff] [blame] | 277 | StringRef getLLVMArchSuffixForARM(StringRef CPU, StringRef Arch, |
| 278 | const llvm::Triple &Triple); |
| Joerg Sonnenberger | 1689d3f | 2015-01-28 23:30:39 +0000 | [diff] [blame] | 279 | |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 280 | void appendEBLinkFlags(const llvm::opt::ArgList &Args, ArgStringList &CmdArgs, |
| 281 | const llvm::Triple &Triple); |
| Eugene Zelenko | d4304d2 | 2015-11-04 21:37:17 +0000 | [diff] [blame] | 282 | } // end namespace arm |
| Tony Linthicum | 76329bf | 2011-12-12 21:14:55 +0000 | [diff] [blame] | 283 | |
| Jonathan Roelofs | 2cea1be | 2014-02-12 03:21:20 +0000 | [diff] [blame] | 284 | namespace mips { |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 285 | typedef enum { NanLegacy = 1, Nan2008 = 2 } NanEncoding; |
| Saleem Abdulrasool | d5556e3 | 2015-09-19 04:33:38 +0000 | [diff] [blame] | 286 | |
| 287 | enum class FloatABI { |
| 288 | Invalid, |
| 289 | Soft, |
| 290 | Hard, |
| 291 | }; |
| 292 | |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 293 | NanEncoding getSupportedNanEncoding(StringRef &CPU); |
| 294 | void getMipsCPUAndABI(const llvm::opt::ArgList &Args, |
| 295 | const llvm::Triple &Triple, StringRef &CPUName, |
| 296 | StringRef &ABIName); |
| Vasileios Kalintiris | c744e12 | 2015-11-12 15:26:54 +0000 | [diff] [blame] | 297 | std::string getMipsABILibSuffix(const llvm::opt::ArgList &Args, |
| 298 | const llvm::Triple &Triple); |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 299 | bool hasMipsAbiArg(const llvm::opt::ArgList &Args, const char *Value); |
| 300 | bool isUCLibc(const llvm::opt::ArgList &Args); |
| 301 | bool isNaN2008(const llvm::opt::ArgList &Args, const llvm::Triple &Triple); |
| 302 | bool isFPXXDefault(const llvm::Triple &Triple, StringRef CPUName, |
| Saleem Abdulrasool | d5556e3 | 2015-09-19 04:33:38 +0000 | [diff] [blame] | 303 | StringRef ABIName, mips::FloatABI FloatABI); |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 304 | bool shouldUseFPXX(const llvm::opt::ArgList &Args, const llvm::Triple &Triple, |
| Saleem Abdulrasool | d5556e3 | 2015-09-19 04:33:38 +0000 | [diff] [blame] | 305 | StringRef CPUName, StringRef ABIName, |
| 306 | mips::FloatABI FloatABI); |
| Eugene Zelenko | d4304d2 | 2015-11-04 21:37:17 +0000 | [diff] [blame] | 307 | } // end namespace mips |
| Jonathan Roelofs | 2cea1be | 2014-02-12 03:21:20 +0000 | [diff] [blame] | 308 | |
| Ulrich Weigand | 8afad61 | 2014-07-28 13:17:52 +0000 | [diff] [blame] | 309 | namespace ppc { |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 310 | bool hasPPCAbiArg(const llvm::opt::ArgList &Args, const char *Value); |
| Eugene Zelenko | d4304d2 | 2015-11-04 21:37:17 +0000 | [diff] [blame] | 311 | } // end namespace ppc |
| Ulrich Weigand | 8afad61 | 2014-07-28 13:17:52 +0000 | [diff] [blame] | 312 | |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 313 | /// cloudabi -- Directly call GNU Binutils linker |
| Ed Schouten | 3c3e58c | 2015-03-26 11:13:44 +0000 | [diff] [blame] | 314 | namespace cloudabi { |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 315 | class LLVM_LIBRARY_VISIBILITY Linker : public GnuTool { |
| Ed Schouten | 3c3e58c | 2015-03-26 11:13:44 +0000 | [diff] [blame] | 316 | public: |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 317 | Linker(const ToolChain &TC) : GnuTool("cloudabi::Linker", "linker", TC) {} |
| Ed Schouten | 3c3e58c | 2015-03-26 11:13:44 +0000 | [diff] [blame] | 318 | |
| 319 | bool hasIntegratedCPP() const override { return false; } |
| 320 | bool isLinkJob() const override { return true; } |
| 321 | |
| 322 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 323 | const InputInfo &Output, const InputInfoList &Inputs, |
| 324 | const llvm::opt::ArgList &TCArgs, |
| 325 | const char *LinkingOutput) const override; |
| 326 | }; |
| 327 | } // end namespace cloudabi |
| 328 | |
| Daniel Dunbar | 64ed5e3 | 2009-03-20 00:52:38 +0000 | [diff] [blame] | 329 | namespace darwin { |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 330 | llvm::Triple::ArchType getArchTypeForMachOArchName(StringRef Str); |
| 331 | void setTripleTypeForMachOArchName(llvm::Triple &T, StringRef Str); |
| Rafael Espindola | dcbf698 | 2012-10-31 18:51:07 +0000 | [diff] [blame] | 332 | |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 333 | class LLVM_LIBRARY_VISIBILITY MachOTool : public Tool { |
| 334 | virtual void anchor(); |
| Daniel Dunbar | e9ded43 | 2009-09-09 18:36:20 +0000 | [diff] [blame] | 335 | |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 336 | protected: |
| 337 | void AddMachOArch(const llvm::opt::ArgList &Args, |
| 338 | llvm::opt::ArgStringList &CmdArgs) const; |
| Daniel Dunbar | e9ded43 | 2009-09-09 18:36:20 +0000 | [diff] [blame] | 339 | |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 340 | const toolchains::MachO &getMachOToolChain() const { |
| 341 | return reinterpret_cast<const toolchains::MachO &>(getToolChain()); |
| 342 | } |
| Daniel Dunbar | e9ded43 | 2009-09-09 18:36:20 +0000 | [diff] [blame] | 343 | |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 344 | public: |
| 345 | MachOTool( |
| 346 | const char *Name, const char *ShortName, const ToolChain &TC, |
| 347 | ResponseFileSupport ResponseSupport = RF_None, |
| 348 | llvm::sys::WindowsEncodingMethod ResponseEncoding = llvm::sys::WEM_UTF8, |
| 349 | const char *ResponseFlag = "@") |
| 350 | : Tool(Name, ShortName, TC, ResponseSupport, ResponseEncoding, |
| 351 | ResponseFlag) {} |
| 352 | }; |
| Daniel Dunbar | be22084 | 2009-03-20 16:06:39 +0000 | [diff] [blame] | 353 | |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 354 | class LLVM_LIBRARY_VISIBILITY Assembler : public MachOTool { |
| 355 | public: |
| 356 | Assembler(const ToolChain &TC) |
| 357 | : MachOTool("darwin::Assembler", "assembler", TC) {} |
| Daniel Dunbar | be22084 | 2009-03-20 16:06:39 +0000 | [diff] [blame] | 358 | |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 359 | bool hasIntegratedCPP() const override { return false; } |
| Daniel Dunbar | be22084 | 2009-03-20 16:06:39 +0000 | [diff] [blame] | 360 | |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 361 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 362 | const InputInfo &Output, const InputInfoList &Inputs, |
| 363 | const llvm::opt::ArgList &TCArgs, |
| 364 | const char *LinkingOutput) const override; |
| 365 | }; |
| Daniel Dunbar | c196421 | 2009-03-26 16:23:12 +0000 | [diff] [blame] | 366 | |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 367 | class LLVM_LIBRARY_VISIBILITY Linker : public MachOTool { |
| 368 | bool NeedsTempPath(const InputInfoList &Inputs) const; |
| 369 | void AddLinkArgs(Compilation &C, const llvm::opt::ArgList &Args, |
| 370 | llvm::opt::ArgStringList &CmdArgs, |
| 371 | const InputInfoList &Inputs) const; |
| Daniel Dunbar | c196421 | 2009-03-26 16:23:12 +0000 | [diff] [blame] | 372 | |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 373 | public: |
| 374 | Linker(const ToolChain &TC) |
| 375 | : MachOTool("darwin::Linker", "linker", TC, RF_FileList, |
| 376 | llvm::sys::WEM_UTF8, "-filelist") {} |
| Daniel Dunbar | c196421 | 2009-03-26 16:23:12 +0000 | [diff] [blame] | 377 | |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 378 | bool hasIntegratedCPP() const override { return false; } |
| 379 | bool isLinkJob() const override { return true; } |
| Daniel Dunbar | c196421 | 2009-03-26 16:23:12 +0000 | [diff] [blame] | 380 | |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 381 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 382 | const InputInfo &Output, const InputInfoList &Inputs, |
| 383 | const llvm::opt::ArgList &TCArgs, |
| 384 | const char *LinkingOutput) const override; |
| 385 | }; |
| Daniel Dunbar | 64ed5e3 | 2009-03-20 00:52:38 +0000 | [diff] [blame] | 386 | |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 387 | class LLVM_LIBRARY_VISIBILITY Lipo : public MachOTool { |
| 388 | public: |
| 389 | Lipo(const ToolChain &TC) : MachOTool("darwin::Lipo", "lipo", TC) {} |
| Daniel Dunbar | 64ed5e3 | 2009-03-20 00:52:38 +0000 | [diff] [blame] | 390 | |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 391 | bool hasIntegratedCPP() const override { return false; } |
| Daniel Dunbar | 8829962 | 2010-06-04 18:28:36 +0000 | [diff] [blame] | 392 | |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 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 | }; |
| Daniel Dunbar | 8829962 | 2010-06-04 18:28:36 +0000 | [diff] [blame] | 398 | |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 399 | class LLVM_LIBRARY_VISIBILITY Dsymutil : public MachOTool { |
| 400 | public: |
| 401 | Dsymutil(const ToolChain &TC) |
| 402 | : MachOTool("darwin::Dsymutil", "dsymutil", TC) {} |
| Daniel Dunbar | 8829962 | 2010-06-04 18:28:36 +0000 | [diff] [blame] | 403 | |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 404 | bool hasIntegratedCPP() const override { return false; } |
| 405 | bool isDsymutilJob() const override { return true; } |
| Eric Christopher | 551ef45 | 2011-08-23 17:56:55 +0000 | [diff] [blame] | 406 | |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 407 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 408 | const InputInfo &Output, const InputInfoList &Inputs, |
| 409 | const llvm::opt::ArgList &TCArgs, |
| 410 | const char *LinkingOutput) const override; |
| 411 | }; |
| Eric Christopher | 551ef45 | 2011-08-23 17:56:55 +0000 | [diff] [blame] | 412 | |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 413 | class LLVM_LIBRARY_VISIBILITY VerifyDebug : public MachOTool { |
| 414 | public: |
| 415 | VerifyDebug(const ToolChain &TC) |
| 416 | : MachOTool("darwin::VerifyDebug", "dwarfdump", TC) {} |
| Eric Christopher | 551ef45 | 2011-08-23 17:56:55 +0000 | [diff] [blame] | 417 | |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 418 | bool hasIntegratedCPP() const override { return false; } |
| Eric Christopher | 551ef45 | 2011-08-23 17:56:55 +0000 | [diff] [blame] | 419 | |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 420 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 421 | const InputInfo &Output, const InputInfoList &Inputs, |
| 422 | const llvm::opt::ArgList &TCArgs, |
| 423 | const char *LinkingOutput) const override; |
| 424 | }; |
| Eugene Zelenko | d4304d2 | 2015-11-04 21:37:17 +0000 | [diff] [blame] | 425 | } // end namespace darwin |
| Daniel Dunbar | 64ed5e3 | 2009-03-20 00:52:38 +0000 | [diff] [blame] | 426 | |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 427 | /// openbsd -- Directly call GNU Binutils assembler and linker |
| Daniel Dunbar | 10de9e6 | 2009-06-29 20:52:51 +0000 | [diff] [blame] | 428 | namespace openbsd { |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 429 | class LLVM_LIBRARY_VISIBILITY Assembler : public GnuTool { |
| 430 | public: |
| 431 | Assembler(const ToolChain &TC) |
| 432 | : GnuTool("openbsd::Assembler", "assembler", TC) {} |
| Daniel Dunbar | 10de9e6 | 2009-06-29 20:52:51 +0000 | [diff] [blame] | 433 | |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 434 | bool hasIntegratedCPP() const override { return false; } |
| Daniel Dunbar | 10de9e6 | 2009-06-29 20:52:51 +0000 | [diff] [blame] | 435 | |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 436 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 437 | const InputInfo &Output, const InputInfoList &Inputs, |
| 438 | const llvm::opt::ArgList &TCArgs, |
| 439 | const char *LinkingOutput) const override; |
| 440 | }; |
| Eugene Zelenko | d4304d2 | 2015-11-04 21:37:17 +0000 | [diff] [blame] | 441 | |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 442 | class LLVM_LIBRARY_VISIBILITY Linker : public GnuTool { |
| 443 | public: |
| 444 | Linker(const ToolChain &TC) : GnuTool("openbsd::Linker", "linker", TC) {} |
| Daniel Dunbar | 10de9e6 | 2009-06-29 20:52:51 +0000 | [diff] [blame] | 445 | |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 446 | bool hasIntegratedCPP() const override { return false; } |
| 447 | bool isLinkJob() const override { return true; } |
| Daniel Dunbar | 10de9e6 | 2009-06-29 20:52:51 +0000 | [diff] [blame] | 448 | |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 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 | }; |
| Edward O'Callaghan | 856e4ff | 2009-08-22 01:06:46 +0000 | [diff] [blame] | 454 | } // end namespace openbsd |
| Daniel Dunbar | 10de9e6 | 2009-06-29 20:52:51 +0000 | [diff] [blame] | 455 | |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 456 | /// bitrig -- Directly call GNU Binutils assembler and linker |
| Eli Friedman | 9fa2885 | 2012-08-08 23:57:20 +0000 | [diff] [blame] | 457 | namespace bitrig { |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 458 | class LLVM_LIBRARY_VISIBILITY Assembler : public GnuTool { |
| 459 | public: |
| 460 | Assembler(const ToolChain &TC) |
| 461 | : GnuTool("bitrig::Assembler", "assembler", TC) {} |
| Eli Friedman | 9fa2885 | 2012-08-08 23:57:20 +0000 | [diff] [blame] | 462 | |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 463 | bool hasIntegratedCPP() const override { return false; } |
| Eli Friedman | 9fa2885 | 2012-08-08 23:57:20 +0000 | [diff] [blame] | 464 | |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 465 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 466 | const InputInfo &Output, const InputInfoList &Inputs, |
| 467 | const llvm::opt::ArgList &TCArgs, |
| 468 | const char *LinkingOutput) const override; |
| 469 | }; |
| Eugene Zelenko | d4304d2 | 2015-11-04 21:37:17 +0000 | [diff] [blame] | 470 | |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 471 | class LLVM_LIBRARY_VISIBILITY Linker : public GnuTool { |
| 472 | public: |
| 473 | Linker(const ToolChain &TC) : GnuTool("bitrig::Linker", "linker", TC) {} |
| Eli Friedman | 9fa2885 | 2012-08-08 23:57:20 +0000 | [diff] [blame] | 474 | |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 475 | bool hasIntegratedCPP() const override { return false; } |
| 476 | bool isLinkJob() const override { return true; } |
| Eli Friedman | 9fa2885 | 2012-08-08 23:57:20 +0000 | [diff] [blame] | 477 | |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 478 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 479 | const InputInfo &Output, const InputInfoList &Inputs, |
| 480 | const llvm::opt::ArgList &TCArgs, |
| 481 | const char *LinkingOutput) const override; |
| 482 | }; |
| Eli Friedman | 9fa2885 | 2012-08-08 23:57:20 +0000 | [diff] [blame] | 483 | } // end namespace bitrig |
| 484 | |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 485 | /// freebsd -- Directly call GNU Binutils assembler and linker |
| Daniel Dunbar | 8eb473c | 2009-03-31 17:45:15 +0000 | [diff] [blame] | 486 | namespace freebsd { |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 487 | class LLVM_LIBRARY_VISIBILITY Assembler : public GnuTool { |
| 488 | public: |
| 489 | Assembler(const ToolChain &TC) |
| 490 | : GnuTool("freebsd::Assembler", "assembler", TC) {} |
| Daniel Dunbar | 8eb473c | 2009-03-31 17:45:15 +0000 | [diff] [blame] | 491 | |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 492 | bool hasIntegratedCPP() const override { return false; } |
| Daniel Dunbar | 8eb473c | 2009-03-31 17:45:15 +0000 | [diff] [blame] | 493 | |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 494 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 495 | const InputInfo &Output, const InputInfoList &Inputs, |
| 496 | const llvm::opt::ArgList &TCArgs, |
| 497 | const char *LinkingOutput) const override; |
| 498 | }; |
| Eugene Zelenko | d4304d2 | 2015-11-04 21:37:17 +0000 | [diff] [blame] | 499 | |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 500 | class LLVM_LIBRARY_VISIBILITY Linker : public GnuTool { |
| 501 | public: |
| 502 | Linker(const ToolChain &TC) : GnuTool("freebsd::Linker", "linker", TC) {} |
| Daniel Dunbar | d854c8d | 2009-04-01 19:36:32 +0000 | [diff] [blame] | 503 | |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 504 | bool hasIntegratedCPP() const override { return false; } |
| 505 | bool isLinkJob() const override { return true; } |
| Daniel Dunbar | d854c8d | 2009-04-01 19:36:32 +0000 | [diff] [blame] | 506 | |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 507 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 508 | const InputInfo &Output, const InputInfoList &Inputs, |
| 509 | const llvm::opt::ArgList &TCArgs, |
| 510 | const char *LinkingOutput) const override; |
| 511 | }; |
| Edward O'Callaghan | 856e4ff | 2009-08-22 01:06:46 +0000 | [diff] [blame] | 512 | } // end namespace freebsd |
| 513 | |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 514 | /// netbsd -- Directly call GNU Binutils assembler and linker |
| Benjamin Kramer | 24f1d3e | 2011-02-02 18:59:27 +0000 | [diff] [blame] | 515 | namespace netbsd { |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 516 | class LLVM_LIBRARY_VISIBILITY Assembler : public GnuTool { |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 517 | public: |
| 518 | Assembler(const ToolChain &TC) |
| 519 | : GnuTool("netbsd::Assembler", "assembler", TC) {} |
| Benjamin Kramer | 24f1d3e | 2011-02-02 18:59:27 +0000 | [diff] [blame] | 520 | |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 521 | bool hasIntegratedCPP() const override { return false; } |
| Benjamin Kramer | 24f1d3e | 2011-02-02 18:59:27 +0000 | [diff] [blame] | 522 | |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 523 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 524 | const InputInfo &Output, const InputInfoList &Inputs, |
| 525 | const llvm::opt::ArgList &TCArgs, |
| 526 | const char *LinkingOutput) const override; |
| 527 | }; |
| Joerg Sonnenberger | 637603a | 2011-05-16 13:35:02 +0000 | [diff] [blame] | 528 | |
| Eugene Zelenko | d4304d2 | 2015-11-04 21:37:17 +0000 | [diff] [blame] | 529 | class LLVM_LIBRARY_VISIBILITY Linker : public GnuTool { |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 530 | public: |
| 531 | Linker(const ToolChain &TC) : GnuTool("netbsd::Linker", "linker", TC) {} |
| Benjamin Kramer | 24f1d3e | 2011-02-02 18:59:27 +0000 | [diff] [blame] | 532 | |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 533 | bool hasIntegratedCPP() const override { return false; } |
| 534 | bool isLinkJob() const override { return true; } |
| Benjamin Kramer | 24f1d3e | 2011-02-02 18:59:27 +0000 | [diff] [blame] | 535 | |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 536 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 537 | const InputInfo &Output, const InputInfoList &Inputs, |
| 538 | const llvm::opt::ArgList &TCArgs, |
| 539 | const char *LinkingOutput) const override; |
| 540 | }; |
| Benjamin Kramer | 24f1d3e | 2011-02-02 18:59:27 +0000 | [diff] [blame] | 541 | } // end namespace netbsd |
| 542 | |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 543 | /// Directly call GNU Binutils' assembler and linker. |
| Thomas Schwinge | 4e55526 | 2013-03-28 19:04:25 +0000 | [diff] [blame] | 544 | namespace gnutools { |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 545 | class LLVM_LIBRARY_VISIBILITY Assembler : public GnuTool { |
| 546 | public: |
| 547 | Assembler(const ToolChain &TC) : GnuTool("GNU::Assembler", "assembler", TC) {} |
| Rafael Espindola | 92b0093 | 2010-08-10 00:25:48 +0000 | [diff] [blame] | 548 | |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 549 | bool hasIntegratedCPP() const override { return false; } |
| 550 | |
| 551 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 552 | const InputInfo &Output, const InputInfoList &Inputs, |
| 553 | const llvm::opt::ArgList &TCArgs, |
| 554 | const char *LinkingOutput) const override; |
| 555 | }; |
| Eugene Zelenko | d4304d2 | 2015-11-04 21:37:17 +0000 | [diff] [blame] | 556 | |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 557 | class LLVM_LIBRARY_VISIBILITY Linker : public GnuTool { |
| 558 | public: |
| 559 | Linker(const ToolChain &TC) : GnuTool("GNU::Linker", "linker", TC) {} |
| 560 | |
| 561 | bool hasIntegratedCPP() const override { return false; } |
| 562 | bool isLinkJob() const override { return true; } |
| Rafael Espindola | 92b0093 | 2010-08-10 00:25:48 +0000 | [diff] [blame] | 563 | |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 564 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 565 | const InputInfo &Output, const InputInfoList &Inputs, |
| 566 | const llvm::opt::ArgList &TCArgs, |
| 567 | const char *LinkingOutput) const override; |
| 568 | }; |
| Eugene Zelenko | d4304d2 | 2015-11-04 21:37:17 +0000 | [diff] [blame] | 569 | } // end namespace gnutools |
| Rafael Espindola | c8f008f | 2010-11-07 20:14:31 +0000 | [diff] [blame] | 570 | |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 571 | namespace nacltools { |
| 572 | class LLVM_LIBRARY_VISIBILITY AssemblerARM : public gnutools::Assembler { |
| 573 | public: |
| 574 | AssemblerARM(const ToolChain &TC) : gnutools::Assembler(TC) {} |
| Rafael Espindola | c8f008f | 2010-11-07 20:14:31 +0000 | [diff] [blame] | 575 | |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 576 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 577 | const InputInfo &Output, const InputInfoList &Inputs, |
| 578 | const llvm::opt::ArgList &TCArgs, |
| 579 | const char *LinkingOutput) const override; |
| 580 | }; |
| Eugene Zelenko | d4304d2 | 2015-11-04 21:37:17 +0000 | [diff] [blame] | 581 | |
| Derek Schuff | 821d884 | 2015-11-16 22:21:25 +0000 | [diff] [blame] | 582 | class LLVM_LIBRARY_VISIBILITY Linker : public GnuTool { |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 583 | public: |
| Derek Schuff | 821d884 | 2015-11-16 22:21:25 +0000 | [diff] [blame] | 584 | Linker(const ToolChain &TC) : GnuTool("NaCl::Linker", "linker", TC) {} |
| Derek Schuff | 6ab52fa | 2015-03-30 20:31:33 +0000 | [diff] [blame] | 585 | |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 586 | bool hasIntegratedCPP() const override { return false; } |
| 587 | bool isLinkJob() const override { return true; } |
| Derek Schuff | 6ab52fa | 2015-03-30 20:31:33 +0000 | [diff] [blame] | 588 | |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 589 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 590 | const InputInfo &Output, const InputInfoList &Inputs, |
| 591 | const llvm::opt::ArgList &TCArgs, |
| 592 | const char *LinkingOutput) const override; |
| 593 | }; |
| Eugene Zelenko | d4304d2 | 2015-11-04 21:37:17 +0000 | [diff] [blame] | 594 | } // end namespace nacltools |
| Derek Schuff | 6ab52fa | 2015-03-30 20:31:33 +0000 | [diff] [blame] | 595 | |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 596 | /// minix -- Directly call GNU Binutils assembler and linker |
| Chris Lattner | 3e2ee14 | 2010-07-07 16:01:42 +0000 | [diff] [blame] | 597 | namespace minix { |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 598 | class LLVM_LIBRARY_VISIBILITY Assembler : public GnuTool { |
| 599 | public: |
| 600 | Assembler(const ToolChain &TC) |
| 601 | : GnuTool("minix::Assembler", "assembler", TC) {} |
| Chris Lattner | 3e2ee14 | 2010-07-07 16:01:42 +0000 | [diff] [blame] | 602 | |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 603 | bool hasIntegratedCPP() const override { return false; } |
| Chris Lattner | 3e2ee14 | 2010-07-07 16:01:42 +0000 | [diff] [blame] | 604 | |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 605 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 606 | const InputInfo &Output, const InputInfoList &Inputs, |
| 607 | const llvm::opt::ArgList &TCArgs, |
| 608 | const char *LinkingOutput) const override; |
| 609 | }; |
| Eugene Zelenko | d4304d2 | 2015-11-04 21:37:17 +0000 | [diff] [blame] | 610 | |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 611 | class LLVM_LIBRARY_VISIBILITY Linker : public GnuTool { |
| 612 | public: |
| 613 | Linker(const ToolChain &TC) : GnuTool("minix::Linker", "linker", TC) {} |
| Chris Lattner | 3e2ee14 | 2010-07-07 16:01:42 +0000 | [diff] [blame] | 614 | |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 615 | bool hasIntegratedCPP() const override { return false; } |
| 616 | bool isLinkJob() const override { return true; } |
| Chris Lattner | 3e2ee14 | 2010-07-07 16:01:42 +0000 | [diff] [blame] | 617 | |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 618 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 619 | const InputInfo &Output, const InputInfoList &Inputs, |
| 620 | const llvm::opt::ArgList &TCArgs, |
| 621 | const char *LinkingOutput) const override; |
| 622 | }; |
| Chris Lattner | 3e2ee14 | 2010-07-07 16:01:42 +0000 | [diff] [blame] | 623 | } // end namespace minix |
| 624 | |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 625 | /// solaris -- Directly call Solaris assembler and linker |
| David Chisnall | f571cde | 2012-02-15 13:39:01 +0000 | [diff] [blame] | 626 | namespace solaris { |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 627 | class LLVM_LIBRARY_VISIBILITY Assembler : public Tool { |
| 628 | public: |
| 629 | Assembler(const ToolChain &TC) |
| 630 | : Tool("solaris::Assembler", "assembler", TC) {} |
| David Chisnall | f571cde | 2012-02-15 13:39:01 +0000 | [diff] [blame] | 631 | |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 632 | bool hasIntegratedCPP() const override { return false; } |
| David Chisnall | f571cde | 2012-02-15 13:39:01 +0000 | [diff] [blame] | 633 | |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 634 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 635 | const InputInfo &Output, const InputInfoList &Inputs, |
| 636 | const llvm::opt::ArgList &TCArgs, |
| 637 | const char *LinkingOutput) const override; |
| 638 | }; |
| Eugene Zelenko | d4304d2 | 2015-11-04 21:37:17 +0000 | [diff] [blame] | 639 | |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 640 | class LLVM_LIBRARY_VISIBILITY Linker : public Tool { |
| 641 | public: |
| 642 | Linker(const ToolChain &TC) : Tool("solaris::Linker", "linker", TC) {} |
| David Chisnall | f571cde | 2012-02-15 13:39:01 +0000 | [diff] [blame] | 643 | |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 644 | bool hasIntegratedCPP() const override { return false; } |
| 645 | bool isLinkJob() const override { return true; } |
| David Chisnall | f571cde | 2012-02-15 13:39:01 +0000 | [diff] [blame] | 646 | |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 647 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 648 | const InputInfo &Output, const InputInfoList &Inputs, |
| 649 | const llvm::opt::ArgList &TCArgs, |
| 650 | const char *LinkingOutput) const override; |
| 651 | }; |
| David Chisnall | a9ed5d7 | 2012-02-15 16:25:46 +0000 | [diff] [blame] | 652 | } // end namespace solaris |
| David Chisnall | f571cde | 2012-02-15 13:39:01 +0000 | [diff] [blame] | 653 | |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 654 | /// dragonfly -- Directly call GNU Binutils assembler and linker |
| Daniel Dunbar | cc91234 | 2009-05-02 18:28:39 +0000 | [diff] [blame] | 655 | namespace dragonfly { |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 656 | class LLVM_LIBRARY_VISIBILITY Assembler : public GnuTool { |
| 657 | public: |
| 658 | Assembler(const ToolChain &TC) |
| 659 | : GnuTool("dragonfly::Assembler", "assembler", TC) {} |
| Daniel Dunbar | cc91234 | 2009-05-02 18:28:39 +0000 | [diff] [blame] | 660 | |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 661 | bool hasIntegratedCPP() const override { return false; } |
| Daniel Dunbar | cc91234 | 2009-05-02 18:28:39 +0000 | [diff] [blame] | 662 | |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 663 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 664 | const InputInfo &Output, const InputInfoList &Inputs, |
| 665 | const llvm::opt::ArgList &TCArgs, |
| 666 | const char *LinkingOutput) const override; |
| 667 | }; |
| Eugene Zelenko | d4304d2 | 2015-11-04 21:37:17 +0000 | [diff] [blame] | 668 | |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 669 | class LLVM_LIBRARY_VISIBILITY Linker : public GnuTool { |
| 670 | public: |
| 671 | Linker(const ToolChain &TC) : GnuTool("dragonfly::Linker", "linker", TC) {} |
| Daniel Dunbar | cc91234 | 2009-05-02 18:28:39 +0000 | [diff] [blame] | 672 | |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 673 | bool hasIntegratedCPP() const override { return false; } |
| 674 | bool isLinkJob() const override { return true; } |
| Daniel Dunbar | cc91234 | 2009-05-02 18:28:39 +0000 | [diff] [blame] | 675 | |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 676 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 677 | const InputInfo &Output, const InputInfoList &Inputs, |
| 678 | const llvm::opt::ArgList &TCArgs, |
| 679 | const char *LinkingOutput) const override; |
| 680 | }; |
| Edward O'Callaghan | 856e4ff | 2009-08-22 01:06:46 +0000 | [diff] [blame] | 681 | } // end namespace dragonfly |
| Daniel Dunbar | cc91234 | 2009-05-02 18:28:39 +0000 | [diff] [blame] | 682 | |
| Hans Wennborg | 1da044a | 2014-06-26 19:59:02 +0000 | [diff] [blame] | 683 | /// Visual studio tools. |
| Michael J. Spencer | b186bc3 | 2010-08-21 21:55:07 +0000 | [diff] [blame] | 684 | namespace visualstudio { |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 685 | VersionTuple getMSVCVersion(const Driver *D, const llvm::Triple &Triple, |
| 686 | const llvm::opt::ArgList &Args, bool IsWindowsMSVC); |
| David Majnemer | e11d373 | 2015-06-08 00:22:46 +0000 | [diff] [blame] | 687 | |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 688 | class LLVM_LIBRARY_VISIBILITY Linker : public Tool { |
| 689 | public: |
| 690 | Linker(const ToolChain &TC) |
| 691 | : Tool("visualstudio::Linker", "linker", TC, RF_Full, |
| 692 | llvm::sys::WEM_UTF16) {} |
| Michael J. Spencer | b186bc3 | 2010-08-21 21:55:07 +0000 | [diff] [blame] | 693 | |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 694 | bool hasIntegratedCPP() const override { return false; } |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 695 | bool isLinkJob() const override { return true; } |
| Michael J. Spencer | b186bc3 | 2010-08-21 21:55:07 +0000 | [diff] [blame] | 696 | |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 697 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 698 | const InputInfo &Output, const InputInfoList &Inputs, |
| 699 | const llvm::opt::ArgList &TCArgs, |
| 700 | const char *LinkingOutput) const override; |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 701 | }; |
| Hans Wennborg | 87cfa71 | 2013-09-19 20:32:16 +0000 | [diff] [blame] | 702 | |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 703 | class LLVM_LIBRARY_VISIBILITY Compiler : public Tool { |
| 704 | public: |
| 705 | Compiler(const ToolChain &TC) |
| 706 | : Tool("visualstudio::Compiler", "compiler", TC, RF_Full, |
| 707 | llvm::sys::WEM_UTF16) {} |
| Hans Wennborg | 87cfa71 | 2013-09-19 20:32:16 +0000 | [diff] [blame] | 708 | |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 709 | bool hasIntegratedAssembler() const override { return true; } |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 710 | bool hasIntegratedCPP() const override { return true; } |
| 711 | bool isLinkJob() const override { return false; } |
| Hans Wennborg | 87cfa71 | 2013-09-19 20:32:16 +0000 | [diff] [blame] | 712 | |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 713 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 714 | const InputInfo &Output, const InputInfoList &Inputs, |
| 715 | const llvm::opt::ArgList &TCArgs, |
| 716 | const char *LinkingOutput) const override; |
| Hans Wennborg | 87cfa71 | 2013-09-19 20:32:16 +0000 | [diff] [blame] | 717 | |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 718 | std::unique_ptr<Command> GetCommand(Compilation &C, const JobAction &JA, |
| 719 | const InputInfo &Output, |
| 720 | const InputInfoList &Inputs, |
| 721 | const llvm::opt::ArgList &TCArgs, |
| 722 | const char *LinkingOutput) const; |
| 723 | }; |
| Michael J. Spencer | b186bc3 | 2010-08-21 21:55:07 +0000 | [diff] [blame] | 724 | } // end namespace visualstudio |
| 725 | |
| Yaron Keren | 1c0070c | 2015-07-02 04:45:27 +0000 | [diff] [blame] | 726 | /// MinGW -- Directly call GNU Binutils assembler and linker |
| 727 | namespace MinGW { |
| 728 | class LLVM_LIBRARY_VISIBILITY Assembler : public Tool { |
| 729 | public: |
| 730 | Assembler(const ToolChain &TC) : Tool("MinGW::Assemble", "assembler", TC) {} |
| 731 | |
| 732 | bool hasIntegratedCPP() const override { return false; } |
| 733 | |
| 734 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 735 | const InputInfo &Output, const InputInfoList &Inputs, |
| 736 | const llvm::opt::ArgList &TCArgs, |
| 737 | const char *LinkingOutput) const override; |
| 738 | }; |
| 739 | |
| 740 | class LLVM_LIBRARY_VISIBILITY Linker : public Tool { |
| 741 | public: |
| 742 | Linker(const ToolChain &TC) : Tool("MinGW::Linker", "linker", TC) {} |
| 743 | |
| 744 | bool hasIntegratedCPP() const override { return false; } |
| 745 | bool isLinkJob() const override { return true; } |
| 746 | |
| 747 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 748 | const InputInfo &Output, const InputInfoList &Inputs, |
| 749 | const llvm::opt::ArgList &TCArgs, |
| 750 | const char *LinkingOutput) const override; |
| 751 | |
| 752 | private: |
| 753 | void AddLibGCC(const llvm::opt::ArgList &Args, ArgStringList &CmdArgs) const; |
| 754 | }; |
| 755 | } // end namespace MinGW |
| 756 | |
| Tim Northover | 9c7e035 | 2013-12-12 11:55:52 +0000 | [diff] [blame] | 757 | namespace arm { |
| Saleem Abdulrasool | eee54b4 | 2015-09-18 05:32:23 +0000 | [diff] [blame] | 758 | enum class FloatABI { |
| 759 | Invalid, |
| 760 | Soft, |
| 761 | SoftFP, |
| 762 | Hard, |
| 763 | }; |
| 764 | |
| Saleem Abdulrasool | 06f6f99 | 2015-09-19 20:40:16 +0000 | [diff] [blame] | 765 | FloatABI getARMFloatABI(const ToolChain &TC, const llvm::opt::ArgList &Args); |
| Eugene Zelenko | d4304d2 | 2015-11-04 21:37:17 +0000 | [diff] [blame] | 766 | } // end namespace arm |
| 767 | |
| Petar Jovanovic | 88a328f | 2015-12-14 17:51:50 +0000 | [diff] [blame] | 768 | namespace ppc { |
| 769 | enum class FloatABI { |
| 770 | Invalid, |
| 771 | Soft, |
| 772 | Hard, |
| 773 | }; |
| 774 | |
| 775 | FloatABI getPPCFloatABI(const Driver &D, const llvm::opt::ArgList &Args); |
| 776 | } // end namespace ppc |
| 777 | |
| Robert Lytton | cf1dd69 | 2013-10-11 10:29:40 +0000 | [diff] [blame] | 778 | namespace XCore { |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 779 | // For XCore, we do not need to instantiate tools for PreProcess, PreCompile and |
| 780 | // Compile. |
| 781 | // We simply use "clang -cc1" for those actions. |
| 782 | class LLVM_LIBRARY_VISIBILITY Assembler : public Tool { |
| Saleem Abdulrasool | 543a78b | 2014-10-24 03:13:37 +0000 | [diff] [blame] | 783 | public: |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 784 | Assembler(const ToolChain &TC) : Tool("XCore::Assembler", "XCore-as", TC) {} |
| Saleem Abdulrasool | 543a78b | 2014-10-24 03:13:37 +0000 | [diff] [blame] | 785 | |
| 786 | bool hasIntegratedCPP() const override { return false; } |
| Saleem Abdulrasool | 543a78b | 2014-10-24 03:13:37 +0000 | [diff] [blame] | 787 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 788 | const InputInfo &Output, const InputInfoList &Inputs, |
| 789 | const llvm::opt::ArgList &TCArgs, |
| 790 | const char *LinkingOutput) const override; |
| 791 | }; |
| 792 | |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 793 | class LLVM_LIBRARY_VISIBILITY Linker : public Tool { |
| Saleem Abdulrasool | 543a78b | 2014-10-24 03:13:37 +0000 | [diff] [blame] | 794 | public: |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 795 | Linker(const ToolChain &TC) : Tool("XCore::Linker", "XCore-ld", TC) {} |
| Saleem Abdulrasool | 543a78b | 2014-10-24 03:13:37 +0000 | [diff] [blame] | 796 | |
| 797 | bool hasIntegratedCPP() const override { return false; } |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 798 | bool isLinkJob() const override { return true; } |
| 799 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 800 | const InputInfo &Output, const InputInfoList &Inputs, |
| 801 | const llvm::opt::ArgList &TCArgs, |
| 802 | const char *LinkingOutput) const override; |
| 803 | }; |
| 804 | } // end namespace XCore. |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 805 | |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 806 | namespace CrossWindows { |
| 807 | class LLVM_LIBRARY_VISIBILITY Assembler : public Tool { |
| 808 | public: |
| 809 | Assembler(const ToolChain &TC) : Tool("CrossWindows::Assembler", "as", TC) {} |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 810 | |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 811 | bool hasIntegratedCPP() const override { return false; } |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 812 | |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 813 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 814 | const InputInfo &Output, const InputInfoList &Inputs, |
| 815 | const llvm::opt::ArgList &TCArgs, |
| 816 | const char *LinkingOutput) const override; |
| 817 | }; |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 818 | |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 819 | class LLVM_LIBRARY_VISIBILITY Linker : public Tool { |
| 820 | public: |
| 821 | Linker(const ToolChain &TC) |
| 822 | : Tool("CrossWindows::Linker", "ld", TC, RF_Full) {} |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 823 | |
| Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 824 | bool hasIntegratedCPP() const override { return false; } |
| 825 | bool isLinkJob() const override { return true; } |
| Saleem Abdulrasool | 543a78b | 2014-10-24 03:13:37 +0000 | [diff] [blame] | 826 | |
| 827 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 828 | const InputInfo &Output, const InputInfoList &Inputs, |
| 829 | const llvm::opt::ArgList &TCArgs, |
| 830 | const char *LinkingOutput) const override; |
| 831 | }; |
| Eugene Zelenko | d4304d2 | 2015-11-04 21:37:17 +0000 | [diff] [blame] | 832 | } // end namespace CrossWindows |
| Robert Lytton | cf1dd69 | 2013-10-11 10:29:40 +0000 | [diff] [blame] | 833 | |
| Douglas Katzman | 84a7564 | 2015-06-19 14:55:19 +0000 | [diff] [blame] | 834 | /// SHAVE tools -- Directly call moviCompile and moviAsm |
| 835 | namespace SHAVE { |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 836 | class LLVM_LIBRARY_VISIBILITY Compiler : public Tool { |
| Douglas Katzman | 84a7564 | 2015-06-19 14:55:19 +0000 | [diff] [blame] | 837 | public: |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 838 | Compiler(const ToolChain &TC) : Tool("moviCompile", "movicompile", TC) {} |
| Douglas Katzman | 84a7564 | 2015-06-19 14:55:19 +0000 | [diff] [blame] | 839 | |
| 840 | bool hasIntegratedCPP() const override { return true; } |
| 841 | |
| 842 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 843 | const InputInfo &Output, const InputInfoList &Inputs, |
| 844 | const llvm::opt::ArgList &TCArgs, |
| 845 | const char *LinkingOutput) const override; |
| 846 | }; |
| 847 | |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 848 | class LLVM_LIBRARY_VISIBILITY Assembler : public Tool { |
| Douglas Katzman | 84a7564 | 2015-06-19 14:55:19 +0000 | [diff] [blame] | 849 | public: |
| Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 850 | Assembler(const ToolChain &TC) : Tool("moviAsm", "moviAsm", TC) {} |
| Douglas Katzman | 84a7564 | 2015-06-19 14:55:19 +0000 | [diff] [blame] | 851 | |
| 852 | bool hasIntegratedCPP() const override { return false; } // not sure. |
| 853 | |
| 854 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 855 | const InputInfo &Output, const InputInfoList &Inputs, |
| 856 | const llvm::opt::ArgList &TCArgs, |
| 857 | const char *LinkingOutput) const override; |
| 858 | }; |
| 859 | } // end namespace SHAVE |
| 860 | |
| Douglas Katzman | d6e597c | 2015-09-17 19:56:40 +0000 | [diff] [blame] | 861 | /// The Myriad toolchain uses tools that are in two different namespaces. |
| 862 | /// The Compiler and Assembler as defined above are in the SHAVE namespace, |
| 863 | /// whereas the linker, which accepts code for a mixture of Sparc and SHAVE, |
| 864 | /// is in the Myriad namespace. |
| 865 | namespace Myriad { |
| 866 | class LLVM_LIBRARY_VISIBILITY Linker : public GnuTool { |
| 867 | public: |
| 868 | Linker(const ToolChain &TC) : GnuTool("shave::Linker", "ld", TC) {} |
| 869 | bool hasIntegratedCPP() const override { return false; } |
| 870 | bool isLinkJob() const override { return true; } |
| 871 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 872 | const InputInfo &Output, const InputInfoList &Inputs, |
| 873 | const llvm::opt::ArgList &TCArgs, |
| 874 | const char *LinkingOutput) const override; |
| 875 | }; |
| 876 | } // end namespace Myriad |
| 877 | |
| Filipe Cabecinhas | c888e19 | 2015-10-14 12:25:43 +0000 | [diff] [blame] | 878 | namespace PS4cpu { |
| 879 | class LLVM_LIBRARY_VISIBILITY Assemble : public Tool { |
| 880 | public: |
| 881 | Assemble(const ToolChain &TC) |
| 882 | : Tool("PS4cpu::Assemble", "assembler", TC, RF_Full) {} |
| 883 | |
| Eugene Zelenko | d4304d2 | 2015-11-04 21:37:17 +0000 | [diff] [blame] | 884 | bool hasIntegratedCPP() const override { return false; } |
| Filipe Cabecinhas | c888e19 | 2015-10-14 12:25:43 +0000 | [diff] [blame] | 885 | |
| Eugene Zelenko | d4304d2 | 2015-11-04 21:37:17 +0000 | [diff] [blame] | 886 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 887 | const InputInfo &Output, |
| 888 | const InputInfoList &Inputs, |
| 889 | const llvm::opt::ArgList &TCArgs, |
| 890 | const char *LinkingOutput) const override; |
| Filipe Cabecinhas | c888e19 | 2015-10-14 12:25:43 +0000 | [diff] [blame] | 891 | }; |
| 892 | |
| 893 | class LLVM_LIBRARY_VISIBILITY Link : public Tool { |
| 894 | public: |
| 895 | Link(const ToolChain &TC) : Tool("PS4cpu::Link", "linker", TC, RF_Full) {} |
| 896 | |
| Eugene Zelenko | d4304d2 | 2015-11-04 21:37:17 +0000 | [diff] [blame] | 897 | bool hasIntegratedCPP() const override { return false; } |
| 898 | bool isLinkJob() const override { return true; } |
| Filipe Cabecinhas | c888e19 | 2015-10-14 12:25:43 +0000 | [diff] [blame] | 899 | |
| Eugene Zelenko | d4304d2 | 2015-11-04 21:37:17 +0000 | [diff] [blame] | 900 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 901 | const InputInfo &Output, |
| 902 | const InputInfoList &Inputs, |
| 903 | const llvm::opt::ArgList &TCArgs, |
| 904 | const char *LinkingOutput) const override; |
| Filipe Cabecinhas | c888e19 | 2015-10-14 12:25:43 +0000 | [diff] [blame] | 905 | }; |
| 906 | } // end namespace PS4cpu |
| 907 | |
| Justin Lebar | 21e5d4f | 2016-01-14 21:41:27 +0000 | [diff] [blame] | 908 | namespace NVPTX { |
| 909 | |
| 910 | // Run ptxas, the NVPTX assembler. |
| 911 | class LLVM_LIBRARY_VISIBILITY Assembler : public Tool { |
| 912 | public: |
| 913 | Assembler(const ToolChain &TC) |
| 914 | : Tool("NVPTX::Assembler", "ptxas", TC, RF_Full, llvm::sys::WEM_UTF8, |
| 915 | "--options-file") {} |
| 916 | |
| 917 | bool hasIntegratedCPP() const override { return false; } |
| 918 | |
| 919 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 920 | const InputInfo &Output, const InputInfoList &Inputs, |
| 921 | const llvm::opt::ArgList &TCArgs, |
| 922 | const char *LinkingOutput) const override; |
| 923 | }; |
| 924 | |
| 925 | // Runs fatbinary, which combines GPU object files ("cubin" files) and/or PTX |
| 926 | // assembly into a single output file. |
| 927 | class LLVM_LIBRARY_VISIBILITY Linker : public Tool { |
| 928 | public: |
| 929 | Linker(const ToolChain &TC) |
| 930 | : Tool("NVPTX::Linker", "fatbinary", TC, RF_Full, llvm::sys::WEM_UTF8, |
| 931 | "--options-file") {} |
| 932 | |
| 933 | bool hasIntegratedCPP() const override { return false; } |
| 934 | |
| 935 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 936 | const InputInfo &Output, const InputInfoList &Inputs, |
| 937 | const llvm::opt::ArgList &TCArgs, |
| 938 | const char *LinkingOutput) const override; |
| 939 | }; |
| 940 | |
| 941 | } // end namespace NVPTX |
| 942 | |
| Douglas Katzman | 9dc5fbb | 2015-06-03 16:56:50 +0000 | [diff] [blame] | 943 | } // end namespace tools |
| Daniel Dunbar | 5903d8c | 2009-03-17 22:07:58 +0000 | [diff] [blame] | 944 | } // end namespace driver |
| 945 | } // end namespace clang |
| 946 | |
| Eugene Zelenko | d4304d2 | 2015-11-04 21:37:17 +0000 | [diff] [blame] | 947 | #endif // LLVM_CLANG_LIB_DRIVER_TOOLS_H |