MSP430.h 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. //===--- MSP430.h - MSP430-specific Tool Helpers ----------------*- 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_MSP430_H
  9. #define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_MSP430_H
  10. #include "Gnu.h"
  11. #include "clang/Driver/Driver.h"
  12. #include "clang/Driver/DriverDiagnostic.h"
  13. #include "clang/Driver/InputInfo.h"
  14. #include "clang/Driver/Tool.h"
  15. #include "clang/Driver/ToolChain.h"
  16. #include "llvm/ADT/StringRef.h"
  17. #include "llvm/Option/Option.h"
  18. #include <string>
  19. #include <vector>
  20. namespace clang {
  21. namespace driver {
  22. namespace toolchains {
  23. class LLVM_LIBRARY_VISIBILITY MSP430ToolChain : public Generic_ELF {
  24. public:
  25. MSP430ToolChain(const Driver &D, const llvm::Triple &Triple,
  26. const llvm::opt::ArgList &Args);
  27. void
  28. AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
  29. llvm::opt::ArgStringList &CC1Args) const override;
  30. void addClangTargetOptions(const llvm::opt::ArgList &DriverArgs,
  31. llvm::opt::ArgStringList &CC1Args,
  32. Action::OffloadKind) const override;
  33. bool isPICDefault() const override { return false; }
  34. bool isPIEDefault(const llvm::opt::ArgList &Args) const override {
  35. return false;
  36. }
  37. bool isPICDefaultForced() const override { return true; }
  38. UnwindLibType
  39. GetUnwindLibType(const llvm::opt::ArgList &Args) const override {
  40. return UNW_None;
  41. }
  42. protected:
  43. Tool *buildLinker() const override;
  44. private:
  45. std::string computeSysRoot() const override;
  46. };
  47. } // end namespace toolchains
  48. namespace tools {
  49. namespace msp430 {
  50. class LLVM_LIBRARY_VISIBILITY Linker : public Tool {
  51. public:
  52. Linker(const ToolChain &TC) : Tool("MSP430::Linker", "msp430-elf-ld", TC) {}
  53. bool hasIntegratedCPP() const override { return false; }
  54. bool isLinkJob() const override { return true; }
  55. void ConstructJob(Compilation &C, const JobAction &JA,
  56. const InputInfo &Output, const InputInfoList &Inputs,
  57. const llvm::opt::ArgList &TCArgs,
  58. const char *LinkingOutput) const override;
  59. private:
  60. void AddStartFiles(bool UseExceptions, const llvm::opt::ArgList &Args,
  61. llvm::opt::ArgStringList &CmdArgs) const;
  62. void AddDefaultLibs(const llvm::opt::ArgList &Args,
  63. llvm::opt::ArgStringList &CmdArgs) const;
  64. void AddEndFiles(bool UseExceptions, const llvm::opt::ArgList &Args,
  65. llvm::opt::ArgStringList &CmdArgs) const;
  66. };
  67. void getMSP430TargetFeatures(const Driver &D, const llvm::opt::ArgList &Args,
  68. std::vector<llvm::StringRef> &Features);
  69. } // end namespace msp430
  70. } // end namespace tools
  71. } // end namespace driver
  72. } // end namespace clang
  73. #endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_MSP430_H