Lanai.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. //===--- Lanai.h - Declare Lanai target feature support ---------*- 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. //
  9. // This file declares Lanai TargetInfo objects.
  10. //
  11. //===----------------------------------------------------------------------===//
  12. #ifndef LLVM_CLANG_LIB_BASIC_TARGETS_LANAI_H
  13. #define LLVM_CLANG_LIB_BASIC_TARGETS_LANAI_H
  14. #include "clang/Basic/TargetInfo.h"
  15. #include "clang/Basic/TargetOptions.h"
  16. #include "llvm/ADT/Triple.h"
  17. #include "llvm/Support/Compiler.h"
  18. namespace clang {
  19. namespace targets {
  20. class LLVM_LIBRARY_VISIBILITY LanaiTargetInfo : public TargetInfo {
  21. // Class for Lanai (32-bit).
  22. // The CPU profiles supported by the Lanai backend
  23. enum CPUKind {
  24. CK_NONE,
  25. CK_V11,
  26. } CPU;
  27. static const TargetInfo::GCCRegAlias GCCRegAliases[];
  28. static const char *const GCCRegNames[];
  29. public:
  30. LanaiTargetInfo(const llvm::Triple &Triple, const TargetOptions &)
  31. : TargetInfo(Triple) {
  32. // Description string has to be kept in sync with backend.
  33. resetDataLayout("E" // Big endian
  34. "-m:e" // ELF name manging
  35. "-p:32:32" // 32 bit pointers, 32 bit aligned
  36. "-i64:64" // 64 bit integers, 64 bit aligned
  37. "-a:0:32" // 32 bit alignment of objects of aggregate type
  38. "-n32" // 32 bit native integer width
  39. "-S64" // 64 bit natural stack alignment
  40. );
  41. // Setting RegParmMax equal to what mregparm was set to in the old
  42. // toolchain
  43. RegParmMax = 4;
  44. // Set the default CPU to V11
  45. CPU = CK_V11;
  46. // Temporary approach to make everything at least word-aligned and allow for
  47. // safely casting between pointers with different alignment requirements.
  48. // TODO: Remove this when there are no more cast align warnings on the
  49. // firmware.
  50. MinGlobalAlign = 32;
  51. }
  52. void getTargetDefines(const LangOptions &Opts,
  53. MacroBuilder &Builder) const override;
  54. bool isValidCPUName(StringRef Name) const override;
  55. void fillValidCPUList(SmallVectorImpl<StringRef> &Values) const override;
  56. bool setCPU(const std::string &Name) override;
  57. bool hasFeature(StringRef Feature) const override;
  58. ArrayRef<const char *> getGCCRegNames() const override;
  59. ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override;
  60. BuiltinVaListKind getBuiltinVaListKind() const override {
  61. return TargetInfo::VoidPtrBuiltinVaList;
  62. }
  63. ArrayRef<Builtin::Info> getTargetBuiltins() const override { return None; }
  64. bool validateAsmConstraint(const char *&Name,
  65. TargetInfo::ConstraintInfo &info) const override {
  66. return false;
  67. }
  68. const char *getClobbers() const override { return ""; }
  69. };
  70. } // namespace targets
  71. } // namespace clang
  72. #endif // LLVM_CLANG_LIB_BASIC_TARGETS_LANAI_H