VE.h 5.4 KB

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