WebAssembly.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. #ifndef LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_WEBASSEMBLY_H
  9. #define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_WEBASSEMBLY_H
  10. #include "Gnu.h"
  11. #include "clang/Driver/Tool.h"
  12. #include "clang/Driver/ToolChain.h"
  13. namespace clang {
  14. namespace driver {
  15. namespace tools {
  16. namespace wasm {
  17. class LLVM_LIBRARY_VISIBILITY Linker : public Tool {
  18. public:
  19. explicit Linker(const ToolChain &TC) : Tool("wasm::Linker", "linker", TC) {}
  20. bool isLinkJob() const override { return true; }
  21. bool hasIntegratedCPP() const override { return false; }
  22. std::string getLinkerPath(const llvm::opt::ArgList &Args) const;
  23. void ConstructJob(Compilation &C, const JobAction &JA,
  24. const InputInfo &Output, const InputInfoList &Inputs,
  25. const llvm::opt::ArgList &TCArgs,
  26. const char *LinkingOutput) const override;
  27. };
  28. } // end namespace wasm
  29. } // end namespace tools
  30. namespace toolchains {
  31. class LLVM_LIBRARY_VISIBILITY WebAssembly final : public ToolChain {
  32. public:
  33. WebAssembly(const Driver &D, const llvm::Triple &Triple,
  34. const llvm::opt::ArgList &Args);
  35. private:
  36. bool IsMathErrnoDefault() const override;
  37. bool IsObjCNonFragileABIDefault() const override;
  38. bool UseObjCMixedDispatch() const override;
  39. bool isPICDefault() const override;
  40. bool isPIEDefault(const llvm::opt::ArgList &Args) const override;
  41. bool isPICDefaultForced() const override;
  42. bool IsIntegratedAssemblerDefault() const override;
  43. bool hasBlocksRuntime() const override;
  44. bool SupportsProfiling() const override;
  45. bool HasNativeLLVMSupport() const override;
  46. unsigned GetDefaultDwarfVersion() const override { return 4; }
  47. void
  48. addClangTargetOptions(const llvm::opt::ArgList &DriverArgs,
  49. llvm::opt::ArgStringList &CC1Args,
  50. Action::OffloadKind DeviceOffloadKind) const override;
  51. RuntimeLibType GetDefaultRuntimeLibType() const override;
  52. CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const override;
  53. void
  54. AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
  55. llvm::opt::ArgStringList &CC1Args) const override;
  56. void AddClangCXXStdlibIncludeArgs(
  57. const llvm::opt::ArgList &DriverArgs,
  58. llvm::opt::ArgStringList &CC1Args) const override;
  59. void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args,
  60. llvm::opt::ArgStringList &CmdArgs) const override;
  61. SanitizerMask getSupportedSanitizers() const override;
  62. const char *getDefaultLinker() const override { return "wasm-ld"; }
  63. Tool *buildLinker() const override;
  64. std::string getMultiarchTriple(const Driver &D,
  65. const llvm::Triple &TargetTriple,
  66. StringRef SysRoot) const override;
  67. };
  68. } // end namespace toolchains
  69. } // end namespace driver
  70. } // end namespace clang
  71. #endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_WEBASSEMBLY_H