11539Srgrimes//===--- WebAssembly.h - WebAssembly ToolChain Implementations --*- C++ -*-===//
21539Srgrimes//
31539Srgrimes// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
41539Srgrimes// See https://llvm.org/LICENSE.txt for license information.
51539Srgrimes// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
61539Srgrimes//
71539Srgrimes//===----------------------------------------------------------------------===//
81539Srgrimes
91539Srgrimes#ifndef LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_WEBASSEMBLY_H
101539Srgrimes#define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_WEBASSEMBLY_H
111539Srgrimes
121539Srgrimes#include "Gnu.h"
131539Srgrimes#include "clang/Driver/Tool.h"
141539Srgrimes#include "clang/Driver/ToolChain.h"
151539Srgrimes
161539Srgrimesnamespace clang {
171539Srgrimesnamespace driver {
181539Srgrimesnamespace tools {
191539Srgrimesnamespace wasm {
201539Srgrimes
211539Srgrimesclass LLVM_LIBRARY_VISIBILITY Linker final : public Tool {
221539Srgrimespublic:
231539Srgrimes  explicit Linker(const ToolChain &TC) : Tool("wasm::Linker", "linker", TC) {}
241539Srgrimes  bool isLinkJob() const override { return true; }
251539Srgrimes  bool hasIntegratedCPP() const override { return false; }
261539Srgrimes  std::string getLinkerPath(const llvm::opt::ArgList &Args) const;
271539Srgrimes  void ConstructJob(Compilation &C, const JobAction &JA,
281539Srgrimes                    const InputInfo &Output, const InputInfoList &Inputs,
291539Srgrimes                    const llvm::opt::ArgList &TCArgs,
301539Srgrimes                    const char *LinkingOutput) const override;
311539Srgrimes};
321539Srgrimes
3341284Sbde} // end namespace wasm
3450473Speter} // end namespace tools
351539Srgrimes
361539Srgrimesnamespace toolchains {
371539Srgrimes
381539Srgrimesclass LLVM_LIBRARY_VISIBILITY WebAssembly final : public ToolChain {
391539Srgrimespublic:
401539Srgrimes  WebAssembly(const Driver &D, const llvm::Triple &Triple,
411539Srgrimes              const llvm::opt::ArgList &Args);
421539Srgrimes
431539Srgrimesprivate:
441539Srgrimes  bool IsMathErrnoDefault() const override;
451539Srgrimes  bool IsObjCNonFragileABIDefault() const override;
461539Srgrimes  bool UseObjCMixedDispatch() const override;
471539Srgrimes  bool isPICDefault() const override;
481539Srgrimes  bool isPIEDefault(const llvm::opt::ArgList &Args) const override;
491539Srgrimes  bool isPICDefaultForced() const override;
501539Srgrimes  bool hasBlocksRuntime() const override;
5141284Sbde  bool SupportsProfiling() const override;
5241284Sbde  bool HasNativeLLVMSupport() const override;
5341284Sbde  unsigned GetDefaultDwarfVersion() const override { return 4; }
5441284Sbde  void
5541284Sbde  addClangTargetOptions(const llvm::opt::ArgList &DriverArgs,
5641284Sbde                        llvm::opt::ArgStringList &CC1Args,
5741284Sbde                        Action::OffloadKind DeviceOffloadKind) const override;
5841284Sbde  RuntimeLibType GetDefaultRuntimeLibType() const override;
5941284Sbde  CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const override;
6040739Sjdp  void
6141284Sbde  AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
6240739Sjdp                            llvm::opt::ArgStringList &CC1Args) const override;
6341284Sbde  void AddClangCXXStdlibIncludeArgs(
6440739Sjdp      const llvm::opt::ArgList &DriverArgs,
6541284Sbde      llvm::opt::ArgStringList &CC1Args) const override;
6618286Sbde  void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args,
6718286Sbde                           llvm::opt::ArgStringList &CmdArgs) const override;
681539Srgrimes  SanitizerMask getSupportedSanitizers() const override;
691539Srgrimes
701539Srgrimes  const char *getDefaultLinker() const override;
71
72  CXXStdlibType GetDefaultCXXStdlibType() const override {
73    return ToolChain::CST_Libcxx;
74  }
75
76  Tool *buildLinker() const override;
77
78  std::string getMultiarchTriple(const Driver &D,
79                                 const llvm::Triple &TargetTriple,
80                                 StringRef SysRoot) const override;
81
82  void addLibCxxIncludePaths(const llvm::opt::ArgList &DriverArgs,
83                             llvm::opt::ArgStringList &CC1Args) const;
84  void addLibStdCXXIncludePaths(const llvm::opt::ArgList &DriverArgs,
85                                llvm::opt::ArgStringList &CC1Args) const;
86};
87
88} // end namespace toolchains
89} // end namespace driver
90} // end namespace clang
91
92#endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_WEBASSEMBLY_H
93