AArch64.cpp 35 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066
  1. //===--- AArch64.cpp - Implement AArch64 target feature support -----------===//
  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 implements AArch64 TargetInfo objects.
  10. //
  11. //===----------------------------------------------------------------------===//
  12. #include "AArch64.h"
  13. #include "clang/Basic/LangOptions.h"
  14. #include "clang/Basic/TargetBuiltins.h"
  15. #include "clang/Basic/TargetInfo.h"
  16. #include "llvm/ADT/ArrayRef.h"
  17. #include "llvm/ADT/StringExtras.h"
  18. #include "llvm/ADT/StringSwitch.h"
  19. #include "llvm/Support/AArch64TargetParser.h"
  20. using namespace clang;
  21. using namespace clang::targets;
  22. const Builtin::Info AArch64TargetInfo::BuiltinInfo[] = {
  23. #define BUILTIN(ID, TYPE, ATTRS) \
  24. {#ID, TYPE, ATTRS, nullptr, ALL_LANGUAGES, nullptr},
  25. #include "clang/Basic/BuiltinsNEON.def"
  26. #define BUILTIN(ID, TYPE, ATTRS) \
  27. {#ID, TYPE, ATTRS, nullptr, ALL_LANGUAGES, nullptr},
  28. #include "clang/Basic/BuiltinsSVE.def"
  29. #define BUILTIN(ID, TYPE, ATTRS) \
  30. {#ID, TYPE, ATTRS, nullptr, ALL_LANGUAGES, nullptr},
  31. #define LANGBUILTIN(ID, TYPE, ATTRS, LANG) \
  32. {#ID, TYPE, ATTRS, nullptr, LANG, nullptr},
  33. #define TARGET_HEADER_BUILTIN(ID, TYPE, ATTRS, HEADER, LANGS, FEATURE) \
  34. {#ID, TYPE, ATTRS, HEADER, LANGS, FEATURE},
  35. #include "clang/Basic/BuiltinsAArch64.def"
  36. };
  37. static StringRef getArchVersionString(llvm::AArch64::ArchKind Kind) {
  38. switch (Kind) {
  39. case llvm::AArch64::ArchKind::ARMV9A:
  40. case llvm::AArch64::ArchKind::ARMV9_1A:
  41. case llvm::AArch64::ArchKind::ARMV9_2A:
  42. case llvm::AArch64::ArchKind::ARMV9_3A:
  43. return "9";
  44. default:
  45. return "8";
  46. }
  47. }
  48. StringRef AArch64TargetInfo::getArchProfile() const {
  49. switch (ArchKind) {
  50. case llvm::AArch64::ArchKind::ARMV8R:
  51. return "R";
  52. default:
  53. return "A";
  54. }
  55. }
  56. AArch64TargetInfo::AArch64TargetInfo(const llvm::Triple &Triple,
  57. const TargetOptions &Opts)
  58. : TargetInfo(Triple), ABI("aapcs") {
  59. if (getTriple().isOSOpenBSD()) {
  60. Int64Type = SignedLongLong;
  61. IntMaxType = SignedLongLong;
  62. } else {
  63. if (!getTriple().isOSDarwin() && !getTriple().isOSNetBSD())
  64. WCharType = UnsignedInt;
  65. Int64Type = SignedLong;
  66. IntMaxType = SignedLong;
  67. }
  68. // All AArch64 implementations support ARMv8 FP, which makes half a legal type.
  69. HasLegalHalfType = true;
  70. HasFloat16 = true;
  71. if (Triple.isArch64Bit())
  72. LongWidth = LongAlign = PointerWidth = PointerAlign = 64;
  73. else
  74. LongWidth = LongAlign = PointerWidth = PointerAlign = 32;
  75. MaxVectorAlign = 128;
  76. MaxAtomicInlineWidth = 128;
  77. MaxAtomicPromoteWidth = 128;
  78. LongDoubleWidth = LongDoubleAlign = SuitableAlign = 128;
  79. LongDoubleFormat = &llvm::APFloat::IEEEquad();
  80. BFloat16Width = BFloat16Align = 16;
  81. BFloat16Format = &llvm::APFloat::BFloat();
  82. // Make __builtin_ms_va_list available.
  83. HasBuiltinMSVaList = true;
  84. // Make the SVE types available. Note that this deliberately doesn't
  85. // depend on SveMode, since in principle it should be possible to turn
  86. // SVE on and off within a translation unit. It should also be possible
  87. // to compile the global declaration:
  88. //
  89. // __SVInt8_t *ptr;
  90. //
  91. // even without SVE.
  92. HasAArch64SVETypes = true;
  93. // {} in inline assembly are neon specifiers, not assembly variant
  94. // specifiers.
  95. NoAsmVariants = true;
  96. // AAPCS gives rules for bitfields. 7.1.7 says: "The container type
  97. // contributes to the alignment of the containing aggregate in the same way
  98. // a plain (non bit-field) member of that type would, without exception for
  99. // zero-sized or anonymous bit-fields."
  100. assert(UseBitFieldTypeAlignment && "bitfields affect type alignment");
  101. UseZeroLengthBitfieldAlignment = true;
  102. // AArch64 targets default to using the ARM C++ ABI.
  103. TheCXXABI.set(TargetCXXABI::GenericAArch64);
  104. if (Triple.getOS() == llvm::Triple::Linux)
  105. this->MCountName = "\01_mcount";
  106. else if (Triple.getOS() == llvm::Triple::UnknownOS)
  107. this->MCountName =
  108. Opts.EABIVersion == llvm::EABI::GNU ? "\01_mcount" : "mcount";
  109. }
  110. StringRef AArch64TargetInfo::getABI() const { return ABI; }
  111. bool AArch64TargetInfo::setABI(const std::string &Name) {
  112. if (Name != "aapcs" && Name != "darwinpcs")
  113. return false;
  114. ABI = Name;
  115. return true;
  116. }
  117. bool AArch64TargetInfo::validateBranchProtection(StringRef Spec, StringRef,
  118. BranchProtectionInfo &BPI,
  119. StringRef &Err) const {
  120. llvm::ARM::ParsedBranchProtection PBP;
  121. if (!llvm::ARM::parseBranchProtection(Spec, PBP, Err))
  122. return false;
  123. BPI.SignReturnAddr =
  124. llvm::StringSwitch<LangOptions::SignReturnAddressScopeKind>(PBP.Scope)
  125. .Case("non-leaf", LangOptions::SignReturnAddressScopeKind::NonLeaf)
  126. .Case("all", LangOptions::SignReturnAddressScopeKind::All)
  127. .Default(LangOptions::SignReturnAddressScopeKind::None);
  128. if (PBP.Key == "a_key")
  129. BPI.SignKey = LangOptions::SignReturnAddressKeyKind::AKey;
  130. else
  131. BPI.SignKey = LangOptions::SignReturnAddressKeyKind::BKey;
  132. BPI.BranchTargetEnforcement = PBP.BranchTargetEnforcement;
  133. return true;
  134. }
  135. bool AArch64TargetInfo::isValidCPUName(StringRef Name) const {
  136. return Name == "generic" ||
  137. llvm::AArch64::parseCPUArch(Name) != llvm::AArch64::ArchKind::INVALID;
  138. }
  139. bool AArch64TargetInfo::setCPU(const std::string &Name) {
  140. return isValidCPUName(Name);
  141. }
  142. void AArch64TargetInfo::fillValidCPUList(
  143. SmallVectorImpl<StringRef> &Values) const {
  144. llvm::AArch64::fillValidCPUArchList(Values);
  145. }
  146. void AArch64TargetInfo::getTargetDefinesARMV81A(const LangOptions &Opts,
  147. MacroBuilder &Builder) const {
  148. Builder.defineMacro("__ARM_FEATURE_QRDMX", "1");
  149. Builder.defineMacro("__ARM_FEATURE_ATOMICS", "1");
  150. Builder.defineMacro("__ARM_FEATURE_CRC32", "1");
  151. }
  152. void AArch64TargetInfo::getTargetDefinesARMV82A(const LangOptions &Opts,
  153. MacroBuilder &Builder) const {
  154. // Also include the ARMv8.1 defines
  155. getTargetDefinesARMV81A(Opts, Builder);
  156. }
  157. void AArch64TargetInfo::getTargetDefinesARMV83A(const LangOptions &Opts,
  158. MacroBuilder &Builder) const {
  159. Builder.defineMacro("__ARM_FEATURE_COMPLEX", "1");
  160. Builder.defineMacro("__ARM_FEATURE_JCVT", "1");
  161. // Also include the Armv8.2 defines
  162. getTargetDefinesARMV82A(Opts, Builder);
  163. }
  164. void AArch64TargetInfo::getTargetDefinesARMV84A(const LangOptions &Opts,
  165. MacroBuilder &Builder) const {
  166. // Also include the Armv8.3 defines
  167. getTargetDefinesARMV83A(Opts, Builder);
  168. }
  169. void AArch64TargetInfo::getTargetDefinesARMV85A(const LangOptions &Opts,
  170. MacroBuilder &Builder) const {
  171. Builder.defineMacro("__ARM_FEATURE_FRINT", "1");
  172. // Also include the Armv8.4 defines
  173. getTargetDefinesARMV84A(Opts, Builder);
  174. }
  175. void AArch64TargetInfo::getTargetDefinesARMV86A(const LangOptions &Opts,
  176. MacroBuilder &Builder) const {
  177. // Also include the Armv8.5 defines
  178. // FIXME: Armv8.6 makes the following extensions mandatory:
  179. // - __ARM_FEATURE_BF16
  180. // - __ARM_FEATURE_MATMUL_INT8
  181. // Handle them here.
  182. getTargetDefinesARMV85A(Opts, Builder);
  183. }
  184. void AArch64TargetInfo::getTargetDefinesARMV87A(const LangOptions &Opts,
  185. MacroBuilder &Builder) const {
  186. // Also include the Armv8.6 defines
  187. getTargetDefinesARMV86A(Opts, Builder);
  188. }
  189. void AArch64TargetInfo::getTargetDefinesARMV88A(const LangOptions &Opts,
  190. MacroBuilder &Builder) const {
  191. // Also include the Armv8.7 defines
  192. getTargetDefinesARMV87A(Opts, Builder);
  193. }
  194. void AArch64TargetInfo::getTargetDefinesARMV9A(const LangOptions &Opts,
  195. MacroBuilder &Builder) const {
  196. // Armv9-A maps to Armv8.5-A
  197. getTargetDefinesARMV85A(Opts, Builder);
  198. }
  199. void AArch64TargetInfo::getTargetDefinesARMV91A(const LangOptions &Opts,
  200. MacroBuilder &Builder) const {
  201. // Armv9.1-A maps to Armv8.6-A
  202. getTargetDefinesARMV86A(Opts, Builder);
  203. }
  204. void AArch64TargetInfo::getTargetDefinesARMV92A(const LangOptions &Opts,
  205. MacroBuilder &Builder) const {
  206. // Armv9.2-A maps to Armv8.7-A
  207. getTargetDefinesARMV87A(Opts, Builder);
  208. }
  209. void AArch64TargetInfo::getTargetDefinesARMV93A(const LangOptions &Opts,
  210. MacroBuilder &Builder) const {
  211. // Armv9.3-A maps to Armv8.8-A
  212. getTargetDefinesARMV88A(Opts, Builder);
  213. }
  214. void AArch64TargetInfo::getTargetDefines(const LangOptions &Opts,
  215. MacroBuilder &Builder) const {
  216. // Target identification.
  217. Builder.defineMacro("__aarch64__");
  218. // For bare-metal.
  219. if (getTriple().getOS() == llvm::Triple::UnknownOS &&
  220. getTriple().isOSBinFormatELF())
  221. Builder.defineMacro("__ELF__");
  222. // Target properties.
  223. if (!getTriple().isOSWindows() && getTriple().isArch64Bit()) {
  224. Builder.defineMacro("_LP64");
  225. Builder.defineMacro("__LP64__");
  226. }
  227. std::string CodeModel = getTargetOpts().CodeModel;
  228. if (CodeModel == "default")
  229. CodeModel = "small";
  230. for (char &c : CodeModel)
  231. c = toupper(c);
  232. Builder.defineMacro("__AARCH64_CMODEL_" + CodeModel + "__");
  233. // ACLE predefines. Many can only have one possible value on v8 AArch64.
  234. Builder.defineMacro("__ARM_ACLE", "200");
  235. Builder.defineMacro("__ARM_ARCH", getArchVersionString(ArchKind));
  236. Builder.defineMacro("__ARM_ARCH_PROFILE", "'" + getArchProfile() + "'");
  237. Builder.defineMacro("__ARM_64BIT_STATE", "1");
  238. Builder.defineMacro("__ARM_PCS_AAPCS64", "1");
  239. Builder.defineMacro("__ARM_ARCH_ISA_A64", "1");
  240. Builder.defineMacro("__ARM_FEATURE_CLZ", "1");
  241. Builder.defineMacro("__ARM_FEATURE_FMA", "1");
  242. Builder.defineMacro("__ARM_FEATURE_LDREX", "0xF");
  243. Builder.defineMacro("__ARM_FEATURE_IDIV", "1"); // As specified in ACLE
  244. Builder.defineMacro("__ARM_FEATURE_DIV"); // For backwards compatibility
  245. Builder.defineMacro("__ARM_FEATURE_NUMERIC_MAXMIN", "1");
  246. Builder.defineMacro("__ARM_FEATURE_DIRECTED_ROUNDING", "1");
  247. Builder.defineMacro("__ARM_ALIGN_MAX_STACK_PWR", "4");
  248. // 0xe implies support for half, single and double precision operations.
  249. Builder.defineMacro("__ARM_FP", "0xE");
  250. // PCS specifies this for SysV variants, which is all we support. Other ABIs
  251. // may choose __ARM_FP16_FORMAT_ALTERNATIVE.
  252. Builder.defineMacro("__ARM_FP16_FORMAT_IEEE", "1");
  253. Builder.defineMacro("__ARM_FP16_ARGS", "1");
  254. if (Opts.UnsafeFPMath)
  255. Builder.defineMacro("__ARM_FP_FAST", "1");
  256. Builder.defineMacro("__ARM_SIZEOF_WCHAR_T",
  257. Twine(Opts.WCharSize ? Opts.WCharSize : 4));
  258. Builder.defineMacro("__ARM_SIZEOF_MINIMAL_ENUM", Opts.ShortEnums ? "1" : "4");
  259. if (FPU & NeonMode) {
  260. Builder.defineMacro("__ARM_NEON", "1");
  261. // 64-bit NEON supports half, single and double precision operations.
  262. Builder.defineMacro("__ARM_NEON_FP", "0xE");
  263. }
  264. if (FPU & SveMode)
  265. Builder.defineMacro("__ARM_FEATURE_SVE", "1");
  266. if ((FPU & NeonMode) && (FPU & SveMode))
  267. Builder.defineMacro("__ARM_NEON_SVE_BRIDGE", "1");
  268. if (HasSVE2)
  269. Builder.defineMacro("__ARM_FEATURE_SVE2", "1");
  270. if (HasSVE2 && HasSVE2AES)
  271. Builder.defineMacro("__ARM_FEATURE_SVE2_AES", "1");
  272. if (HasSVE2 && HasSVE2BitPerm)
  273. Builder.defineMacro("__ARM_FEATURE_SVE2_BITPERM", "1");
  274. if (HasSVE2 && HasSVE2SHA3)
  275. Builder.defineMacro("__ARM_FEATURE_SVE2_SHA3", "1");
  276. if (HasSVE2 && HasSVE2SM4)
  277. Builder.defineMacro("__ARM_FEATURE_SVE2_SM4", "1");
  278. if (HasCRC)
  279. Builder.defineMacro("__ARM_FEATURE_CRC32", "1");
  280. // The __ARM_FEATURE_CRYPTO is deprecated in favor of finer grained feature
  281. // macros for AES, SHA2, SHA3 and SM4
  282. if (HasAES && HasSHA2)
  283. Builder.defineMacro("__ARM_FEATURE_CRYPTO", "1");
  284. if (HasAES)
  285. Builder.defineMacro("__ARM_FEATURE_AES", "1");
  286. if (HasSHA2)
  287. Builder.defineMacro("__ARM_FEATURE_SHA2", "1");
  288. if (HasSHA3) {
  289. Builder.defineMacro("__ARM_FEATURE_SHA3", "1");
  290. Builder.defineMacro("__ARM_FEATURE_SHA512", "1");
  291. }
  292. if (HasSM4) {
  293. Builder.defineMacro("__ARM_FEATURE_SM3", "1");
  294. Builder.defineMacro("__ARM_FEATURE_SM4", "1");
  295. }
  296. if (HasUnaligned)
  297. Builder.defineMacro("__ARM_FEATURE_UNALIGNED", "1");
  298. if ((FPU & NeonMode) && HasFullFP16)
  299. Builder.defineMacro("__ARM_FEATURE_FP16_VECTOR_ARITHMETIC", "1");
  300. if (HasFullFP16)
  301. Builder.defineMacro("__ARM_FEATURE_FP16_SCALAR_ARITHMETIC", "1");
  302. if (HasDotProd)
  303. Builder.defineMacro("__ARM_FEATURE_DOTPROD", "1");
  304. if (HasMTE)
  305. Builder.defineMacro("__ARM_FEATURE_MEMORY_TAGGING", "1");
  306. if (HasTME)
  307. Builder.defineMacro("__ARM_FEATURE_TME", "1");
  308. if (HasMatMul)
  309. Builder.defineMacro("__ARM_FEATURE_MATMUL_INT8", "1");
  310. if (HasLSE)
  311. Builder.defineMacro("__ARM_FEATURE_ATOMICS", "1");
  312. if (HasBFloat16) {
  313. Builder.defineMacro("__ARM_FEATURE_BF16", "1");
  314. Builder.defineMacro("__ARM_FEATURE_BF16_VECTOR_ARITHMETIC", "1");
  315. Builder.defineMacro("__ARM_BF16_FORMAT_ALTERNATIVE", "1");
  316. Builder.defineMacro("__ARM_FEATURE_BF16_SCALAR_ARITHMETIC", "1");
  317. }
  318. if ((FPU & SveMode) && HasBFloat16) {
  319. Builder.defineMacro("__ARM_FEATURE_SVE_BF16", "1");
  320. }
  321. if ((FPU & SveMode) && HasMatmulFP64)
  322. Builder.defineMacro("__ARM_FEATURE_SVE_MATMUL_FP64", "1");
  323. if ((FPU & SveMode) && HasMatmulFP32)
  324. Builder.defineMacro("__ARM_FEATURE_SVE_MATMUL_FP32", "1");
  325. if ((FPU & SveMode) && HasMatMul)
  326. Builder.defineMacro("__ARM_FEATURE_SVE_MATMUL_INT8", "1");
  327. if ((FPU & NeonMode) && HasFP16FML)
  328. Builder.defineMacro("__ARM_FEATURE_FP16_FML", "1");
  329. if (Opts.hasSignReturnAddress()) {
  330. // Bitmask:
  331. // 0: Protection using the A key
  332. // 1: Protection using the B key
  333. // 2: Protection including leaf functions
  334. unsigned Value = 0;
  335. if (Opts.isSignReturnAddressWithAKey())
  336. Value |= (1 << 0);
  337. else
  338. Value |= (1 << 1);
  339. if (Opts.isSignReturnAddressScopeAll())
  340. Value |= (1 << 2);
  341. Builder.defineMacro("__ARM_FEATURE_PAC_DEFAULT", std::to_string(Value));
  342. }
  343. if (Opts.BranchTargetEnforcement)
  344. Builder.defineMacro("__ARM_FEATURE_BTI_DEFAULT", "1");
  345. if (HasLS64)
  346. Builder.defineMacro("__ARM_FEATURE_LS64", "1");
  347. if (HasRandGen)
  348. Builder.defineMacro("__ARM_FEATURE_RNG", "1");
  349. switch (ArchKind) {
  350. default:
  351. break;
  352. case llvm::AArch64::ArchKind::ARMV8_1A:
  353. getTargetDefinesARMV81A(Opts, Builder);
  354. break;
  355. case llvm::AArch64::ArchKind::ARMV8_2A:
  356. getTargetDefinesARMV82A(Opts, Builder);
  357. break;
  358. case llvm::AArch64::ArchKind::ARMV8_3A:
  359. getTargetDefinesARMV83A(Opts, Builder);
  360. break;
  361. case llvm::AArch64::ArchKind::ARMV8_4A:
  362. getTargetDefinesARMV84A(Opts, Builder);
  363. break;
  364. case llvm::AArch64::ArchKind::ARMV8_5A:
  365. getTargetDefinesARMV85A(Opts, Builder);
  366. break;
  367. case llvm::AArch64::ArchKind::ARMV8_6A:
  368. getTargetDefinesARMV86A(Opts, Builder);
  369. break;
  370. case llvm::AArch64::ArchKind::ARMV8_7A:
  371. getTargetDefinesARMV87A(Opts, Builder);
  372. break;
  373. case llvm::AArch64::ArchKind::ARMV8_8A:
  374. getTargetDefinesARMV88A(Opts, Builder);
  375. break;
  376. case llvm::AArch64::ArchKind::ARMV9A:
  377. getTargetDefinesARMV9A(Opts, Builder);
  378. break;
  379. case llvm::AArch64::ArchKind::ARMV9_1A:
  380. getTargetDefinesARMV91A(Opts, Builder);
  381. break;
  382. case llvm::AArch64::ArchKind::ARMV9_2A:
  383. getTargetDefinesARMV92A(Opts, Builder);
  384. break;
  385. case llvm::AArch64::ArchKind::ARMV9_3A:
  386. getTargetDefinesARMV93A(Opts, Builder);
  387. break;
  388. }
  389. // All of the __sync_(bool|val)_compare_and_swap_(1|2|4|8) builtins work.
  390. Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1");
  391. Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2");
  392. Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4");
  393. Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8");
  394. if (Opts.VScaleMin && Opts.VScaleMin == Opts.VScaleMax) {
  395. Builder.defineMacro("__ARM_FEATURE_SVE_BITS", Twine(Opts.VScaleMin * 128));
  396. Builder.defineMacro("__ARM_FEATURE_SVE_VECTOR_OPERATORS");
  397. }
  398. }
  399. ArrayRef<Builtin::Info> AArch64TargetInfo::getTargetBuiltins() const {
  400. return llvm::makeArrayRef(BuiltinInfo, clang::AArch64::LastTSBuiltin -
  401. Builtin::FirstTSBuiltin);
  402. }
  403. Optional<std::pair<unsigned, unsigned>>
  404. AArch64TargetInfo::getVScaleRange(const LangOptions &LangOpts) const {
  405. if (LangOpts.VScaleMin || LangOpts.VScaleMax)
  406. return std::pair<unsigned, unsigned>(
  407. LangOpts.VScaleMin ? LangOpts.VScaleMin : 1, LangOpts.VScaleMax);
  408. if (hasFeature("sve"))
  409. return std::pair<unsigned, unsigned>(1, 16);
  410. return None;
  411. }
  412. bool AArch64TargetInfo::hasFeature(StringRef Feature) const {
  413. return Feature == "aarch64" || Feature == "arm64" || Feature == "arm" ||
  414. (Feature == "neon" && (FPU & NeonMode)) ||
  415. ((Feature == "sve" || Feature == "sve2" || Feature == "sve2-bitperm" ||
  416. Feature == "sve2-aes" || Feature == "sve2-sha3" ||
  417. Feature == "sve2-sm4" || Feature == "f64mm" || Feature == "f32mm" ||
  418. Feature == "i8mm" || Feature == "bf16") &&
  419. (FPU & SveMode)) ||
  420. (Feature == "ls64" && HasLS64);
  421. }
  422. bool AArch64TargetInfo::handleTargetFeatures(std::vector<std::string> &Features,
  423. DiagnosticsEngine &Diags) {
  424. FPU = FPUMode;
  425. HasCRC = false;
  426. HasCrypto = false;
  427. HasAES = false;
  428. HasSHA2 = false;
  429. HasSHA3 = false;
  430. HasSM4 = false;
  431. HasUnaligned = true;
  432. HasFullFP16 = false;
  433. HasDotProd = false;
  434. HasFP16FML = false;
  435. HasMTE = false;
  436. HasTME = false;
  437. HasLS64 = false;
  438. HasRandGen = false;
  439. HasMatMul = false;
  440. HasBFloat16 = false;
  441. HasSVE2 = false;
  442. HasSVE2AES = false;
  443. HasSVE2SHA3 = false;
  444. HasSVE2SM4 = false;
  445. HasSVE2BitPerm = false;
  446. HasMatmulFP64 = false;
  447. HasMatmulFP32 = false;
  448. HasLSE = false;
  449. HasHBC = false;
  450. HasMOPS = false;
  451. ArchKind = llvm::AArch64::ArchKind::INVALID;
  452. for (const auto &Feature : Features) {
  453. if (Feature == "+neon")
  454. FPU |= NeonMode;
  455. if (Feature == "+sve") {
  456. FPU |= SveMode;
  457. HasFullFP16 = true;
  458. }
  459. if (Feature == "+sve2") {
  460. FPU |= SveMode;
  461. HasFullFP16 = true;
  462. HasSVE2 = true;
  463. }
  464. if (Feature == "+sve2-aes") {
  465. FPU |= SveMode;
  466. HasFullFP16 = true;
  467. HasSVE2 = true;
  468. HasSVE2AES = true;
  469. }
  470. if (Feature == "+sve2-sha3") {
  471. FPU |= SveMode;
  472. HasFullFP16 = true;
  473. HasSVE2 = true;
  474. HasSVE2SHA3 = true;
  475. }
  476. if (Feature == "+sve2-sm4") {
  477. FPU |= SveMode;
  478. HasFullFP16 = true;
  479. HasSVE2 = true;
  480. HasSVE2SM4 = true;
  481. }
  482. if (Feature == "+sve2-bitperm") {
  483. FPU |= SveMode;
  484. HasFullFP16 = true;
  485. HasSVE2 = true;
  486. HasSVE2BitPerm = true;
  487. }
  488. if (Feature == "+f32mm") {
  489. FPU |= SveMode;
  490. HasMatmulFP32 = true;
  491. }
  492. if (Feature == "+f64mm") {
  493. FPU |= SveMode;
  494. HasMatmulFP64 = true;
  495. }
  496. if (Feature == "+crc")
  497. HasCRC = true;
  498. if (Feature == "+crypto")
  499. HasCrypto = true;
  500. if (Feature == "+aes")
  501. HasAES = true;
  502. if (Feature == "+sha2")
  503. HasSHA2 = true;
  504. if (Feature == "+sha3") {
  505. HasSHA2 = true;
  506. HasSHA3 = true;
  507. }
  508. if (Feature == "+sm4")
  509. HasSM4 = true;
  510. if (Feature == "+strict-align")
  511. HasUnaligned = false;
  512. if (Feature == "+v8a")
  513. ArchKind = llvm::AArch64::ArchKind::ARMV8A;
  514. if (Feature == "+v8.1a")
  515. ArchKind = llvm::AArch64::ArchKind::ARMV8_1A;
  516. if (Feature == "+v8.2a")
  517. ArchKind = llvm::AArch64::ArchKind::ARMV8_2A;
  518. if (Feature == "+v8.3a")
  519. ArchKind = llvm::AArch64::ArchKind::ARMV8_3A;
  520. if (Feature == "+v8.4a")
  521. ArchKind = llvm::AArch64::ArchKind::ARMV8_4A;
  522. if (Feature == "+v8.5a")
  523. ArchKind = llvm::AArch64::ArchKind::ARMV8_5A;
  524. if (Feature == "+v8.6a")
  525. ArchKind = llvm::AArch64::ArchKind::ARMV8_6A;
  526. if (Feature == "+v8.7a")
  527. ArchKind = llvm::AArch64::ArchKind::ARMV8_7A;
  528. if (Feature == "+v8.8a")
  529. ArchKind = llvm::AArch64::ArchKind::ARMV8_8A;
  530. if (Feature == "+v9a")
  531. ArchKind = llvm::AArch64::ArchKind::ARMV9A;
  532. if (Feature == "+v9.1a")
  533. ArchKind = llvm::AArch64::ArchKind::ARMV9_1A;
  534. if (Feature == "+v9.2a")
  535. ArchKind = llvm::AArch64::ArchKind::ARMV9_2A;
  536. if (Feature == "+v9.3a")
  537. ArchKind = llvm::AArch64::ArchKind::ARMV9_3A;
  538. if (Feature == "+v8r")
  539. ArchKind = llvm::AArch64::ArchKind::ARMV8R;
  540. if (Feature == "+fullfp16")
  541. HasFullFP16 = true;
  542. if (Feature == "+dotprod")
  543. HasDotProd = true;
  544. if (Feature == "+fp16fml")
  545. HasFP16FML = true;
  546. if (Feature == "+mte")
  547. HasMTE = true;
  548. if (Feature == "+tme")
  549. HasTME = true;
  550. if (Feature == "+pauth")
  551. HasPAuth = true;
  552. if (Feature == "+i8mm")
  553. HasMatMul = true;
  554. if (Feature == "+bf16")
  555. HasBFloat16 = true;
  556. if (Feature == "+lse")
  557. HasLSE = true;
  558. if (Feature == "+ls64")
  559. HasLS64 = true;
  560. if (Feature == "+rand")
  561. HasRandGen = true;
  562. if (Feature == "+flagm")
  563. HasFlagM = true;
  564. if (Feature == "+hbc")
  565. HasHBC = true;
  566. }
  567. setDataLayout();
  568. return true;
  569. }
  570. TargetInfo::CallingConvCheckResult
  571. AArch64TargetInfo::checkCallingConvention(CallingConv CC) const {
  572. switch (CC) {
  573. case CC_C:
  574. case CC_Swift:
  575. case CC_SwiftAsync:
  576. case CC_PreserveMost:
  577. case CC_PreserveAll:
  578. case CC_OpenCLKernel:
  579. case CC_AArch64VectorCall:
  580. case CC_Win64:
  581. return CCCR_OK;
  582. default:
  583. return CCCR_Warning;
  584. }
  585. }
  586. bool AArch64TargetInfo::isCLZForZeroUndef() const { return false; }
  587. TargetInfo::BuiltinVaListKind AArch64TargetInfo::getBuiltinVaListKind() const {
  588. return TargetInfo::AArch64ABIBuiltinVaList;
  589. }
  590. const char *const AArch64TargetInfo::GCCRegNames[] = {
  591. // 32-bit Integer registers
  592. "w0", "w1", "w2", "w3", "w4", "w5", "w6", "w7", "w8", "w9", "w10", "w11",
  593. "w12", "w13", "w14", "w15", "w16", "w17", "w18", "w19", "w20", "w21", "w22",
  594. "w23", "w24", "w25", "w26", "w27", "w28", "w29", "w30", "wsp",
  595. // 64-bit Integer registers
  596. "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7", "x8", "x9", "x10", "x11",
  597. "x12", "x13", "x14", "x15", "x16", "x17", "x18", "x19", "x20", "x21", "x22",
  598. "x23", "x24", "x25", "x26", "x27", "x28", "fp", "lr", "sp",
  599. // 32-bit floating point regsisters
  600. "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", "s8", "s9", "s10", "s11",
  601. "s12", "s13", "s14", "s15", "s16", "s17", "s18", "s19", "s20", "s21", "s22",
  602. "s23", "s24", "s25", "s26", "s27", "s28", "s29", "s30", "s31",
  603. // 64-bit floating point regsisters
  604. "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", "d11",
  605. "d12", "d13", "d14", "d15", "d16", "d17", "d18", "d19", "d20", "d21", "d22",
  606. "d23", "d24", "d25", "d26", "d27", "d28", "d29", "d30", "d31",
  607. // Neon vector registers
  608. "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", "v11",
  609. "v12", "v13", "v14", "v15", "v16", "v17", "v18", "v19", "v20", "v21", "v22",
  610. "v23", "v24", "v25", "v26", "v27", "v28", "v29", "v30", "v31",
  611. // SVE vector registers
  612. "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z10",
  613. "z11", "z12", "z13", "z14", "z15", "z16", "z17", "z18", "z19", "z20", "z21",
  614. "z22", "z23", "z24", "z25", "z26", "z27", "z28", "z29", "z30", "z31",
  615. // SVE predicate registers
  616. "p0", "p1", "p2", "p3", "p4", "p5", "p6", "p7", "p8", "p9", "p10",
  617. "p11", "p12", "p13", "p14", "p15"
  618. };
  619. ArrayRef<const char *> AArch64TargetInfo::getGCCRegNames() const {
  620. return llvm::makeArrayRef(GCCRegNames);
  621. }
  622. const TargetInfo::GCCRegAlias AArch64TargetInfo::GCCRegAliases[] = {
  623. {{"w31"}, "wsp"},
  624. {{"x31"}, "sp"},
  625. // GCC rN registers are aliases of xN registers.
  626. {{"r0"}, "x0"},
  627. {{"r1"}, "x1"},
  628. {{"r2"}, "x2"},
  629. {{"r3"}, "x3"},
  630. {{"r4"}, "x4"},
  631. {{"r5"}, "x5"},
  632. {{"r6"}, "x6"},
  633. {{"r7"}, "x7"},
  634. {{"r8"}, "x8"},
  635. {{"r9"}, "x9"},
  636. {{"r10"}, "x10"},
  637. {{"r11"}, "x11"},
  638. {{"r12"}, "x12"},
  639. {{"r13"}, "x13"},
  640. {{"r14"}, "x14"},
  641. {{"r15"}, "x15"},
  642. {{"r16"}, "x16"},
  643. {{"r17"}, "x17"},
  644. {{"r18"}, "x18"},
  645. {{"r19"}, "x19"},
  646. {{"r20"}, "x20"},
  647. {{"r21"}, "x21"},
  648. {{"r22"}, "x22"},
  649. {{"r23"}, "x23"},
  650. {{"r24"}, "x24"},
  651. {{"r25"}, "x25"},
  652. {{"r26"}, "x26"},
  653. {{"r27"}, "x27"},
  654. {{"r28"}, "x28"},
  655. {{"r29", "x29"}, "fp"},
  656. {{"r30", "x30"}, "lr"},
  657. // The S/D/Q and W/X registers overlap, but aren't really aliases; we
  658. // don't want to substitute one of these for a different-sized one.
  659. };
  660. ArrayRef<TargetInfo::GCCRegAlias> AArch64TargetInfo::getGCCRegAliases() const {
  661. return llvm::makeArrayRef(GCCRegAliases);
  662. }
  663. bool AArch64TargetInfo::validateAsmConstraint(
  664. const char *&Name, TargetInfo::ConstraintInfo &Info) const {
  665. switch (*Name) {
  666. default:
  667. return false;
  668. case 'w': // Floating point and SIMD registers (V0-V31)
  669. Info.setAllowsRegister();
  670. return true;
  671. case 'I': // Constant that can be used with an ADD instruction
  672. case 'J': // Constant that can be used with a SUB instruction
  673. case 'K': // Constant that can be used with a 32-bit logical instruction
  674. case 'L': // Constant that can be used with a 64-bit logical instruction
  675. case 'M': // Constant that can be used as a 32-bit MOV immediate
  676. case 'N': // Constant that can be used as a 64-bit MOV immediate
  677. case 'Y': // Floating point constant zero
  678. case 'Z': // Integer constant zero
  679. return true;
  680. case 'Q': // A memory reference with base register and no offset
  681. Info.setAllowsMemory();
  682. return true;
  683. case 'S': // A symbolic address
  684. Info.setAllowsRegister();
  685. return true;
  686. case 'U':
  687. if (Name[1] == 'p' && (Name[2] == 'l' || Name[2] == 'a')) {
  688. // SVE predicate registers ("Upa"=P0-15, "Upl"=P0-P7)
  689. Info.setAllowsRegister();
  690. Name += 2;
  691. return true;
  692. }
  693. // Ump: A memory address suitable for ldp/stp in SI, DI, SF and DF modes.
  694. // Utf: A memory address suitable for ldp/stp in TF mode.
  695. // Usa: An absolute symbolic address.
  696. // Ush: The high part (bits 32:12) of a pc-relative symbolic address.
  697. // Better to return an error saying that it's an unrecognised constraint
  698. // even if this is a valid constraint in gcc.
  699. return false;
  700. case 'z': // Zero register, wzr or xzr
  701. Info.setAllowsRegister();
  702. return true;
  703. case 'x': // Floating point and SIMD registers (V0-V15)
  704. Info.setAllowsRegister();
  705. return true;
  706. case 'y': // SVE registers (V0-V7)
  707. Info.setAllowsRegister();
  708. return true;
  709. }
  710. return false;
  711. }
  712. bool AArch64TargetInfo::validateConstraintModifier(
  713. StringRef Constraint, char Modifier, unsigned Size,
  714. std::string &SuggestedModifier) const {
  715. // Strip off constraint modifiers.
  716. while (Constraint[0] == '=' || Constraint[0] == '+' || Constraint[0] == '&')
  717. Constraint = Constraint.substr(1);
  718. switch (Constraint[0]) {
  719. default:
  720. return true;
  721. case 'z':
  722. case 'r': {
  723. switch (Modifier) {
  724. case 'x':
  725. case 'w':
  726. // For now assume that the person knows what they're
  727. // doing with the modifier.
  728. return true;
  729. default:
  730. // By default an 'r' constraint will be in the 'x'
  731. // registers.
  732. if (Size == 64)
  733. return true;
  734. if (Size == 512)
  735. return HasLS64;
  736. SuggestedModifier = "w";
  737. return false;
  738. }
  739. }
  740. }
  741. }
  742. const char *AArch64TargetInfo::getClobbers() const { return ""; }
  743. int AArch64TargetInfo::getEHDataRegisterNumber(unsigned RegNo) const {
  744. if (RegNo == 0)
  745. return 0;
  746. if (RegNo == 1)
  747. return 1;
  748. return -1;
  749. }
  750. bool AArch64TargetInfo::hasInt128Type() const { return true; }
  751. AArch64leTargetInfo::AArch64leTargetInfo(const llvm::Triple &Triple,
  752. const TargetOptions &Opts)
  753. : AArch64TargetInfo(Triple, Opts) {}
  754. void AArch64leTargetInfo::setDataLayout() {
  755. if (getTriple().isOSBinFormatMachO()) {
  756. if(getTriple().isArch32Bit())
  757. resetDataLayout("e-m:o-p:32:32-i64:64-i128:128-n32:64-S128", "_");
  758. else
  759. resetDataLayout("e-m:o-i64:64-i128:128-n32:64-S128", "_");
  760. } else
  761. resetDataLayout("e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128");
  762. }
  763. void AArch64leTargetInfo::getTargetDefines(const LangOptions &Opts,
  764. MacroBuilder &Builder) const {
  765. Builder.defineMacro("__AARCH64EL__");
  766. AArch64TargetInfo::getTargetDefines(Opts, Builder);
  767. }
  768. AArch64beTargetInfo::AArch64beTargetInfo(const llvm::Triple &Triple,
  769. const TargetOptions &Opts)
  770. : AArch64TargetInfo(Triple, Opts) {}
  771. void AArch64beTargetInfo::getTargetDefines(const LangOptions &Opts,
  772. MacroBuilder &Builder) const {
  773. Builder.defineMacro("__AARCH64EB__");
  774. Builder.defineMacro("__AARCH_BIG_ENDIAN");
  775. Builder.defineMacro("__ARM_BIG_ENDIAN");
  776. AArch64TargetInfo::getTargetDefines(Opts, Builder);
  777. }
  778. void AArch64beTargetInfo::setDataLayout() {
  779. assert(!getTriple().isOSBinFormatMachO());
  780. resetDataLayout("E-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128");
  781. }
  782. WindowsARM64TargetInfo::WindowsARM64TargetInfo(const llvm::Triple &Triple,
  783. const TargetOptions &Opts)
  784. : WindowsTargetInfo<AArch64leTargetInfo>(Triple, Opts), Triple(Triple) {
  785. // This is an LLP64 platform.
  786. // int:4, long:4, long long:8, long double:8.
  787. IntWidth = IntAlign = 32;
  788. LongWidth = LongAlign = 32;
  789. DoubleAlign = LongLongAlign = 64;
  790. LongDoubleWidth = LongDoubleAlign = 64;
  791. LongDoubleFormat = &llvm::APFloat::IEEEdouble();
  792. IntMaxType = SignedLongLong;
  793. Int64Type = SignedLongLong;
  794. SizeType = UnsignedLongLong;
  795. PtrDiffType = SignedLongLong;
  796. IntPtrType = SignedLongLong;
  797. }
  798. void WindowsARM64TargetInfo::setDataLayout() {
  799. resetDataLayout(Triple.isOSBinFormatMachO()
  800. ? "e-m:o-i64:64-i128:128-n32:64-S128"
  801. : "e-m:w-p:64:64-i32:32-i64:64-i128:128-n32:64-S128",
  802. Triple.isOSBinFormatMachO() ? "_" : "");
  803. }
  804. TargetInfo::BuiltinVaListKind
  805. WindowsARM64TargetInfo::getBuiltinVaListKind() const {
  806. return TargetInfo::CharPtrBuiltinVaList;
  807. }
  808. TargetInfo::CallingConvCheckResult
  809. WindowsARM64TargetInfo::checkCallingConvention(CallingConv CC) const {
  810. switch (CC) {
  811. case CC_X86StdCall:
  812. case CC_X86ThisCall:
  813. case CC_X86FastCall:
  814. case CC_X86VectorCall:
  815. return CCCR_Ignore;
  816. case CC_C:
  817. case CC_OpenCLKernel:
  818. case CC_PreserveMost:
  819. case CC_PreserveAll:
  820. case CC_Swift:
  821. case CC_SwiftAsync:
  822. case CC_Win64:
  823. return CCCR_OK;
  824. default:
  825. return CCCR_Warning;
  826. }
  827. }
  828. MicrosoftARM64TargetInfo::MicrosoftARM64TargetInfo(const llvm::Triple &Triple,
  829. const TargetOptions &Opts)
  830. : WindowsARM64TargetInfo(Triple, Opts) {
  831. TheCXXABI.set(TargetCXXABI::Microsoft);
  832. }
  833. void MicrosoftARM64TargetInfo::getTargetDefines(const LangOptions &Opts,
  834. MacroBuilder &Builder) const {
  835. WindowsARM64TargetInfo::getTargetDefines(Opts, Builder);
  836. Builder.defineMacro("_M_ARM64", "1");
  837. }
  838. TargetInfo::CallingConvKind
  839. MicrosoftARM64TargetInfo::getCallingConvKind(bool ClangABICompat4) const {
  840. return CCK_MicrosoftWin64;
  841. }
  842. unsigned MicrosoftARM64TargetInfo::getMinGlobalAlign(uint64_t TypeSize) const {
  843. unsigned Align = WindowsARM64TargetInfo::getMinGlobalAlign(TypeSize);
  844. // MSVC does size based alignment for arm64 based on alignment section in
  845. // below document, replicate that to keep alignment consistent with object
  846. // files compiled by MSVC.
  847. // https://docs.microsoft.com/en-us/cpp/build/arm64-windows-abi-conventions
  848. if (TypeSize >= 512) { // TypeSize >= 64 bytes
  849. Align = std::max(Align, 128u); // align type at least 16 bytes
  850. } else if (TypeSize >= 64) { // TypeSize >= 8 bytes
  851. Align = std::max(Align, 64u); // align type at least 8 butes
  852. } else if (TypeSize >= 16) { // TypeSize >= 2 bytes
  853. Align = std::max(Align, 32u); // align type at least 4 bytes
  854. }
  855. return Align;
  856. }
  857. MinGWARM64TargetInfo::MinGWARM64TargetInfo(const llvm::Triple &Triple,
  858. const TargetOptions &Opts)
  859. : WindowsARM64TargetInfo(Triple, Opts) {
  860. TheCXXABI.set(TargetCXXABI::GenericAArch64);
  861. }
  862. DarwinAArch64TargetInfo::DarwinAArch64TargetInfo(const llvm::Triple &Triple,
  863. const TargetOptions &Opts)
  864. : DarwinTargetInfo<AArch64leTargetInfo>(Triple, Opts) {
  865. Int64Type = SignedLongLong;
  866. if (getTriple().isArch32Bit())
  867. IntMaxType = SignedLongLong;
  868. WCharType = SignedInt;
  869. UseSignedCharForObjCBool = false;
  870. LongDoubleWidth = LongDoubleAlign = SuitableAlign = 64;
  871. LongDoubleFormat = &llvm::APFloat::IEEEdouble();
  872. UseZeroLengthBitfieldAlignment = false;
  873. if (getTriple().isArch32Bit()) {
  874. UseBitFieldTypeAlignment = false;
  875. ZeroLengthBitfieldBoundary = 32;
  876. UseZeroLengthBitfieldAlignment = true;
  877. TheCXXABI.set(TargetCXXABI::WatchOS);
  878. } else
  879. TheCXXABI.set(TargetCXXABI::AppleARM64);
  880. }
  881. void DarwinAArch64TargetInfo::getOSDefines(const LangOptions &Opts,
  882. const llvm::Triple &Triple,
  883. MacroBuilder &Builder) const {
  884. Builder.defineMacro("__AARCH64_SIMD__");
  885. if (Triple.isArch32Bit())
  886. Builder.defineMacro("__ARM64_ARCH_8_32__");
  887. else
  888. Builder.defineMacro("__ARM64_ARCH_8__");
  889. Builder.defineMacro("__ARM_NEON__");
  890. Builder.defineMacro("__LITTLE_ENDIAN__");
  891. Builder.defineMacro("__REGISTER_PREFIX__", "");
  892. Builder.defineMacro("__arm64", "1");
  893. Builder.defineMacro("__arm64__", "1");
  894. if (Triple.isArm64e())
  895. Builder.defineMacro("__arm64e__", "1");
  896. getDarwinDefines(Builder, Opts, Triple, PlatformName, PlatformMinVersion);
  897. }
  898. TargetInfo::BuiltinVaListKind
  899. DarwinAArch64TargetInfo::getBuiltinVaListKind() const {
  900. return TargetInfo::CharPtrBuiltinVaList;
  901. }
  902. // 64-bit RenderScript is aarch64
  903. RenderScript64TargetInfo::RenderScript64TargetInfo(const llvm::Triple &Triple,
  904. const TargetOptions &Opts)
  905. : AArch64leTargetInfo(llvm::Triple("aarch64", Triple.getVendorName(),
  906. Triple.getOSName(),
  907. Triple.getEnvironmentName()),
  908. Opts) {
  909. IsRenderScriptTarget = true;
  910. }
  911. void RenderScript64TargetInfo::getTargetDefines(const LangOptions &Opts,
  912. MacroBuilder &Builder) const {
  913. Builder.defineMacro("__RENDERSCRIPT__");
  914. AArch64leTargetInfo::getTargetDefines(Opts, Builder);
  915. }