LLVM: lib/TargetParser/Triple.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

20#include

21#include

22using namespace llvm;

23

25 switch (Kind) {

27

28 case aarch64: return "aarch64";

31 case amdgcn: return "amdgcn";

32 case amdil64: return "amdil64";

33 case amdil: return "amdil";

34 case arc: return "arc";

35 case arm: return "arm";

36 case armeb: return "armeb";

37 case avr: return "avr";

38 case bpfeb: return "bpfeb";

39 case bpfel: return "bpfel";

40 case csky: return "csky";

41 case dxil: return "dxil";

42 case hexagon: return "hexagon";

43 case hsail64: return "hsail64";

44 case hsail: return "hsail";

45 case kalimba: return "kalimba";

46 case lanai: return "lanai";

49 case m68k: return "m68k";

50 case mips64: return "mips64";

51 case mips64el: return "mips64el";

52 case mips: return "mips";

53 case mipsel: return "mipsel";

54 case msp430: return "msp430";

55 case nvptx64: return "nvptx64";

56 case nvptx: return "nvptx";

57 case ppc64: return "powerpc64";

58 case ppc64le: return "powerpc64le";

59 case ppc: return "powerpc";

60 case ppcle: return "powerpcle";

61 case r600: return "r600";

64 case riscv32: return "riscv32";

65 case riscv64: return "riscv64";

67 return "riscv32be";

69 return "riscv64be";

70 case shave: return "shave";

71 case sparc: return "sparc";

72 case sparcel: return "sparcel";

73 case sparcv9: return "sparcv9";

74 case spir64: return "spir64";

75 case spir: return "spir";

76 case spirv: return "spirv";

77 case spirv32: return "spirv32";

78 case spirv64: return "spirv64";

79 case systemz: return "s390x";

80 case tce: return "tce";

81 case tcele: return "tcele";

82 case thumb: return "thumb";

83 case thumbeb: return "thumbeb";

84 case ve: return "ve";

85 case wasm32: return "wasm32";

86 case wasm64: return "wasm64";

87 case x86: return "i386";

88 case x86_64: return "x86_64";

89 case xcore: return "xcore";

90 case xtensa: return "xtensa";

91 }

92

94}

95

97 switch (Kind) {

100 return "mipsisa32r6";

101 break;

104 return "mipsisa32r6el";

105 break;

108 return "mipsisa64r6";

109 break;

112 return "mipsisa64r6el";

113 break;

116 return "arm64ec";

118 return "arm64e";

119 break;

121 switch (SubArch) {

123 return "spirv1.0";

125 return "spirv1.1";

127 return "spirv1.2";

129 return "spirv1.3";

131 return "spirv1.4";

133 return "spirv1.5";

135 return "spirv1.6";

136 default:

137 break;

138 }

139 break;

141 switch (SubArch) {

144 return "dxilv1.0";

146 return "dxilv1.1";

148 return "dxilv1.2";

150 return "dxilv1.3";

152 return "dxilv1.4";

154 return "dxilv1.5";

156 return "dxilv1.6";

158 return "dxilv1.7";

160 return "dxilv1.8";

162 return "dxilv1.9";

163 default:

164 break;

165 }

166 break;

167 default:

168 break;

169 }

171}

172

174 switch (Kind) {

175 default:

177

181

182 case arc: return "arc";

183

184 case arm:

187 case thumbeb: return "arm";

188

189 case avr: return "avr";

190

193 case ppc:

194 case ppcle: return "ppc";

195

196 case m68k: return "m68k";

197

201 case mips64el: return "mips";

202

203 case hexagon: return "hexagon";

204

205 case amdgcn: return "amdgcn";

206 case r600: return "r600";

207

209 case bpfeb: return "bpf";

210

213 case sparc: return "sparc";

214

215 case systemz: return "s390";

216

217 case x86:

218 case x86_64: return "x86";

219

220 case xcore: return "xcore";

221

222

223 case nvptx: return "nvvm";

224 case nvptx64: return "nvvm";

225

227 case amdil64: return "amdil";

228

230 case hsail64: return "hsail";

231

233 case spir64: return "spir";

234

237 case spirv64: return "spv";

238

239 case kalimba: return "kalimba";

240 case lanai: return "lanai";

241 case shave: return "shave";

243 case wasm64: return "wasm";

244

249 return "riscv";

250

251 case ve: return "ve";

252 case csky: return "csky";

253

256

257 case dxil: return "dx";

258

259 case xtensa: return "xtensa";

260 }

261}

262

264 switch (Kind) {

266

267 case AMD: return "amd";

268 case Apple: return "apple";

269 case CSR: return "csr";

271 case IBM: return "ibm";

274 return "intel";

275 case Mesa: return "mesa";

277 case NVIDIA: return "nvidia";

279 case PC: return "pc";

280 case SCEI: return "scei";

281 case SUSE: return "suse";

283 return "meta";

284 }

285

287}

288

