VE.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. //===--- VE.h - Declare VE 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 VE TargetInfo objects.
  10. //
  11. //===----------------------------------------------------------------------===//
  12. #ifndef LLVM_CLANG_LIB_BASIC_TARGETS_VE_H
  13. #define LLVM_CLANG_LIB_BASIC_TARGETS_VE_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 VETargetInfo : public TargetInfo {
  21. public:
  22. VETargetInfo(const llvm::Triple &Triple, const TargetOptions &)
  23. : TargetInfo(Triple) {
  24. NoAsmVariants = true;
  25. LongDoubleWidth = 128;
  26. LongDoubleAlign = 128;
  27. LongDoubleFormat = &llvm::APFloat::IEEEquad();
  28. DoubleAlign = LongLongAlign = 64;
  29. SuitableAlign = 64;
  30. LongWidth = LongAlign = PointerWidth = PointerAlign = 64;
  31. SizeType = UnsignedLong;
  32. PtrDiffType = SignedLong;
  33. IntPtrType = SignedLong;
  34. IntMaxType = SignedLong;
  35. Int64Type = SignedLong;
  36. RegParmMax = 8;
  37. MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 64;
  38. WCharType = UnsignedInt;
  39. WIntType = UnsignedInt;
  40. UseZeroLengthBitfieldAlignment = true;
  41. resetDataLayout(
  42. "e-m:e-i64:64-n32:64-S128-v64:64:64-v128:64:64-v256:64:64-v512:64:64-"
  43. "v1024:64:64-v2048:64:64-v4096:64:64-v8192:64:64-v16384:64:64");
  44. }
  45. void getTargetDefines(const LangOptions &Opts,
  46. MacroBuilder &Builder) const override;
  47. bool hasSjLjLowering() const override { return true; }
  48. ArrayRef<Builtin::Info> getTargetBuiltins() const override;
  49. BuiltinVaListKind getBuiltinVaListKind() const override {
  50. return TargetInfo::VoidPtrBuiltinVaList;
  51. }
  52. CallingConvCheckResult checkCallingConvention(CallingConv CC) const override {
  53. switch (CC) {
  54. default:
  55. return CCCR_Warning;
  56. case CC_C:
  57. return CCCR_OK;
  58. }
  59. }
  60. const char *getClobbers() const override { return ""; }
  61. ArrayRef<const char *> getGCCRegNames() const override {
  62. static const char *const GCCRegNames[] = {
  63. // Regular registers
  64. "sx0", "sx1", "sx2", "sx3", "sx4", "sx5", "sx6", "sx7",
  65. "sx8", "sx9", "sx10", "sx11", "sx12", "sx13", "sx14", "sx15",
  66. "sx16", "sx17", "sx18", "sx19", "sx20", "sx21", "sx22", "sx23",
  67. "sx24", "sx25", "sx26", "sx27", "sx28", "sx29", "sx30", "sx31",
  68. "sx32", "sx33", "sx34", "sx35", "sx36", "sx37", "sx38", "sx39",
  69. "sx40", "sx41", "sx42", "sx43", "sx44", "sx45", "sx46", "sx47",
  70. "sx48", "sx49", "sx50", "sx51", "sx52", "sx53", "sx54", "sx55",
  71. "sx56", "sx57", "sx58", "sx59", "sx60", "sx61", "sx62", "sx63",
  72. };
  73. return llvm::ArrayRef(GCCRegNames);
  74. }
  75. ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override {
  76. static const TargetInfo::GCCRegAlias GCCRegAliases[] = {
  77. {{"s0"}, "sx0"},
  78. {{"s1"}, "sx1"},
  79. {{"s2"}, "sx2"},
  80. {{"s3"}, "sx3"},
  81. {{"s4"}, "sx4"},
  82. {{"s5"}, "sx5"},
  83. {{"s6"}, "sx6"},
  84. {{"s7"}, "sx7"},
  85. {{"s8", "sl"}, "sx8"},
  86. {{"s9", "fp"}, "sx9"},
  87. {{"s10", "lr"}, "sx10"},
  88. {{"s11", "sp"}, "sx11"},
  89. {{"s12", "outer"}, "sx12"},
  90. {{"s13"}, "sx13"},
  91. {{"s14", "tp"}, "sx14"},
  92. {{"s15", "got"}, "sx15"},
  93. {{"s16", "plt"}, "sx16"},
  94. {{"s17", "info"}, "sx17"},
  95. {{"s18"}, "sx18"},
  96. {{"s19"}, "sx19"},
  97. {{"s20"}, "sx20"},
  98. {{"s21"}, "sx21"},
  99. {{"s22"}, "sx22"},
  100. {{"s23"}, "sx23"},
  101. {{"s24"}, "sx24"},
  102. {{"s25"}, "sx25"},
  103. {{"s26"}, "sx26"},
  104. {{"s27"}, "sx27"},
  105. {{"s28"}, "sx28"},
  106. {{"s29"}, "sx29"},
  107. {{"s30"}, "sx30"},
  108. {{"s31"}, "sx31"},
  109. {{"s32"}, "sx32"},
  110. {{"s33"}, "sx33"},
  111. {{"s34"}, "sx34"},
  112. {{"s35"}, "sx35"},
  113. {{"s36"}, "sx36"},
  114. {{"s37"}, "sx37"},
  115. {{"s38"}, "sx38"},
  116. {{"s39"}, "sx39"},
  117. {{"s40"}, "sx40"},
  118. {{"s41"}, "sx41"},
  119. {{"s42"}, "sx42"},
  120. {{"s43"}, "sx43"},
  121. {{"s44"}, "sx44"},
  122. {{"s45"}, "sx45"},
  123. {{"s46"}, "sx46"},
  124. {{"s47"}, "sx47"},
  125. {{"s48"}, "sx48"},
  126. {{"s49"}, "sx49"},
  127. {{"s50"}, "sx50"},
  128. {{"s51"}, "sx51"},
  129. {{"s52"}, "sx52"},
  130. {{"s53"}, "sx53"},
  131. {{"s54"}, "sx54"},
  132. {{"s55"}, "sx55"},
  133. {{"s56"}, "sx56"},
  134. {{"s57"}, "sx57"},
  135. {{"s58"}, "sx58"},
  136. {{"s59"}, "sx59"},
  137. {{"s60"}, "sx60"},
  138. {{"s61"}, "sx61"},
  139. {{"s62"}, "sx62"},
  140. {{"s63"}, "sx63"},
  141. };
  142. return llvm::ArrayRef(GCCRegAliases);
  143. }
  144. bool validateAsmConstraint(const char *&Name,
  145. TargetInfo::ConstraintInfo &Info) const override {
  146. switch (*Name) {
  147. default:
  148. return false;
  149. case 'v':
  150. Info.setAllowsRegister();
  151. return true;
  152. }
  153. return false;
  154. }
  155. bool allowsLargerPreferedTypeAlignment() const override { return false; }
  156. };
  157. } // namespace targets
  158. } // namespace clang
  159. #endif // LLVM_CLANG_LIB_BASIC_TARGETS_VE_H