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-18 06:07:31 +08:00
|
|
|
mutable llvm::DenseMap<unsigned, Tool*> Tools;
|
|
|
|
|
2009-03-18 05:38:00 +08:00
|
|
|
public:
|
|
|
|
Generic_GCC(const HostInfo &Host, const char *Arch, const char *Platform,
|
2009-03-24 00:15:50 +08:00
|
|
|
const char *OS);
|
2009-03-20 08:20:03 +08:00
|
|
|
~Generic_GCC();
|
2009-03-18 05:38:00 +08:00
|
|
|
|
|
|
|
virtual ArgList *TranslateArgs(ArgList &Args) const { return &Args; }
|
|
|
|
|
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-03-20 08:57:52 +08:00
|
|
|
/// Darwin_X86 - Darwin tool chain for i386 an x86_64.
|
|
|
|
class VISIBILITY_HIDDEN Darwin_X86 : public ToolChain {
|
|
|
|
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];
|
|
|
|
|
|
|
|
/// The directory suffix for this tool chain.
|
|
|
|
std::string ToolChainDir;
|
|
|
|
|
2009-03-20 08:57:52 +08:00
|
|
|
public:
|
|
|
|
Darwin_X86(const HostInfo &Host, const char *Arch, const char *Platform,
|
2009-03-24 00:15:50 +08:00
|
|
|
const char *OS, const unsigned (&DarwinVersion)[3],
|
|
|
|
const unsigned (&GCCVersion)[3]);
|
2009-03-20 08:57:52 +08:00
|
|
|
~Darwin_X86();
|
|
|
|
|
|
|
|
virtual ArgList *TranslateArgs(ArgList &Args) const;
|
|
|
|
|
|
|
|
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-03-24 00:15:50 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
const std::string &getToolChainDir() const { return ToolChainDir; }
|
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:
|
|
|
|
Darwin_GCC(const HostInfo &Host, const char *Arch, const char *Platform,
|
|
|
|
const char *OS) : Generic_GCC(Host, Arch, Platform, OS) {}
|
|
|
|
|
|
|
|
virtual const char *GetDefaultRelocationModel() const { return "pic"; }
|
|
|
|
};
|
|
|
|
|
2009-03-18 05:38:00 +08:00
|
|
|
} // end namespace toolchains
|
|
|
|
} // end namespace driver
|
|
|
|
} // end namespace clang
|
|
|
|
|
|
|
|
#endif
|