290 switch (Kind) {

291 case UnknownOS: return "unknown";

292

293 case AIX: return "aix";

294 case AMDHSA: return "amdhsa";

295 case AMDPAL: return "amdpal";

296 case BridgeOS: return "bridgeos";

297 case CUDA: return "cuda";

298 case Darwin: return "darwin";

299 case DragonFly: return "dragonfly";

300 case DriverKit: return "driverkit";

301 case ELFIAMCU: return "elfiamcu";

302 case Emscripten: return "emscripten";

303 case FreeBSD: return "freebsd";

304 case Fuchsia: return "fuchsia";

305 case Haiku: return "haiku";

307 case Hurd: return "hurd";

308 case IOS: return "ios";

309 case KFreeBSD: return "kfreebsd";

310 case Linux: return "linux";

311 case Lv2: return "lv2";

312 case MacOSX: return "macosx";

314 return "managarm";

315 case Mesa3D: return "mesa3d";

316 case NVCL: return "nvcl";

317 case NetBSD: return "netbsd";

318 case OpenBSD: return "openbsd";

319 case PS4: return "ps4";

320 case PS5: return "ps5";

321 case RTEMS: return "rtems";

322 case Solaris: return "solaris";

323 case Serenity: return "serenity";

324 case TvOS: return "tvos";

325 case UEFI: return "uefi";

326 case WASI: return "wasi";

327 case WatchOS: return "watchos";

328 case Win32: return "windows";

329 case ZOS: return "zos";

331 case LiteOS: return "liteos";

332 case XROS: return "xros";

333 case Vulkan: return "vulkan";

335 return "cheriotrtos";

336 }

337

339}

340

342 switch (Kind) {

344 case Android: return "android";

345 case CODE16: return "code16";

346 case CoreCLR: return "coreclr";

347 case Cygnus: return "cygnus";

348 case EABI: return "eabi";

349 case EABIHF: return "eabihf";

350 case GNU: return "gnu";

351 case GNUT64: return "gnut64";

352 case GNUABI64: return "gnuabi64";

353 case GNUABIN32: return "gnuabin32";

354 case GNUEABI: return "gnueabi";

355 case GNUEABIT64: return "gnueabit64";

356 case GNUEABIHF: return "gnueabihf";

358 case GNUF32: return "gnuf32";

359 case GNUF64: return "gnuf64";

360 case GNUSF: return "gnusf";

361 case GNUX32: return "gnux32";

362 case GNUILP32: return "gnu_ilp32";

363 case Itanium: return "itanium";

364 case MSVC: return "msvc";

365 case MacABI: return "macabi";

366 case Musl: return "musl";

368 return "muslabin32";

370 return "muslabi64";

371 case MuslEABI: return "musleabi";

372 case MuslEABIHF: return "musleabihf";

374 return "muslf32";

376 return "muslsf";

377 case MuslX32: return "muslx32";

379 return "muslwali";

380 case Simulator: return "simulator";

381 case Pixel: return "pixel";

382 case Vertex: return "vertex";

383 case Geometry: return "geometry";

384 case Hull: return "hull";

385 case Domain: return "domain";

386 case Compute: return "compute";

387 case Library: return "library";

390 case AnyHit: return "anyhit";

391 case ClosestHit: return "closesthit";

392 case Miss: return "miss";

393 case Callable: return "callable";

394 case Mesh: return "mesh";

397 return "rootsignature";

399 return "opencl";

400 case OpenHOS: return "ohos";

402 return "pauthtest";

404 return "mtia";

406 return "llvm";

408 return "mlibc";

409 }

410

412}

413

415 switch (Kind) {

417 case COFF: return "coff";

418 case ELF: return "elf";

419 case GOFF: return "goff";

420 case MachO: return "macho";

421 case Wasm: return "wasm";

422 case XCOFF: return "xcoff";

424 case SPIRV: return "spirv";

425 }

427}

428

430 if (ArchName == "bpf") {

433 else

435 } else if (ArchName == "bpf_be" || ArchName == "bpfeb") {

437 } else if (ArchName == "bpf_le" || ArchName == "bpfel") {

439 } else {

441 }

442}

443

515

519

521 switch (ENDIAN) {

523 switch (ISA) {

526 break;

529 break;

532 break;

534 break;

535 }

536 break;

537 }

539 switch (ISA) {

542 break;

545 break;

548 break;

550 break;

551 }

552 break;

553 }

555 break;

556 }

557 }

558

560 if (ArchName.empty())

562

563

567

568

574 else

576 }

577

578 return arch;

579}

580

582 auto AT =

585

586 .Cases({"i786", "i886", "i986"}, Triple::x86)

587 .Cases({"amd64", "x86_64", "x86_64h"}, Triple::x86_64)

588 .Cases({"powerpc", "powerpcspe", "ppc", "ppc32"}, Triple::ppc)

589 .Cases({"powerpcle", "ppcle", "ppc32le"}, Triple::ppcle)

590 .Cases({"powerpc64", "ppu", "ppc64"}, Triple::ppc64)

