clang  15.0.0git
WebAssembly.h
Go to the documentation of this file.
1 //===--- WebAssembly.h - WebAssembly ToolChain Implementations --*- C++ -*-===//
2 //
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
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 Tool {
22 public:
23  explicit Linker(const ToolChain &TC) : Tool("wasm::Linker", "linker", TC) {}
24  bool isLinkJob() const override { return true; }
25  bool hasIntegratedCPP() const override { return false; }
26  std::string getLinkerPath(const llvm::opt::ArgList &Args) const;
27  void ConstructJob(Compilation &C, const JobAction &JA,
28  const InputInfo &Output, const InputInfoList &Inputs,
29  const llvm::opt::ArgList &TCArgs,
30  const char *LinkingOutput) const override;
31 };
32 
33 } // end namespace wasm
34 } // end namespace tools
35 
36 namespace toolchains {
37 
38 class LLVM_LIBRARY_VISIBILITY WebAssembly final : public ToolChain {
39 public:
40  WebAssembly(const Driver &D, const llvm::Triple &Triple,
41  const llvm::opt::ArgList &Args);
42 
43 private:
44  bool IsMathErrnoDefault() const override;
45  bool IsObjCNonFragileABIDefault() const override;
46  bool UseObjCMixedDispatch() const override;
47  bool isPICDefault() const override;
48  bool isPIEDefault(const llvm::opt::ArgList &Args) const override;
49  bool isPICDefaultForced() const override;
50  bool IsIntegratedAssemblerDefault() const override;
51  bool hasBlocksRuntime() const override;
52  bool SupportsProfiling() const override;
53  bool HasNativeLLVMSupport() const override;
54  unsigned GetDefaultDwarfVersion() const override { return 4; }
55  void
56  addClangTargetOptions(const llvm::opt::ArgList &DriverArgs,
57  llvm::opt::ArgStringList &CC1Args,
58  Action::OffloadKind DeviceOffloadKind) const override;
59  RuntimeLibType GetDefaultRuntimeLibType() const override;
60  CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const override;
61  void
62  AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
63  llvm::opt::ArgStringList &CC1Args) const override;
64  void AddClangCXXStdlibIncludeArgs(
65  const llvm::opt::ArgList &DriverArgs,
66  llvm::opt::ArgStringList &CC1Args) const override;
67  void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args,
68  llvm::opt::ArgStringList &CmdArgs) const override;
69  SanitizerMask getSupportedSanitizers() const override;
70 
71  const char *getDefaultLinker() const override { return "wasm-ld"; }
72 
73  CXXStdlibType GetDefaultCXXStdlibType() const override {
74  return ToolChain::CST_Libcxx;
75  }
76 
77  Tool *buildLinker() const override;
78 
79  std::string getMultiarchTriple(const Driver &D,
80  const llvm::Triple &TargetTriple,
81  StringRef SysRoot) const override;
82 
83  void addLibCxxIncludePaths(const llvm::opt::ArgList &DriverArgs,
84  llvm::opt::ArgStringList &CC1Args) const;
85  void addLibStdCXXIncludePaths(const llvm::opt::ArgList &DriverArgs,
86  llvm::opt::ArgStringList &CC1Args) const;
87 };
88 
89 } // end namespace toolchains
90 } // end namespace driver
91 } // end namespace clang
92 
93 #endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_WEBASSEMBLY_H
clang::driver::tools::wasm::Linker
Definition: WebAssembly.h:21
clang::driver::tools::wasm::Linker::Linker
Linker(const ToolChain &TC)
Definition: WebAssembly.h:23
string
string(SUBSTRING ${CMAKE_CURRENT_BINARY_DIR} 0 ${PATH_LIB_START} PATH_HEAD) string(SUBSTRING $
Definition: CMakeLists.txt:22
llvm::SmallVector
Definition: LLVM.h:38
clang::driver::InputInfo
InputInfo - Wrapper for information about an input source.
Definition: InputInfo.h:22
clang::driver::ToolChain::RuntimeLibType
RuntimeLibType
Definition: ToolChain.h:100
clang::driver::tools::wasm::Linker::isLinkJob
bool isLinkJob() const override
Definition: WebAssembly.h:24
clang::driver::Tool
Tool - Information on a specific compilation tool.
Definition: Tool.h:32
clang::driver::ToolChain::CXXStdlibType
CXXStdlibType
Definition: ToolChain.h:95
Tool.h
clang::driver::ToolChain::CST_Libcxx
@ CST_Libcxx
Definition: ToolChain.h:96
ToolChain.h
Gnu.h
clang::driver::ToolChain
ToolChain - Access to tools for a single platform.
Definition: ToolChain.h:91
clang::driver::tools::wasm::Linker::hasIntegratedCPP
bool hasIntegratedCPP() const override
Definition: WebAssembly.h:25
clang::driver::Compilation
Compilation - A set of tasks to perform for a single driver invocation.
Definition: Compilation.h:45
clang
Definition: CalledOnceCheck.h:17
clang::driver::Driver
Driver - Encapsulate logic for constructing compilation processes from a set of gcc-driver-like comma...
Definition: Driver.h:72
clang::driver::Action::OffloadKind
OffloadKind
Definition: Action.h:88
clang::driver::toolchains::WebAssembly
Definition: WebAssembly.h:38
clang::driver::JobAction
Definition: Action.h:395
clang::SanitizerMask
Definition: Sanitizers.h:30