1 //===-- ARMTargetParser - Parser for ARM target features --------*- 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 implements a target parser to recognise ARM hardware features 10 // such as FPU/CPU/ARCH/extensions and specific support such as HWDIV. 11 // 12 //===----------------------------------------------------------------------===// 13 14 #include "llvm/Support/ARMTargetParser.h" 15 #include "llvm/ADT/StringSwitch.h" 16 #include <cctype> 17 18 using namespace llvm; 19 20 static StringRef getHWDivSynonym(StringRef HWDiv) { 21 return StringSwitch<StringRef>(HWDiv) 22 .Case("thumb,arm", "arm,thumb") 23 .Default(HWDiv); 24 } 25 26 // Allows partial match, ex. "v7a" matches "armv7a". 27 ARM::ArchKind ARM::parseArch(StringRef Arch) { 28 Arch = getCanonicalArchName(Arch); 29 StringRef Syn = getArchSynonym(Arch); 30 for (const auto &A : ARCHNames) { 31 if (A.getName().endswith(Syn)) 32 return A.ID; 33 } 34 return ArchKind::INVALID; 35 } 36 37 // Version number (ex. v7 = 7). 38 unsigned ARM::parseArchVersion(StringRef Arch) { 39 Arch = getCanonicalArchName(Arch); 40 switch (parseArch(Arch)) { 41 case ArchKind::ARMV2: 42 case ArchKind::ARMV2A: 43 return 2; 44 case ArchKind::ARMV3: 45 case ArchKind::ARMV3M: 46 return 3; 47 case ArchKind::ARMV4: 48 case ArchKind::ARMV4T: 49 return 4; 50 case ArchKind::ARMV5T: 51 case ArchKind::ARMV5TE: 52 case ArchKind::IWMMXT: 53 case ArchKind::IWMMXT2: 54 case ArchKind::XSCALE: 55 case ArchKind::ARMV5TEJ: 56 return 5; 57 case ArchKind::ARMV6: 58 case ArchKind::ARMV6K: 59 case ArchKind::ARMV6T2: 60 case ArchKind::ARMV6KZ: 61 case ArchKind::ARMV6M: 62 return 6; 63 case ArchKind::ARMV7A: 64 case ArchKind::ARMV7VE: 65 case ArchKind::ARMV7R: 66 case ArchKind::ARMV7M: 67 case ArchKind::ARMV7S: 68 case ArchKind::ARMV7EM: 69 case ArchKind::ARMV7K: 70 return 7; 71 case ArchKind::ARMV8A: 72 case ArchKind::ARMV8_1A: 73 case ArchKind::ARMV8_2A: 74 case ArchKind::ARMV8_3A: 75 case ArchKind::ARMV8_4A: 76 case ArchKind::ARMV8_5A: 77 case ArchKind::ARMV8_6A: 78 case ArchKind::ARMV8R: 79 case ArchKind::ARMV8MBaseline: 80 case ArchKind::ARMV8MMainline: 81 case ArchKind::ARMV8_1MMainline: 82 return 8; 83 case ArchKind::INVALID: 84 return 0; 85 } 86 llvm_unreachable("Unhandled architecture"); 87 } 88 89 // Profile A/R/M 90 ARM::ProfileKind ARM::parseArchProfile(StringRef Arch) { 91 Arch = getCanonicalArchName(Arch); 92 switch (parseArch(Arch)) { 93 case ArchKind::ARMV6M: 94 case ArchKind::ARMV7M: 95 case ArchKind::ARMV7EM: 96 case ArchKind::ARMV8MMainline: 97 case ArchKind::ARMV8MBaseline: 98 case ArchKind::ARMV8_1MMainline: 99 return ProfileKind::M; 100 case ArchKind::ARMV7R: 101 case ArchKind::ARMV8R: 102 return ProfileKind::R; 103 case ArchKind::ARMV7A: 104 case ArchKind::ARMV7VE: 105 case ArchKind::ARMV7K: 106 case ArchKind::ARMV8A: 107 case ArchKind::ARMV8_1A: 108 case ArchKind::ARMV8_2A: 109 case ArchKind::ARMV8_3A: 110 case ArchKind::ARMV8_4A: 111 case ArchKind::ARMV8_5A: 112 case ArchKind::ARMV8_6A: 113 return ProfileKind::A; 114 case ArchKind::ARMV2: 115 case ArchKind::ARMV2A: 116 case ArchKind::ARMV3: 117 case ArchKind::ARMV3M: 118 case ArchKind::ARMV4: 119 case ArchKind::ARMV4T: 120 case ArchKind::ARMV5T: 121 case ArchKind::ARMV5TE: 122 case ArchKind::ARMV5TEJ: 123 case ArchKind::ARMV6: 124 case ArchKind::ARMV6K: 125 case ArchKind::ARMV6T2: 126 case ArchKind::ARMV6KZ: 127 case ArchKind::ARMV7S: 128 case ArchKind::IWMMXT: 129 case ArchKind::IWMMXT2: 130 case ArchKind::XSCALE: 131 case ArchKind::INVALID: 132 return ProfileKind::INVALID; 133 } 134 llvm_unreachable("Unhandled architecture"); 135 } 136 137 StringRef ARM::getArchSynonym(StringRef Arch) { 138 return StringSwitch<StringRef>(Arch) 139 .Case("v5", "v5t") 140 .Case("v5e", "v5te") 141 .Case("v6j", "v6") 142 .Case("v6hl", "v6k") 143 .Cases("v6m", "v6sm", "v6s-m", "v6-m") 144 .Cases("v6z", "v6zk", "v6kz") 145 .Cases("v7", "v7a", "v7hl", "v7l", "v7-a") 146 .Case("v7r", "v7-r") 147 .Case("v7m", "v7-m") 148 .Case("v7em", "v7e-m") 149 .Cases("v8", "v8a", "v8l", "aarch64", "arm64", "v8-a") 150 .Case("v8.1a", "v8.1-a") 151 .Case("v8.2a", "v8.2-a") 152 .Case("v8.3a", "v8.3-a") 153 .Case("v8.4a", "v8.4-a") 154 .Case("v8.5a", "v8.5-a") 155 .Case("v8.6a", "v8.6-a") 156 .Case("v8r", "v8-r") 157 .Case("v8m.base", "v8-m.base") 158 .Case("v8m.main", "v8-m.main") 159 .Case("v8.1m.main", "v8.1-m.main") 160 .Default(Arch); 161 } 162 163 bool ARM::getFPUFeatures(unsigned FPUKind, std::vector<StringRef> &Features) { 164 165 if (FPUKind >= FK_LAST || FPUKind == FK_INVALID) 166 return false; 167 168 static const struct FPUFeatureNameInfo { 169 const char *PlusName, *MinusName; 170 FPUVersion MinVersion; 171 FPURestriction MaxRestriction; 172 } FPUFeatureInfoList[] = { 173 // We have to specify the + and - versions of the name in full so 174 // that we can return them as static StringRefs. 175 // 176 // Also, the SubtargetFeatures ending in just "sp" are listed here 177 // under FPURestriction::None, which is the only FPURestriction in 178 // which they would be valid (since FPURestriction::SP doesn't 179 // exist). 180 {"+vfp2", "-vfp2", FPUVersion::VFPV2, FPURestriction::D16}, 181 {"+vfp2sp", "-vfp2sp", FPUVersion::VFPV2, FPURestriction::SP_D16}, 182 {"+vfp3", "-vfp3", FPUVersion::VFPV3, FPURestriction::None}, 183 {"+vfp3d16", "-vfp3d16", FPUVersion::VFPV3, FPURestriction::D16}, 184 {"+vfp3d16sp", "-vfp3d16sp", FPUVersion::VFPV3, FPURestriction::SP_D16}, 185 {"+vfp3sp", "-vfp3sp", FPUVersion::VFPV3, FPURestriction::None}, 186 {"+fp16", "-fp16", FPUVersion::VFPV3_FP16, FPURestriction::SP_D16}, 187 {"+vfp4", "-vfp4", FPUVersion::VFPV4, FPURestriction::None}, 188 {"+vfp4d16", "-vfp4d16", FPUVersion::VFPV4, FPURestriction::D16}, 189 {"+vfp4d16sp", "-vfp4d16sp", FPUVersion::VFPV4, FPURestriction::SP_D16}, 190 {"+vfp4sp", "-vfp4sp", FPUVersion::VFPV4, FPURestriction::None}, 191 {"+fp-armv8", "-fp-armv8", FPUVersion::VFPV5, FPURestriction::None}, 192 {"+fp-armv8d16", "-fp-armv8d16", FPUVersion::VFPV5, FPURestriction::D16}, 193 {"+fp-armv8d16sp", "-fp-armv8d16sp", FPUVersion::VFPV5, FPURestriction::SP_D16}, 194 {"+fp-armv8sp", "-fp-armv8sp", FPUVersion::VFPV5, FPURestriction::None}, 195 {"+fullfp16", "-fullfp16", FPUVersion::VFPV5_FULLFP16, FPURestriction::SP_D16}, 196 {"+fp64", "-fp64", FPUVersion::VFPV2, FPURestriction::D16}, 197 {"+d32", "-d32", FPUVersion::VFPV3, FPURestriction::None}, 198 }; 199 200 for (const auto &Info: FPUFeatureInfoList) { 201 if (FPUNames[FPUKind].FPUVer >= Info.MinVersion && 202 FPUNames[FPUKind].Restriction <= Info.MaxRestriction) 203 Features.push_back(Info.PlusName); 204 else 205 Features.push_back(Info.MinusName); 206 } 207 208 static const struct NeonFeatureNameInfo { 209 const char *PlusName, *MinusName; 210 NeonSupportLevel MinSupportLevel; 211 } NeonFeatureInfoList[] = { 212 {"+neon", "-neon", NeonSupportLevel::Neon}, 213 {"+crypto", "-crypto", NeonSupportLevel::Crypto}, 214 }; 215 216 for (const auto &Info: NeonFeatureInfoList) { 217 if (FPUNames[FPUKind].NeonSupport >= Info.MinSupportLevel) 218 Features.push_back(Info.PlusName); 219 else 220 Features.push_back(Info.MinusName); 221 } 222 223 return true; 224 } 225 226 // Little/Big endian 227 ARM::EndianKind ARM::parseArchEndian(StringRef Arch) { 228 if (Arch.startswith("armeb") || Arch.startswith("thumbeb") || 229 Arch.startswith("aarch64_be")) 230 return EndianKind::BIG; 231 232 if (Arch.startswith("arm") || Arch.startswith("thumb")) { 233 if (Arch.endswith("eb")) 234 return EndianKind::BIG; 235 else 236 return EndianKind::LITTLE; 237 } 238 239 if (Arch.startswith("aarch64") || Arch.startswith("aarch64_32")) 240 return EndianKind::LITTLE; 241 242 return EndianKind::INVALID; 243 } 244 245 // ARM, Thumb, AArch64 246 ARM::ISAKind ARM::parseArchISA(StringRef Arch) { 247 return StringSwitch<ISAKind>(Arch) 248 .StartsWith("aarch64", ISAKind::AARCH64) 249 .StartsWith("arm64", ISAKind::AARCH64) 250 .StartsWith("thumb", ISAKind::THUMB) 251 .StartsWith("arm", ISAKind::ARM) 252 .Default(ISAKind::INVALID); 253 } 254 255 unsigned ARM::parseFPU(StringRef FPU) { 256 StringRef Syn = getFPUSynonym(FPU); 257 for (const auto F : FPUNames) { 258 if (Syn == F.getName()) 259 return F.ID; 260 } 261 return FK_INVALID; 262 } 263 264 ARM::NeonSupportLevel ARM::getFPUNeonSupportLevel(unsigned FPUKind) { 265 if (FPUKind >= FK_LAST) 266 return NeonSupportLevel::None; 267 return FPUNames[FPUKind].NeonSupport; 268 } 269 270 // MArch is expected to be of the form (arm|thumb)?(eb)?(v.+)?(eb)?, but 271 // (iwmmxt|xscale)(eb)? is also permitted. If the former, return 272 // "v.+", if the latter, return unmodified string, minus 'eb'. 273 // If invalid, return empty string. 274 StringRef ARM::getCanonicalArchName(StringRef Arch) { 275 size_t offset = StringRef::npos; 276 StringRef A = Arch; 277 StringRef Error = ""; 278 279 // Begins with "arm" / "thumb", move past it. 280 if (A.startswith("arm64_32")) 281 offset = 8; 282 else if (A.startswith("arm64")) 283 offset = 5; 284 else if (A.startswith("aarch64_32")) 285 offset = 10; 286 else if (A.startswith("arm")) 287 offset = 3; 288 else if (A.startswith("thumb")) 289 offset = 5; 290 else if (A.startswith("aarch64")) { 291 offset = 7; 292 // AArch64 uses "_be", not "eb" suffix. 293 if (A.find("eb") != StringRef::npos) 294 return Error; 295 if (A.substr(offset, 3) == "_be") 296 offset += 3; 297 } 298 299 // Ex. "armebv7", move past the "eb". 300 if (offset != StringRef::npos && A.substr(offset, 2) == "eb") 301 offset += 2; 302 // Or, if it ends with eb ("armv7eb"), chop it off. 303 else if (A.endswith("eb")) 304 A = A.substr(0, A.size() - 2); 305 // Trim the head 306 if (offset != StringRef::npos) 307 A = A.substr(offset); 308 309 // Empty string means offset reached the end, which means it's valid. 310 if (A.empty()) 311 return Arch; 312 313 // Only match non-marketing names 314 if (offset != StringRef::npos) { 315 // Must start with 'vN'. 316 if (A.size() >= 2 && (A[0] != 'v' || !std::isdigit(A[1]))) 317 return Error; 318 // Can't have an extra 'eb'. 319 if (A.find("eb") != StringRef::npos) 320 return Error; 321 } 322 323 // Arch will either be a 'v' name (v7a) or a marketing name (xscale). 324 return A; 325 } 326 327 StringRef ARM::getFPUSynonym(StringRef FPU) { 328 return StringSwitch<StringRef>(FPU) 329 .Cases("fpa", "fpe2", "fpe3", "maverick", "invalid") // Unsupported 330 .Case("vfp2", "vfpv2") 331 .Case("vfp3", "vfpv3") 332 .Case("vfp4", "vfpv4") 333 .Case("vfp3-d16", "vfpv3-d16") 334 .Case("vfp4-d16", "vfpv4-d16") 335 .Cases("fp4-sp-d16", "vfpv4-sp-d16", "fpv4-sp-d16") 336 .Cases("fp4-dp-d16", "fpv4-dp-d16", "vfpv4-d16") 337 .Case("fp5-sp-d16", "fpv5-sp-d16") 338 .Cases("fp5-dp-d16", "fpv5-dp-d16", "fpv5-d16") 339 // FIXME: Clang uses it, but it's bogus, since neon defaults to vfpv3. 340 .Case("neon-vfpv3", "neon") 341 .Default(FPU); 342 } 343 344 StringRef ARM::getFPUName(unsigned FPUKind) { 345 if (FPUKind >= FK_LAST) 346 return StringRef(); 347 return FPUNames[FPUKind].getName(); 348 } 349 350 ARM::FPUVersion ARM::getFPUVersion(unsigned FPUKind) { 351 if (FPUKind >= FK_LAST) 352 return FPUVersion::NONE; 353 return FPUNames[FPUKind].FPUVer; 354 } 355 356 ARM::FPURestriction ARM::getFPURestriction(unsigned FPUKind) { 357 if (FPUKind >= FK_LAST) 358 return FPURestriction::None; 359 return FPUNames[FPUKind].Restriction; 360 } 361 362 unsigned ARM::getDefaultFPU(StringRef CPU, ARM::ArchKind AK) { 363 if (CPU == "generic") 364 return ARM::ARCHNames[static_cast<unsigned>(AK)].DefaultFPU; 365 366 return StringSwitch<unsigned>(CPU) 367 #define ARM_CPU_NAME(NAME, ID, DEFAULT_FPU, IS_DEFAULT, DEFAULT_EXT) \ 368 .Case(NAME, DEFAULT_FPU) 369 #include "llvm/Support/ARMTargetParser.def" 370 .Default(ARM::FK_INVALID); 371 } 372 373 uint64_t ARM::getDefaultExtensions(StringRef CPU, ARM::ArchKind AK) { 374 if (CPU == "generic") 375 return ARM::ARCHNames[static_cast<unsigned>(AK)].ArchBaseExtensions; 376 377 return StringSwitch<uint64_t>(CPU) 378 #define ARM_CPU_NAME(NAME, ID, DEFAULT_FPU, IS_DEFAULT, DEFAULT_EXT) \ 379 .Case(NAME, \ 380 ARCHNames[static_cast<unsigned>(ArchKind::ID)].ArchBaseExtensions | \ 381 DEFAULT_EXT) 382 #include "llvm/Support/ARMTargetParser.def" 383 .Default(ARM::AEK_INVALID); 384 } 385 386 bool ARM::getHWDivFeatures(uint64_t HWDivKind, 387 std::vector<StringRef> &Features) { 388 389 if (HWDivKind == AEK_INVALID) 390 return false; 391 392 if (HWDivKind & AEK_HWDIVARM) 393 Features.push_back("+hwdiv-arm"); 394 else 395 Features.push_back("-hwdiv-arm"); 396 397 if (HWDivKind & AEK_HWDIVTHUMB) 398 Features.push_back("+hwdiv"); 399 else 400 Features.push_back("-hwdiv"); 401 402 return true; 403 } 404 405 bool ARM::getExtensionFeatures(uint64_t Extensions, 406 std::vector<StringRef> &Features) { 407 408 if (Extensions == AEK_INVALID) 409 return false; 410 411 for (const auto AE : ARCHExtNames) { 412 if ((Extensions & AE.ID) == AE.ID && AE.Feature) 413 Features.push_back(AE.Feature); 414 else if (AE.NegFeature) 415 Features.push_back(AE.NegFeature); 416 } 417 418 return getHWDivFeatures(Extensions, Features); 419 } 420 421 StringRef ARM::getArchName(ARM::ArchKind AK) { 422 return ARCHNames[static_cast<unsigned>(AK)].getName(); 423 } 424 425 StringRef ARM::getCPUAttr(ARM::ArchKind AK) { 426 return ARCHNames[static_cast<unsigned>(AK)].getCPUAttr(); 427 } 428 429 StringRef ARM::getSubArch(ARM::ArchKind AK) { 430 return ARCHNames[static_cast<unsigned>(AK)].getSubArch(); 431 } 432 433 unsigned ARM::getArchAttr(ARM::ArchKind AK) { 434 return ARCHNames[static_cast<unsigned>(AK)].ArchAttr; 435 } 436 437 StringRef ARM::getArchExtName(uint64_t ArchExtKind) { 438 for (const auto AE : ARCHExtNames) { 439 if (ArchExtKind == AE.ID) 440 return AE.getName(); 441 } 442 return StringRef(); 443 } 444 445 static bool stripNegationPrefix(StringRef &Name) { 446 if (Name.startswith("no")) { 447 Name = Name.substr(2); 448 return true; 449 } 450 return false; 451 } 452 453 StringRef ARM::getArchExtFeature(StringRef ArchExt) { 454 bool Negated = stripNegationPrefix(ArchExt); 455 for (const auto AE : ARCHExtNames) { 456 if (AE.Feature && ArchExt == AE.getName()) 457 return StringRef(Negated ? AE.NegFeature : AE.Feature); 458 } 459 460 return StringRef(); 461 } 462 463 static unsigned findDoublePrecisionFPU(unsigned InputFPUKind) { 464 const ARM::FPUName &InputFPU = ARM::FPUNames[InputFPUKind]; 465 466 // If the input FPU already supports double-precision, then there 467 // isn't any different FPU we can return here. 468 // 469 // The current available FPURestriction values are None (no 470 // restriction), D16 (only 16 d-regs) and SP_D16 (16 d-regs 471 // and single precision only); there's no value representing 472 // SP restriction without D16. So this test just means 'is it 473 // SP only?'. 474 if (InputFPU.Restriction != ARM::FPURestriction::SP_D16) 475 return ARM::FK_INVALID; 476 477 // Otherwise, look for an FPU entry with all the same fields, except 478 // that SP_D16 has been replaced with just D16, representing adding 479 // double precision and not changing anything else. 480 for (const ARM::FPUName &CandidateFPU : ARM::FPUNames) { 481 if (CandidateFPU.FPUVer == InputFPU.FPUVer && 482 CandidateFPU.NeonSupport == InputFPU.NeonSupport && 483 CandidateFPU.Restriction == ARM::FPURestriction::D16) { 484 return CandidateFPU.ID; 485 } 486 } 487 488 // nothing found 489 return ARM::FK_INVALID; 490 } 491 492 bool ARM::appendArchExtFeatures( 493 StringRef CPU, ARM::ArchKind AK, StringRef ArchExt, 494 std::vector<StringRef> &Features) { 495 496 size_t StartingNumFeatures = Features.size(); 497 const bool Negated = stripNegationPrefix(ArchExt); 498 uint64_t ID = parseArchExt(ArchExt); 499 500 if (ID == AEK_INVALID) 501 return false; 502 503 for (const auto AE : ARCHExtNames) { 504 if (Negated) { 505 if ((AE.ID & ID) == ID && AE.NegFeature) 506 Features.push_back(AE.NegFeature); 507 } else { 508 if ((AE.ID & ID) == AE.ID && AE.Feature) 509 Features.push_back(AE.Feature); 510 } 511 } 512 513 if (CPU == "") 514 CPU = "generic"; 515 516 if (ArchExt == "fp" || ArchExt == "fp.dp") { 517 unsigned FPUKind; 518 if (ArchExt == "fp.dp") { 519 if (Negated) { 520 Features.push_back("-fp64"); 521 return true; 522 } 523 FPUKind = findDoublePrecisionFPU(getDefaultFPU(CPU, AK)); 524 } else if (Negated) { 525 FPUKind = ARM::FK_NONE; 526 } else { 527 FPUKind = getDefaultFPU(CPU, AK); 528 } 529 return ARM::getFPUFeatures(FPUKind, Features); 530 } 531 return StartingNumFeatures != Features.size(); 532 } 533 534 StringRef ARM::getHWDivName(uint64_t HWDivKind) { 535 for (const auto D : HWDivNames) { 536 if (HWDivKind == D.ID) 537 return D.getName(); 538 } 539 return StringRef(); 540 } 541 542 StringRef ARM::getDefaultCPU(StringRef Arch) { 543 ArchKind AK = parseArch(Arch); 544 if (AK == ArchKind::INVALID) 545 return StringRef(); 546 547 // Look for multiple AKs to find the default for pair AK+Name. 548 for (const auto CPU : CPUNames) { 549 if (CPU.ArchID == AK && CPU.Default) 550 return CPU.getName(); 551 } 552 553 // If we can't find a default then target the architecture instead 554 return "generic"; 555 } 556 557 uint64_t ARM::parseHWDiv(StringRef HWDiv) { 558 StringRef Syn = getHWDivSynonym(HWDiv); 559 for (const auto D : HWDivNames) { 560 if (Syn == D.getName()) 561 return D.ID; 562 } 563 return AEK_INVALID; 564 } 565 566 uint64_t ARM::parseArchExt(StringRef ArchExt) { 567 for (const auto A : ARCHExtNames) { 568 if (ArchExt == A.getName()) 569 return A.ID; 570 } 571 return AEK_INVALID; 572 } 573 574 ARM::ArchKind ARM::parseCPUArch(StringRef CPU) { 575 for (const auto C : CPUNames) { 576 if (CPU == C.getName()) 577 return C.ArchID; 578 } 579 return ArchKind::INVALID; 580 } 581 582 void ARM::fillValidCPUArchList(SmallVectorImpl<StringRef> &Values) { 583 for (const CpuNames<ArchKind> &Arch : CPUNames) { 584 if (Arch.ArchID != ArchKind::INVALID) 585 Values.push_back(Arch.getName()); 586 } 587 } 588 589 StringRef ARM::computeDefaultTargetABI(const Triple &TT, StringRef CPU) { 590 StringRef ArchName = 591 CPU.empty() ? TT.getArchName() : getArchName(parseCPUArch(CPU)); 592 593 if (TT.isOSBinFormatMachO()) { 594 if (TT.getEnvironment() == Triple::EABI || 595 TT.getOS() == Triple::UnknownOS || 596 parseArchProfile(ArchName) == ProfileKind::M) 597 return "aapcs"; 598 if (TT.isWatchABI()) 599 return "aapcs16"; 600 return "apcs-gnu"; 601 } else if (TT.isOSWindows()) 602 // FIXME: this is invalid for WindowsCE. 603 return "aapcs"; 604 605 // Select the default based on the platform. 606 switch (TT.getEnvironment()) { 607 case Triple::Android: 608 case Triple::GNUEABI: 609 case Triple::GNUEABIHF: 610 case Triple::MuslEABI: 611 case Triple::MuslEABIHF: 612 return "aapcs-linux"; 613 case Triple::EABIHF: 614 case Triple::EABI: 615 return "aapcs"; 616 default: 617 if (TT.isOSNetBSD()) 618 return "apcs-gnu"; 619 if (TT.isOSOpenBSD()) 620 return "aapcs-linux"; 621 return "aapcs"; 622 } 623 } 624