| David L. Jones | f561aba | 2017-03-08 01:02:16 +0000 | [diff] [blame] | 1 | //===--- WebAssembly.h - WebAssembly ToolChain Implementations --*- C++ -*-===// |
| 2 | // |
| Chandler Carruth | 2946cd7 | 2019-01-19 08:50:56 +0000 | [diff] [blame] | 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| David L. Jones | f561aba | 2017-03-08 01:02:16 +0000 | [diff] [blame] | 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #ifndef LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_WEBASSEMBLY_H |
| 10 | #define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_WEBASSEMBLY_H |
| 11 | |
| 12 | #include "Gnu.h" |
| 13 | #include "clang/Driver/Tool.h" |
| 14 | #include "clang/Driver/ToolChain.h" |
| 15 | |
| 16 | namespace clang { |
| 17 | namespace driver { |
| 18 | namespace tools { |
| 19 | namespace wasm { |
| 20 | |
| 21 | class LLVM_LIBRARY_VISIBILITY Linker : public GnuTool { |
| 22 | public: |
| Sam Clegg | cebce0d | 2019-05-24 17:36:07 +0000 | [diff] [blame] | 23 | explicit Linker(const ToolChain &TC) |
| 24 | : GnuTool("wasm::Linker", "linker", TC) {} |
| 25 | bool isLinkJob() const override { return true; } |
| 26 | bool hasIntegratedCPP() const override { return false; } |
| Sam Clegg | fc5ddee | 2019-03-28 17:45:18 +0000 | [diff] [blame] | 27 | std::string getLinkerPath(const llvm::opt::ArgList &Args) const; |
| David L. Jones | f561aba | 2017-03-08 01:02:16 +0000 | [diff] [blame] | 28 | void ConstructJob(Compilation &C, const JobAction &JA, |
| 29 | const InputInfo &Output, const InputInfoList &Inputs, |
| 30 | const llvm::opt::ArgList &TCArgs, |
| 31 | const char *LinkingOutput) const override; |
| 32 | }; |
| 33 | |
| 34 | } // end namespace wasm |
| 35 | } // end namespace tools |
| 36 | |
| 37 | namespace toolchains { |
| 38 | |
| 39 | class LLVM_LIBRARY_VISIBILITY WebAssembly final : public ToolChain { |
| 40 | public: |
| 41 | WebAssembly(const Driver &D, const llvm::Triple &Triple, |
| 42 | const llvm::opt::ArgList &Args); |
| 43 | |
| 44 | private: |
| 45 | bool IsMathErrnoDefault() const override; |
| 46 | bool IsObjCNonFragileABIDefault() const override; |
| 47 | bool UseObjCMixedDispatch() const override; |
| 48 | bool isPICDefault() const override; |
| 49 | bool isPIEDefault() const override; |
| 50 | bool isPICDefaultForced() const override; |
| 51 | bool IsIntegratedAssemblerDefault() const override; |
| 52 | bool hasBlocksRuntime() const override; |
| David L. Jones | f561aba | 2017-03-08 01:02:16 +0000 | [diff] [blame] | 53 | bool SupportsProfiling() const override; |
| 54 | bool HasNativeLLVMSupport() const override; |
| Heejin Ahn | 4fa8dd9 | 2018-08-31 20:57:00 +0000 | [diff] [blame] | 55 | void |
| 56 | addClangTargetOptions(const llvm::opt::ArgList &DriverArgs, |
| 57 | llvm::opt::ArgStringList &CC1Args, |
| 58 | Action::OffloadKind DeviceOffloadKind) const override; |
| David L. Jones | f561aba | 2017-03-08 01:02:16 +0000 | [diff] [blame] | 59 | RuntimeLibType GetDefaultRuntimeLibType() const override; |
| 60 | CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const override; |
| Heejin Ahn | 4fa8dd9 | 2018-08-31 20:57:00 +0000 | [diff] [blame] | 61 | void |
| 62 | AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs, |
| 63 | llvm::opt::ArgStringList &CC1Args) const override; |
| David L. Jones | f561aba | 2017-03-08 01:02:16 +0000 | [diff] [blame] | 64 | void AddClangCXXStdlibIncludeArgs( |
| 65 | const llvm::opt::ArgList &DriverArgs, |
| 66 | llvm::opt::ArgStringList &CC1Args) const override; |
| Sam Clegg | ffbfc0f | 2018-01-12 17:54:49 +0000 | [diff] [blame] | 67 | void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args, |
| 68 | llvm::opt::ArgStringList &CmdArgs) const override; |
| Thomas Lively | 5458cd4 | 2019-05-29 18:31:50 +0000 | [diff] [blame] | 69 | SanitizerMask getSupportedSanitizers() const override; |
| David L. Jones | f561aba | 2017-03-08 01:02:16 +0000 | [diff] [blame] | 70 | |
| Sam Clegg | 98dbbfd | 2018-08-07 18:55:41 +0000 | [diff] [blame] | 71 | const char *getDefaultLinker() const override { return "wasm-ld"; } |
| David L. Jones | f561aba | 2017-03-08 01:02:16 +0000 | [diff] [blame] | 72 | |
| 73 | Tool *buildLinker() const override; |
| 74 | }; |
| 75 | |
| 76 | } // end namespace toolchains |
| 77 | } // end namespace driver |
| 78 | } // end namespace clang |
| 79 | |
| 80 | #endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_WEBASSEMBLY_H |