609 .Cases({"mips", "mipseb", "mipsallegrex", "mipsisa32r6", "mipsr6"},

611 .Cases({"mipsel", "mipsallegrexel", "mipsisa32r6el", "mipsr6el"},

613 .Cases({"mips64", "mips64eb", "mipsn32", "mipsisa64r6", "mips64r6",

614 "mipsn32r6"},

616 .Cases({"mips64el", "mipsn32el", "mipsisa64r6el", "mips64r6el",

617 "mipsn32r6el"},

642 .Cases({"spirv32", "spirv32v1.0", "spirv32v1.1", "spirv32v1.2",

643 "spirv32v1.3", "spirv32v1.4", "spirv32v1.5", "spirv32v1.6"},

645 .Cases({"spirv64", "spirv64v1.0", "spirv64v1.1", "spirv64v1.2",

646 "spirv64v1.3", "spirv64v1.4", "spirv64v1.5", "spirv64v1.6"},

659 .Cases({"dxil", "dxilv1.0", "dxilv1.1", "dxilv1.2", "dxilv1.3",

660 "dxilv1.4", "dxilv1.5", "dxilv1.6", "dxilv1.7", "dxilv1.8",

661 "dxilv1.9"},

665

666

667

674 }

675

676 return AT;

677}

678

699

747

806

820

825

826 if (SubArchName == "powerpcspe")

828

829 if (SubArchName == "arm64e")

831

832 if (SubArchName == "arm64ec")

834

845

859

861

862

863 if (ARMSubArch.empty())

869

870

872 case ARM::ArchKind::ARMV4:

874 case ARM::ArchKind::ARMV4T:

876 case ARM::ArchKind::ARMV5T:

878 case ARM::ArchKind::ARMV5TE:

879 case ARM::ArchKind::IWMMXT:

880 case ARM::ArchKind::IWMMXT2:

881 case ARM::ArchKind::XSCALE:

882 case ARM::ArchKind::ARMV5TEJ:

884 case ARM::ArchKind::ARMV6:

886 case ARM::ArchKind::ARMV6K:

887 case ARM::ArchKind::ARMV6KZ:

889 case ARM::ArchKind::ARMV6T2:

891 case ARM::ArchKind::ARMV6M:

893 case ARM::ArchKind::ARMV7A:

894 case ARM::ArchKind::ARMV7R:

896 case ARM::ArchKind::ARMV7VE:

898 case ARM::ArchKind::ARMV7K:

900 case ARM::ArchKind::ARMV7M:

902 case ARM::ArchKind::ARMV7S:

904 case ARM::ArchKind::ARMV7EM:

906 case ARM::ArchKind::ARMV8A:

908 case ARM::ArchKind::ARMV8_1A:

910 case ARM::ArchKind::ARMV8_2A:

912 case ARM::ArchKind::ARMV8_3A:

914 case ARM::ArchKind::ARMV8_4A:

916 case ARM::ArchKind::ARMV8_5A:

918 case ARM::ArchKind::ARMV8_6A:

920 case ARM::ArchKind::ARMV8_7A:

922 case ARM::ArchKind::ARMV8_8A:

924 case ARM::ArchKind::ARMV8_9A:

926 case ARM::ArchKind::ARMV9A:

928 case ARM::ArchKind::ARMV9_1A:

930 case ARM::ArchKind::ARMV9_2A:

932 case ARM::ArchKind::ARMV9_3A:

934 case ARM::ArchKind::ARMV9_4A:

936 case ARM::ArchKind::ARMV9_5A:

938 case ARM::ArchKind::ARMV9_6A:

940 case ARM::ArchKind::ARMV9_7A:

942 case ARM::ArchKind::ARMV8R:

944 case ARM::ArchKind::ARMV8MBaseline:

946 case ARM::ArchKind::ARMV8MMainline:

948 case ARM::ArchKind::ARMV8_1MMainline:

950 default:

952 }

953}

954

956 switch (T.getArch()) {

964 switch (T.getOS()) {

968 default:

970 }

1017

1019 if (T.isOSWindows())

1022

1025 if (T.isOSAIX())

1027 if (T.isOSDarwin())

1030

1032 if (T.isOSzOS())

1035

1039

1044

1047 }

1049}

1050

1051

1052

1053

1054

1056

1058 StringRef(Data).split(Components, '-', 3);

1059 if (Components.size() > 0) {

1060 Arch = parseArch(Components[0]);

1062 if (Components.size() > 1) {

1064 if (Components.size() > 2) {

1065 OS = parseOS(Components[2]);

1066 if (Components.size() > 3) {

1068 ObjectFormat = parseFormat(Components[3]);

1069 }

1070 }

1071 } else {

1072 Environment =

1078 .Cases({"mips", "mipsel", "mipsr6", "mipsr6el"}, Triple::GNU)

1080 }

1081 }

1084}

1085

1087

1088

1089

1090

1091

1092

1093

1095 : Data((ArchStr + Twine('-') + VendorStr + Twine('-') + OSStr).str()),

1102}

1103

1104

1105

1106

1107

1108

1110 const Twine &EnvironmentStr)

1111 : Data((ArchStr + Twine('-') + VendorStr + Twine('-') + OSStr + Twine('-') +

1112 EnvironmentStr).str()),

1121}

1122

1124

1128

1129

1130 const unsigned SMMajor = 6;

1131 if (!Ver.empty()) {

1132 if (Ver.getMajor() == SMMajor) {

1133 if (std::optional SMMinor = Ver.getMinor()) {

1134 switch (*SMMinor) {

1135 case 0:

1137 case 1:

1139 case 2:

1141 case 3:

1143 case 4:

1145 case 5:

1147 case 6:

1149 case 7:

1151 case 8:

1153 case 9:

1155 default:

1157 }

1158 }

1159 }

1160 } else {

1161

1162

1163 if (ShaderModelStr == "shadermodel6.x") {

1165 }

1166 }

1167

1168

1170}

1171

1173 bool IsMinGW32 = false;

1174 bool IsCygwin = false;

1175

1176

1178 Str.split(Components, '-');

1179

1180

1181

1182

1183

1184

1186 if (Components.size() > 0)

1187 Arch = parseArch(Components[0]);

1189 if (Components.size() > 1)

1192 if (Components.size() > 2) {

1193 OS = parseOS(Components[2]);

1194 IsCygwin = Components[2].starts_with("cygwin") ||

1195 Components[2].starts_with("msys");

1196 IsMinGW32 = Components[2].starts_with("mingw");

1197 }

