RISCVToolchain.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. //===--- RISCVToolchain.h - RISCV 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_RISCVTOOLCHAIN_H
  9. #define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_RISCVTOOLCHAIN_H
  10. #include "Gnu.h"
  11. #include "clang/Driver/ToolChain.h"
  12. namespace clang {
  13. namespace driver {
  14. namespace toolchains {
  15. class LLVM_LIBRARY_VISIBILITY RISCVToolChain : public Generic_ELF {
  16. public:
  17. RISCVToolChain(const Driver &D, const llvm::Triple &Triple,
  18. const llvm::opt::ArgList &Args);
  19. static bool hasGCCToolchain(const Driver &D, const llvm::opt::ArgList &Args);
  20. bool IsIntegratedAssemblerDefault() const override { return true; }
  21. void addClangTargetOptions(const llvm::opt::ArgList &DriverArgs,
  22. llvm::opt::ArgStringList &CC1Args,
  23. Action::OffloadKind) const override;
  24. RuntimeLibType GetDefaultRuntimeLibType() const override;
  25. UnwindLibType
  26. GetUnwindLibType(const llvm::opt::ArgList &Args) const override;
  27. void
  28. AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
  29. llvm::opt::ArgStringList &CC1Args) const override;
  30. void
  31. addLibStdCxxIncludePaths(const llvm::opt::ArgList &DriverArgs,
  32. llvm::opt::ArgStringList &CC1Args) const override;
  33. protected:
  34. Tool *buildLinker() const override;
  35. private:
  36. std::string computeSysRoot() const override;
  37. };
  38. } // end namespace toolchains
  39. namespace tools {
  40. namespace RISCV {
  41. class LLVM_LIBRARY_VISIBILITY Linker : public Tool {
  42. public:
  43. Linker(const ToolChain &TC) : Tool("RISCV::Linker", "ld", TC) {}
  44. bool hasIntegratedCPP() const override { return false; }
  45. bool isLinkJob() const override { return true; }
  46. void ConstructJob(Compilation &C, const JobAction &JA,
  47. const InputInfo &Output, const InputInfoList &Inputs,
  48. const llvm::opt::ArgList &TCArgs,
  49. const char *LinkingOutput) const override;
  50. };
  51. } // end namespace RISCV
  52. } // end namespace tools
  53. } // end namespace driver
  54. } // end namespace clang
  55. #endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_RISCVTOOLCHAIN_H