XCore.h 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. //===--- XCore.h - XCore 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_XCORE_H
  9. #define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_XCORE_H
  10. #include "clang/Driver/Tool.h"
  11. #include "clang/Driver/ToolChain.h"
  12. namespace clang {
  13. namespace driver {
  14. namespace tools {
  15. namespace XCore {
  16. // For XCore, we do not need to instantiate tools for PreProcess, PreCompile and
  17. // Compile.
  18. // We simply use "clang -cc1" for those actions.
  19. class LLVM_LIBRARY_VISIBILITY Assembler : public Tool {
  20. public:
  21. Assembler(const ToolChain &TC) : Tool("XCore::Assembler", "XCore-as", TC) {}
  22. bool hasIntegratedCPP() const override { return false; }
  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. class LLVM_LIBRARY_VISIBILITY Linker : public Tool {
  29. public:
  30. Linker(const ToolChain &TC) : Tool("XCore::Linker", "XCore-ld", TC) {}
  31. bool hasIntegratedCPP() const override { return false; }
  32. bool isLinkJob() const override { return true; }
  33. void ConstructJob(Compilation &C, const JobAction &JA,
  34. const InputInfo &Output, const InputInfoList &Inputs,
  35. const llvm::opt::ArgList &TCArgs,
  36. const char *LinkingOutput) const override;
  37. };
  38. } // end namespace XCore.
  39. } // end namespace tools
  40. namespace toolchains {
  41. class LLVM_LIBRARY_VISIBILITY XCoreToolChain : public ToolChain {
  42. public:
  43. XCoreToolChain(const Driver &D, const llvm::Triple &Triple,
  44. const llvm::opt::ArgList &Args);
  45. protected:
  46. Tool *buildAssembler() const override;
  47. Tool *buildLinker() const override;
  48. public:
  49. bool isPICDefault() const override;
  50. bool isPIEDefault(const llvm::opt::ArgList &Args) const override;
  51. bool isPICDefaultForced() const override;
  52. bool SupportsProfiling() const override;
  53. bool hasBlocksRuntime() const override;
  54. void
  55. AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
  56. llvm::opt::ArgStringList &CC1Args) const override;
  57. void addClangTargetOptions(const llvm::opt::ArgList &DriverArgs,
  58. llvm::opt::ArgStringList &CC1Args,
  59. Action::OffloadKind DeviceOffloadKind) const override;
  60. void AddClangCXXStdlibIncludeArgs(
  61. const llvm::opt::ArgList &DriverArgs,
  62. llvm::opt::ArgStringList &CC1Args) const override;
  63. void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args,
  64. llvm::opt::ArgStringList &CmdArgs) const override;
  65. };
  66. } // end namespace toolchains
  67. } // end namespace driver
  68. } // end namespace clang
  69. #endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_XCORE_H