1199 if (Components.size() > 3)

1202 if (Components.size() > 4)

1203 ObjectFormat = parseFormat(Components[4]);

1204

1205

1206

1207 bool Found[4];

1212

1213

1214

1215

1216 for (unsigned Pos = 0; Pos != std::size(Found); ++Pos) {

1217 if (Found[Pos])

1218 continue;

1219

1220 for (unsigned Idx = 0; Idx != Components.size(); ++Idx) {

1221

1222 if (Idx < std::size(Found) && Found[Idx])

1223 continue;

1224

1225

1226 bool Valid = false;

1227 StringRef Comp = Components[Idx];

1228 switch (Pos) {

1230 case 0:

1233 break;

1234 case 1:

1237 break;

1238 case 2:

1242 Valid = OS != UnknownOS || IsCygwin || IsMinGW32;

1243 break;

1244 case 3:

1247 if (!Valid) {

1250 }

1251 break;

1252 }

1253 if (!Valid)

1254 continue;

1255

1256

1257

1258

1259

1260 if (Pos < Idx) {

1261

1262

1263 StringRef CurrentComponent("");

1264

1265 std::swap(CurrentComponent, Components[Idx]);

1266

1267

1268 for (unsigned i = Pos; !CurrentComponent.empty(); ++i) {

1269

1270 while (i < std::size(Found) && Found[i])

1271 ++i;

1272

1273

1274 std::swap(CurrentComponent, Components[i]);

1275 }

1276 } else if (Pos > Idx) {

1277

1278

1279

1280 do {

1281

1282 StringRef CurrentComponent("");

1283 for (unsigned i = Idx; i < Components.size();) {

1284

1285

1286 std::swap(CurrentComponent, Components[i]);

1287

1288 if (CurrentComponent.empty())

1289 break;

1290

1291 while (++i < std::size(Found) && Found[i])

1292 ;

1293 }

1294

1295 if (!CurrentComponent.empty())

1296 Components.push_back(CurrentComponent);

1297

1298

1299 while (++Idx < std::size(Found) && Found[Idx])

1300 ;

1301 } while (Idx < Pos);

1302 }

1303 assert(Pos < Components.size() && Components[Pos] == Comp &&

1304 "Component moved wrong!");

1305 Found[Pos] = true;

1306 break;

1307 }

1308 }

1309

1310

1311

1312 if (Found[0] && !Found[1] && !Found[2] && Found[3] &&

1313 Components[1] == "none" && Components[2].empty())

1314 std::swap(Components[1], Components[2]);

1315

1316

1318 if (C.empty())

1319 C = "unknown";

1320

1321

1322

1323 std::string NormalizedEnvironment;

1325 Components[3].starts_with("androideabi")) {

1326 StringRef AndroidVersion = Components[3].drop_front(strlen("androideabi"));

1327 if (AndroidVersion.empty()) {

1328 Components[3] = "android";

1329 } else {

1330 NormalizedEnvironment = Twine("android", AndroidVersion).str();

1331 Components[3] = NormalizedEnvironment;

1332 }

1333 }

1334

1335

1337 Components[3] = "gnueabihf";

1338

1340 Components.resize(4);

1341 Components[2] = "windows";

1344 Components[3] = "msvc";

1345 else

1347 }

1348 } else if (IsMinGW32) {

1349 Components.resize(4);

1350 Components[2] = "windows";

1351 Components[3] = "gnu";

1352 } else if (IsCygwin) {

1353 Components.resize(4);

1354 Components[2] = "windows";

1355 Components[3] = "cygnus";

1356 }

1357 if (IsMinGW32 || IsCygwin ||

1360 Components.resize(5);

1362 }

1363 }

1364

1365

1366

1367

1368

1369

1370 if (Components[0] == "dxil") {

1371 if (Components.size() > 4) {

1372 Components.resize(4);

1373 }

1374

1377 }

1378 }

1379

1380

1381 switch (Form) {

1383 break;

1387 Components.resize(static_cast<unsigned>(Form), "unknown");

1388 break;

1389 }

1390 }

1391

1392

1393 return join(Components, "-");

1394}

1395

1399

1402 return Tmp.split('-').first;

1403}

1404

1407 Tmp = Tmp.split('-').second;

1408 return Tmp.split('-').first;

1409}

1410

1413 Tmp = Tmp.split('-').second;

1414 return Tmp.split('-').second;

1415}

1416

1419 return Tmp.split('-').second;

1420}

1421

1425 return Version.withoutBuild();

1426}

1427

1431

1434

1435

1436

1437 if (EnvironmentName == "none")

1438 return "";

1439

1441 EnvironmentName.consume_front(EnvironmentTypeName);

1442

1443 if (EnvironmentName.contains("-")) {

1444

1446 StringRef ObjectFormatTypeName =

1448 const std::string tmp = (Twine("-") + ObjectFormatTypeName).str();

1450 }

1451 }

1452 return EnvironmentName;

1453}

1454

1457

1460 OSName = OSName.substr(OSTypeName.size());

1463 else if (OSName.starts_with("visionos"))

1465

1467}

1468

1471

1472 switch (getOS()) {

1473 default: llvm_unreachable("unexpected OS for Darwin triple");

1475

1476 if (Version.getMajor() == 0)

1478

1479 if (Version.getMajor() < 4) {

1480 return false;

1481 }

1482 if (Version.getMajor() <= 19) {

1484 } else if (Version.getMajor() < 25) {

1485

1487 } else {

1488

1490 }

1491 break;

1493

1494 if (Version.getMajor() == 0) {

1496 } else if (Version.getMajor() < 10) {

1497 return false;

1498 }

1499 break;

1500 case IOS:

1503

1504

1505

1506

1508 break;

1512 llvm_unreachable("OSX version isn't relevant for DriverKit");

1513 }

