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: |
Tom Stellard | f6699f5 | 2016-05-05 17:03:41 +0000 | [diff] [blame] | 245 | Linker(const ToolChain &TC) : GnuTool("amdgpu::Linker", "ld.lld", 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); |
Simon Dardis | d0e83ba | 2016-05-27 15:13:31 +0000 | [diff] [blame] | 294 | bool hasCompactBranches(StringRef &CPU); |
Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 295 | void getMipsCPUAndABI(const llvm::opt::ArgList &Args, |
| 296 | const llvm::Triple &Triple, StringRef &CPUName, |
| 297 | StringRef &ABIName); |
Vasileios Kalintiris | c744e12 | 2015-11-12 15:26:54 +0000 | [diff] [blame] | 298 | std::string getMipsABILibSuffix(const llvm::opt::ArgList &Args, |
| 299 | const llvm::Triple &Triple); |
Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 300 | bool hasMipsAbiArg(const llvm::opt::ArgList &Args, const char *Value); |
| 301 | bool isUCLibc(const llvm::opt::ArgList &Args); |
| 302 | bool isNaN2008(const llvm::opt::ArgList &Args, const llvm::Triple &Triple); |
Petar Jovanovic | 3ca1622 | 2016-05-18 12:46:06 +0000 | [diff] [blame] | 303 | bool isFP64ADefault(const llvm::Triple &Triple, StringRef CPUName); |
Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 304 | bool isFPXXDefault(const llvm::Triple &Triple, StringRef CPUName, |
Saleem Abdulrasool | d5556e3 | 2015-09-19 04:33:38 +0000 | [diff] [blame] | 305 | StringRef ABIName, mips::FloatABI FloatABI); |
Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 306 | bool shouldUseFPXX(const llvm::opt::ArgList &Args, const llvm::Triple &Triple, |
Saleem Abdulrasool | d5556e3 | 2015-09-19 04:33:38 +0000 | [diff] [blame] | 307 | StringRef CPUName, StringRef ABIName, |
| 308 | mips::FloatABI FloatABI); |
Eugene Zelenko | d4304d2 | 2015-11-04 21:37:17 +0000 | [diff] [blame] | 309 | } // end namespace mips |
Jonathan Roelofs | 2cea1be | 2014-02-12 03:21:20 +0000 | [diff] [blame] | 310 | |
Ulrich Weigand | 8afad61 | 2014-07-28 13:17:52 +0000 | [diff] [blame] | 311 | namespace ppc { |
Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 312 | bool hasPPCAbiArg(const llvm::opt::ArgList &Args, const char *Value); |
Eugene Zelenko | d4304d2 | 2015-11-04 21:37:17 +0000 | [diff] [blame] | 313 | } // end namespace ppc |
Ulrich Weigand | 8afad61 | 2014-07-28 13:17:52 +0000 | [diff] [blame] | 314 | |
Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 315 | /// cloudabi -- Directly call GNU Binutils linker |
Ed Schouten | 3c3e58c | 2015-03-26 11:13:44 +0000 | [diff] [blame] | 316 | namespace cloudabi { |
Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 317 | class LLVM_LIBRARY_VISIBILITY Linker : public GnuTool { |
Ed Schouten | 3c3e58c | 2015-03-26 11:13:44 +0000 | [diff] [blame] | 318 | public: |
Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 319 | Linker(const ToolChain &TC) : GnuTool("cloudabi::Linker", "linker", TC) {} |
Ed Schouten | 3c3e58c | 2015-03-26 11:13:44 +0000 | [diff] [blame] | 320 | |
| 321 | bool hasIntegratedCPP() const override { return false; } |
| 322 | bool isLinkJob() const override { return true; } |
| 323 | |
| 324 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 325 | const InputInfo &Output, const InputInfoList &Inputs, |
| 326 | const llvm::opt::ArgList &TCArgs, |
| 327 | const char *LinkingOutput) const override; |
| 328 | }; |
| 329 | } // end namespace cloudabi |
| 330 | |
Daniel Dunbar | 64ed5e3 | 2009-03-20 00:52:38 +0000 | [diff] [blame] | 331 | namespace darwin { |
Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 332 | llvm::Triple::ArchType getArchTypeForMachOArchName(StringRef Str); |
| 333 | void setTripleTypeForMachOArchName(llvm::Triple &T, StringRef Str); |
Rafael Espindola | dcbf698 | 2012-10-31 18:51:07 +0000 | [diff] [blame] | 334 | |
Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 335 | class LLVM_LIBRARY_VISIBILITY MachOTool : public Tool { |
| 336 | virtual void anchor(); |
Daniel Dunbar | e9ded43 | 2009-09-09 18:36:20 +0000 | [diff] [blame] | 337 | |
Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 338 | protected: |
| 339 | void AddMachOArch(const llvm::opt::ArgList &Args, |
| 340 | llvm::opt::ArgStringList &CmdArgs) const; |
Daniel Dunbar | e9ded43 | 2009-09-09 18:36:20 +0000 | [diff] [blame] | 341 | |
Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 342 | const toolchains::MachO &getMachOToolChain() const { |
| 343 | return reinterpret_cast<const toolchains::MachO &>(getToolChain()); |
| 344 | } |
Daniel Dunbar | e9ded43 | 2009-09-09 18:36:20 +0000 | [diff] [blame] | 345 | |
Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 346 | public: |
| 347 | MachOTool( |
| 348 | const char *Name, const char *ShortName, const ToolChain &TC, |
| 349 | ResponseFileSupport ResponseSupport = RF_None, |
| 350 | llvm::sys::WindowsEncodingMethod ResponseEncoding = llvm::sys::WEM_UTF8, |
| 351 | const char *ResponseFlag = "@") |
| 352 | : Tool(Name, ShortName, TC, ResponseSupport, ResponseEncoding, |
| 353 | ResponseFlag) {} |
| 354 | }; |
Daniel Dunbar | be22084 | 2009-03-20 16:06:39 +0000 | [diff] [blame] | 355 | |
Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 356 | class LLVM_LIBRARY_VISIBILITY Assembler : public MachOTool { |
| 357 | public: |
| 358 | Assembler(const ToolChain &TC) |
| 359 | : MachOTool("darwin::Assembler", "assembler", TC) {} |
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 | bool hasIntegratedCPP() const override { return false; } |
Daniel Dunbar | be22084 | 2009-03-20 16:06:39 +0000 | [diff] [blame] | 362 | |
Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 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 | }; |
Daniel Dunbar | c196421 | 2009-03-26 16:23:12 +0000 | [diff] [blame] | 368 | |
Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 369 | class LLVM_LIBRARY_VISIBILITY Linker : public MachOTool { |
| 370 | bool NeedsTempPath(const InputInfoList &Inputs) const; |
| 371 | void AddLinkArgs(Compilation &C, const llvm::opt::ArgList &Args, |
| 372 | llvm::opt::ArgStringList &CmdArgs, |
| 373 | const InputInfoList &Inputs) const; |
Daniel Dunbar | c196421 | 2009-03-26 16:23:12 +0000 | [diff] [blame] | 374 | |
Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 375 | public: |
| 376 | Linker(const ToolChain &TC) |
| 377 | : MachOTool("darwin::Linker", "linker", TC, RF_FileList, |
| 378 | llvm::sys::WEM_UTF8, "-filelist") {} |
Daniel Dunbar | c196421 | 2009-03-26 16:23:12 +0000 | [diff] [blame] | 379 | |
Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 380 | bool hasIntegratedCPP() const override { return false; } |
| 381 | bool isLinkJob() const override { return true; } |
Daniel Dunbar | c196421 | 2009-03-26 16:23:12 +0000 | [diff] [blame] | 382 | |
Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 383 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 384 | const InputInfo &Output, const InputInfoList &Inputs, |
| 385 | const llvm::opt::ArgList &TCArgs, |
| 386 | const char *LinkingOutput) const override; |
| 387 | }; |
Daniel Dunbar | 64ed5e3 | 2009-03-20 00:52:38 +0000 | [diff] [blame] | 388 | |
Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 389 | class LLVM_LIBRARY_VISIBILITY Lipo : public MachOTool { |
| 390 | public: |
| 391 | Lipo(const ToolChain &TC) : MachOTool("darwin::Lipo", "lipo", TC) {} |
Daniel Dunbar | 64ed5e3 | 2009-03-20 00:52:38 +0000 | [diff] [blame] | 392 | |
Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 393 | bool hasIntegratedCPP() const override { return false; } |
Daniel Dunbar | 8829962 | 2010-06-04 18:28:36 +0000 | [diff] [blame] | 394 | |
Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 395 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 396 | const InputInfo &Output, const InputInfoList &Inputs, |
| 397 | const llvm::opt::ArgList &TCArgs, |
| 398 | const char *LinkingOutput) const override; |
| 399 | }; |
Daniel Dunbar | 8829962 | 2010-06-04 18:28:36 +0000 | [diff] [blame] | 400 | |
Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 401 | class LLVM_LIBRARY_VISIBILITY Dsymutil : public MachOTool { |
| 402 | public: |
| 403 | Dsymutil(const ToolChain &TC) |
| 404 | : MachOTool("darwin::Dsymutil", "dsymutil", TC) {} |
Daniel Dunbar | 8829962 | 2010-06-04 18:28:36 +0000 | [diff] [blame] | 405 | |
Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 406 | bool hasIntegratedCPP() const override { return false; } |
| 407 | bool isDsymutilJob() const override { return true; } |
Eric Christopher | 551ef45 | 2011-08-23 17:56:55 +0000 | [diff] [blame] | 408 | |
Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 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 | }; |
Eric Christopher | 551ef45 | 2011-08-23 17:56:55 +0000 | [diff] [blame] | 414 | |
Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 415 | class LLVM_LIBRARY_VISIBILITY VerifyDebug : public MachOTool { |
| 416 | public: |
| 417 | VerifyDebug(const ToolChain &TC) |
| 418 | : MachOTool("darwin::VerifyDebug", "dwarfdump", TC) {} |
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 | bool hasIntegratedCPP() const override { return false; } |
Eric Christopher | 551ef45 | 2011-08-23 17:56:55 +0000 | [diff] [blame] | 421 | |
Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 422 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 423 | const InputInfo &Output, const InputInfoList &Inputs, |
| 424 | const llvm::opt::ArgList &TCArgs, |
| 425 | const char *LinkingOutput) const override; |
| 426 | }; |
Eugene Zelenko | d4304d2 | 2015-11-04 21:37:17 +0000 | [diff] [blame] | 427 | } // end namespace darwin |
Daniel Dunbar | 64ed5e3 | 2009-03-20 00:52:38 +0000 | [diff] [blame] | 428 | |
Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 429 | /// openbsd -- Directly call GNU Binutils assembler and linker |
Daniel Dunbar | 10de9e6 | 2009-06-29 20:52:51 +0000 | [diff] [blame] | 430 | namespace openbsd { |
Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 431 | class LLVM_LIBRARY_VISIBILITY Assembler : public GnuTool { |
| 432 | public: |
| 433 | Assembler(const ToolChain &TC) |
| 434 | : GnuTool("openbsd::Assembler", "assembler", TC) {} |
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 | bool hasIntegratedCPP() const override { return false; } |
Daniel Dunbar | 10de9e6 | 2009-06-29 20:52:51 +0000 | [diff] [blame] | 437 | |
Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 438 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 439 | const InputInfo &Output, const InputInfoList &Inputs, |
| 440 | const llvm::opt::ArgList &TCArgs, |
| 441 | const char *LinkingOutput) const override; |
| 442 | }; |
Eugene Zelenko | d4304d2 | 2015-11-04 21:37:17 +0000 | [diff] [blame] | 443 | |
Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 444 | class LLVM_LIBRARY_VISIBILITY Linker : public GnuTool { |
| 445 | public: |
| 446 | Linker(const ToolChain &TC) : GnuTool("openbsd::Linker", "linker", TC) {} |
Daniel Dunbar | 10de9e6 | 2009-06-29 20:52:51 +0000 | [diff] [blame] | 447 | |
Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 448 | bool hasIntegratedCPP() const override { return false; } |
| 449 | bool isLinkJob() const override { return true; } |
Daniel Dunbar | 10de9e6 | 2009-06-29 20:52:51 +0000 | [diff] [blame] | 450 | |
Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 451 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 452 | const InputInfo &Output, const InputInfoList &Inputs, |
| 453 | const llvm::opt::ArgList &TCArgs, |
| 454 | const char *LinkingOutput) const override; |
| 455 | }; |
Edward O'Callaghan | 856e4ff | 2009-08-22 01:06:46 +0000 | [diff] [blame] | 456 | } // end namespace openbsd |
Daniel Dunbar | 10de9e6 | 2009-06-29 20:52:51 +0000 | [diff] [blame] | 457 | |
Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 458 | /// bitrig -- Directly call GNU Binutils assembler and linker |
Eli Friedman | 9fa2885 | 2012-08-08 23:57:20 +0000 | [diff] [blame] | 459 | namespace bitrig { |
Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 460 | class LLVM_LIBRARY_VISIBILITY Assembler : public GnuTool { |
| 461 | public: |
| 462 | Assembler(const ToolChain &TC) |
| 463 | : GnuTool("bitrig::Assembler", "assembler", TC) {} |
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 | bool hasIntegratedCPP() const override { return false; } |
Eli Friedman | 9fa2885 | 2012-08-08 23:57:20 +0000 | [diff] [blame] | 466 | |
Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 467 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 468 | const InputInfo &Output, const InputInfoList &Inputs, |
| 469 | const llvm::opt::ArgList &TCArgs, |
| 470 | const char *LinkingOutput) const override; |
| 471 | }; |
Eugene Zelenko | d4304d2 | 2015-11-04 21:37:17 +0000 | [diff] [blame] | 472 | |
Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 473 | class LLVM_LIBRARY_VISIBILITY Linker : public GnuTool { |
| 474 | public: |
| 475 | Linker(const ToolChain &TC) : GnuTool("bitrig::Linker", "linker", TC) {} |
Eli Friedman | 9fa2885 | 2012-08-08 23:57:20 +0000 | [diff] [blame] | 476 | |
Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 477 | bool hasIntegratedCPP() const override { return false; } |
| 478 | bool isLinkJob() const override { return true; } |
Eli Friedman | 9fa2885 | 2012-08-08 23:57:20 +0000 | [diff] [blame] | 479 | |
Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 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 | }; |
Eli Friedman | 9fa2885 | 2012-08-08 23:57:20 +0000 | [diff] [blame] | 485 | } // end namespace bitrig |
| 486 | |
Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 487 | /// freebsd -- Directly call GNU Binutils assembler and linker |
Daniel Dunbar | 8eb473c | 2009-03-31 17:45:15 +0000 | [diff] [blame] | 488 | namespace freebsd { |
Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 489 | class LLVM_LIBRARY_VISIBILITY Assembler : public GnuTool { |
| 490 | public: |
| 491 | Assembler(const ToolChain &TC) |
| 492 | : GnuTool("freebsd::Assembler", "assembler", TC) {} |
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 | bool hasIntegratedCPP() const override { return false; } |
Daniel Dunbar | 8eb473c | 2009-03-31 17:45:15 +0000 | [diff] [blame] | 495 | |
Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 496 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 497 | const InputInfo &Output, const InputInfoList &Inputs, |
| 498 | const llvm::opt::ArgList &TCArgs, |
| 499 | const char *LinkingOutput) const override; |
| 500 | }; |
Eugene Zelenko | d4304d2 | 2015-11-04 21:37:17 +0000 | [diff] [blame] | 501 | |
Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 502 | class LLVM_LIBRARY_VISIBILITY Linker : public GnuTool { |
| 503 | public: |
| 504 | Linker(const ToolChain &TC) : GnuTool("freebsd::Linker", "linker", TC) {} |
Daniel Dunbar | d854c8d | 2009-04-01 19:36:32 +0000 | [diff] [blame] | 505 | |
Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 506 | bool hasIntegratedCPP() const override { return false; } |
| 507 | bool isLinkJob() const override { return true; } |
Daniel Dunbar | d854c8d | 2009-04-01 19:36:32 +0000 | [diff] [blame] | 508 | |
Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 509 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 510 | const InputInfo &Output, const InputInfoList &Inputs, |
| 511 | const llvm::opt::ArgList &TCArgs, |
| 512 | const char *LinkingOutput) const override; |
| 513 | }; |
Edward O'Callaghan | 856e4ff | 2009-08-22 01:06:46 +0000 | [diff] [blame] | 514 | } // end namespace freebsd |
| 515 | |
Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 516 | /// netbsd -- Directly call GNU Binutils assembler and linker |
Benjamin Kramer | 24f1d3e | 2011-02-02 18:59:27 +0000 | [diff] [blame] | 517 | namespace netbsd { |
Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 518 | class LLVM_LIBRARY_VISIBILITY Assembler : public GnuTool { |
Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 519 | public: |
| 520 | Assembler(const ToolChain &TC) |
| 521 | : GnuTool("netbsd::Assembler", "assembler", TC) {} |
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 | bool hasIntegratedCPP() const override { return false; } |
Benjamin Kramer | 24f1d3e | 2011-02-02 18:59:27 +0000 | [diff] [blame] | 524 | |
Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 525 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 526 | const InputInfo &Output, const InputInfoList &Inputs, |
| 527 | const llvm::opt::ArgList &TCArgs, |
| 528 | const char *LinkingOutput) const override; |
| 529 | }; |
Joerg Sonnenberger | 637603a | 2011-05-16 13:35:02 +0000 | [diff] [blame] | 530 | |
Eugene Zelenko | d4304d2 | 2015-11-04 21:37:17 +0000 | [diff] [blame] | 531 | class LLVM_LIBRARY_VISIBILITY Linker : public GnuTool { |
Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 532 | public: |
| 533 | Linker(const ToolChain &TC) : GnuTool("netbsd::Linker", "linker", TC) {} |
Benjamin Kramer | 24f1d3e | 2011-02-02 18:59:27 +0000 | [diff] [blame] | 534 | |
Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 535 | bool hasIntegratedCPP() const override { return false; } |
| 536 | bool isLinkJob() const override { return true; } |
Benjamin Kramer | 24f1d3e | 2011-02-02 18:59:27 +0000 | [diff] [blame] | 537 | |
Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 538 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 539 | const InputInfo &Output, const InputInfoList &Inputs, |
| 540 | const llvm::opt::ArgList &TCArgs, |
| 541 | const char *LinkingOutput) const override; |
| 542 | }; |
Benjamin Kramer | 24f1d3e | 2011-02-02 18:59:27 +0000 | [diff] [blame] | 543 | } // end namespace netbsd |
| 544 | |
Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 545 | /// Directly call GNU Binutils' assembler and linker. |
Thomas Schwinge | 4e55526 | 2013-03-28 19:04:25 +0000 | [diff] [blame] | 546 | namespace gnutools { |
Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 547 | class LLVM_LIBRARY_VISIBILITY Assembler : public GnuTool { |
| 548 | public: |
| 549 | Assembler(const ToolChain &TC) : GnuTool("GNU::Assembler", "assembler", TC) {} |
Rafael Espindola | 92b0093 | 2010-08-10 00:25:48 +0000 | [diff] [blame] | 550 | |
Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 551 | bool hasIntegratedCPP() const override { return false; } |
| 552 | |
| 553 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 554 | const InputInfo &Output, const InputInfoList &Inputs, |
| 555 | const llvm::opt::ArgList &TCArgs, |
| 556 | const char *LinkingOutput) const override; |
| 557 | }; |
Eugene Zelenko | d4304d2 | 2015-11-04 21:37:17 +0000 | [diff] [blame] | 558 | |
Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 559 | class LLVM_LIBRARY_VISIBILITY Linker : public GnuTool { |
| 560 | public: |
| 561 | Linker(const ToolChain &TC) : GnuTool("GNU::Linker", "linker", TC) {} |
| 562 | |
| 563 | bool hasIntegratedCPP() const override { return false; } |
| 564 | bool isLinkJob() const override { return true; } |
Rafael Espindola | 92b0093 | 2010-08-10 00:25:48 +0000 | [diff] [blame] | 565 | |
Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 566 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 567 | const InputInfo &Output, const InputInfoList &Inputs, |
| 568 | const llvm::opt::ArgList &TCArgs, |
| 569 | const char *LinkingOutput) const override; |
| 570 | }; |
Eugene Zelenko | d4304d2 | 2015-11-04 21:37:17 +0000 | [diff] [blame] | 571 | } // end namespace gnutools |
Rafael Espindola | c8f008f | 2010-11-07 20:14:31 +0000 | [diff] [blame] | 572 | |
Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 573 | namespace nacltools { |
| 574 | class LLVM_LIBRARY_VISIBILITY AssemblerARM : public gnutools::Assembler { |
| 575 | public: |
| 576 | AssemblerARM(const ToolChain &TC) : gnutools::Assembler(TC) {} |
Rafael Espindola | c8f008f | 2010-11-07 20:14:31 +0000 | [diff] [blame] | 577 | |
Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 578 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 579 | const InputInfo &Output, const InputInfoList &Inputs, |
| 580 | const llvm::opt::ArgList &TCArgs, |
| 581 | const char *LinkingOutput) const override; |
| 582 | }; |
Eugene Zelenko | d4304d2 | 2015-11-04 21:37:17 +0000 | [diff] [blame] | 583 | |
Derek Schuff | 821d884 | 2015-11-16 22:21:25 +0000 | [diff] [blame] | 584 | class LLVM_LIBRARY_VISIBILITY Linker : public GnuTool { |
Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 585 | public: |
Derek Schuff | 821d884 | 2015-11-16 22:21:25 +0000 | [diff] [blame] | 586 | Linker(const ToolChain &TC) : GnuTool("NaCl::Linker", "linker", TC) {} |
Derek Schuff | 6ab52fa | 2015-03-30 20:31:33 +0000 | [diff] [blame] | 587 | |
Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 588 | bool hasIntegratedCPP() const override { return false; } |
| 589 | bool isLinkJob() const override { return true; } |
Derek Schuff | 6ab52fa | 2015-03-30 20:31:33 +0000 | [diff] [blame] | 590 | |
Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 591 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 592 | const InputInfo &Output, const InputInfoList &Inputs, |
| 593 | const llvm::opt::ArgList &TCArgs, |
| 594 | const char *LinkingOutput) const override; |
| 595 | }; |
Eugene Zelenko | d4304d2 | 2015-11-04 21:37:17 +0000 | [diff] [blame] | 596 | } // end namespace nacltools |
Derek Schuff | 6ab52fa | 2015-03-30 20:31:33 +0000 | [diff] [blame] | 597 | |
Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 598 | /// minix -- Directly call GNU Binutils assembler and linker |
Chris Lattner | 3e2ee14 | 2010-07-07 16:01:42 +0000 | [diff] [blame] | 599 | namespace minix { |
Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 600 | class LLVM_LIBRARY_VISIBILITY Assembler : public GnuTool { |
| 601 | public: |
| 602 | Assembler(const ToolChain &TC) |
| 603 | : GnuTool("minix::Assembler", "assembler", TC) {} |
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 | bool hasIntegratedCPP() const override { return false; } |
Chris Lattner | 3e2ee14 | 2010-07-07 16:01:42 +0000 | [diff] [blame] | 606 | |
Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 607 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 608 | const InputInfo &Output, const InputInfoList &Inputs, |
| 609 | const llvm::opt::ArgList &TCArgs, |
| 610 | const char *LinkingOutput) const override; |
| 611 | }; |
Eugene Zelenko | d4304d2 | 2015-11-04 21:37:17 +0000 | [diff] [blame] | 612 | |
Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 613 | class LLVM_LIBRARY_VISIBILITY Linker : public GnuTool { |
| 614 | public: |
| 615 | Linker(const ToolChain &TC) : GnuTool("minix::Linker", "linker", TC) {} |
Chris Lattner | 3e2ee14 | 2010-07-07 16:01:42 +0000 | [diff] [blame] | 616 | |
Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 617 | bool hasIntegratedCPP() const override { return false; } |
| 618 | bool isLinkJob() const override { return true; } |
Chris Lattner | 3e2ee14 | 2010-07-07 16:01:42 +0000 | [diff] [blame] | 619 | |
Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 620 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 621 | const InputInfo &Output, const InputInfoList &Inputs, |
| 622 | const llvm::opt::ArgList &TCArgs, |
| 623 | const char *LinkingOutput) const override; |
| 624 | }; |
Chris Lattner | 3e2ee14 | 2010-07-07 16:01:42 +0000 | [diff] [blame] | 625 | } // end namespace minix |
| 626 | |
Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 627 | /// solaris -- Directly call Solaris assembler and linker |
David Chisnall | f571cde | 2012-02-15 13:39:01 +0000 | [diff] [blame] | 628 | namespace solaris { |
Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 629 | class LLVM_LIBRARY_VISIBILITY Assembler : public Tool { |
| 630 | public: |
| 631 | Assembler(const ToolChain &TC) |
| 632 | : Tool("solaris::Assembler", "assembler", TC) {} |
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 | bool hasIntegratedCPP() const override { return false; } |
David Chisnall | f571cde | 2012-02-15 13:39:01 +0000 | [diff] [blame] | 635 | |
Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 636 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 637 | const InputInfo &Output, const InputInfoList &Inputs, |
| 638 | const llvm::opt::ArgList &TCArgs, |
| 639 | const char *LinkingOutput) const override; |
| 640 | }; |
Eugene Zelenko | d4304d2 | 2015-11-04 21:37:17 +0000 | [diff] [blame] | 641 | |
Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 642 | class LLVM_LIBRARY_VISIBILITY Linker : public Tool { |
| 643 | public: |
| 644 | Linker(const ToolChain &TC) : Tool("solaris::Linker", "linker", TC) {} |
David Chisnall | f571cde | 2012-02-15 13:39:01 +0000 | [diff] [blame] | 645 | |
Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 646 | bool hasIntegratedCPP() const override { return false; } |
| 647 | bool isLinkJob() const override { return true; } |
David Chisnall | f571cde | 2012-02-15 13:39:01 +0000 | [diff] [blame] | 648 | |
Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 649 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 650 | const InputInfo &Output, const InputInfoList &Inputs, |
| 651 | const llvm::opt::ArgList &TCArgs, |
| 652 | const char *LinkingOutput) const override; |
| 653 | }; |
David Chisnall | a9ed5d7 | 2012-02-15 16:25:46 +0000 | [diff] [blame] | 654 | } // end namespace solaris |
David Chisnall | f571cde | 2012-02-15 13:39:01 +0000 | [diff] [blame] | 655 | |
Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 656 | /// dragonfly -- Directly call GNU Binutils assembler and linker |
Daniel Dunbar | cc91234 | 2009-05-02 18:28:39 +0000 | [diff] [blame] | 657 | namespace dragonfly { |
Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 658 | class LLVM_LIBRARY_VISIBILITY Assembler : public GnuTool { |
| 659 | public: |
| 660 | Assembler(const ToolChain &TC) |
| 661 | : GnuTool("dragonfly::Assembler", "assembler", TC) {} |
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 | bool hasIntegratedCPP() const override { return false; } |
Daniel Dunbar | cc91234 | 2009-05-02 18:28:39 +0000 | [diff] [blame] | 664 | |
Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 665 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 666 | const InputInfo &Output, const InputInfoList &Inputs, |
| 667 | const llvm::opt::ArgList &TCArgs, |
| 668 | const char *LinkingOutput) const override; |
| 669 | }; |
Eugene Zelenko | d4304d2 | 2015-11-04 21:37:17 +0000 | [diff] [blame] | 670 | |
Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 671 | class LLVM_LIBRARY_VISIBILITY Linker : public GnuTool { |
| 672 | public: |
| 673 | Linker(const ToolChain &TC) : GnuTool("dragonfly::Linker", "linker", TC) {} |
Daniel Dunbar | cc91234 | 2009-05-02 18:28:39 +0000 | [diff] [blame] | 674 | |
Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 675 | bool hasIntegratedCPP() const override { return false; } |
| 676 | bool isLinkJob() const override { return true; } |
Daniel Dunbar | cc91234 | 2009-05-02 18:28:39 +0000 | [diff] [blame] | 677 | |
Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 678 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 679 | const InputInfo &Output, const InputInfoList &Inputs, |
| 680 | const llvm::opt::ArgList &TCArgs, |
| 681 | const char *LinkingOutput) const override; |
| 682 | }; |
Edward O'Callaghan | 856e4ff | 2009-08-22 01:06:46 +0000 | [diff] [blame] | 683 | } // end namespace dragonfly |
Daniel Dunbar | cc91234 | 2009-05-02 18:28:39 +0000 | [diff] [blame] | 684 | |
Hans Wennborg | 1da044a | 2014-06-26 19:59:02 +0000 | [diff] [blame] | 685 | /// Visual studio tools. |
Michael J. Spencer | b186bc3 | 2010-08-21 21:55:07 +0000 | [diff] [blame] | 686 | namespace visualstudio { |
Adrian McCarthy | e4b26fc | 2016-05-13 23:20:11 +0000 | [diff] [blame] | 687 | VersionTuple getMSVCVersion(const Driver *D, const ToolChain &TC, |
| 688 | const llvm::Triple &Triple, |
Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 689 | const llvm::opt::ArgList &Args, bool IsWindowsMSVC); |
David Majnemer | e11d373 | 2015-06-08 00:22:46 +0000 | [diff] [blame] | 690 | |
Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 691 | class LLVM_LIBRARY_VISIBILITY Linker : public Tool { |
| 692 | public: |
| 693 | Linker(const ToolChain &TC) |
| 694 | : Tool("visualstudio::Linker", "linker", TC, RF_Full, |
| 695 | llvm::sys::WEM_UTF16) {} |
Michael J. Spencer | b186bc3 | 2010-08-21 21:55:07 +0000 | [diff] [blame] | 696 | |
Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 697 | bool hasIntegratedCPP() const override { return false; } |
Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 698 | bool isLinkJob() const override { return true; } |
Michael J. Spencer | b186bc3 | 2010-08-21 21:55:07 +0000 | [diff] [blame] | 699 | |
Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 700 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 701 | const InputInfo &Output, const InputInfoList &Inputs, |
| 702 | const llvm::opt::ArgList &TCArgs, |
| 703 | const char *LinkingOutput) const override; |
Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 704 | }; |
Hans Wennborg | 87cfa71 | 2013-09-19 20:32:16 +0000 | [diff] [blame] | 705 | |
Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 706 | class LLVM_LIBRARY_VISIBILITY Compiler : public Tool { |
| 707 | public: |
| 708 | Compiler(const ToolChain &TC) |
| 709 | : Tool("visualstudio::Compiler", "compiler", TC, RF_Full, |
| 710 | llvm::sys::WEM_UTF16) {} |
Hans Wennborg | 87cfa71 | 2013-09-19 20:32:16 +0000 | [diff] [blame] | 711 | |
Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 712 | bool hasIntegratedAssembler() const override { return true; } |
Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 713 | bool hasIntegratedCPP() const override { return true; } |
| 714 | bool isLinkJob() const override { return false; } |
Hans Wennborg | 87cfa71 | 2013-09-19 20:32:16 +0000 | [diff] [blame] | 715 | |
Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 716 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 717 | const InputInfo &Output, const InputInfoList &Inputs, |
| 718 | const llvm::opt::ArgList &TCArgs, |
| 719 | const char *LinkingOutput) const override; |
Hans Wennborg | 87cfa71 | 2013-09-19 20:32:16 +0000 | [diff] [blame] | 720 | |
Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 721 | std::unique_ptr<Command> GetCommand(Compilation &C, const JobAction &JA, |
| 722 | const InputInfo &Output, |
| 723 | const InputInfoList &Inputs, |
| 724 | const llvm::opt::ArgList &TCArgs, |
| 725 | const char *LinkingOutput) const; |
| 726 | }; |
Michael J. Spencer | b186bc3 | 2010-08-21 21:55:07 +0000 | [diff] [blame] | 727 | } // end namespace visualstudio |
| 728 | |
Yaron Keren | 1c0070c | 2015-07-02 04:45:27 +0000 | [diff] [blame] | 729 | /// MinGW -- Directly call GNU Binutils assembler and linker |
| 730 | namespace MinGW { |
| 731 | class LLVM_LIBRARY_VISIBILITY Assembler : public Tool { |
| 732 | public: |
| 733 | Assembler(const ToolChain &TC) : Tool("MinGW::Assemble", "assembler", TC) {} |
| 734 | |
| 735 | bool hasIntegratedCPP() const override { return false; } |
| 736 | |
| 737 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 738 | const InputInfo &Output, const InputInfoList &Inputs, |
| 739 | const llvm::opt::ArgList &TCArgs, |
| 740 | const char *LinkingOutput) const override; |
| 741 | }; |
| 742 | |
| 743 | class LLVM_LIBRARY_VISIBILITY Linker : public Tool { |
| 744 | public: |
| 745 | Linker(const ToolChain &TC) : Tool("MinGW::Linker", "linker", TC) {} |
| 746 | |
| 747 | bool hasIntegratedCPP() const override { return false; } |
| 748 | bool isLinkJob() const override { return true; } |
| 749 | |
| 750 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 751 | const InputInfo &Output, const InputInfoList &Inputs, |
| 752 | const llvm::opt::ArgList &TCArgs, |
| 753 | const char *LinkingOutput) const override; |
| 754 | |
| 755 | private: |
| 756 | void AddLibGCC(const llvm::opt::ArgList &Args, ArgStringList &CmdArgs) const; |
| 757 | }; |
| 758 | } // end namespace MinGW |
| 759 | |
Tim Northover | 9c7e035 | 2013-12-12 11:55:52 +0000 | [diff] [blame] | 760 | namespace arm { |
Saleem Abdulrasool | eee54b4 | 2015-09-18 05:32:23 +0000 | [diff] [blame] | 761 | enum class FloatABI { |
| 762 | Invalid, |
| 763 | Soft, |
| 764 | SoftFP, |
| 765 | Hard, |
| 766 | }; |
| 767 | |
Saleem Abdulrasool | 06f6f99 | 2015-09-19 20:40:16 +0000 | [diff] [blame] | 768 | FloatABI getARMFloatABI(const ToolChain &TC, const llvm::opt::ArgList &Args); |
Eugene Zelenko | d4304d2 | 2015-11-04 21:37:17 +0000 | [diff] [blame] | 769 | } // end namespace arm |
| 770 | |
Petar Jovanovic | 88a328f | 2015-12-14 17:51:50 +0000 | [diff] [blame] | 771 | namespace ppc { |
| 772 | enum class FloatABI { |
| 773 | Invalid, |
| 774 | Soft, |
| 775 | Hard, |
| 776 | }; |
| 777 | |
| 778 | FloatABI getPPCFloatABI(const Driver &D, const llvm::opt::ArgList &Args); |
| 779 | } // end namespace ppc |
| 780 | |
Jacob Baungard Hansen | 13a4937 | 2016-05-24 08:30:08 +0000 | [diff] [blame] | 781 | namespace sparc { |
| 782 | enum class FloatABI { |
| 783 | Invalid, |
| 784 | Soft, |
| 785 | Hard, |
| 786 | }; |
| 787 | |
| 788 | FloatABI getSparcFloatABI(const Driver &D, const llvm::opt::ArgList &Args); |
| 789 | } // end namespace sparc |
| 790 | |
Robert Lytton | cf1dd69 | 2013-10-11 10:29:40 +0000 | [diff] [blame] | 791 | namespace XCore { |
Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 792 | // For XCore, we do not need to instantiate tools for PreProcess, PreCompile and |
| 793 | // Compile. |
| 794 | // We simply use "clang -cc1" for those actions. |
| 795 | class LLVM_LIBRARY_VISIBILITY Assembler : public Tool { |
Saleem Abdulrasool | 543a78b | 2014-10-24 03:13:37 +0000 | [diff] [blame] | 796 | public: |
Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 797 | Assembler(const ToolChain &TC) : Tool("XCore::Assembler", "XCore-as", TC) {} |
Saleem Abdulrasool | 543a78b | 2014-10-24 03:13:37 +0000 | [diff] [blame] | 798 | |
| 799 | bool hasIntegratedCPP() const override { return false; } |
Saleem Abdulrasool | 543a78b | 2014-10-24 03:13:37 +0000 | [diff] [blame] | 800 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 801 | const InputInfo &Output, const InputInfoList &Inputs, |
| 802 | const llvm::opt::ArgList &TCArgs, |
| 803 | const char *LinkingOutput) const override; |
| 804 | }; |
| 805 | |
Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 806 | class LLVM_LIBRARY_VISIBILITY Linker : public Tool { |
Saleem Abdulrasool | 543a78b | 2014-10-24 03:13:37 +0000 | [diff] [blame] | 807 | public: |
Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 808 | Linker(const ToolChain &TC) : Tool("XCore::Linker", "XCore-ld", TC) {} |
Saleem Abdulrasool | 543a78b | 2014-10-24 03:13:37 +0000 | [diff] [blame] | 809 | |
| 810 | bool hasIntegratedCPP() const override { return false; } |
Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 811 | bool isLinkJob() const override { return true; } |
| 812 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 813 | const InputInfo &Output, const InputInfoList &Inputs, |
| 814 | const llvm::opt::ArgList &TCArgs, |
| 815 | const char *LinkingOutput) const override; |
| 816 | }; |
| 817 | } // end namespace XCore. |
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 | namespace CrossWindows { |
| 820 | class LLVM_LIBRARY_VISIBILITY Assembler : public Tool { |
| 821 | public: |
| 822 | Assembler(const ToolChain &TC) : Tool("CrossWindows::Assembler", "as", TC) {} |
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; } |
Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 825 | |
Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 826 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 827 | const InputInfo &Output, const InputInfoList &Inputs, |
| 828 | const llvm::opt::ArgList &TCArgs, |
| 829 | const char *LinkingOutput) const override; |
| 830 | }; |
Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 831 | |
Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 832 | class LLVM_LIBRARY_VISIBILITY Linker : public Tool { |
| 833 | public: |
| 834 | Linker(const ToolChain &TC) |
| 835 | : Tool("CrossWindows::Linker", "ld", TC, RF_Full) {} |
Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 836 | |
Reid Kleckner | bac59a1 | 2015-07-15 17:58:55 +0000 | [diff] [blame] | 837 | bool hasIntegratedCPP() const override { return false; } |
| 838 | bool isLinkJob() const override { return true; } |
Saleem Abdulrasool | 543a78b | 2014-10-24 03:13:37 +0000 | [diff] [blame] | 839 | |
| 840 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 841 | const InputInfo &Output, const InputInfoList &Inputs, |
| 842 | const llvm::opt::ArgList &TCArgs, |
| 843 | const char *LinkingOutput) const override; |
| 844 | }; |
Eugene Zelenko | d4304d2 | 2015-11-04 21:37:17 +0000 | [diff] [blame] | 845 | } // end namespace CrossWindows |
Robert Lytton | cf1dd69 | 2013-10-11 10:29:40 +0000 | [diff] [blame] | 846 | |
Douglas Katzman | 84a7564 | 2015-06-19 14:55:19 +0000 | [diff] [blame] | 847 | /// SHAVE tools -- Directly call moviCompile and moviAsm |
| 848 | namespace SHAVE { |
Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 849 | class LLVM_LIBRARY_VISIBILITY Compiler : public Tool { |
Douglas Katzman | 84a7564 | 2015-06-19 14:55:19 +0000 | [diff] [blame] | 850 | public: |
Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 851 | Compiler(const ToolChain &TC) : Tool("moviCompile", "movicompile", TC) {} |
Douglas Katzman | 84a7564 | 2015-06-19 14:55:19 +0000 | [diff] [blame] | 852 | |
| 853 | bool hasIntegratedCPP() const override { return true; } |
| 854 | |
| 855 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 856 | const InputInfo &Output, const InputInfoList &Inputs, |
| 857 | const llvm::opt::ArgList &TCArgs, |
| 858 | const char *LinkingOutput) const override; |
| 859 | }; |
| 860 | |
Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 861 | class LLVM_LIBRARY_VISIBILITY Assembler : public Tool { |
Douglas Katzman | 84a7564 | 2015-06-19 14:55:19 +0000 | [diff] [blame] | 862 | public: |
Douglas Katzman | 9535429 | 2015-06-23 20:42:09 +0000 | [diff] [blame] | 863 | Assembler(const ToolChain &TC) : Tool("moviAsm", "moviAsm", TC) {} |
Douglas Katzman | 84a7564 | 2015-06-19 14:55:19 +0000 | [diff] [blame] | 864 | |
| 865 | bool hasIntegratedCPP() const override { return false; } // not sure. |
| 866 | |
| 867 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 868 | const InputInfo &Output, const InputInfoList &Inputs, |
| 869 | const llvm::opt::ArgList &TCArgs, |
| 870 | const char *LinkingOutput) const override; |
| 871 | }; |
| 872 | } // end namespace SHAVE |
| 873 | |
Douglas Katzman | d6e597c | 2015-09-17 19:56:40 +0000 | [diff] [blame] | 874 | /// The Myriad toolchain uses tools that are in two different namespaces. |
| 875 | /// The Compiler and Assembler as defined above are in the SHAVE namespace, |
| 876 | /// whereas the linker, which accepts code for a mixture of Sparc and SHAVE, |
| 877 | /// is in the Myriad namespace. |
| 878 | namespace Myriad { |
| 879 | class LLVM_LIBRARY_VISIBILITY Linker : public GnuTool { |
| 880 | public: |
| 881 | Linker(const ToolChain &TC) : GnuTool("shave::Linker", "ld", TC) {} |
| 882 | bool hasIntegratedCPP() const override { return false; } |
| 883 | bool isLinkJob() const override { return true; } |
| 884 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 885 | const InputInfo &Output, const InputInfoList &Inputs, |
| 886 | const llvm::opt::ArgList &TCArgs, |
| 887 | const char *LinkingOutput) const override; |
| 888 | }; |
| 889 | } // end namespace Myriad |
| 890 | |
Filipe Cabecinhas | c888e19 | 2015-10-14 12:25:43 +0000 | [diff] [blame] | 891 | namespace PS4cpu { |
| 892 | class LLVM_LIBRARY_VISIBILITY Assemble : public Tool { |
| 893 | public: |
| 894 | Assemble(const ToolChain &TC) |
| 895 | : Tool("PS4cpu::Assemble", "assembler", TC, RF_Full) {} |
| 896 | |
Eugene Zelenko | d4304d2 | 2015-11-04 21:37:17 +0000 | [diff] [blame] | 897 | bool hasIntegratedCPP() const override { return false; } |
Filipe Cabecinhas | c888e19 | 2015-10-14 12:25:43 +0000 | [diff] [blame] | 898 | |
Eugene Zelenko | d4304d2 | 2015-11-04 21:37:17 +0000 | [diff] [blame] | 899 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 900 | const InputInfo &Output, |
| 901 | const InputInfoList &Inputs, |
| 902 | const llvm::opt::ArgList &TCArgs, |
| 903 | const char *LinkingOutput) const override; |
Filipe Cabecinhas | c888e19 | 2015-10-14 12:25:43 +0000 | [diff] [blame] | 904 | }; |
| 905 | |
| 906 | class LLVM_LIBRARY_VISIBILITY Link : public Tool { |
| 907 | public: |
| 908 | Link(const ToolChain &TC) : Tool("PS4cpu::Link", "linker", TC, RF_Full) {} |
| 909 | |
Eugene Zelenko | d4304d2 | 2015-11-04 21:37:17 +0000 | [diff] [blame] | 910 | bool hasIntegratedCPP() const override { return false; } |
| 911 | bool isLinkJob() const override { return true; } |
Filipe Cabecinhas | c888e19 | 2015-10-14 12:25:43 +0000 | [diff] [blame] | 912 | |
Eugene Zelenko | d4304d2 | 2015-11-04 21:37:17 +0000 | [diff] [blame] | 913 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 914 | const InputInfo &Output, |
| 915 | const InputInfoList &Inputs, |
| 916 | const llvm::opt::ArgList &TCArgs, |
| 917 | const char *LinkingOutput) const override; |
Filipe Cabecinhas | c888e19 | 2015-10-14 12:25:43 +0000 | [diff] [blame] | 918 | }; |
| 919 | } // end namespace PS4cpu |
| 920 | |
Justin Lebar | 21e5d4f | 2016-01-14 21:41:27 +0000 | [diff] [blame] | 921 | namespace NVPTX { |
| 922 | |
| 923 | // Run ptxas, the NVPTX assembler. |
| 924 | class LLVM_LIBRARY_VISIBILITY Assembler : public Tool { |
| 925 | public: |
| 926 | Assembler(const ToolChain &TC) |
| 927 | : Tool("NVPTX::Assembler", "ptxas", TC, RF_Full, llvm::sys::WEM_UTF8, |
| 928 | "--options-file") {} |
| 929 | |
| 930 | bool hasIntegratedCPP() const override { return false; } |
| 931 | |
| 932 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 933 | const InputInfo &Output, const InputInfoList &Inputs, |
| 934 | const llvm::opt::ArgList &TCArgs, |
| 935 | const char *LinkingOutput) const override; |
| 936 | }; |
| 937 | |
| 938 | // Runs fatbinary, which combines GPU object files ("cubin" files) and/or PTX |
| 939 | // assembly into a single output file. |
| 940 | class LLVM_LIBRARY_VISIBILITY Linker : public Tool { |
| 941 | public: |
| 942 | Linker(const ToolChain &TC) |
| 943 | : Tool("NVPTX::Linker", "fatbinary", TC, RF_Full, llvm::sys::WEM_UTF8, |
| 944 | "--options-file") {} |
| 945 | |
| 946 | bool hasIntegratedCPP() const override { return false; } |
| 947 | |
| 948 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 949 | const InputInfo &Output, const InputInfoList &Inputs, |
| 950 | const llvm::opt::ArgList &TCArgs, |
| 951 | const char *LinkingOutput) const override; |
| 952 | }; |
| 953 | |
| 954 | } // end namespace NVPTX |
| 955 | |
Douglas Katzman | 9dc5fbb | 2015-06-03 16:56:50 +0000 | [diff] [blame] | 956 | } // end namespace tools |
Daniel Dunbar | 5903d8c | 2009-03-17 22:07:58 +0000 | [diff] [blame] | 957 | } // end namespace driver |
| 958 | } // end namespace clang |
| 959 | |
Eugene Zelenko | d4304d2 | 2015-11-04 21:37:17 +0000 | [diff] [blame] | 960 | #endif // LLVM_CLANG_LIB_DRIVER_TOOLS_H |