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 | |
| 10 | #ifndef CLANG_LIB_DRIVER_TOOLS_H_ |
| 11 | #define CLANG_LIB_DRIVER_TOOLS_H_ |
| 12 | |
| 13 | #include "clang/Driver/Tool.h" |
Daniel Dunbar | e6adeee | 2009-03-29 17:08:39 +0000 | [diff] [blame] | 14 | #include "clang/Driver/Types.h" |
Daniel Dunbar | a3246a0 | 2009-03-18 08:07:30 +0000 | [diff] [blame] | 15 | #include "clang/Driver/Util.h" |
Joerg Sonnenberger | 637603a | 2011-05-16 13:35:02 +0000 | [diff] [blame] | 16 | #include "llvm/ADT/Triple.h" |
Reid Kleckner | 898229a | 2013-06-14 17:17:23 +0000 | [diff] [blame] | 17 | #include "llvm/Option/Option.h" |
Daniel Dunbar | 5903d8c | 2009-03-17 22:07:58 +0000 | [diff] [blame] | 18 | #include "llvm/Support/Compiler.h" |
| 19 | |
| 20 | namespace clang { |
John McCall | 5fb5df9 | 2012-06-20 06:18:46 +0000 | [diff] [blame] | 21 | class ObjCRuntime; |
| 22 | |
Daniel Dunbar | 5903d8c | 2009-03-17 22:07:58 +0000 | [diff] [blame] | 23 | namespace driver { |
Hans Wennborg | 87cfa71 | 2013-09-19 20:32:16 +0000 | [diff] [blame] | 24 | class Command; |
Douglas Gregor | 111af7d | 2009-04-18 00:34:01 +0000 | [diff] [blame] | 25 | class Driver; |
| 26 | |
Daniel Dunbar | c196421 | 2009-03-26 16:23:12 +0000 | [diff] [blame] | 27 | namespace toolchains { |
Tim Northover | 157d911 | 2014-01-16 08:48:16 +0000 | [diff] [blame] | 28 | class MachO; |
Daniel Dunbar | c196421 | 2009-03-26 16:23:12 +0000 | [diff] [blame] | 29 | } |
| 30 | |
Daniel Dunbar | 15abb2e | 2009-03-17 22:18:43 +0000 | [diff] [blame] | 31 | namespace tools { |
Hans Wennborg | 1da044a | 2014-06-26 19:59:02 +0000 | [diff] [blame] | 32 | |
| 33 | namespace visualstudio { |
| 34 | class Compile; |
| 35 | } |
| 36 | |
Reid Kleckner | 898229a | 2013-06-14 17:17:23 +0000 | [diff] [blame] | 37 | using llvm::opt::ArgStringList; |
Daniel Dunbar | 5903d8c | 2009-03-17 22:07:58 +0000 | [diff] [blame] | 38 | |
Daniel Dunbar | 4f5e79c | 2010-05-20 21:30:13 +0000 | [diff] [blame] | 39 | /// \brief Clang compiler tool. |
Duncan Sands | af260b9 | 2010-05-11 20:16:05 +0000 | [diff] [blame] | 40 | class LLVM_LIBRARY_VISIBILITY Clang : public Tool { |
Eric Christopher | 45f2e71 | 2012-12-18 00:31:10 +0000 | [diff] [blame] | 41 | public: |
Reid Kleckner | 724c21c | 2013-06-17 13:59:19 +0000 | [diff] [blame] | 42 | static const char *getBaseInputName(const llvm::opt::ArgList &Args, |
Bob Wilson | decc03e | 2012-11-23 06:14:39 +0000 | [diff] [blame] | 43 | const InputInfoList &Inputs); |
Reid Kleckner | 724c21c | 2013-06-17 13:59:19 +0000 | [diff] [blame] | 44 | static const char *getBaseInputStem(const llvm::opt::ArgList &Args, |
Bob Wilson | decc03e | 2012-11-23 06:14:39 +0000 | [diff] [blame] | 45 | const InputInfoList &Inputs); |
Reid Kleckner | 724c21c | 2013-06-17 13:59:19 +0000 | [diff] [blame] | 46 | static const char *getDependencyFileName(const llvm::opt::ArgList &Args, |
Bob Wilson | decc03e | 2012-11-23 06:14:39 +0000 | [diff] [blame] | 47 | const InputInfoList &Inputs); |
| 48 | |
Eric Christopher | 45f2e71 | 2012-12-18 00:31:10 +0000 | [diff] [blame] | 49 | private: |
Reid Kleckner | 724c21c | 2013-06-17 13:59:19 +0000 | [diff] [blame] | 50 | void AddPreprocessingOptions(Compilation &C, const JobAction &JA, |
Peter Collingbourne | 9b515cb | 2011-11-06 00:40:05 +0000 | [diff] [blame] | 51 | const Driver &D, |
Reid Kleckner | 724c21c | 2013-06-17 13:59:19 +0000 | [diff] [blame] | 52 | const llvm::opt::ArgList &Args, |
| 53 | llvm::opt::ArgStringList &CmdArgs, |
Daniel Dunbar | d067f7f | 2009-04-08 23:54:23 +0000 | [diff] [blame] | 54 | const InputInfo &Output, |
| 55 | const InputInfoList &Inputs) const; |
| 56 | |
Amara Emerson | 703da2e | 2013-10-31 09:32:33 +0000 | [diff] [blame] | 57 | void AddAArch64TargetArgs(const llvm::opt::ArgList &Args, |
| 58 | llvm::opt::ArgStringList &CmdArgs) const; |
Reid Kleckner | 724c21c | 2013-06-17 13:59:19 +0000 | [diff] [blame] | 59 | void AddARMTargetArgs(const llvm::opt::ArgList &Args, |
| 60 | llvm::opt::ArgStringList &CmdArgs, |
Daniel Dunbar | c9388c1 | 2011-03-17 17:10:06 +0000 | [diff] [blame] | 61 | bool KernelOrKext) const; |
Tim Northover | a2ee433 | 2014-03-29 15:09:45 +0000 | [diff] [blame] | 62 | void AddARM64TargetArgs(const llvm::opt::ArgList &Args, |
| 63 | llvm::opt::ArgStringList &CmdArgs) const; |
Reid Kleckner | 724c21c | 2013-06-17 13:59:19 +0000 | [diff] [blame] | 64 | void AddMIPSTargetArgs(const llvm::opt::ArgList &Args, |
| 65 | llvm::opt::ArgStringList &CmdArgs) const; |
Ulrich Weigand | 8afad61 | 2014-07-28 13:17:52 +0000 | [diff] [blame] | 66 | void AddPPCTargetArgs(const llvm::opt::ArgList &Args, |
| 67 | llvm::opt::ArgStringList &CmdArgs) const; |
Reid Kleckner | 724c21c | 2013-06-17 13:59:19 +0000 | [diff] [blame] | 68 | void AddR600TargetArgs(const llvm::opt::ArgList &Args, |
| 69 | llvm::opt::ArgStringList &CmdArgs) const; |
| 70 | void AddSparcTargetArgs(const llvm::opt::ArgList &Args, |
| 71 | llvm::opt::ArgStringList &CmdArgs) const; |
Richard Sandiford | 4652d89 | 2013-07-19 16:51:51 +0000 | [diff] [blame] | 72 | void AddSystemZTargetArgs(const llvm::opt::ArgList &Args, |
| 73 | llvm::opt::ArgStringList &CmdArgs) const; |
Reid Kleckner | 724c21c | 2013-06-17 13:59:19 +0000 | [diff] [blame] | 74 | void AddX86TargetArgs(const llvm::opt::ArgList &Args, |
| 75 | llvm::opt::ArgStringList &CmdArgs) const; |
| 76 | void AddHexagonTargetArgs(const llvm::opt::ArgList &Args, |
| 77 | llvm::opt::ArgStringList &CmdArgs) const; |
Daniel Dunbar | 3b3191f | 2009-09-09 22:33:08 +0000 | [diff] [blame] | 78 | |
John McCall | 5fb5df9 | 2012-06-20 06:18:46 +0000 | [diff] [blame] | 79 | enum RewriteKind { RK_None, RK_Fragile, RK_NonFragile }; |
| 80 | |
Reid Kleckner | 724c21c | 2013-06-17 13:59:19 +0000 | [diff] [blame] | 81 | ObjCRuntime AddObjCRuntimeArgs(const llvm::opt::ArgList &args, |
| 82 | llvm::opt::ArgStringList &cmdArgs, |
John McCall | 5fb5df9 | 2012-06-20 06:18:46 +0000 | [diff] [blame] | 83 | RewriteKind rewrite) const; |
| 84 | |
Hans Wennborg | 75958c4 | 2013-08-08 00:17:41 +0000 | [diff] [blame] | 85 | void AddClangCLArgs(const llvm::opt::ArgList &Args, |
| 86 | llvm::opt::ArgStringList &CmdArgs) const; |
| 87 | |
Hans Wennborg | 1da044a | 2014-06-26 19:59:02 +0000 | [diff] [blame] | 88 | visualstudio::Compile *getCLFallback() const; |
| 89 | |
| 90 | mutable std::unique_ptr<visualstudio::Compile> CLFallback; |
| 91 | |
Daniel Dunbar | 5903d8c | 2009-03-17 22:07:58 +0000 | [diff] [blame] | 92 | public: |
Daniel Dunbar | 1cb532c | 2010-05-22 00:37:18 +0000 | [diff] [blame] | 93 | Clang(const ToolChain &TC) : Tool("clang", "clang frontend", TC) {} |
Daniel Dunbar | 5903d8c | 2009-03-17 22:07:58 +0000 | [diff] [blame] | 94 | |
Craig Topper | b45acb8 | 2014-03-14 06:02:07 +0000 | [diff] [blame] | 95 | bool hasGoodDiagnostics() const override { return true; } |
| 96 | bool hasIntegratedAssembler() const override { return true; } |
| 97 | bool hasIntegratedCPP() const override { return true; } |
Daniel Dunbar | 1a093d2 | 2009-03-18 06:00:36 +0000 | [diff] [blame] | 98 | |
Craig Topper | b45acb8 | 2014-03-14 06:02:07 +0000 | [diff] [blame] | 99 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 100 | const InputInfo &Output, const InputInfoList &Inputs, |
| 101 | const llvm::opt::ArgList &TCArgs, |
| 102 | const char *LinkingOutput) const override; |
Daniel Dunbar | 5903d8c | 2009-03-17 22:07:58 +0000 | [diff] [blame] | 103 | }; |
| 104 | |
Daniel Dunbar | 4f5e79c | 2010-05-20 21:30:13 +0000 | [diff] [blame] | 105 | /// \brief Clang integrated assembler tool. |
| 106 | class LLVM_LIBRARY_VISIBILITY ClangAs : public Tool { |
| 107 | public: |
Daniel Dunbar | 1cb532c | 2010-05-22 00:37:18 +0000 | [diff] [blame] | 108 | ClangAs(const ToolChain &TC) : Tool("clang::as", |
| 109 | "clang integrated assembler", TC) {} |
Daniel Dunbar | 4f5e79c | 2010-05-20 21:30:13 +0000 | [diff] [blame] | 110 | |
Craig Topper | b45acb8 | 2014-03-14 06:02:07 +0000 | [diff] [blame] | 111 | bool hasGoodDiagnostics() const override { return true; } |
| 112 | bool hasIntegratedAssembler() const override { return false; } |
| 113 | bool hasIntegratedCPP() const override { return false; } |
Daniel Dunbar | 4f5e79c | 2010-05-20 21:30:13 +0000 | [diff] [blame] | 114 | |
Craig Topper | b45acb8 | 2014-03-14 06:02:07 +0000 | [diff] [blame] | 115 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 116 | const InputInfo &Output, const InputInfoList &Inputs, |
| 117 | const llvm::opt::ArgList &TCArgs, |
| 118 | const char *LinkingOutput) const override; |
Daniel Dunbar | 4f5e79c | 2010-05-20 21:30:13 +0000 | [diff] [blame] | 119 | }; |
| 120 | |
Daniel Dunbar | 82116f8 | 2009-03-17 22:45:24 +0000 | [diff] [blame] | 121 | /// gcc - Generic GCC tool implementations. |
| 122 | namespace gcc { |
Duncan Sands | af260b9 | 2010-05-11 20:16:05 +0000 | [diff] [blame] | 123 | class LLVM_LIBRARY_VISIBILITY Common : public Tool { |
Daniel Dunbar | 5903d8c | 2009-03-17 22:07:58 +0000 | [diff] [blame] | 124 | public: |
Daniel Dunbar | 1cb532c | 2010-05-22 00:37:18 +0000 | [diff] [blame] | 125 | Common(const char *Name, const char *ShortName, |
| 126 | const ToolChain &TC) : Tool(Name, ShortName, TC) {} |
Daniel Dunbar | a3246a0 | 2009-03-18 08:07:30 +0000 | [diff] [blame] | 127 | |
Craig Topper | b45acb8 | 2014-03-14 06:02:07 +0000 | [diff] [blame] | 128 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 129 | const InputInfo &Output, |
| 130 | const InputInfoList &Inputs, |
| 131 | const llvm::opt::ArgList &TCArgs, |
| 132 | const char *LinkingOutput) const override; |
Daniel Dunbar | a3246a0 | 2009-03-18 08:07:30 +0000 | [diff] [blame] | 133 | |
| 134 | /// RenderExtraToolArgs - Render any arguments necessary to force |
| 135 | /// the particular tool mode. |
Reid Kleckner | 724c21c | 2013-06-17 13:59:19 +0000 | [diff] [blame] | 136 | virtual void |
| 137 | RenderExtraToolArgs(const JobAction &JA, |
| 138 | llvm::opt::ArgStringList &CmdArgs) const = 0; |
Daniel Dunbar | a3246a0 | 2009-03-18 08:07:30 +0000 | [diff] [blame] | 139 | }; |
| 140 | |
Duncan Sands | af260b9 | 2010-05-11 20:16:05 +0000 | [diff] [blame] | 141 | class LLVM_LIBRARY_VISIBILITY Preprocess : public Common { |
Daniel Dunbar | a3246a0 | 2009-03-18 08:07:30 +0000 | [diff] [blame] | 142 | public: |
Daniel Dunbar | 1cb532c | 2010-05-22 00:37:18 +0000 | [diff] [blame] | 143 | Preprocess(const ToolChain &TC) : Common("gcc::Preprocess", |
| 144 | "gcc preprocessor", TC) {} |
Daniel Dunbar | 5903d8c | 2009-03-17 22:07:58 +0000 | [diff] [blame] | 145 | |
Craig Topper | b45acb8 | 2014-03-14 06:02:07 +0000 | [diff] [blame] | 146 | bool hasGoodDiagnostics() const override { return true; } |
| 147 | bool hasIntegratedCPP() const override { return false; } |
Daniel Dunbar | 1a093d2 | 2009-03-18 06:00:36 +0000 | [diff] [blame] | 148 | |
Craig Topper | b45acb8 | 2014-03-14 06:02:07 +0000 | [diff] [blame] | 149 | void RenderExtraToolArgs(const JobAction &JA, |
| 150 | llvm::opt::ArgStringList &CmdArgs) const override; |
Daniel Dunbar | 5903d8c | 2009-03-17 22:07:58 +0000 | [diff] [blame] | 151 | }; |
| 152 | |
Duncan Sands | af260b9 | 2010-05-11 20:16:05 +0000 | [diff] [blame] | 153 | class LLVM_LIBRARY_VISIBILITY Compile : public Common { |
Daniel Dunbar | 5903d8c | 2009-03-17 22:07:58 +0000 | [diff] [blame] | 154 | public: |
Daniel Dunbar | 1cb532c | 2010-05-22 00:37:18 +0000 | [diff] [blame] | 155 | Compile(const ToolChain &TC) : Common("gcc::Compile", |
| 156 | "gcc frontend", TC) {} |
Daniel Dunbar | 5903d8c | 2009-03-17 22:07:58 +0000 | [diff] [blame] | 157 | |
Craig Topper | b45acb8 | 2014-03-14 06:02:07 +0000 | [diff] [blame] | 158 | bool hasGoodDiagnostics() const override { return true; } |
| 159 | bool hasIntegratedCPP() const override { return true; } |
Daniel Dunbar | 1a093d2 | 2009-03-18 06:00:36 +0000 | [diff] [blame] | 160 | |
Craig Topper | b45acb8 | 2014-03-14 06:02:07 +0000 | [diff] [blame] | 161 | void RenderExtraToolArgs(const JobAction &JA, |
| 162 | llvm::opt::ArgStringList &CmdArgs) const override; |
Daniel Dunbar | 5903d8c | 2009-03-17 22:07:58 +0000 | [diff] [blame] | 163 | }; |
| 164 | |
Duncan Sands | af260b9 | 2010-05-11 20:16:05 +0000 | [diff] [blame] | 165 | class LLVM_LIBRARY_VISIBILITY Link : public Common { |
Daniel Dunbar | 5903d8c | 2009-03-17 22:07:58 +0000 | [diff] [blame] | 166 | public: |
Daniel Dunbar | 1cb532c | 2010-05-22 00:37:18 +0000 | [diff] [blame] | 167 | Link(const ToolChain &TC) : Common("gcc::Link", |
| 168 | "linker (via gcc)", TC) {} |
Daniel Dunbar | 5903d8c | 2009-03-17 22:07:58 +0000 | [diff] [blame] | 169 | |
Craig Topper | b45acb8 | 2014-03-14 06:02:07 +0000 | [diff] [blame] | 170 | bool hasIntegratedCPP() const override { return false; } |
| 171 | bool isLinkJob() const override { return true; } |
Daniel Dunbar | 1a093d2 | 2009-03-18 06:00:36 +0000 | [diff] [blame] | 172 | |
Craig Topper | b45acb8 | 2014-03-14 06:02:07 +0000 | [diff] [blame] | 173 | void RenderExtraToolArgs(const JobAction &JA, |
| 174 | llvm::opt::ArgStringList &CmdArgs) const override; |
Daniel Dunbar | 5903d8c | 2009-03-17 22:07:58 +0000 | [diff] [blame] | 175 | }; |
Daniel Dunbar | 82116f8 | 2009-03-17 22:45:24 +0000 | [diff] [blame] | 176 | } // end namespace gcc |
Daniel Dunbar | 5903d8c | 2009-03-17 22:07:58 +0000 | [diff] [blame] | 177 | |
Tony Linthicum | 76329bf | 2011-12-12 21:14:55 +0000 | [diff] [blame] | 178 | namespace hexagon { |
| 179 | // For Hexagon, we do not need to instantiate tools for PreProcess, PreCompile and Compile. |
| 180 | // We simply use "clang -cc1" for those actions. |
| 181 | class LLVM_LIBRARY_VISIBILITY Assemble : public Tool { |
| 182 | public: |
| 183 | Assemble(const ToolChain &TC) : Tool("hexagon::Assemble", |
| 184 | "hexagon-as", TC) {} |
| 185 | |
Craig Topper | b45acb8 | 2014-03-14 06:02:07 +0000 | [diff] [blame] | 186 | bool hasIntegratedCPP() const override { return false; } |
Tony Linthicum | 76329bf | 2011-12-12 21:14:55 +0000 | [diff] [blame] | 187 | |
Craig Topper | f85c6ce | 2014-03-14 06:06:19 +0000 | [diff] [blame] | 188 | void RenderExtraToolArgs(const JobAction &JA, |
| 189 | llvm::opt::ArgStringList &CmdArgs) const; |
Craig Topper | b45acb8 | 2014-03-14 06:02:07 +0000 | [diff] [blame] | 190 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 191 | const InputInfo &Output, const InputInfoList &Inputs, |
| 192 | const llvm::opt::ArgList &TCArgs, |
| 193 | const char *LinkingOutput) const override; |
Tony Linthicum | 76329bf | 2011-12-12 21:14:55 +0000 | [diff] [blame] | 194 | }; |
| 195 | |
| 196 | class LLVM_LIBRARY_VISIBILITY Link : public Tool { |
| 197 | public: |
| 198 | Link(const ToolChain &TC) : Tool("hexagon::Link", |
| 199 | "hexagon-ld", TC) {} |
| 200 | |
Craig Topper | b45acb8 | 2014-03-14 06:02:07 +0000 | [diff] [blame] | 201 | bool hasIntegratedCPP() const override { return false; } |
| 202 | bool isLinkJob() const override { return true; } |
Tony Linthicum | 76329bf | 2011-12-12 21:14:55 +0000 | [diff] [blame] | 203 | |
| 204 | virtual void RenderExtraToolArgs(const JobAction &JA, |
Reid Kleckner | 724c21c | 2013-06-17 13:59:19 +0000 | [diff] [blame] | 205 | llvm::opt::ArgStringList &CmdArgs) const; |
Craig Topper | b45acb8 | 2014-03-14 06:02:07 +0000 | [diff] [blame] | 206 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 207 | const InputInfo &Output, const InputInfoList &Inputs, |
| 208 | const llvm::opt::ArgList &TCArgs, |
| 209 | const char *LinkingOutput) const override; |
Tony Linthicum | 76329bf | 2011-12-12 21:14:55 +0000 | [diff] [blame] | 210 | }; |
| 211 | } // end namespace hexagon. |
| 212 | |
Bernard Ogden | 3156176 | 2013-12-12 13:27:11 +0000 | [diff] [blame] | 213 | namespace arm { |
Rafael Espindola | 80d333b | 2013-12-12 15:48:19 +0000 | [diff] [blame] | 214 | StringRef getARMTargetCPU(const llvm::opt::ArgList &Args, |
| 215 | const llvm::Triple &Triple); |
Bernard Ogden | 3156176 | 2013-12-12 13:27:11 +0000 | [diff] [blame] | 216 | const char* getARMCPUForMArch(const llvm::opt::ArgList &Args, |
| 217 | const llvm::Triple &Triple); |
| 218 | const char* getLLVMArchSuffixForARM(StringRef CPU); |
| 219 | } |
Tony Linthicum | 76329bf | 2011-12-12 21:14:55 +0000 | [diff] [blame] | 220 | |
Jonathan Roelofs | 2cea1be | 2014-02-12 03:21:20 +0000 | [diff] [blame] | 221 | namespace mips { |
Simon Atanasyan | 7018e1d | 2014-07-16 12:29:22 +0000 | [diff] [blame] | 222 | void getMipsCPUAndABI(const llvm::opt::ArgList &Args, |
| 223 | const llvm::Triple &Triple, StringRef &CPUName, |
| 224 | StringRef &ABIName); |
Jonathan Roelofs | 2cea1be | 2014-02-12 03:21:20 +0000 | [diff] [blame] | 225 | bool hasMipsAbiArg(const llvm::opt::ArgList &Args, const char *Value); |
Simon Atanasyan | d95c67d | 2014-08-13 14:34:14 +0000 | [diff] [blame^] | 226 | bool isUCLibc(const llvm::opt::ArgList &Args); |
Daniel Sanders | 2bf1366 | 2014-07-10 14:40:57 +0000 | [diff] [blame] | 227 | bool isNaN2008(const llvm::opt::ArgList &Args, const llvm::Triple &Triple); |
Daniel Sanders | 379d44b | 2014-07-16 11:52:23 +0000 | [diff] [blame] | 228 | bool isFPXXDefault(const llvm::Triple &Triple, StringRef CPUName, |
| 229 | StringRef ABIName); |
Jonathan Roelofs | 2cea1be | 2014-02-12 03:21:20 +0000 | [diff] [blame] | 230 | } |
| 231 | |
Ulrich Weigand | 8afad61 | 2014-07-28 13:17:52 +0000 | [diff] [blame] | 232 | namespace ppc { |
| 233 | bool hasPPCAbiArg(const llvm::opt::ArgList &Args, const char *Value); |
| 234 | } |
| 235 | |
Daniel Dunbar | 64ed5e3 | 2009-03-20 00:52:38 +0000 | [diff] [blame] | 236 | namespace darwin { |
Tim Northover | 157d911 | 2014-01-16 08:48:16 +0000 | [diff] [blame] | 237 | llvm::Triple::ArchType getArchTypeForMachOArchName(StringRef Str); |
| 238 | void setTripleTypeForMachOArchName(llvm::Triple &T, StringRef Str); |
Rafael Espindola | dcbf698 | 2012-10-31 18:51:07 +0000 | [diff] [blame] | 239 | |
Tim Northover | 157d911 | 2014-01-16 08:48:16 +0000 | [diff] [blame] | 240 | class LLVM_LIBRARY_VISIBILITY MachOTool : public Tool { |
David Blaikie | 68e081d | 2011-12-20 02:48:34 +0000 | [diff] [blame] | 241 | virtual void anchor(); |
Daniel Dunbar | e9ded43 | 2009-09-09 18:36:20 +0000 | [diff] [blame] | 242 | protected: |
Tim Northover | 157d911 | 2014-01-16 08:48:16 +0000 | [diff] [blame] | 243 | void AddMachOArch(const llvm::opt::ArgList &Args, |
Reid Kleckner | 724c21c | 2013-06-17 13:59:19 +0000 | [diff] [blame] | 244 | llvm::opt::ArgStringList &CmdArgs) const; |
Daniel Dunbar | e9ded43 | 2009-09-09 18:36:20 +0000 | [diff] [blame] | 245 | |
Tim Northover | 157d911 | 2014-01-16 08:48:16 +0000 | [diff] [blame] | 246 | const toolchains::MachO &getMachOToolChain() const { |
| 247 | return reinterpret_cast<const toolchains::MachO&>(getToolChain()); |
Daniel Dunbar | e9ded43 | 2009-09-09 18:36:20 +0000 | [diff] [blame] | 248 | } |
| 249 | |
| 250 | public: |
Tim Northover | 157d911 | 2014-01-16 08:48:16 +0000 | [diff] [blame] | 251 | MachOTool(const char *Name, const char *ShortName, |
Daniel Dunbar | 1cb532c | 2010-05-22 00:37:18 +0000 | [diff] [blame] | 252 | const ToolChain &TC) : Tool(Name, ShortName, TC) {} |
Daniel Dunbar | e9ded43 | 2009-09-09 18:36:20 +0000 | [diff] [blame] | 253 | }; |
| 254 | |
Tim Northover | 157d911 | 2014-01-16 08:48:16 +0000 | [diff] [blame] | 255 | class LLVM_LIBRARY_VISIBILITY Assemble : public MachOTool { |
Daniel Dunbar | be22084 | 2009-03-20 16:06:39 +0000 | [diff] [blame] | 256 | public: |
Tim Northover | 157d911 | 2014-01-16 08:48:16 +0000 | [diff] [blame] | 257 | Assemble(const ToolChain &TC) : MachOTool("darwin::Assemble", |
| 258 | "assembler", TC) {} |
Daniel Dunbar | be22084 | 2009-03-20 16:06:39 +0000 | [diff] [blame] | 259 | |
Craig Topper | b45acb8 | 2014-03-14 06:02:07 +0000 | [diff] [blame] | 260 | bool hasIntegratedCPP() const override { return false; } |
Daniel Dunbar | be22084 | 2009-03-20 16:06:39 +0000 | [diff] [blame] | 261 | |
Craig Topper | b45acb8 | 2014-03-14 06:02:07 +0000 | [diff] [blame] | 262 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 263 | const InputInfo &Output, const InputInfoList &Inputs, |
| 264 | const llvm::opt::ArgList &TCArgs, |
| 265 | const char *LinkingOutput) const override; |
Daniel Dunbar | be22084 | 2009-03-20 16:06:39 +0000 | [diff] [blame] | 266 | }; |
| 267 | |
Tim Northover | 157d911 | 2014-01-16 08:48:16 +0000 | [diff] [blame] | 268 | class LLVM_LIBRARY_VISIBILITY Link : public MachOTool { |
Bill Wendling | 3b2000f | 2012-10-02 18:02:50 +0000 | [diff] [blame] | 269 | bool NeedsTempPath(const InputInfoList &Inputs) const; |
Reid Kleckner | 724c21c | 2013-06-17 13:59:19 +0000 | [diff] [blame] | 270 | void AddLinkArgs(Compilation &C, const llvm::opt::ArgList &Args, |
| 271 | llvm::opt::ArgStringList &CmdArgs, |
| 272 | const InputInfoList &Inputs) const; |
Daniel Dunbar | c196421 | 2009-03-26 16:23:12 +0000 | [diff] [blame] | 273 | |
Daniel Dunbar | c196421 | 2009-03-26 16:23:12 +0000 | [diff] [blame] | 274 | public: |
Tim Northover | 157d911 | 2014-01-16 08:48:16 +0000 | [diff] [blame] | 275 | Link(const ToolChain &TC) : MachOTool("darwin::Link", "linker", TC) {} |
Daniel Dunbar | c196421 | 2009-03-26 16:23:12 +0000 | [diff] [blame] | 276 | |
Craig Topper | b45acb8 | 2014-03-14 06:02:07 +0000 | [diff] [blame] | 277 | bool hasIntegratedCPP() const override { return false; } |
| 278 | bool isLinkJob() const override { return true; } |
Daniel Dunbar | c196421 | 2009-03-26 16:23:12 +0000 | [diff] [blame] | 279 | |
Craig Topper | b45acb8 | 2014-03-14 06:02:07 +0000 | [diff] [blame] | 280 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 281 | const InputInfo &Output, const InputInfoList &Inputs, |
| 282 | const llvm::opt::ArgList &TCArgs, |
| 283 | const char *LinkingOutput) const override; |
Daniel Dunbar | c196421 | 2009-03-26 16:23:12 +0000 | [diff] [blame] | 284 | }; |
| 285 | |
Tim Northover | 157d911 | 2014-01-16 08:48:16 +0000 | [diff] [blame] | 286 | class LLVM_LIBRARY_VISIBILITY Lipo : public MachOTool { |
Daniel Dunbar | 64ed5e3 | 2009-03-20 00:52:38 +0000 | [diff] [blame] | 287 | public: |
Tim Northover | 157d911 | 2014-01-16 08:48:16 +0000 | [diff] [blame] | 288 | Lipo(const ToolChain &TC) : MachOTool("darwin::Lipo", "lipo", TC) {} |
Daniel Dunbar | 64ed5e3 | 2009-03-20 00:52:38 +0000 | [diff] [blame] | 289 | |
Craig Topper | b45acb8 | 2014-03-14 06:02:07 +0000 | [diff] [blame] | 290 | bool hasIntegratedCPP() const override { return false; } |
Daniel Dunbar | 64ed5e3 | 2009-03-20 00:52:38 +0000 | [diff] [blame] | 291 | |
Craig Topper | b45acb8 | 2014-03-14 06:02:07 +0000 | [diff] [blame] | 292 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 293 | const InputInfo &Output, const InputInfoList &Inputs, |
| 294 | const llvm::opt::ArgList &TCArgs, |
| 295 | const char *LinkingOutput) const override; |
Daniel Dunbar | 64ed5e3 | 2009-03-20 00:52:38 +0000 | [diff] [blame] | 296 | }; |
Daniel Dunbar | 8829962 | 2010-06-04 18:28:36 +0000 | [diff] [blame] | 297 | |
Tim Northover | 157d911 | 2014-01-16 08:48:16 +0000 | [diff] [blame] | 298 | class LLVM_LIBRARY_VISIBILITY Dsymutil : public MachOTool { |
Daniel Dunbar | 8829962 | 2010-06-04 18:28:36 +0000 | [diff] [blame] | 299 | public: |
Tim Northover | 157d911 | 2014-01-16 08:48:16 +0000 | [diff] [blame] | 300 | Dsymutil(const ToolChain &TC) : MachOTool("darwin::Dsymutil", |
| 301 | "dsymutil", TC) {} |
Daniel Dunbar | 8829962 | 2010-06-04 18:28:36 +0000 | [diff] [blame] | 302 | |
Craig Topper | b45acb8 | 2014-03-14 06:02:07 +0000 | [diff] [blame] | 303 | bool hasIntegratedCPP() const override { return false; } |
| 304 | bool isDsymutilJob() const override { return true; } |
Daniel Dunbar | 8829962 | 2010-06-04 18:28:36 +0000 | [diff] [blame] | 305 | |
Craig Topper | b45acb8 | 2014-03-14 06:02:07 +0000 | [diff] [blame] | 306 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 307 | const InputInfo &Output, |
| 308 | const InputInfoList &Inputs, |
| 309 | const llvm::opt::ArgList &TCArgs, |
| 310 | const char *LinkingOutput) const override; |
Daniel Dunbar | 8829962 | 2010-06-04 18:28:36 +0000 | [diff] [blame] | 311 | }; |
Eric Christopher | 551ef45 | 2011-08-23 17:56:55 +0000 | [diff] [blame] | 312 | |
Tim Northover | 157d911 | 2014-01-16 08:48:16 +0000 | [diff] [blame] | 313 | class LLVM_LIBRARY_VISIBILITY VerifyDebug : public MachOTool { |
Eric Christopher | 551ef45 | 2011-08-23 17:56:55 +0000 | [diff] [blame] | 314 | public: |
Tim Northover | 157d911 | 2014-01-16 08:48:16 +0000 | [diff] [blame] | 315 | VerifyDebug(const ToolChain &TC) : MachOTool("darwin::VerifyDebug", |
| 316 | "dwarfdump", TC) {} |
Eric Christopher | 551ef45 | 2011-08-23 17:56:55 +0000 | [diff] [blame] | 317 | |
Craig Topper | b45acb8 | 2014-03-14 06:02:07 +0000 | [diff] [blame] | 318 | bool hasIntegratedCPP() const override { return false; } |
Eric Christopher | 551ef45 | 2011-08-23 17:56:55 +0000 | [diff] [blame] | 319 | |
Craig Topper | b45acb8 | 2014-03-14 06:02:07 +0000 | [diff] [blame] | 320 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 321 | const InputInfo &Output, const InputInfoList &Inputs, |
| 322 | const llvm::opt::ArgList &TCArgs, |
| 323 | const char *LinkingOutput) const override; |
Eric Christopher | 551ef45 | 2011-08-23 17:56:55 +0000 | [diff] [blame] | 324 | }; |
| 325 | |
Daniel Dunbar | 64ed5e3 | 2009-03-20 00:52:38 +0000 | [diff] [blame] | 326 | } |
| 327 | |
Daniel Dunbar | 10de9e6 | 2009-06-29 20:52:51 +0000 | [diff] [blame] | 328 | /// openbsd -- Directly call GNU Binutils assembler and linker |
| 329 | namespace openbsd { |
Duncan Sands | af260b9 | 2010-05-11 20:16:05 +0000 | [diff] [blame] | 330 | class LLVM_LIBRARY_VISIBILITY Assemble : public Tool { |
Daniel Dunbar | 10de9e6 | 2009-06-29 20:52:51 +0000 | [diff] [blame] | 331 | public: |
Daniel Dunbar | 1cb532c | 2010-05-22 00:37:18 +0000 | [diff] [blame] | 332 | Assemble(const ToolChain &TC) : Tool("openbsd::Assemble", "assembler", |
| 333 | TC) {} |
Daniel Dunbar | 10de9e6 | 2009-06-29 20:52:51 +0000 | [diff] [blame] | 334 | |
Craig Topper | b45acb8 | 2014-03-14 06:02:07 +0000 | [diff] [blame] | 335 | bool hasIntegratedCPP() const override { return false; } |
Daniel Dunbar | 10de9e6 | 2009-06-29 20:52:51 +0000 | [diff] [blame] | 336 | |
Craig Topper | b45acb8 | 2014-03-14 06:02:07 +0000 | [diff] [blame] | 337 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 338 | const InputInfo &Output, |
| 339 | const InputInfoList &Inputs, |
| 340 | const llvm::opt::ArgList &TCArgs, |
| 341 | const char *LinkingOutput) const override; |
Daniel Dunbar | 10de9e6 | 2009-06-29 20:52:51 +0000 | [diff] [blame] | 342 | }; |
Duncan Sands | af260b9 | 2010-05-11 20:16:05 +0000 | [diff] [blame] | 343 | class LLVM_LIBRARY_VISIBILITY Link : public Tool { |
Daniel Dunbar | 10de9e6 | 2009-06-29 20:52:51 +0000 | [diff] [blame] | 344 | public: |
Daniel Dunbar | 1cb532c | 2010-05-22 00:37:18 +0000 | [diff] [blame] | 345 | Link(const ToolChain &TC) : Tool("openbsd::Link", "linker", TC) {} |
Daniel Dunbar | 10de9e6 | 2009-06-29 20:52:51 +0000 | [diff] [blame] | 346 | |
Craig Topper | b45acb8 | 2014-03-14 06:02:07 +0000 | [diff] [blame] | 347 | bool hasIntegratedCPP() const override { return false; } |
| 348 | bool isLinkJob() const override { return true; } |
Daniel Dunbar | 10de9e6 | 2009-06-29 20:52:51 +0000 | [diff] [blame] | 349 | |
Craig Topper | b45acb8 | 2014-03-14 06:02:07 +0000 | [diff] [blame] | 350 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 351 | const InputInfo &Output, const InputInfoList &Inputs, |
| 352 | const llvm::opt::ArgList &TCArgs, |
| 353 | const char *LinkingOutput) const override; |
Daniel Dunbar | 10de9e6 | 2009-06-29 20:52:51 +0000 | [diff] [blame] | 354 | }; |
Edward O'Callaghan | 856e4ff | 2009-08-22 01:06:46 +0000 | [diff] [blame] | 355 | } // end namespace openbsd |
Daniel Dunbar | 10de9e6 | 2009-06-29 20:52:51 +0000 | [diff] [blame] | 356 | |
Eli Friedman | 9fa2885 | 2012-08-08 23:57:20 +0000 | [diff] [blame] | 357 | /// bitrig -- Directly call GNU Binutils assembler and linker |
| 358 | namespace bitrig { |
| 359 | class LLVM_LIBRARY_VISIBILITY Assemble : public Tool { |
| 360 | public: |
| 361 | Assemble(const ToolChain &TC) : Tool("bitrig::Assemble", "assembler", |
| 362 | TC) {} |
| 363 | |
Craig Topper | b45acb8 | 2014-03-14 06:02:07 +0000 | [diff] [blame] | 364 | bool hasIntegratedCPP() const override { return false; } |
Eli Friedman | 9fa2885 | 2012-08-08 23:57:20 +0000 | [diff] [blame] | 365 | |
Craig Topper | b45acb8 | 2014-03-14 06:02:07 +0000 | [diff] [blame] | 366 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 367 | const InputInfo &Output, const InputInfoList &Inputs, |
| 368 | const llvm::opt::ArgList &TCArgs, |
| 369 | const char *LinkingOutput) const override; |
Eli Friedman | 9fa2885 | 2012-08-08 23:57:20 +0000 | [diff] [blame] | 370 | }; |
| 371 | class LLVM_LIBRARY_VISIBILITY Link : public Tool { |
| 372 | public: |
| 373 | Link(const ToolChain &TC) : Tool("bitrig::Link", "linker", TC) {} |
| 374 | |
Craig Topper | b45acb8 | 2014-03-14 06:02:07 +0000 | [diff] [blame] | 375 | bool hasIntegratedCPP() const override { return false; } |
| 376 | bool isLinkJob() const override { return true; } |
Eli Friedman | 9fa2885 | 2012-08-08 23:57:20 +0000 | [diff] [blame] | 377 | |
Craig Topper | b45acb8 | 2014-03-14 06:02:07 +0000 | [diff] [blame] | 378 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 379 | const InputInfo &Output, const InputInfoList &Inputs, |
| 380 | const llvm::opt::ArgList &TCArgs, |
| 381 | const char *LinkingOutput) const override; |
Eli Friedman | 9fa2885 | 2012-08-08 23:57:20 +0000 | [diff] [blame] | 382 | }; |
| 383 | } // end namespace bitrig |
| 384 | |
Daniel Dunbar | 8eb473c | 2009-03-31 17:45:15 +0000 | [diff] [blame] | 385 | /// freebsd -- Directly call GNU Binutils assembler and linker |
| 386 | namespace freebsd { |
Duncan Sands | af260b9 | 2010-05-11 20:16:05 +0000 | [diff] [blame] | 387 | class LLVM_LIBRARY_VISIBILITY Assemble : public Tool { |
Daniel Dunbar | 8eb473c | 2009-03-31 17:45:15 +0000 | [diff] [blame] | 388 | public: |
Daniel Dunbar | 1cb532c | 2010-05-22 00:37:18 +0000 | [diff] [blame] | 389 | Assemble(const ToolChain &TC) : Tool("freebsd::Assemble", "assembler", |
| 390 | TC) {} |
Daniel Dunbar | 8eb473c | 2009-03-31 17:45:15 +0000 | [diff] [blame] | 391 | |
Craig Topper | b45acb8 | 2014-03-14 06:02:07 +0000 | [diff] [blame] | 392 | bool hasIntegratedCPP() const override { return false; } |
Daniel Dunbar | 8eb473c | 2009-03-31 17:45:15 +0000 | [diff] [blame] | 393 | |
Craig Topper | b45acb8 | 2014-03-14 06:02:07 +0000 | [diff] [blame] | 394 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 395 | const InputInfo &Output, const InputInfoList &Inputs, |
| 396 | const llvm::opt::ArgList &TCArgs, |
| 397 | const char *LinkingOutput) const override; |
Daniel Dunbar | 8eb473c | 2009-03-31 17:45:15 +0000 | [diff] [blame] | 398 | }; |
Duncan Sands | af260b9 | 2010-05-11 20:16:05 +0000 | [diff] [blame] | 399 | class LLVM_LIBRARY_VISIBILITY Link : public Tool { |
Daniel Dunbar | d854c8d | 2009-04-01 19:36:32 +0000 | [diff] [blame] | 400 | public: |
Daniel Dunbar | 1cb532c | 2010-05-22 00:37:18 +0000 | [diff] [blame] | 401 | Link(const ToolChain &TC) : Tool("freebsd::Link", "linker", TC) {} |
Daniel Dunbar | d854c8d | 2009-04-01 19:36:32 +0000 | [diff] [blame] | 402 | |
Craig Topper | b45acb8 | 2014-03-14 06:02:07 +0000 | [diff] [blame] | 403 | bool hasIntegratedCPP() const override { return false; } |
| 404 | bool isLinkJob() const override { return true; } |
Daniel Dunbar | d854c8d | 2009-04-01 19:36:32 +0000 | [diff] [blame] | 405 | |
Craig Topper | b45acb8 | 2014-03-14 06:02:07 +0000 | [diff] [blame] | 406 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 407 | const InputInfo &Output, const InputInfoList &Inputs, |
| 408 | const llvm::opt::ArgList &TCArgs, |
| 409 | const char *LinkingOutput) const override; |
Daniel Dunbar | d854c8d | 2009-04-01 19:36:32 +0000 | [diff] [blame] | 410 | }; |
Edward O'Callaghan | 856e4ff | 2009-08-22 01:06:46 +0000 | [diff] [blame] | 411 | } // end namespace freebsd |
| 412 | |
Benjamin Kramer | 24f1d3e | 2011-02-02 18:59:27 +0000 | [diff] [blame] | 413 | /// netbsd -- Directly call GNU Binutils assembler and linker |
| 414 | namespace netbsd { |
| 415 | class LLVM_LIBRARY_VISIBILITY Assemble : public Tool { |
Joerg Sonnenberger | 637603a | 2011-05-16 13:35:02 +0000 | [diff] [blame] | 416 | |
Benjamin Kramer | 24f1d3e | 2011-02-02 18:59:27 +0000 | [diff] [blame] | 417 | public: |
Joerg Sonnenberger | d64c60e | 2012-01-26 22:27:52 +0000 | [diff] [blame] | 418 | Assemble(const ToolChain &TC) |
| 419 | : Tool("netbsd::Assemble", "assembler", TC) {} |
Benjamin Kramer | 24f1d3e | 2011-02-02 18:59:27 +0000 | [diff] [blame] | 420 | |
Craig Topper | b45acb8 | 2014-03-14 06:02:07 +0000 | [diff] [blame] | 421 | bool hasIntegratedCPP() const override { return false; } |
Benjamin Kramer | 24f1d3e | 2011-02-02 18:59:27 +0000 | [diff] [blame] | 422 | |
Craig Topper | b45acb8 | 2014-03-14 06:02:07 +0000 | [diff] [blame] | 423 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 424 | const InputInfo &Output, const InputInfoList &Inputs, |
| 425 | const llvm::opt::ArgList &TCArgs, |
| 426 | const char *LinkingOutput) const override; |
Benjamin Kramer | 24f1d3e | 2011-02-02 18:59:27 +0000 | [diff] [blame] | 427 | }; |
| 428 | class LLVM_LIBRARY_VISIBILITY Link : public Tool { |
Joerg Sonnenberger | 637603a | 2011-05-16 13:35:02 +0000 | [diff] [blame] | 429 | |
Benjamin Kramer | 24f1d3e | 2011-02-02 18:59:27 +0000 | [diff] [blame] | 430 | public: |
Joerg Sonnenberger | d64c60e | 2012-01-26 22:27:52 +0000 | [diff] [blame] | 431 | Link(const ToolChain &TC) |
| 432 | : Tool("netbsd::Link", "linker", TC) {} |
Benjamin Kramer | 24f1d3e | 2011-02-02 18:59:27 +0000 | [diff] [blame] | 433 | |
Craig Topper | b45acb8 | 2014-03-14 06:02:07 +0000 | [diff] [blame] | 434 | bool hasIntegratedCPP() const override { return false; } |
| 435 | bool isLinkJob() const override { return true; } |
Benjamin Kramer | 24f1d3e | 2011-02-02 18:59:27 +0000 | [diff] [blame] | 436 | |
Craig Topper | b45acb8 | 2014-03-14 06:02:07 +0000 | [diff] [blame] | 437 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 438 | const InputInfo &Output, const InputInfoList &Inputs, |
| 439 | const llvm::opt::ArgList &TCArgs, |
| 440 | const char *LinkingOutput) const override; |
Benjamin Kramer | 24f1d3e | 2011-02-02 18:59:27 +0000 | [diff] [blame] | 441 | }; |
| 442 | } // end namespace netbsd |
| 443 | |
Thomas Schwinge | 4e55526 | 2013-03-28 19:04:25 +0000 | [diff] [blame] | 444 | /// Directly call GNU Binutils' assembler and linker. |
| 445 | namespace gnutools { |
Rafael Espindola | 92b0093 | 2010-08-10 00:25:48 +0000 | [diff] [blame] | 446 | class LLVM_LIBRARY_VISIBILITY Assemble : public Tool { |
| 447 | public: |
Thomas Schwinge | 4e55526 | 2013-03-28 19:04:25 +0000 | [diff] [blame] | 448 | Assemble(const ToolChain &TC) : Tool("GNU::Assemble", "assembler", TC) {} |
Rafael Espindola | 92b0093 | 2010-08-10 00:25:48 +0000 | [diff] [blame] | 449 | |
Craig Topper | b45acb8 | 2014-03-14 06:02:07 +0000 | [diff] [blame] | 450 | bool hasIntegratedCPP() const override { return false; } |
Rafael Espindola | 92b0093 | 2010-08-10 00:25:48 +0000 | [diff] [blame] | 451 | |
Craig Topper | b45acb8 | 2014-03-14 06:02:07 +0000 | [diff] [blame] | 452 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 453 | const InputInfo &Output, |
| 454 | const InputInfoList &Inputs, |
| 455 | const llvm::opt::ArgList &TCArgs, |
| 456 | const char *LinkingOutput) const override; |
Rafael Espindola | 92b0093 | 2010-08-10 00:25:48 +0000 | [diff] [blame] | 457 | }; |
Rafael Espindola | c8f008f | 2010-11-07 20:14:31 +0000 | [diff] [blame] | 458 | class LLVM_LIBRARY_VISIBILITY Link : public Tool { |
| 459 | public: |
Thomas Schwinge | 4e55526 | 2013-03-28 19:04:25 +0000 | [diff] [blame] | 460 | Link(const ToolChain &TC) : Tool("GNU::Link", "linker", TC) {} |
Rafael Espindola | c8f008f | 2010-11-07 20:14:31 +0000 | [diff] [blame] | 461 | |
Craig Topper | b45acb8 | 2014-03-14 06:02:07 +0000 | [diff] [blame] | 462 | bool hasIntegratedCPP() const override { return false; } |
| 463 | bool isLinkJob() const override { return true; } |
Rafael Espindola | c8f008f | 2010-11-07 20:14:31 +0000 | [diff] [blame] | 464 | |
Craig Topper | b45acb8 | 2014-03-14 06:02:07 +0000 | [diff] [blame] | 465 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 466 | const InputInfo &Output, |
| 467 | const InputInfoList &Inputs, |
| 468 | const llvm::opt::ArgList &TCArgs, |
| 469 | const char *LinkingOutput) const override; |
Rafael Espindola | c8f008f | 2010-11-07 20:14:31 +0000 | [diff] [blame] | 470 | }; |
Rafael Espindola | 92b0093 | 2010-08-10 00:25:48 +0000 | [diff] [blame] | 471 | } |
Chris Lattner | 3e2ee14 | 2010-07-07 16:01:42 +0000 | [diff] [blame] | 472 | /// minix -- Directly call GNU Binutils assembler and linker |
| 473 | namespace minix { |
| 474 | class LLVM_LIBRARY_VISIBILITY Assemble : public Tool { |
| 475 | public: |
| 476 | Assemble(const ToolChain &TC) : Tool("minix::Assemble", "assembler", |
| 477 | TC) {} |
| 478 | |
Craig Topper | b45acb8 | 2014-03-14 06:02:07 +0000 | [diff] [blame] | 479 | bool hasIntegratedCPP() const override { return false; } |
Chris Lattner | 3e2ee14 | 2010-07-07 16:01:42 +0000 | [diff] [blame] | 480 | |
Craig Topper | b45acb8 | 2014-03-14 06:02:07 +0000 | [diff] [blame] | 481 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 482 | const InputInfo &Output, |
| 483 | const InputInfoList &Inputs, |
| 484 | const llvm::opt::ArgList &TCArgs, |
| 485 | const char *LinkingOutput) const override; |
Chris Lattner | 3e2ee14 | 2010-07-07 16:01:42 +0000 | [diff] [blame] | 486 | }; |
| 487 | class LLVM_LIBRARY_VISIBILITY Link : public Tool { |
| 488 | public: |
| 489 | Link(const ToolChain &TC) : Tool("minix::Link", "linker", TC) {} |
| 490 | |
Craig Topper | b45acb8 | 2014-03-14 06:02:07 +0000 | [diff] [blame] | 491 | bool hasIntegratedCPP() const override { return false; } |
| 492 | bool isLinkJob() const override { return true; } |
Chris Lattner | 3e2ee14 | 2010-07-07 16:01:42 +0000 | [diff] [blame] | 493 | |
Craig Topper | b45acb8 | 2014-03-14 06:02:07 +0000 | [diff] [blame] | 494 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 495 | const InputInfo &Output, |
| 496 | const InputInfoList &Inputs, |
| 497 | const llvm::opt::ArgList &TCArgs, |
| 498 | const char *LinkingOutput) const override; |
Chris Lattner | 3e2ee14 | 2010-07-07 16:01:42 +0000 | [diff] [blame] | 499 | }; |
| 500 | } // end namespace minix |
| 501 | |
David Chisnall | f571cde | 2012-02-15 13:39:01 +0000 | [diff] [blame] | 502 | /// solaris -- Directly call Solaris assembler and linker |
| 503 | namespace solaris { |
| 504 | class LLVM_LIBRARY_VISIBILITY Assemble : public Tool { |
| 505 | public: |
| 506 | Assemble(const ToolChain &TC) : Tool("solaris::Assemble", "assembler", |
| 507 | TC) {} |
| 508 | |
Craig Topper | b45acb8 | 2014-03-14 06:02:07 +0000 | [diff] [blame] | 509 | bool hasIntegratedCPP() const override { return false; } |
David Chisnall | f571cde | 2012-02-15 13:39:01 +0000 | [diff] [blame] | 510 | |
Craig Topper | b45acb8 | 2014-03-14 06:02:07 +0000 | [diff] [blame] | 511 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 512 | const InputInfo &Output, const InputInfoList &Inputs, |
| 513 | const llvm::opt::ArgList &TCArgs, |
| 514 | const char *LinkingOutput) const override; |
David Chisnall | f571cde | 2012-02-15 13:39:01 +0000 | [diff] [blame] | 515 | }; |
| 516 | class LLVM_LIBRARY_VISIBILITY Link : public Tool { |
| 517 | public: |
| 518 | Link(const ToolChain &TC) : Tool("solaris::Link", "linker", TC) {} |
| 519 | |
Craig Topper | b45acb8 | 2014-03-14 06:02:07 +0000 | [diff] [blame] | 520 | bool hasIntegratedCPP() const override { return false; } |
| 521 | bool isLinkJob() const override { return true; } |
David Chisnall | f571cde | 2012-02-15 13:39:01 +0000 | [diff] [blame] | 522 | |
Craig Topper | b45acb8 | 2014-03-14 06:02:07 +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; |
David Chisnall | f571cde | 2012-02-15 13:39:01 +0000 | [diff] [blame] | 527 | }; |
David Chisnall | a9ed5d7 | 2012-02-15 16:25:46 +0000 | [diff] [blame] | 528 | } // end namespace solaris |
David Chisnall | f571cde | 2012-02-15 13:39:01 +0000 | [diff] [blame] | 529 | |
Edward O'Callaghan | 856e4ff | 2009-08-22 01:06:46 +0000 | [diff] [blame] | 530 | /// auroraux -- Directly call GNU Binutils assembler and linker |
| 531 | namespace auroraux { |
Duncan Sands | af260b9 | 2010-05-11 20:16:05 +0000 | [diff] [blame] | 532 | class LLVM_LIBRARY_VISIBILITY Assemble : public Tool { |
Edward O'Callaghan | 856e4ff | 2009-08-22 01:06:46 +0000 | [diff] [blame] | 533 | public: |
Daniel Dunbar | 1cb532c | 2010-05-22 00:37:18 +0000 | [diff] [blame] | 534 | Assemble(const ToolChain &TC) : Tool("auroraux::Assemble", "assembler", |
| 535 | TC) {} |
Edward O'Callaghan | 856e4ff | 2009-08-22 01:06:46 +0000 | [diff] [blame] | 536 | |
Craig Topper | b45acb8 | 2014-03-14 06:02:07 +0000 | [diff] [blame] | 537 | bool hasIntegratedCPP() const override { return false; } |
Edward O'Callaghan | 856e4ff | 2009-08-22 01:06:46 +0000 | [diff] [blame] | 538 | |
Craig Topper | b45acb8 | 2014-03-14 06:02:07 +0000 | [diff] [blame] | 539 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 540 | const InputInfo &Output, const InputInfoList &Inputs, |
| 541 | const llvm::opt::ArgList &TCArgs, |
| 542 | const char *LinkingOutput) const override; |
Edward O'Callaghan | 856e4ff | 2009-08-22 01:06:46 +0000 | [diff] [blame] | 543 | }; |
Duncan Sands | af260b9 | 2010-05-11 20:16:05 +0000 | [diff] [blame] | 544 | class LLVM_LIBRARY_VISIBILITY Link : public Tool { |
Edward O'Callaghan | 856e4ff | 2009-08-22 01:06:46 +0000 | [diff] [blame] | 545 | public: |
Daniel Dunbar | 1cb532c | 2010-05-22 00:37:18 +0000 | [diff] [blame] | 546 | Link(const ToolChain &TC) : Tool("auroraux::Link", "linker", TC) {} |
Edward O'Callaghan | 856e4ff | 2009-08-22 01:06:46 +0000 | [diff] [blame] | 547 | |
Craig Topper | b45acb8 | 2014-03-14 06:02:07 +0000 | [diff] [blame] | 548 | bool hasIntegratedCPP() const override { return false; } |
| 549 | bool isLinkJob() const override { return true; } |
Edward O'Callaghan | 856e4ff | 2009-08-22 01:06:46 +0000 | [diff] [blame] | 550 | |
Craig Topper | b45acb8 | 2014-03-14 06:02:07 +0000 | [diff] [blame] | 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; |
Edward O'Callaghan | 856e4ff | 2009-08-22 01:06:46 +0000 | [diff] [blame] | 555 | }; |
| 556 | } // end namespace auroraux |
Daniel Dunbar | 8eb473c | 2009-03-31 17:45:15 +0000 | [diff] [blame] | 557 | |
Daniel Dunbar | cc91234 | 2009-05-02 18:28:39 +0000 | [diff] [blame] | 558 | /// dragonfly -- Directly call GNU Binutils assembler and linker |
| 559 | namespace dragonfly { |
Duncan Sands | af260b9 | 2010-05-11 20:16:05 +0000 | [diff] [blame] | 560 | class LLVM_LIBRARY_VISIBILITY Assemble : public Tool { |
Daniel Dunbar | cc91234 | 2009-05-02 18:28:39 +0000 | [diff] [blame] | 561 | public: |
Daniel Dunbar | 1cb532c | 2010-05-22 00:37:18 +0000 | [diff] [blame] | 562 | Assemble(const ToolChain &TC) : Tool("dragonfly::Assemble", "assembler", |
| 563 | TC) {} |
Daniel Dunbar | cc91234 | 2009-05-02 18:28:39 +0000 | [diff] [blame] | 564 | |
Craig Topper | b45acb8 | 2014-03-14 06:02:07 +0000 | [diff] [blame] | 565 | bool hasIntegratedCPP() const override { return false; } |
Daniel Dunbar | cc91234 | 2009-05-02 18:28:39 +0000 | [diff] [blame] | 566 | |
Craig Topper | b45acb8 | 2014-03-14 06:02:07 +0000 | [diff] [blame] | 567 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 568 | const InputInfo &Output, const InputInfoList &Inputs, |
| 569 | const llvm::opt::ArgList &TCArgs, |
| 570 | const char *LinkingOutput) const override; |
Daniel Dunbar | cc91234 | 2009-05-02 18:28:39 +0000 | [diff] [blame] | 571 | }; |
Duncan Sands | af260b9 | 2010-05-11 20:16:05 +0000 | [diff] [blame] | 572 | class LLVM_LIBRARY_VISIBILITY Link : public Tool { |
Daniel Dunbar | cc91234 | 2009-05-02 18:28:39 +0000 | [diff] [blame] | 573 | public: |
Daniel Dunbar | 1cb532c | 2010-05-22 00:37:18 +0000 | [diff] [blame] | 574 | Link(const ToolChain &TC) : Tool("dragonfly::Link", "linker", TC) {} |
Daniel Dunbar | cc91234 | 2009-05-02 18:28:39 +0000 | [diff] [blame] | 575 | |
Craig Topper | b45acb8 | 2014-03-14 06:02:07 +0000 | [diff] [blame] | 576 | bool hasIntegratedCPP() const override { return false; } |
| 577 | bool isLinkJob() const override { return true; } |
Daniel Dunbar | cc91234 | 2009-05-02 18:28:39 +0000 | [diff] [blame] | 578 | |
Craig Topper | b45acb8 | 2014-03-14 06:02:07 +0000 | [diff] [blame] | 579 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 580 | const InputInfo &Output, |
| 581 | const InputInfoList &Inputs, |
| 582 | const llvm::opt::ArgList &TCArgs, |
| 583 | const char *LinkingOutput) const override; |
Daniel Dunbar | cc91234 | 2009-05-02 18:28:39 +0000 | [diff] [blame] | 584 | }; |
Edward O'Callaghan | 856e4ff | 2009-08-22 01:06:46 +0000 | [diff] [blame] | 585 | } // end namespace dragonfly |
Daniel Dunbar | cc91234 | 2009-05-02 18:28:39 +0000 | [diff] [blame] | 586 | |
Hans Wennborg | 1da044a | 2014-06-26 19:59:02 +0000 | [diff] [blame] | 587 | /// Visual studio tools. |
Michael J. Spencer | b186bc3 | 2010-08-21 21:55:07 +0000 | [diff] [blame] | 588 | namespace visualstudio { |
Hans Wennborg | 87cfa71 | 2013-09-19 20:32:16 +0000 | [diff] [blame] | 589 | class LLVM_LIBRARY_VISIBILITY Link : public Tool { |
Michael J. Spencer | b186bc3 | 2010-08-21 21:55:07 +0000 | [diff] [blame] | 590 | public: |
| 591 | Link(const ToolChain &TC) : Tool("visualstudio::Link", "linker", TC) {} |
| 592 | |
Craig Topper | b45acb8 | 2014-03-14 06:02:07 +0000 | [diff] [blame] | 593 | bool hasIntegratedCPP() const override { return false; } |
| 594 | bool isLinkJob() const override { return true; } |
Michael J. Spencer | b186bc3 | 2010-08-21 21:55:07 +0000 | [diff] [blame] | 595 | |
Craig Topper | b45acb8 | 2014-03-14 06:02:07 +0000 | [diff] [blame] | 596 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 597 | const InputInfo &Output, const InputInfoList &Inputs, |
| 598 | const llvm::opt::ArgList &TCArgs, |
| 599 | const char *LinkingOutput) const override; |
Michael J. Spencer | b186bc3 | 2010-08-21 21:55:07 +0000 | [diff] [blame] | 600 | }; |
Hans Wennborg | 87cfa71 | 2013-09-19 20:32:16 +0000 | [diff] [blame] | 601 | |
| 602 | class LLVM_LIBRARY_VISIBILITY Compile : public Tool { |
| 603 | public: |
| 604 | Compile(const ToolChain &TC) : Tool("visualstudio::Compile", "compiler", TC) {} |
| 605 | |
Craig Topper | b45acb8 | 2014-03-14 06:02:07 +0000 | [diff] [blame] | 606 | bool hasIntegratedAssembler() const override { return true; } |
| 607 | bool hasIntegratedCPP() const override { return true; } |
| 608 | bool isLinkJob() const override { return false; } |
Hans Wennborg | 87cfa71 | 2013-09-19 20:32:16 +0000 | [diff] [blame] | 609 | |
Craig Topper | b45acb8 | 2014-03-14 06:02:07 +0000 | [diff] [blame] | 610 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 611 | const InputInfo &Output, const InputInfoList &Inputs, |
| 612 | const llvm::opt::ArgList &TCArgs, |
| 613 | const char *LinkingOutput) const override; |
Hans Wennborg | 87cfa71 | 2013-09-19 20:32:16 +0000 | [diff] [blame] | 614 | |
| 615 | Command *GetCommand(Compilation &C, const JobAction &JA, |
| 616 | const InputInfo &Output, |
| 617 | const InputInfoList &Inputs, |
| 618 | const llvm::opt::ArgList &TCArgs, |
| 619 | const char *LinkingOutput) const; |
| 620 | }; |
Michael J. Spencer | b186bc3 | 2010-08-21 21:55:07 +0000 | [diff] [blame] | 621 | } // end namespace visualstudio |
| 622 | |
Tim Northover | 9c7e035 | 2013-12-12 11:55:52 +0000 | [diff] [blame] | 623 | namespace arm { |
| 624 | StringRef getARMFloatABI(const Driver &D, const llvm::opt::ArgList &Args, |
| 625 | const llvm::Triple &Triple); |
| 626 | } |
Robert Lytton | cf1dd69 | 2013-10-11 10:29:40 +0000 | [diff] [blame] | 627 | namespace XCore { |
| 628 | // For XCore, we do not need to instantiate tools for PreProcess, PreCompile and Compile. |
| 629 | // We simply use "clang -cc1" for those actions. |
| 630 | class LLVM_LIBRARY_VISIBILITY Assemble : public Tool { |
| 631 | public: |
| 632 | Assemble(const ToolChain &TC) : Tool("XCore::Assemble", |
| 633 | "XCore-as", TC) {} |
| 634 | |
Craig Topper | b45acb8 | 2014-03-14 06:02:07 +0000 | [diff] [blame] | 635 | bool hasIntegratedCPP() const override { return false; } |
| 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; |
Robert Lytton | cf1dd69 | 2013-10-11 10:29:40 +0000 | [diff] [blame] | 640 | }; |
| 641 | |
| 642 | class LLVM_LIBRARY_VISIBILITY Link : public Tool { |
| 643 | public: |
| 644 | Link(const ToolChain &TC) : Tool("XCore::Link", |
| 645 | "XCore-ld", TC) {} |
| 646 | |
Craig Topper | b45acb8 | 2014-03-14 06:02:07 +0000 | [diff] [blame] | 647 | bool hasIntegratedCPP() const override { return false; } |
| 648 | bool isLinkJob() const override { return true; } |
| 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; |
Robert Lytton | cf1dd69 | 2013-10-11 10:29:40 +0000 | [diff] [blame] | 653 | }; |
| 654 | } // end namespace XCore. |
| 655 | |
| 656 | |
Daniel Dunbar | 5903d8c | 2009-03-17 22:07:58 +0000 | [diff] [blame] | 657 | } // end namespace toolchains |
| 658 | } // end namespace driver |
| 659 | } // end namespace clang |
| 660 | |
Edward O'Callaghan | 856e4ff | 2009-08-22 01:06:46 +0000 | [diff] [blame] | 661 | #endif // CLANG_LIB_DRIVER_TOOLS_H_ |