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