1514 return true;

1515}

1516

1518 switch (getOS()) {

1519 default: llvm_unreachable("unexpected OS for Darwin triple");

1522

1523

1524

1525

1527 case IOS:

1528 case TvOS: {

1530

1531 if (Version.getMajor() == 0)

1533 if (Version.getMajor() == 19)

1534

1538 }

1539 case XROS: {

1541

1542 if (Version.getMajor() < 3)

1543 return Version.withMajorReplaced(Version.getMajor() + 16);

1544

1545 if (Version.getMajor() == 3)

1549 }

1552

1553 if (Version.getMajor() == 12)

1558 }

1563 }

1564}

1565

1590

1592 switch (getOS()) {

1593 default:

1597 if (Version.getMajor() == 0)

1598 return Version.withMajorReplaced(19);

1600 }

1601}

1602

1606

1609

1611

1613

1615

1616

1619

1620 if (ValidVersionMap.contains(VulkanVersion) &&

1621 (ValidVersionMap.lookup(VulkanVersion) == SpirvVersion ||

1623 return VulkanVersion;

1624

1626}

1627

1634 Arch.consume_front("dxilv");

1636

1637

1638 return DXILVersion;

1639}

1640

1642 *this = Triple(Str);

1643}

1644

1648

1652

1656

1664

1672

1676

1680

1688

1693

1697

1699 switch (Arch) {

1701 return 0;

1702

1705 return 16;

1706

1742 return 32;

1743

1768 return 64;

1769 }

1771}

1772

1775 default:

1776 break;

1780 return 40;

1781 break;

1785 return 48;

1786 break;

1787 }

1788 return 32;

1789}

1790

1794

1798

1802

1815 break;

1816

1852

1853 break;

1854

1862 break;

1865 break;

1873 break;

1879 break;

1882 }

1883 return T;

1884}

1885

1907 break;

1908

1932

1933 break;

1934

1943 break;

1946 break;

1954 break;

1960 break;

1965 }

1966 return T;

1967}

1968

1971

1973 return T;

2007

2008

2009

2013 break;

2014

2019 break;

2022 break;

2027 break;

2030 break;

2033 default:

2034 llvm_unreachable("getBigEndianArchVariant: unknown triple.");

2035 }

2036 return T;

2037}

2038

2042 return T;

2043

2050

2051

2052

2056 break;

2057

2062 break;

2065 break;

2070 break;

2073 break;

2076 default:

2077 llvm_unreachable("getLittleEndianArchVariant: unknown triple.");

2078 }

2079 return T;

2080}

2081

2128 return true;

2129 default:

2130 return false;

2131 }

2132}

2133

2135

2136

2138

2139

2147 else

2149 (getVendor() == Other.getVendor() || IgnoreVendor) &&

2153 }

2154

2155

2156

2159 (getVendor() == Other.getVendor() || IgnoreVendor) &&

2161

2163 (getVendor() == Other.getVendor() || IgnoreVendor) &&

2167}

2168

2170

2172 if (Other.isOSVersionLT(*this))

2173 return str();

2174

2175 return Other.str();

2176}

2177

2179 unsigned Micro) const {

2181

2182

2185

2186

2187 if (Major == 10)

2189 assert(Major >= 11 && "Unexpected major version");

2190 if (Major < 25)

2191 return isOSVersionLT(Major - 11 + 20, Minor, Micro);

2193}

2194

2198 switch (getOS()) {

2200

2203

2204

2207

2210 break;

2212

2215 break;

2217

2220

2221

2226 default:

2227 break;

2228 }

2230}

2231

2234 bool IsInValidRange) {

2235 const unsigned MacOSRangeBump = 10;

2236 const unsigned IOSRangeBump = 7;

2237 const unsigned XROSRangeBump = 23;

2238 const unsigned WatchOSRangeBump = 14;

2239 switch (OSKind) {

2241

2244

2247 if (!IsInValidRange)

2248 return Version.withMajorReplaced(Version.getMajor() + MacOSRangeBump);

2249 break;

2250 }

2251 case IOS:

2252 case TvOS: {

2253

2256 if (!IsInValidRange)

2257 return Version.withMajorReplaced(Version.getMajor() + IOSRangeBump);

2258 break;

2259 }

2260 case XROS: {

2261

2264 if (!IsInValidRange)

2265 return Version.withMajorReplaced(Version.getMajor() + XROSRangeBump);

2266 break;

2267 }

2269

2272 if (!IsInValidRange)

2273 return Version.withMajorReplaced(Version.getMajor() + WatchOSRangeBump);

2274 break;

2275 }

2276 default:

2278 }

2279

2281}

2282

2284

2286 auto IsValid = [&](const VersionTuple &StartingVersion) {

2287 return !((Version > StartingVersion) && (Version < CommonVersion));

2288 };

2289 switch (OSKind) {

2292 return IsValid(StartingWatchOS);

2293 }

2294 case IOS:

2295 case TvOS: {

2297 return IsValid(StartingIOS);

2298 }

2301 return IsValid(StartingMacOS);

2302 }

2303 case XROS: {

2305 return IsValid(StartingXROS);

2306 }

2307 default:

