[Driver] Consolidate tools and toolchains by target platform. (NFC)
Summary:
(This is a move-only refactoring patch. There are no functionality changes.)
This patch splits apart the Clang driver's tool and toolchain implementation
files. Each target platform toolchain is moved to its own file, along with the
closest-related tools. Each target platform toolchain has separate headers and
implementation files, so the hierarchy of classes is unchanged.
There are some remaining shared free functions, mostly from Tools.cpp. Several
of these move to their own architecture-specific files, similar to r296056. Some
of them are only used by a single target platform; since the tools and
toolchains are now together, some helpers now live in a platform-specific file.
The balance are helpers related to manipulating argument lists, so they are now
in a new file pair, CommonArgs.h and .cpp.
I've tried to cluster the code logically, which is fairly straightforward for
most of the target platforms and shared architectures. I think I've made
reasonable choices for these, as well as the various shared helpers; but of
course, I'm happy to hear feedback in the review.
There are some particular things I don't like about this patch, but haven't been
able to find a better overall solution. The first is the proliferation of files:
there are several files that are tiny because the toolchain is not very
different from its base (usually the Gnu tools/toolchain). I think this is
mostly a reflection of the true complexity, though, so it may not be "fixable"
in any reasonable sense. The second thing I don't like are the includes like
"../Something.h". I've avoided this largely by clustering into the current file
structure. However, a few of these includes remain, and in those cases it
doesn't make sense to me to sink an existing file any deeper.
Reviewers: rsmith, mehdi_amini, compnerd, rnk, javed.absar
Subscribers: emaste, jfb, danalbert, srhines, dschuff, jyknight, nemanjai, nhaehnle, mgorny, cfe-commits
Differential Revision: https://reviews.llvm.org/D30372
llvm-svn: 297250
2017-03-08 09:02:16 +08:00
|
|
|
//===--- WebAssembly.h - WebAssembly 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 LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_WEBASSEMBLY_H
|
|
|
|
#define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_WEBASSEMBLY_H
|
|
|
|
|
|
|
|
#include "Gnu.h"
|
|
|
|
#include "clang/Driver/Tool.h"
|
|
|
|
#include "clang/Driver/ToolChain.h"
|
|
|
|
|
|
|
|
namespace clang {
|
|
|
|
namespace driver {
|
|
|
|
namespace tools {
|
|
|
|
namespace wasm {
|
|
|
|
|
|
|
|
class LLVM_LIBRARY_VISIBILITY Linker : public GnuTool {
|
|
|
|
public:
|
|
|
|
explicit Linker(const ToolChain &TC);
|
|
|
|
bool isLinkJob() const override;
|
|
|
|
bool hasIntegratedCPP() const override;
|
|
|
|
void ConstructJob(Compilation &C, const JobAction &JA,
|
|
|
|
const InputInfo &Output, const InputInfoList &Inputs,
|
|
|
|
const llvm::opt::ArgList &TCArgs,
|
|
|
|
const char *LinkingOutput) const override;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // end namespace wasm
|
|
|
|
} // end namespace tools
|
|
|
|
|
|
|
|
namespace toolchains {
|
|
|
|
|
|
|
|
class LLVM_LIBRARY_VISIBILITY WebAssembly final : public ToolChain {
|
|
|
|
public:
|
|
|
|
WebAssembly(const Driver &D, const llvm::Triple &Triple,
|
|
|
|
const llvm::opt::ArgList &Args);
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool IsMathErrnoDefault() const override;
|
|
|
|
bool IsObjCNonFragileABIDefault() const override;
|
|
|
|
bool UseObjCMixedDispatch() const override;
|
|
|
|
bool isPICDefault() const override;
|
|
|
|
bool isPIEDefault() const override;
|
|
|
|
bool isPICDefaultForced() const override;
|
|
|
|
bool IsIntegratedAssemblerDefault() const override;
|
|
|
|
bool hasBlocksRuntime() const override;
|
|
|
|
bool SupportsProfiling() const override;
|
|
|
|
bool HasNativeLLVMSupport() const override;
|
|
|
|
void addClangTargetOptions(const llvm::opt::ArgList &DriverArgs,
|
[OpenMP] Extend CLANG target options with device offloading kind.
Summary: Pass the type of the device offloading when building the tool chain for a particular target architecture. This is required when supporting multiple tool chains that target a single device type. In our particular use case, the OpenMP and CUDA tool chains will use the same ```addClangTargetOptions ``` method. This enables the reuse of common options and ensures control over options only supported by a particular tool chain.
Reviewers: arpith-jacob, caomhin, carlo.bertolli, ABataev, jlebar, hfinkel, tstellar, Hahnfeld
Reviewed By: hfinkel
Subscribers: jgravelle-google, aheejin, rengolin, jfb, dschuff, sbc100, cfe-commits
Differential Revision: https://reviews.llvm.org/D29647
llvm-svn: 307272
2017-07-07 00:22:21 +08:00
|
|
|
llvm::opt::ArgStringList &CC1Args,
|
|
|
|
Action::OffloadKind DeviceOffloadKind) const override;
|
[Driver] Consolidate tools and toolchains by target platform. (NFC)
Summary:
(This is a move-only refactoring patch. There are no functionality changes.)
This patch splits apart the Clang driver's tool and toolchain implementation
files. Each target platform toolchain is moved to its own file, along with the
closest-related tools. Each target platform toolchain has separate headers and
implementation files, so the hierarchy of classes is unchanged.
There are some remaining shared free functions, mostly from Tools.cpp. Several
of these move to their own architecture-specific files, similar to r296056. Some
of them are only used by a single target platform; since the tools and
toolchains are now together, some helpers now live in a platform-specific file.
The balance are helpers related to manipulating argument lists, so they are now
in a new file pair, CommonArgs.h and .cpp.
I've tried to cluster the code logically, which is fairly straightforward for
most of the target platforms and shared architectures. I think I've made
reasonable choices for these, as well as the various shared helpers; but of
course, I'm happy to hear feedback in the review.
There are some particular things I don't like about this patch, but haven't been
able to find a better overall solution. The first is the proliferation of files:
there are several files that are tiny because the toolchain is not very
different from its base (usually the Gnu tools/toolchain). I think this is
mostly a reflection of the true complexity, though, so it may not be "fixable"
in any reasonable sense. The second thing I don't like are the includes like
"../Something.h". I've avoided this largely by clustering into the current file
structure. However, a few of these includes remain, and in those cases it
doesn't make sense to me to sink an existing file any deeper.
Reviewers: rsmith, mehdi_amini, compnerd, rnk, javed.absar
Subscribers: emaste, jfb, danalbert, srhines, dschuff, jyknight, nemanjai, nhaehnle, mgorny, cfe-commits
Differential Revision: https://reviews.llvm.org/D30372
llvm-svn: 297250
2017-03-08 09:02:16 +08:00
|
|
|
RuntimeLibType GetDefaultRuntimeLibType() const override;
|
|
|
|
CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const override;
|
|
|
|
void AddClangSystemIncludeArgs(
|
|
|
|
const llvm::opt::ArgList &DriverArgs,
|
|
|
|
llvm::opt::ArgStringList &CC1Args) const override;
|
|
|
|
void AddClangCXXStdlibIncludeArgs(
|
|
|
|
const llvm::opt::ArgList &DriverArgs,
|
|
|
|
llvm::opt::ArgStringList &CC1Args) const override;
|
2018-01-13 01:54:49 +08:00
|
|
|
void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args,
|
|
|
|
llvm::opt::ArgStringList &CmdArgs) const override;
|
2017-11-28 05:39:16 +08:00
|
|
|
std::string getThreadModel() const override;
|
[Driver] Consolidate tools and toolchains by target platform. (NFC)
Summary:
(This is a move-only refactoring patch. There are no functionality changes.)
This patch splits apart the Clang driver's tool and toolchain implementation
files. Each target platform toolchain is moved to its own file, along with the
closest-related tools. Each target platform toolchain has separate headers and
implementation files, so the hierarchy of classes is unchanged.
There are some remaining shared free functions, mostly from Tools.cpp. Several
of these move to their own architecture-specific files, similar to r296056. Some
of them are only used by a single target platform; since the tools and
toolchains are now together, some helpers now live in a platform-specific file.
The balance are helpers related to manipulating argument lists, so they are now
in a new file pair, CommonArgs.h and .cpp.
I've tried to cluster the code logically, which is fairly straightforward for
most of the target platforms and shared architectures. I think I've made
reasonable choices for these, as well as the various shared helpers; but of
course, I'm happy to hear feedback in the review.
There are some particular things I don't like about this patch, but haven't been
able to find a better overall solution. The first is the proliferation of files:
there are several files that are tiny because the toolchain is not very
different from its base (usually the Gnu tools/toolchain). I think this is
mostly a reflection of the true complexity, though, so it may not be "fixable"
in any reasonable sense. The second thing I don't like are the includes like
"../Something.h". I've avoided this largely by clustering into the current file
structure. However, a few of these includes remain, and in those cases it
doesn't make sense to me to sink an existing file any deeper.
Reviewers: rsmith, mehdi_amini, compnerd, rnk, javed.absar
Subscribers: emaste, jfb, danalbert, srhines, dschuff, jyknight, nemanjai, nhaehnle, mgorny, cfe-commits
Differential Revision: https://reviews.llvm.org/D30372
llvm-svn: 297250
2017-03-08 09:02:16 +08:00
|
|
|
|
|
|
|
const char *getDefaultLinker() const override {
|
|
|
|
return "lld";
|
|
|
|
}
|
|
|
|
|
|
|
|
Tool *buildLinker() const override;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // end namespace toolchains
|
|
|
|
} // end namespace driver
|
|
|
|
} // end namespace clang
|
|
|
|
|
|
|
|
#endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_WEBASSEMBLY_H
|