2009-03-18 05:38:00 +08:00
|
|
|
//===--- ToolChains.h - ToolChain Implementations ---------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef CLANG_LIB_DRIVER_TOOLCHAINS_H_
|
|
|
|
#define CLANG_LIB_DRIVER_TOOLCHAINS_H_
|
|
|
|
|
2009-03-18 06:07:31 +08:00
|
|
|
#include "clang/Driver/Action.h"
|
2009-03-18 05:38:00 +08:00
|
|
|
#include "clang/Driver/ToolChain.h"
|
|
|
|
|
2009-03-18 06:07:31 +08:00
|
|
|
#include "llvm/ADT/DenseMap.h"
|
2009-03-18 05:38:00 +08:00
|
|
|
#include "llvm/Support/Compiler.h"
|
|
|
|
|
2009-03-18 06:07:31 +08:00
|
|
|
#include "Tools.h"
|
|
|
|
|
2009-03-18 05:38:00 +08:00
|
|
|
namespace clang {
|
|
|
|
namespace driver {
|
2009-03-18 06:18:43 +08:00
|
|
|
namespace toolchains {
|
2009-03-18 05:38:00 +08:00
|
|
|
|
2009-03-18 06:07:31 +08:00
|
|
|
/// Generic_GCC - A tool chain using the 'gcc' command to perform
|
|
|
|
/// all subcommands; this relies on gcc translating the majority of
|
|
|
|
/// command line options.
|
2009-03-18 06:18:43 +08:00
|
|
|
class VISIBILITY_HIDDEN Generic_GCC : public ToolChain {
|
2009-03-31 05:06:03 +08:00
|
|
|
protected:
|
2009-03-18 06:07:31 +08:00
|
|
|
mutable llvm::DenseMap<unsigned, Tool*> Tools;
|
|
|
|
|
2009-03-18 05:38:00 +08:00
|
|
|
public:
|
2009-05-22 10:53:45 +08:00
|
|
|
Generic_GCC(const HostInfo &Host, const llvm::Triple& Triple);
|
2009-03-20 08:20:03 +08:00
|
|
|
~Generic_GCC();
|
2009-03-18 05:38:00 +08:00
|
|
|
|
2009-09-10 02:36:12 +08:00
|
|
|
virtual DerivedArgList *TranslateArgs(InputArgList &Args,
|
|
|
|
const char *BoundArch) const;
|
2009-03-18 05:38:00 +08:00
|
|
|
|
2009-03-20 08:20:03 +08:00
|
|
|
virtual Tool &SelectTool(const Compilation &C, const JobAction &JA) const;
|
2009-03-18 06:07:31 +08:00
|
|
|
|
2009-03-20 08:20:03 +08:00
|
|
|
virtual bool IsMathErrnoDefault() const;
|
|
|
|
virtual bool IsUnwindTablesDefault() const;
|
|
|
|
virtual const char *GetDefaultRelocationModel() const;
|
|
|
|
virtual const char *GetForcedPicModel() const;
|
2009-03-18 05:38:00 +08:00
|
|
|
};
|
|
|
|
|
2009-09-05 02:34:51 +08:00
|
|
|
/// Darwin - Darwin tool chain.
|
|
|
|
class VISIBILITY_HIDDEN Darwin : public ToolChain {
|
2009-03-20 08:57:52 +08:00
|
|
|
mutable llvm::DenseMap<unsigned, Tool*> Tools;
|
|
|
|
|
2009-03-24 00:15:50 +08:00
|
|
|
/// Darwin version of tool chain.
|
|
|
|
unsigned DarwinVersion[3];
|
|
|
|
|
|
|
|
/// GCC version to use.
|
|
|
|
unsigned GCCVersion[3];
|
|
|
|
|
2009-09-05 02:35:21 +08:00
|
|
|
/// Whether this is this an iPhone toolchain.
|
|
|
|
bool IsIPhone;
|
|
|
|
|
2009-03-24 00:15:50 +08:00
|
|
|
/// The directory suffix for this tool chain.
|
|
|
|
std::string ToolChainDir;
|
|
|
|
|
2009-03-27 00:23:12 +08:00
|
|
|
/// The default macosx-version-min of this tool chain; empty until
|
|
|
|
/// initialized.
|
|
|
|
mutable std::string MacosxVersionMin;
|
|
|
|
|
2009-09-05 02:35:21 +08:00
|
|
|
/// The default iphoneos-version-min of this tool chain.
|
|
|
|
std::string IPhoneOSVersionMin;
|
|
|
|
|
2009-03-27 00:23:12 +08:00
|
|
|
const char *getMacosxVersionMin() const;
|
2009-03-25 14:58:31 +08:00
|
|
|
|
2009-03-20 08:57:52 +08:00
|
|
|
public:
|
2009-09-09 23:08:12 +08:00
|
|
|
Darwin(const HostInfo &Host, const llvm::Triple& Triple,
|
2009-09-05 02:35:21 +08:00
|
|
|
const unsigned (&DarwinVersion)[3],
|
|
|
|
const unsigned (&GCCVersion)[3],
|
|
|
|
bool IsIPhone);
|
2009-09-05 02:34:51 +08:00
|
|
|
~Darwin();
|
2009-03-20 08:57:52 +08:00
|
|
|
|
2009-09-18 16:14:36 +08:00
|
|
|
/// @name Darwin Specific Toolchain API
|
|
|
|
/// {
|
|
|
|
|
2009-03-27 00:23:12 +08:00
|
|
|
void getDarwinVersion(unsigned (&Res)[3]) const {
|
|
|
|
Res[0] = DarwinVersion[0];
|
|
|
|
Res[1] = DarwinVersion[1];
|
|
|
|
Res[2] = DarwinVersion[2];
|
|
|
|
}
|
|
|
|
|
|
|
|
void getMacosxVersion(unsigned (&Res)[3]) const {
|
|
|
|
Res[0] = 10;
|
|
|
|
Res[1] = DarwinVersion[0] - 4;
|
|
|
|
Res[2] = DarwinVersion[1];
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *getMacosxVersionStr() const {
|
|
|
|
return MacosxVersionMin.c_str();
|
|
|
|
}
|
|
|
|
|
2009-09-05 02:35:21 +08:00
|
|
|
const char *getIPhoneOSVersionStr() const {
|
|
|
|
return IPhoneOSVersionMin.c_str();
|
|
|
|
}
|
|
|
|
|
2009-09-18 16:14:36 +08:00
|
|
|
/// AddLinkSearchPathArgs - Add the linker search paths to \arg CmdArgs.
|
|
|
|
///
|
|
|
|
/// \param Args - The input argument list.
|
|
|
|
/// \param CmdArgs [out] - The command argument list to append the paths
|
|
|
|
/// (prefixed by -L) to.
|
|
|
|
void AddLinkSearchPathArgs(const ArgList &Args, ArgStringList &CmdArgs) const;
|
2009-03-27 00:23:12 +08:00
|
|
|
|
2009-09-05 02:35:21 +08:00
|
|
|
bool isIPhone() const { return IsIPhone; }
|
|
|
|
|
2009-09-18 16:14:36 +08:00
|
|
|
/// }
|
|
|
|
/// @name ToolChain Implementation
|
|
|
|
/// {
|
|
|
|
|
2009-09-10 02:36:12 +08:00
|
|
|
virtual DerivedArgList *TranslateArgs(InputArgList &Args,
|
|
|
|
const char *BoundArch) const;
|
2009-03-20 08:57:52 +08:00
|
|
|
|
|
|
|
virtual Tool &SelectTool(const Compilation &C, const JobAction &JA) const;
|
|
|
|
|
|
|
|
virtual bool IsMathErrnoDefault() const;
|
|
|
|
virtual bool IsUnwindTablesDefault() const;
|
|
|
|
virtual const char *GetDefaultRelocationModel() const;
|
|
|
|
virtual const char *GetForcedPicModel() const;
|
2009-09-18 16:14:36 +08:00
|
|
|
|
|
|
|
/// }
|
2009-03-20 08:57:52 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/// Darwin_GCC - Generic Darwin tool chain using gcc.
|
|
|
|
class VISIBILITY_HIDDEN Darwin_GCC : public Generic_GCC {
|
|
|
|
public:
|
2009-09-09 23:08:12 +08:00
|
|
|
Darwin_GCC(const HostInfo &Host, const llvm::Triple& Triple)
|
2009-05-22 10:53:45 +08:00
|
|
|
: Generic_GCC(Host, Triple) {}
|
2009-03-20 08:57:52 +08:00
|
|
|
|
|
|
|
virtual const char *GetDefaultRelocationModel() const { return "pic"; }
|
|
|
|
};
|
|
|
|
|
2009-08-22 09:06:46 +08:00
|
|
|
class VISIBILITY_HIDDEN AuroraUX : public Generic_GCC {
|
|
|
|
public:
|
|
|
|
AuroraUX(const HostInfo &Host, const llvm::Triple& Triple);
|
|
|
|
|
|
|
|
virtual Tool &SelectTool(const Compilation &C, const JobAction &JA) const;
|
|
|
|
};
|
|
|
|
|
2009-06-30 04:52:51 +08:00
|
|
|
class VISIBILITY_HIDDEN OpenBSD : public Generic_GCC {
|
|
|
|
public:
|
|
|
|
OpenBSD(const HostInfo &Host, const llvm::Triple& Triple);
|
|
|
|
|
|
|
|
virtual Tool &SelectTool(const Compilation &C, const JobAction &JA) const;
|
|
|
|
};
|
|
|
|
|
2009-03-31 05:06:03 +08:00
|
|
|
class VISIBILITY_HIDDEN FreeBSD : public Generic_GCC {
|
|
|
|
public:
|
2009-05-22 10:53:45 +08:00
|
|
|
FreeBSD(const HostInfo &Host, const llvm::Triple& Triple, bool Lib32);
|
2009-03-31 05:06:03 +08:00
|
|
|
|
|
|
|
virtual Tool &SelectTool(const Compilation &C, const JobAction &JA) const;
|
|
|
|
};
|
|
|
|
|
2009-05-03 02:28:39 +08:00
|
|
|
class VISIBILITY_HIDDEN DragonFly : public Generic_GCC {
|
|
|
|
public:
|
2009-05-22 10:53:45 +08:00
|
|
|
DragonFly(const HostInfo &Host, const llvm::Triple& Triple);
|
2009-05-03 02:28:39 +08:00
|
|
|
|
|
|
|
virtual Tool &SelectTool(const Compilation &C, const JobAction &JA) const;
|
|
|
|
};
|
|
|
|
|
2009-05-26 15:52:18 +08:00
|
|
|
class VISIBILITY_HIDDEN Linux : public Generic_GCC {
|
|
|
|
public:
|
|
|
|
Linux(const HostInfo &Host, const llvm::Triple& Triple);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2009-03-18 05:38:00 +08:00
|
|
|
} // end namespace toolchains
|
|
|
|
} // end namespace driver
|
|
|
|
} // end namespace clang
|
|
|
|
|
|
|
|
#endif
|