Daniel Dunbar | 83b08eb | 2009-03-17 21:38:00 +0000 | [diff] [blame] | 1 | //===--- ToolChains.h - ToolChain 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_TOOLCHAINS_H_ |
| 11 | #define CLANG_LIB_DRIVER_TOOLCHAINS_H_ |
| 12 | |
Daniel Dunbar | 670b7f4 | 2009-03-17 22:07:31 +0000 | [diff] [blame] | 13 | #include "clang/Driver/Action.h" |
Daniel Dunbar | 83b08eb | 2009-03-17 21:38:00 +0000 | [diff] [blame] | 14 | #include "clang/Driver/ToolChain.h" |
| 15 | |
Daniel Dunbar | 670b7f4 | 2009-03-17 22:07:31 +0000 | [diff] [blame] | 16 | #include "llvm/ADT/DenseMap.h" |
Daniel Dunbar | 83b08eb | 2009-03-17 21:38:00 +0000 | [diff] [blame] | 17 | #include "llvm/Support/Compiler.h" |
| 18 | |
Daniel Dunbar | 670b7f4 | 2009-03-17 22:07:31 +0000 | [diff] [blame] | 19 | #include "Tools.h" |
| 20 | |
Daniel Dunbar | 83b08eb | 2009-03-17 21:38:00 +0000 | [diff] [blame] | 21 | namespace clang { |
| 22 | namespace driver { |
Daniel Dunbar | 985b825 | 2009-03-17 22:18:43 +0000 | [diff] [blame] | 23 | namespace toolchains { |
Daniel Dunbar | 83b08eb | 2009-03-17 21:38:00 +0000 | [diff] [blame] | 24 | |
Daniel Dunbar | 670b7f4 | 2009-03-17 22:07:31 +0000 | [diff] [blame] | 25 | /// Generic_GCC - A tool chain using the 'gcc' command to perform |
| 26 | /// all subcommands; this relies on gcc translating the majority of |
| 27 | /// command line options. |
Daniel Dunbar | 985b825 | 2009-03-17 22:18:43 +0000 | [diff] [blame] | 28 | class VISIBILITY_HIDDEN Generic_GCC : public ToolChain { |
Daniel Dunbar | 670b7f4 | 2009-03-17 22:07:31 +0000 | [diff] [blame] | 29 | mutable llvm::DenseMap<unsigned, Tool*> Tools; |
| 30 | |
Daniel Dunbar | 83b08eb | 2009-03-17 21:38:00 +0000 | [diff] [blame] | 31 | public: |
| 32 | Generic_GCC(const HostInfo &Host, const char *Arch, const char *Platform, |
Daniel Dunbar | 670b7f4 | 2009-03-17 22:07:31 +0000 | [diff] [blame] | 33 | const char *OS) : ToolChain(Host, Arch, Platform, OS) {} |
Daniel Dunbar | 3917608 | 2009-03-20 00:20:03 +0000 | [diff] [blame] | 34 | ~Generic_GCC(); |
Daniel Dunbar | 83b08eb | 2009-03-17 21:38:00 +0000 | [diff] [blame] | 35 | |
| 36 | virtual ArgList *TranslateArgs(ArgList &Args) const { return &Args; } |
| 37 | |
Daniel Dunbar | 3917608 | 2009-03-20 00:20:03 +0000 | [diff] [blame] | 38 | virtual Tool &SelectTool(const Compilation &C, const JobAction &JA) const; |
Daniel Dunbar | 670b7f4 | 2009-03-17 22:07:31 +0000 | [diff] [blame] | 39 | |
Daniel Dunbar | 3917608 | 2009-03-20 00:20:03 +0000 | [diff] [blame] | 40 | virtual bool IsMathErrnoDefault() const; |
| 41 | virtual bool IsUnwindTablesDefault() const; |
| 42 | virtual const char *GetDefaultRelocationModel() const; |
| 43 | virtual const char *GetForcedPicModel() const; |
Daniel Dunbar | 83b08eb | 2009-03-17 21:38:00 +0000 | [diff] [blame] | 44 | }; |
| 45 | |
Daniel Dunbar | 8eddb3f | 2009-03-20 00:57:52 +0000 | [diff] [blame] | 46 | /// Darwin_X86 - Darwin tool chain for i386 an x86_64. |
| 47 | class VISIBILITY_HIDDEN Darwin_X86 : public ToolChain { |
| 48 | mutable llvm::DenseMap<unsigned, Tool*> Tools; |
| 49 | |
| 50 | public: |
| 51 | Darwin_X86(const HostInfo &Host, const char *Arch, const char *Platform, |
| 52 | const char *OS) : ToolChain(Host, Arch, Platform, OS) {} |
| 53 | ~Darwin_X86(); |
| 54 | |
| 55 | virtual ArgList *TranslateArgs(ArgList &Args) const; |
| 56 | |
| 57 | virtual Tool &SelectTool(const Compilation &C, const JobAction &JA) const; |
| 58 | |
| 59 | virtual bool IsMathErrnoDefault() const; |
| 60 | virtual bool IsUnwindTablesDefault() const; |
| 61 | virtual const char *GetDefaultRelocationModel() const; |
| 62 | virtual const char *GetForcedPicModel() const; |
| 63 | }; |
| 64 | |
| 65 | /// Darwin_GCC - Generic Darwin tool chain using gcc. |
| 66 | class VISIBILITY_HIDDEN Darwin_GCC : public Generic_GCC { |
| 67 | public: |
| 68 | Darwin_GCC(const HostInfo &Host, const char *Arch, const char *Platform, |
| 69 | const char *OS) : Generic_GCC(Host, Arch, Platform, OS) {} |
| 70 | |
| 71 | virtual const char *GetDefaultRelocationModel() const { return "pic"; } |
| 72 | }; |
| 73 | |
Daniel Dunbar | 83b08eb | 2009-03-17 21:38:00 +0000 | [diff] [blame] | 74 | } // end namespace toolchains |
| 75 | } // end namespace driver |
| 76 | } // end namespace clang |
| 77 | |
| 78 | #endif |