AVR.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. //===--- AVR.h - AVR Tool and 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_AVR_H
  9. #define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_AVR_H
  10. #include "Gnu.h"
  11. #include "clang/Driver/InputInfo.h"
  12. #include "clang/Driver/Tool.h"
  13. #include "clang/Driver/ToolChain.h"
  14. namespace clang {
  15. namespace driver {
  16. namespace toolchains {
  17. class LLVM_LIBRARY_VISIBILITY AVRToolChain : public Generic_ELF {
  18. public:
  19. AVRToolChain(const Driver &D, const llvm::Triple &Triple,
  20. const llvm::opt::ArgList &Args);
  21. void
  22. AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
  23. llvm::opt::ArgStringList &CC1Args) const override;
  24. void
  25. addClangTargetOptions(const llvm::opt::ArgList &DriverArgs,
  26. llvm::opt::ArgStringList &CC1Args,
  27. Action::OffloadKind DeviceOffloadKind) const override;
  28. std::optional<std::string> findAVRLibcInstallation() const;
  29. StringRef getGCCInstallPath() const { return GCCInstallPath; }
  30. std::string getCompilerRT(const llvm::opt::ArgList &Args, StringRef Component,
  31. FileType Type) const override;
  32. protected:
  33. Tool *buildLinker() const override;
  34. private:
  35. StringRef GCCInstallPath;
  36. };
  37. } // end namespace toolchains
  38. namespace tools {
  39. namespace AVR {
  40. class LLVM_LIBRARY_VISIBILITY Linker : public Tool {
  41. public:
  42. Linker(const llvm::Triple &Triple, const ToolChain &TC)
  43. : Tool("AVR::Linker", "avr-ld", TC), Triple(Triple) {}
  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. protected:
  51. const llvm::Triple &Triple;
  52. };
  53. } // end namespace AVR
  54. } // end namespace tools
  55. } // end namespace driver
  56. } // end namespace clang
  57. #endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_AVR_H