2308 return true;

2309 }

2310

2312}

2313

2320 }

2321

2326

2331 }

2332

2335 }

2336

2340

2352 default:

2353 break;

2354 }

2355

2356

2359

2360

2362}

2363

2364

2366 "incorrect HLSL stage order");

2368 "incorrect HLSL stage order");

2370 "incorrect HLSL stage order");

2372 "incorrect HLSL stage order");

2374 "incorrect HLSL stage order");

2376 "incorrect HLSL stage order");

2378 "incorrect HLSL stage order");

2380 "incorrect HLSL stage order");

2382 "incorrect HLSL stage order");

2384 "incorrect HLSL stage order");

2386 "incorrect HLSL stage order");

2388 "incorrect HLSL stage order");

2390 "incorrect HLSL stage order");

2392 "incorrect HLSL stage order");

assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")

This file defines the DenseMap class.

This file implements the StringSwitch template, which mimics a switch() statement whose cases are str...

static Triple::EnvironmentType parseEnvironment(StringRef EnvironmentName)

Definition Triple.cpp:748

static VersionTuple parseVersionFromName(StringRef Name)

Definition Triple.cpp:1422

static Triple::ObjectFormatType getDefaultFormat(const Triple &T)

Definition Triple.cpp:955

static Triple::ArchType parseARMArch(StringRef ArchName)

Definition Triple.cpp:516

static Triple::OSType parseOS(StringRef OSName)

Definition Triple.cpp:700

static StringRef getDXILArchNameFromShaderModel(StringRef ShaderModelStr)

Definition Triple.cpp:1125

static Triple::ArchType parseBPFArch(StringRef ArchName)

Definition Triple.cpp:429

static Triple::SubArchType parseSubArch(StringRef SubArchName)

Definition Triple.cpp:821

static Triple::ObjectFormatType parseFormat(StringRef EnvironmentName)

Definition Triple.cpp:807

static Triple::ArchType parseArch(StringRef ArchName)

Definition Triple.cpp:581

static Triple::VendorType parseVendor(StringRef VendorName)

Definition Triple.cpp:679

Defines the llvm::VersionTuple class, which represents a version in the form major[....

ValueT lookup(const_arg_type_t< KeyT > Val) const

lookup - Return the entry for the specified key, or a default constructed value if no such entry exis...

bool contains(const_arg_type_t< KeyT > Val) const

Return true if the specified key is in the map, false otherwise.

void push_back(const T &Elt)

This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.

StringRef - Represent a constant reference to a string, i.e.

std::pair< StringRef, StringRef > split(char Separator) const

Split into two substrings around the first occurrence of a separator character.

bool consume_back(StringRef Suffix)

Returns true if this StringRef has the given suffix and removes that suffix.

constexpr StringRef substr(size_t Start, size_t N=npos) const

Return a reference to the substring from [Start, Start + N).

bool starts_with(StringRef Prefix) const

Check if this string starts with the given Prefix.

constexpr bool empty() const

empty - Check if the string is empty.

StringRef drop_front(size_t N=1) const

Return a StringRef equal to 'this' but with the first N elements dropped.

constexpr size_t size() const

size - Get the string size.

bool contains(StringRef Other) const

Return true if the given string is a substring of *this, and false otherwise.

bool consume_front(StringRef Prefix)

Returns true if this StringRef has the given prefix and removes that prefix.

bool ends_with(StringRef Suffix) const

Check if this string ends with the given Suffix.

A switch()-like statement whose cases are string literals.

StringSwitch & Case(StringLiteral S, T Value)

StringSwitch & StartsWith(StringLiteral S, T Value)

StringSwitch & EndsWith(StringLiteral S, T Value)

StringSwitch & Cases(std::initializer_list< StringLiteral > CaseStrings, T Value)

Triple - Helper class for working with autoconf configuration names.

LLVM_ABI bool isMacOSXVersionLT(unsigned Major, unsigned Minor=0, unsigned Micro=0) const

Comparison function for checking OS X version compatibility, which handles supporting skewed version ...

Definition Triple.cpp:2178

LLVM_ABI VersionTuple getOSVersion() const

Parse the version number from the OS name component of the triple, if present.

Definition Triple.cpp:1455

bool isPPC() const

Tests whether the target is PowerPC (32- or 64-bit LE or BE).

LLVM_ABI StringRef getVendorName() const

Get the vendor (second) component of the triple.

Definition Triple.cpp:1400

LLVM_ABI VersionTuple getWatchOSVersion() const

Parse the version number as with getOSVersion.

Definition Triple.cpp:1566

LLVM_ABI void setArchName(StringRef Str)

Set the architecture (first) component of the triple by name.

Definition Triple.cpp:1673

LLVM_ABI void setObjectFormat(ObjectFormatType Kind)

Set the object file format.

Definition Triple.cpp:1665

LLVM_ABI llvm::Triple get32BitArchVariant() const

Form a triple with a 32-bit variant of the current architecture.

Definition Triple.cpp:1803

bool isOSCygMing() const

Tests for either Cygwin or MinGW OS.

Triple()=default

Default constructor is the same as an empty string and leaves all triple fields unknown.

bool isThumb() const

Tests whether the target is Thumb (little and big endian).

static LLVM_ABI VersionTuple getCanonicalVersionForOS(OSType OSKind, const VersionTuple &Version, bool IsInValidRange)

Returns a canonicalized OS version number for the specified OS.

Definition Triple.cpp:2232

CanonicalForm

Canonical form.

unsigned getArchPointerBitWidth() const

Returns the pointer width of this architecture.

LLVM_ABI llvm::Triple getLittleEndianArchVariant() const

Form a triple with a little endian variant of the current architecture.

Definition Triple.cpp:2039

bool isBPF() const

Tests whether the target is eBPF.

static LLVM_ABI StringRef getVendorTypeName(VendorType Kind)

Get the canonical name for the Kind vendor.

Definition Triple.cpp:263

ObjectFormatType getObjectFormat() const

Get the object format for this triple.

SubArchType getSubArch() const

get the parsed subarchitecture type for this triple.

bool isX86() const

Tests whether the target is x86 (32- or 64-bit).

bool isArm64e() const

Tests whether the target is the Apple "arm64e" AArch64 subarch.

bool isOSBinFormatGOFF() const

Tests whether the OS uses the GOFF binary format.

bool isWindowsGNUEnvironment() const

LLVM_ABI void setVendorName(StringRef Str)

Set the vendor (second) component of the triple by name.

Definition Triple.cpp:1677

LLVM_ABI void setOSAndEnvironmentName(StringRef Str)

Set the operating system and optional environment components with a single string.

Definition Triple.cpp:1694

LLVM_ABI llvm::Triple get64BitArchVariant() const

Form a triple with a 64-bit variant of the current architecture.

Definition Triple.cpp:1886

LLVM_ABI bool isLittleEndian() const

Tests whether the target triple is little endian.

Definition Triple.cpp:2082

LLVM_ABI void setEnvironment(EnvironmentType Kind)

Set the environment (fourth) component of the triple to a known type.

Definition Triple.cpp:1657

LLVM_ABI StringRef getOSName() const

Get the operating system (third) component of the triple.

Definition Triple.cpp:1405

bool isSPIROrSPIRV() const

LLVM_ABI ExceptionHandling getDefaultExceptionHandling() const

Definition Triple.cpp:2314

LLVM_ABI void setTriple(const Twine &Str)

Set all components to the new triple Str.

Definition Triple.cpp:1641

OSType getOS() const

Get the parsed operating system type of this triple.

LLVM_ABI VersionTuple getEnvironmentVersion() const

Parse the version number from the OS name component of the triple, if present.

Definition Triple.cpp:1428

static LLVM_ABI std::string normalize(StringRef Str, CanonicalForm Form=CanonicalForm::ANY)

Turn an arbitrary machine specification into the canonical triple form (or something sensible that th...

Definition Triple.cpp:1172

static LLVM_ABI ArchType getArchTypeForLLVMName(StringRef Str)

The canonical type for the given LLVM architecture name (e.g., "x86").

Definition Triple.cpp:444

ArchType getArch() const

Get the parsed architecture type of this triple.

LLVM_ABI unsigned getTrampolineSize() const

Returns the trampoline size in bytes for this configuration.

Definition Triple.cpp:1773

bool isOSBinFormatCOFF() const

Tests whether the OS uses the COFF binary format.

LLVM_ABI StringRef getEnvironmentName() const

Get the optional environment (fourth) component of the triple, or "" if empty.

Definition Triple.cpp:1411

bool isSimulatorEnvironment() const

LLVM_ABI VersionTuple getDXILVersion() const

Parse the DXIL version number from the OSVersion and DXIL version (SubArch).

Definition Triple.cpp:1628

const std::string & str() const

EnvironmentType getEnvironment() const

Get the parsed environment type of this triple.

LLVM_ABI VersionTuple getVulkanVersion() const

Parse the Vulkan version number from the OSVersion and SPIR-V version (SubArch).

Definition Triple.cpp:1603

LLVM_ABI VersionTuple getDriverKitVersion() const

Parse the version number as with getOSVersion.

Definition Triple.cpp:1591

static LLVM_ABI StringRef getArchTypeName(ArchType Kind)

Get the canonical name for the Kind architecture.

Definition Triple.cpp:24

bool isOSBinFormatXCOFF() const

Tests whether the OS uses the XCOFF binary format.

static LLVM_ABI StringRef getOSTypeName(OSType Kind)

Get the canonical name for the Kind operating system.

Definition Triple.cpp:289

bool isARM() const

Tests whether the target is ARM (little and big endian).

LLVM_ABI std::string merge(const Triple &Other) const

Merge target triples.

Definition Triple.cpp:2169

bool isOSLinux() const

Tests whether the OS is Linux.

bool isRISCV() const

Tests whether the target is RISC-V (32- and 64-bit).

@ ImaginationTechnologies

bool isNVPTX() const

Tests whether the target is NVPTX (32- or 64-bit).

LLVM_ABI VersionTuple getMinimumSupportedOSVersion() const

Some platforms have different minimum supported OS versions that varies by the architecture specified...

Definition Triple.cpp:2195

LLVM_ABI bool isArch64Bit() const

Test whether the architecture is 64-bit.

Definition Triple.cpp:1791

LLVM_ABI StringRef getOSAndEnvironmentName() const

Get the operating system and optional environment components as a single string (separated by a '-' i...

Definition Triple.cpp:1417

@ ARMSubArch_v8m_mainline

@ ARMSubArch_v8m_baseline

@ ARMSubArch_v8_1m_mainline

LLVM_ABI bool getMacOSXVersion(VersionTuple &Version) const

Parse the version number as with getOSVersion and then translate generic "darwin" versions to the cor...

Definition Triple.cpp:1469

static LLVM_ABI bool isValidVersionForOS(OSType OSKind, const VersionTuple &Version)

Returns whether an OS version is invalid and would not map to an Apple OS.

Definition Triple.cpp:2283

bool isMacOSX() const

Is this a Mac OS X triple.

LLVM_ABI void setEnvironmentName(StringRef Str)

Set the optional environment (fourth) component of the triple by name.

Definition Triple.cpp:1689

LLVM_ABI void setOS(OSType Kind)

Set the operating system (third) component of the triple to a known type.

Definition Triple.cpp:1653

LLVM_ABI void setOSName(StringRef Str)

Set the operating system (third) component of the triple by name.

Definition Triple.cpp:1681

VendorType getVendor() const

Get the parsed vendor type of this triple.

bool isSPARC() const

Tests whether the target is SPARC.

bool isOSDarwin() const

Is this a "Darwin" OS (macOS, iOS, tvOS, watchOS, DriverKit, XROS, or bridgeOS).

static LLVM_ABI StringRef getEnvironmentTypeName(EnvironmentType Kind)

Get the canonical name for the Kind environment.

Definition Triple.cpp:341

bool isOSVersionLT(unsigned Major, unsigned Minor=0, unsigned Micro=0) const

Helper function for doing comparisons against version numbers included in the target triple.

bool empty() const

Whether the triple is empty / default constructed.

bool isMIPS() const

Tests whether the target is MIPS (little and big endian, 32- or 64-bit).

bool isWasm() const

Tests whether the target is wasm (32- and 64-bit).

LLVM_ABI StringRef getArchName() const

Get the architecture (first) component of the triple.

Definition Triple.cpp:1396

bool isMacCatalystEnvironment() const

bool isAArch64() const

Tests whether the target is AArch64 (little and big endian).

static LLVM_ABI StringRef getObjectFormatTypeName(ObjectFormatType ObjectFormat)

Get the name for the Object format.

Definition Triple.cpp:414

LLVM_ABI bool isArch16Bit() const

Test whether the architecture is 16-bit.

Definition Triple.cpp:1799

LLVM_ABI llvm::Triple getBigEndianArchVariant() const

Form a triple with a big endian variant of the current architecture.

Definition Triple.cpp:1969

LLVM_ABI VersionTuple getiOSVersion() const

Parse the version number as with getOSVersion.

Definition Triple.cpp:1517

LLVM_ABI StringRef getEnvironmentVersionString() const

Get the version component of the environment component as a single string (the version after the envi...

Definition Triple.cpp:1432

LLVM_ABI bool isArch32Bit() const

Test whether the architecture is 32-bit.

Definition Triple.cpp:1795

LLVM_ABI bool isCompatibleWith(const Triple &Other) const

Test whether target triples are compatible.

Definition Triple.cpp:2134

bool isOSBinFormatELF() const

Tests whether the OS uses the ELF binary format.

bool hasEnvironment() const

Does this triple have the optional environment (fourth) component?

static LLVM_ABI StringRef getArchTypePrefix(ArchType Kind)

Get the "prefix" canonical name for the Kind architecture.

Definition Triple.cpp:173

LLVM_ABI void setArch(ArchType Kind, SubArchType SubArch=NoSubArch)

Set the architecture (first) component of the triple to a known type.

Definition Triple.cpp:1645

LLVM_ABI void setVendor(VendorType Kind)

Set the vendor (second) component of the triple to a known type.

Definition Triple.cpp:1649

bool isLoongArch() const

Tests whether the target is LoongArch (32- and 64-bit).

bool isWindowsItaniumEnvironment() const

Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...

LLVM_ABI std::string str() const

Return the twine contents as a std::string.

Represents a version number in the form major[.minor[.subminor[.build]]].

unsigned getMajor() const

Retrieve the major version number.

LLVM_ABI bool tryParse(StringRef string)

Try to parse the given string as a version number.

bool empty() const

Determine whether this version information is empty (e.g., all version components are zero).

std::optional< unsigned > getMinor() const

Retrieve the minor version number, if provided.

#define llvm_unreachable(msg)

Marks that the current location is not supposed to be reachable.

LLVM_ABI StringRef getCanonicalArchName(StringRef Arch)

MArch is expected to be of the form (arm|thumb)?(eb)?(v.

LLVM_ABI ISAKind parseArchISA(StringRef Arch)

LLVM_ABI ArchKind parseArch(StringRef Arch)

LLVM_ABI ProfileKind parseArchProfile(StringRef Arch)

LLVM_ABI unsigned parseArchVersion(StringRef Arch)

LLVM_ABI EndianKind parseArchEndian(StringRef Arch)

@ C

The default llvm calling convention, compatible with C.

constexpr bool IsLittleEndianHost

This is an optimization pass for GlobalISel generic memory operations.

@ SjLj

setjmp/longjmp based exceptions

@ ZOS

z/OS MVS Exception Handling.

@ None

No exception support.

@ AIX

AIX Exception Handling.

@ DwarfCFI

DWARF-like instruction based exceptions.

@ WinEH

Windows Exception Handling.

FunctionAddr VTableAddr uintptr_t uintptr_t Version

LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)

std::string join(IteratorT Begin, IteratorT End, StringRef Separator)

Joins the strings in the range [Begin, End), adding Separator between the elements.

OutputIt move(R &&Range, OutputIt Out)

Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.

@ Default

The result values are uniform if and only if all operands are uniform.

Implement std::hash so that hash_code can be used in STL containers.

void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)

Implement std::swap in terms of BitVector swap.