LLVM 19.0.0git
Triple.h
Go to the documentation of this file.
1//===-- llvm/TargetParser/Triple.h - Target triple helper class--*- 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#ifndef LLVM_TARGETPARSER_TRIPLE_H
10#define LLVM_TARGETPARSER_TRIPLE_H
11
12#include "llvm/ADT/Twine.h"
14
15// Some system headers or GCC predefined macros conflict with identifiers in
16// this file. Undefine them here.
17#undef NetBSD
18#undef mips
19#undef sparc
20
21namespace llvm {
22
23/// Triple - Helper class for working with autoconf configuration names. For
24/// historical reasons, we also call these 'triples' (they used to contain
25/// exactly three fields).
26///
27/// Configuration names are strings in the canonical form:
28/// ARCHITECTURE-VENDOR-OPERATING_SYSTEM
29/// or
30/// ARCHITECTURE-VENDOR-OPERATING_SYSTEM-ENVIRONMENT
31///
32/// This class is used for clients which want to support arbitrary
33/// configuration names, but also want to implement certain special
34/// behavior for particular configurations. This class isolates the mapping
35/// from the components of the configuration name to well known IDs.
36///
37/// At its core the Triple class is designed to be a wrapper for a triple
38/// string; the constructor does not change or normalize the triple string.
39/// Clients that need to handle the non-canonical triples that users often
40/// specify should use the normalize method.
41///
42/// See autoconf/config.guess for a glimpse into what configuration names
43/// look like in practice.
44class Triple {
45public:
46 enum ArchType {
48
49 arm, // ARM (little endian): arm, armv.*, xscale
50 armeb, // ARM (big endian): armeb
51 aarch64, // AArch64 (little endian): aarch64
52 aarch64_be, // AArch64 (big endian): aarch64_be
53 aarch64_32, // AArch64 (little endian) ILP32: aarch64_32
54 arc, // ARC: Synopsys ARC
55 avr, // AVR: Atmel AVR microcontroller
56 bpfel, // eBPF or extended BPF or 64-bit BPF (little endian)
57 bpfeb, // eBPF or extended BPF or 64-bit BPF (big endian)
58 csky, // CSKY: csky
59 dxil, // DXIL 32-bit DirectX bytecode
60 hexagon, // Hexagon: hexagon
61 loongarch32, // LoongArch (32-bit): loongarch32
62 loongarch64, // LoongArch (64-bit): loongarch64
63 m68k, // M68k: Motorola 680x0 family
64 mips, // MIPS: mips, mipsallegrex, mipsr6
65 mipsel, // MIPSEL: mipsel, mipsallegrexe, mipsr6el
66 mips64, // MIPS64: mips64, mips64r6, mipsn32, mipsn32r6
67 mips64el, // MIPS64EL: mips64el, mips64r6el, mipsn32el, mipsn32r6el
68 msp430, // MSP430: msp430
69 ppc, // PPC: powerpc
70 ppcle, // PPCLE: powerpc (little endian)
71 ppc64, // PPC64: powerpc64, ppu
72 ppc64le, // PPC64LE: powerpc64le
73 r600, // R600: AMD GPUs HD2XXX - HD6XXX
74 amdgcn, // AMDGCN: AMD GCN GPUs
75 riscv32, // RISC-V (32-bit): riscv32
76 riscv64, // RISC-V (64-bit): riscv64
77 sparc, // Sparc: sparc
78 sparcv9, // Sparcv9: Sparcv9
79 sparcel, // Sparc: (endianness = little). NB: 'Sparcle' is a CPU variant
80 systemz, // SystemZ: s390x
81 tce, // TCE (http://tce.cs.tut.fi/): tce
82 tcele, // TCE little endian (http://tce.cs.tut.fi/): tcele
83 thumb, // Thumb (little endian): thumb, thumbv.*
84 thumbeb, // Thumb (big endian): thumbeb
85 x86, // X86: i[3-9]86
86 x86_64, // X86-64: amd64, x86_64
87 xcore, // XCore: xcore
88 xtensa, // Tensilica: Xtensa
89 nvptx, // NVPTX: 32-bit
90 nvptx64, // NVPTX: 64-bit
91 le32, // le32: generic little-endian 32-bit CPU (PNaCl)
92 le64, // le64: generic little-endian 64-bit CPU (PNaCl)
93 amdil, // AMDIL
94 amdil64, // AMDIL with 64-bit pointers
95 hsail, // AMD HSAIL
96 hsail64, // AMD HSAIL with 64-bit pointers
97 spir, // SPIR: standard portable IR for OpenCL 32-bit version
98 spir64, // SPIR: standard portable IR for OpenCL 64-bit version
99 spirv, // SPIR-V with logical memory layout.
100 spirv32, // SPIR-V with 32-bit pointers
101 spirv64, // SPIR-V with 64-bit pointers
102 kalimba, // Kalimba: generic kalimba
103 shave, // SHAVE: Movidius vector VLIW processors
104 lanai, // Lanai: Lanai 32-bit
105 wasm32, // WebAssembly with 32-bit pointers
106 wasm64, // WebAssembly with 64-bit pointers
107 renderscript32, // 32-bit RenderScript
108 renderscript64, // 64-bit RenderScript
109 ve, // NEC SX-Aurora Vector Engine
111 };
114
148
151
155
157
159
160 // SPIR-V sub-arch corresponds to its version.
168
169 // DXIL sub-arch corresponds to its version.
180 };
183
198 };
199 enum OSType {
201
209 Lv2, // PS3
219 NaCl, // Native Client
221 CUDA, // NVIDIA CUDA
222 NVCL, // NVIDIA OpenCL
223 AMDHSA, // AMD HSA Runtime
227 TvOS, // Apple tvOS
228 WatchOS, // Apple watchOS
229 BridgeOS, // Apple bridgeOS
230 DriverKit, // Apple DriverKit
231 XROS, // Apple XROS
233 AMDPAL, // AMD PAL Runtime
234 HermitCore, // HermitCore Unikernel/Multikernel
235 Hurd, // GNU/Hurd
236 WASI, // Experimental WebAssembly OS
238 ShaderModel, // DirectX ShaderModel
241 Vulkan, // Vulkan SPIR-V
243 };
246
265
270 Simulator, // Simulator variants of other systems, e.g., Apple's iOS
271 MacABI, // Mac Catalyst variant of Apple's iOS deployment target.
272
273 // Shader Stages
274 // The order of these values matters, and must be kept in sync with the
275 // language options enum in Clang. The ordering is enforced in
276 // static_asserts in Triple.cpp and in Clang.
294
296 };
299
308 };
309
310private:
311 std::string Data;
312
313 /// The parsed arch type.
314 ArchType Arch{};
315
316 /// The parsed subarchitecture type.
317 SubArchType SubArch{};
318
319 /// The parsed vendor type.
320 VendorType Vendor{};
321
322 /// The parsed OS type.
323 OSType OS{};
324
325 /// The parsed Environment type.
326 EnvironmentType Environment{};
327
328 /// The object format type.
329 ObjectFormatType ObjectFormat{};
330
331public:
332 /// @name Constructors
333 /// @{
334
335 /// Default constructor is the same as an empty string and leaves all
336 /// triple fields unknown.
337 Triple() = default;
338
339 explicit Triple(const Twine &Str);
340 Triple(const Twine &ArchStr, const Twine &VendorStr, const Twine &OSStr);
341 Triple(const Twine &ArchStr, const Twine &VendorStr, const Twine &OSStr,
342 const Twine &EnvironmentStr);
343
344 bool operator==(const Triple &Other) const {
345 return Arch == Other.Arch && SubArch == Other.SubArch &&
346 Vendor == Other.Vendor && OS == Other.OS &&
347 Environment == Other.Environment &&
348 ObjectFormat == Other.ObjectFormat;
349 }
350
351 bool operator!=(const Triple &Other) const {
352 return !(*this == Other);
353 }
354
355 /// @}
356 /// @name Normalization
357 /// @{
358
359 /// Turn an arbitrary machine specification into the canonical triple form (or
360 /// something sensible that the Triple class understands if nothing better can
361 /// reasonably be done). In particular, it handles the common case in which
362 /// otherwise valid components are in the wrong order.
363 static std::string normalize(StringRef Str);
364
365 /// Return the normalized form of this triple's string.
366 std::string normalize() const { return normalize(Data); }
367
368 /// @}
369 /// @name Typed Component Access
370 /// @{
371
372 /// Get the parsed architecture type of this triple.
373 ArchType getArch() const { return Arch; }
374
375 /// get the parsed subarchitecture type for this triple.
376 SubArchType getSubArch() const { return SubArch; }
377
378 /// Get the parsed vendor type of this triple.
379 VendorType getVendor() const { return Vendor; }
380
381 /// Get the parsed operating system type of this triple.
382 OSType getOS() const { return OS; }
383
384 /// Does this triple have the optional environment (fourth) component?
385 bool hasEnvironment() const {
386 return getEnvironmentName() != "";
387 }
388
389 /// Get the parsed environment type of this triple.
390 EnvironmentType getEnvironment() const { return Environment; }
391
392 /// Parse the version number from the OS name component of the
393 /// triple, if present.
394 ///
395 /// For example, "fooos1.2.3" would return (1, 2, 3).
397
398 /// Get the object format for this triple.
399 ObjectFormatType getObjectFormat() const { return ObjectFormat; }
400
401 /// Parse the version number from the OS name component of the triple, if
402 /// present.
403 ///
404 /// For example, "fooos1.2.3" would return (1, 2, 3).
406
407 /// Return just the major version number, this is specialized because it is a
408 /// common query.
409 unsigned getOSMajorVersion() const { return getOSVersion().getMajor(); }
410
411 /// Parse the version number as with getOSVersion and then translate generic
412 /// "darwin" versions to the corresponding OS X versions. This may also be
413 /// called with IOS triples but the OS X version number is just set to a
414 /// constant 10.4.0 in that case. Returns true if successful.
415 bool getMacOSXVersion(VersionTuple &Version) const;
416
417 /// Parse the version number as with getOSVersion. This should only be called
418 /// with IOS or generic triples.
420
421 /// Parse the version number as with getOSVersion. This should only be called
422 /// with WatchOS or generic triples.
424
425 /// Parse the version number as with getOSVersion.
427
428 /// Parse the Vulkan version number from the OSVersion and SPIR-V version
429 /// (SubArch). This should only be called with Vulkan SPIR-V triples.
431
432 /// Parse the DXIL version number from the DXIL version
433 /// (SubArch). This should only be called with DXIL triples.
435
436 /// @}
437 /// @name Direct Component Access
438 /// @{
439
440 const std::string &str() const { return Data; }
441
442 const std::string &getTriple() const { return Data; }
443
444 /// Get the architecture (first) component of the triple.
445 StringRef getArchName() const;
446
447 /// Get the vendor (second) component of the triple.
448 StringRef getVendorName() const;
449
450 /// Get the operating system (third) component of the triple.
451 StringRef getOSName() const;
452
453 /// Get the optional environment (fourth) component of the triple, or "" if
454 /// empty.
456
457 /// Get the operating system and optional environment components as a single
458 /// string (separated by a '-' if the environment component is present).
460
461 /// Get the version component of the environment component as a single
462 /// string (the version after the environment).
463 ///
464 /// For example, "fooos1.2.3" would return "1.2.3".
466
467 /// @}
468 /// @name Convenience Predicates
469 /// @{
470
471 /// Returns the pointer width of this architecture.
473
474 /// Returns the pointer width of this architecture.
475 unsigned getArchPointerBitWidth() const {
477 }
478
479 /// Test whether the architecture is 64-bit
480 ///
481 /// Note that this tests for 64-bit pointer width, and nothing else. Note
482 /// that we intentionally expose only three predicates, 64-bit, 32-bit, and
483 /// 16-bit. The inner details of pointer width for particular architectures
484 /// is not summed up in the triple, and so only a coarse grained predicate
485 /// system is provided.
486 bool isArch64Bit() const;
487
488 /// Test whether the architecture is 32-bit
489 ///
490 /// Note that this tests for 32-bit pointer width, and nothing else.
491 bool isArch32Bit() const;
492
493 /// Test whether the architecture is 16-bit
494 ///
495 /// Note that this tests for 16-bit pointer width, and nothing else.
496 bool isArch16Bit() const;
497
498 /// Helper function for doing comparisons against version numbers included in
499 /// the target triple.
500 bool isOSVersionLT(unsigned Major, unsigned Minor = 0,
501 unsigned Micro = 0) const {
502 if (Minor == 0) {
503 return getOSVersion() < VersionTuple(Major);
504 }
505 if (Micro == 0) {
506 return getOSVersion() < VersionTuple(Major, Minor);
507 }
508 return getOSVersion() < VersionTuple(Major, Minor, Micro);
509 }
510
511 bool isOSVersionLT(const Triple &Other) const {
512 return getOSVersion() < Other.getOSVersion();
513 }
514
515 /// Comparison function for checking OS X version compatibility, which handles
516 /// supporting skewed version numbering schemes used by the "darwin" triples.
517 bool isMacOSXVersionLT(unsigned Major, unsigned Minor = 0,
518 unsigned Micro = 0) const;
519
520 /// Is this a Mac OS X triple. For legacy reasons, we support both "darwin"
521 /// and "osx" as OS X triples.
522 bool isMacOSX() const {
523 return getOS() == Triple::Darwin || getOS() == Triple::MacOSX;
524 }
525
526 /// Is this an iOS triple.
527 /// Note: This identifies tvOS as a variant of iOS. If that ever
528 /// changes, i.e., if the two operating systems diverge or their version
529 /// numbers get out of sync, that will need to be changed.
530 /// watchOS has completely different version numbers so it is not included.
531 bool isiOS() const {
532 return getOS() == Triple::IOS || isTvOS();
533 }
534
535 /// Is this an Apple tvOS triple.
536 bool isTvOS() const {
537 return getOS() == Triple::TvOS;
538 }
539
540 /// Is this an Apple watchOS triple.
541 bool isWatchOS() const {
542 return getOS() == Triple::WatchOS;
543 }
544
545 bool isWatchABI() const {
547 }
548
549 /// Is this an Apple XROS triple.
550 bool isXROS() const { return getOS() == Triple::XROS; }
551
552 /// Is this an Apple DriverKit triple.
553 bool isDriverKit() const { return getOS() == Triple::DriverKit; }
554
555 bool isOSzOS() const { return getOS() == Triple::ZOS; }
556
557 /// Is this a "Darwin" OS (macOS, iOS, tvOS, watchOS, XROS, or DriverKit).
558 bool isOSDarwin() const {
559 return isMacOSX() || isiOS() || isWatchOS() || isDriverKit() || isXROS();
560 }
561
564 }
565
567 return getEnvironment() == Triple::MacABI;
568 }
569
570 /// Returns true for targets that run on a macOS machine.
571 bool isTargetMachineMac() const {
572 return isMacOSX() || (isOSDarwin() && (isSimulatorEnvironment() ||
574 }
575
576 bool isOSNetBSD() const {
577 return getOS() == Triple::NetBSD;
578 }
579
580 bool isOSOpenBSD() const {
581 return getOS() == Triple::OpenBSD;
582 }
583
584 bool isOSFreeBSD() const {
585 return getOS() == Triple::FreeBSD;
586 }
587
588 bool isOSFuchsia() const {
589 return getOS() == Triple::Fuchsia;
590 }
591
592 bool isOSDragonFly() const { return getOS() == Triple::DragonFly; }
593
594 bool isOSSolaris() const {
595 return getOS() == Triple::Solaris;
596 }
597
598 bool isOSIAMCU() const {
599 return getOS() == Triple::ELFIAMCU;
600 }
601
602 bool isOSUnknown() const { return getOS() == Triple::UnknownOS; }
603
604 bool isGNUEnvironment() const {
606 return Env == Triple::GNU || Env == Triple::GNUABIN32 ||
607 Env == Triple::GNUABI64 || Env == Triple::GNUEABI ||
608 Env == Triple::GNUEABIHF || Env == Triple::GNUF32 ||
609 Env == Triple::GNUF64 || Env == Triple::GNUSF ||
610 Env == Triple::GNUX32;
611 }
612
613 /// Tests whether the OS is Haiku.
614 bool isOSHaiku() const {
615 return getOS() == Triple::Haiku;
616 }
617
618 /// Tests whether the OS is UEFI.
619 bool isUEFI() const {
620 return getOS() == Triple::UEFI;
621 }
622
623 /// Tests whether the OS is Windows.
624 bool isOSWindows() const {
625 return getOS() == Triple::Win32;
626 }
627
628 /// Checks if the environment is MSVC.
630 return isOSWindows() && getEnvironment() == Triple::MSVC;
631 }
632
633 /// Checks if the environment could be MSVC.
637 }
638
639 // Checks if we're using the Windows Arm64EC ABI.
640 bool isWindowsArm64EC() const {
641 return getArch() == Triple::aarch64 &&
643 }
644
647 }
648
651 }
652
655 }
656
658 return isOSWindows() && getEnvironment() == Triple::GNU;
659 }
660
661 /// Tests for either Cygwin or MinGW OS
662 bool isOSCygMing() const {
664 }
665
666 /// Is this a "Windows" OS targeting a "MSVCRT.dll" environment.
667 bool isOSMSVCRT() const {
670 }
671
672 /// Tests whether the OS is NaCl (Native Client)
673 bool isOSNaCl() const {
674 return getOS() == Triple::NaCl;
675 }
676
677 /// Tests whether the OS is Linux.
678 bool isOSLinux() const {
679 return getOS() == Triple::Linux;
680 }
681
682 /// Tests whether the OS is kFreeBSD.
683 bool isOSKFreeBSD() const {
684 return getOS() == Triple::KFreeBSD;
685 }
686
687 /// Tests whether the OS is Hurd.
688 bool isOSHurd() const {
689 return getOS() == Triple::Hurd;
690 }
691
692 /// Tests whether the OS is WASI.
693 bool isOSWASI() const {
694 return getOS() == Triple::WASI;
695 }
696
697 /// Tests whether the OS is Emscripten.
698 bool isOSEmscripten() const {
699 return getOS() == Triple::Emscripten;
700 }
701
702 /// Tests whether the OS uses glibc.
703 bool isOSGlibc() const {
704 return (getOS() == Triple::Linux || getOS() == Triple::KFreeBSD ||
705 getOS() == Triple::Hurd) &&
706 !isAndroid();
707 }
708
709 /// Tests whether the OS is AIX.
710 bool isOSAIX() const {
711 return getOS() == Triple::AIX;
712 }
713
714 bool isOSSerenity() const {
715 return getOS() == Triple::Serenity;
716 }
717
718 /// Tests whether the OS uses the ELF binary format.
719 bool isOSBinFormatELF() const {
720 return getObjectFormat() == Triple::ELF;
721 }
722
723 /// Tests whether the OS uses the COFF binary format.
724 bool isOSBinFormatCOFF() const {
725 return getObjectFormat() == Triple::COFF;
726 }
727
728 /// Tests whether the OS uses the GOFF binary format.
729 bool isOSBinFormatGOFF() const { return getObjectFormat() == Triple::GOFF; }
730
731 /// Tests whether the environment is MachO.
732 bool isOSBinFormatMachO() const {
733 return getObjectFormat() == Triple::MachO;
734 }
735
736 /// Tests whether the OS uses the Wasm binary format.
737 bool isOSBinFormatWasm() const {
738 return getObjectFormat() == Triple::Wasm;
739 }
740
741 /// Tests whether the OS uses the XCOFF binary format.
742 bool isOSBinFormatXCOFF() const {
743 return getObjectFormat() == Triple::XCOFF;
744 }
745
746 /// Tests whether the OS uses the DXContainer binary format.
749 }
750
751 /// Tests whether the target is the PS4 platform.
752 bool isPS4() const {
753 return getArch() == Triple::x86_64 &&
754 getVendor() == Triple::SCEI &&
755 getOS() == Triple::PS4;
756 }
757
758 /// Tests whether the target is the PS5 platform.
759 bool isPS5() const {
760 return getArch() == Triple::x86_64 &&
761 getVendor() == Triple::SCEI &&
762 getOS() == Triple::PS5;
763 }
764
765 /// Tests whether the target is the PS4 or PS5 platform.
766 bool isPS() const { return isPS4() || isPS5(); }
767
768 /// Tests whether the target is Android
769 bool isAndroid() const { return getEnvironment() == Triple::Android; }
770
771 bool isAndroidVersionLT(unsigned Major) const {
772 assert(isAndroid() && "Not an Android triple!");
773
775
776 // 64-bit targets did not exist before API level 21 (Lollipop).
777 if (isArch64Bit() && Version.getMajor() < 21)
778 return VersionTuple(21) < VersionTuple(Major);
779
780 return Version < VersionTuple(Major);
781 }
782
783 /// Tests whether the environment is musl-libc
784 bool isMusl() const {
785 return getEnvironment() == Triple::Musl ||
790 }
791
792 /// Tests whether the target is OHOS
793 /// LiteOS default enviroment is also OHOS, but omited on triple.
794 bool isOHOSFamily() const { return isOpenHOS() || isOSLiteOS(); }
795
796 bool isOpenHOS() const { return getEnvironment() == Triple::OpenHOS; }
797
798 bool isOSLiteOS() const { return getOS() == Triple::LiteOS; }
799
800 /// Tests whether the target is DXIL.
801 bool isDXIL() const {
802 return getArch() == Triple::dxil;
803 }
804
805 bool isShaderModelOS() const {
806 return getOS() == Triple::ShaderModel;
807 }
808
809 bool isVulkanOS() const { return getOS() == Triple::Vulkan; }
810
813 return Env == Triple::Pixel || Env == Triple::Vertex ||
814 Env == Triple::Geometry || Env == Triple::Hull ||
815 Env == Triple::Domain || Env == Triple::Compute ||
816 Env == Triple::Library || Env == Triple::RayGeneration ||
817 Env == Triple::Intersection || Env == Triple::AnyHit ||
818 Env == Triple::ClosestHit || Env == Triple::Miss ||
819 Env == Triple::Callable || Env == Triple::Mesh ||
821 }
822
823 /// Tests whether the target is SPIR (32- or 64-bit).
824 bool isSPIR() const {
825 return getArch() == Triple::spir || getArch() == Triple::spir64;
826 }
827
828 /// Tests whether the target is SPIR-V (32/64-bit/Logical).
829 bool isSPIRV() const {
830 return getArch() == Triple::spirv32 || getArch() == Triple::spirv64 ||
832 }
833
834 /// Tests whether the target is SPIR-V Logical
835 bool isSPIRVLogical() const {
836 return getArch() == Triple::spirv;
837 }
838
839 /// Tests whether the target is NVPTX (32- or 64-bit).
840 bool isNVPTX() const {
841 return getArch() == Triple::nvptx || getArch() == Triple::nvptx64;
842 }
843
844 /// Tests whether the target is AMDGCN
845 bool isAMDGCN() const { return getArch() == Triple::amdgcn; }
846
847 bool isAMDGPU() const {
848 return getArch() == Triple::r600 || getArch() == Triple::amdgcn;
849 }
850
851 /// Tests whether the target is Thumb (little and big endian).
852 bool isThumb() const {
853 return getArch() == Triple::thumb || getArch() == Triple::thumbeb;
854 }
855
856 /// Tests whether the target is ARM (little and big endian).
857 bool isARM() const {
858 return getArch() == Triple::arm || getArch() == Triple::armeb;
859 }
860
861 /// Tests whether the target supports the EHABI exception
862 /// handling standard.
864 return (isARM() || isThumb()) &&
873 }
874
875 /// Tests whether the target is T32.
876 bool isArmT32() const {
877 switch (getSubArch()) {
889 return false;
890 default:
891 return true;
892 }
893 }
894
895 /// Tests whether the target is an M-class.
896 bool isArmMClass() const {
897 switch (getSubArch()) {
904 return true;
905 default:
906 return false;
907 }
908 }
909
910 /// Tests whether the target is AArch64 (little and big endian).
911 bool isAArch64() const {
914 }
915
916 /// Tests whether the target is AArch64 and pointers are the size specified by
917 /// \p PointerWidth.
918 bool isAArch64(int PointerWidth) const {
919 assert(PointerWidth == 64 || PointerWidth == 32);
920 if (!isAArch64())
921 return false;
922 return getArch() == Triple::aarch64_32 ||
924 ? PointerWidth == 32
925 : PointerWidth == 64;
926 }
927
928 /// Tests whether the target is 32-bit LoongArch.
929 bool isLoongArch32() const { return getArch() == Triple::loongarch32; }
930
931 /// Tests whether the target is 64-bit LoongArch.
932 bool isLoongArch64() const { return getArch() == Triple::loongarch64; }
933
934 /// Tests whether the target is LoongArch (32- and 64-bit).
935 bool isLoongArch() const { return isLoongArch32() || isLoongArch64(); }
936
937 /// Tests whether the target is MIPS 32-bit (little and big endian).
938 bool isMIPS32() const {
939 return getArch() == Triple::mips || getArch() == Triple::mipsel;
940 }
941
942 /// Tests whether the target is MIPS 64-bit (little and big endian).
943 bool isMIPS64() const {
945 }
946
947 /// Tests whether the target is MIPS (little and big endian, 32- or 64-bit).
948 bool isMIPS() const {
949 return isMIPS32() || isMIPS64();
950 }
951
952 /// Tests whether the target is PowerPC (32- or 64-bit LE or BE).
953 bool isPPC() const {
954 return getArch() == Triple::ppc || getArch() == Triple::ppc64 ||
956 }
957
958 /// Tests whether the target is 32-bit PowerPC (little and big endian).
959 bool isPPC32() const {
960 return getArch() == Triple::ppc || getArch() == Triple::ppcle;
961 }
962
963 /// Tests whether the target is 64-bit PowerPC (little and big endian).
964 bool isPPC64() const {
965 return getArch() == Triple::ppc64 || getArch() == Triple::ppc64le;
966 }
967
968 /// Tests whether the target 64-bit PowerPC big endian ABI is ELFv2.
969 bool isPPC64ELFv2ABI() const {
970 return (getArch() == Triple::ppc64 &&
971 ((getOS() == Triple::FreeBSD &&
972 (getOSMajorVersion() >= 13 || getOSVersion().empty())) ||
973 getOS() == Triple::OpenBSD || isMusl()));
974 }
975
976 /// Tests whether the target 32-bit PowerPC uses Secure PLT.
977 bool isPPC32SecurePlt() const {
978 return ((getArch() == Triple::ppc || getArch() == Triple::ppcle) &&
979 ((getOS() == Triple::FreeBSD &&
980 (getOSMajorVersion() >= 13 || getOSVersion().empty())) ||
982 isMusl()));
983 }
984
985 /// Tests whether the target is 32-bit RISC-V.
986 bool isRISCV32() const { return getArch() == Triple::riscv32; }
987
988 /// Tests whether the target is 64-bit RISC-V.
989 bool isRISCV64() const { return getArch() == Triple::riscv64; }
990
991 /// Tests whether the target is RISC-V (32- and 64-bit).
992 bool isRISCV() const { return isRISCV32() || isRISCV64(); }
993
994 /// Tests whether the target is 32-bit SPARC (little and big endian).
995 bool isSPARC32() const {
996 return getArch() == Triple::sparc || getArch() == Triple::sparcel;
997 }
998
999 /// Tests whether the target is 64-bit SPARC (big endian).
1000 bool isSPARC64() const { return getArch() == Triple::sparcv9; }
1001
1002 /// Tests whether the target is SPARC.
1003 bool isSPARC() const { return isSPARC32() || isSPARC64(); }
1004
1005 /// Tests whether the target is SystemZ.
1006 bool isSystemZ() const {
1007 return getArch() == Triple::systemz;
1008 }
1009
1010 /// Tests whether the target is x86 (32- or 64-bit).
1011 bool isX86() const {
1012 return getArch() == Triple::x86 || getArch() == Triple::x86_64;
1013 }
1014
1015 /// Tests whether the target is VE
1016 bool isVE() const {
1017 return getArch() == Triple::ve;
1018 }
1019
1020 /// Tests whether the target is wasm (32- and 64-bit).
1021 bool isWasm() const {
1022 return getArch() == Triple::wasm32 || getArch() == Triple::wasm64;
1023 }
1024
1025 // Tests whether the target is CSKY
1026 bool isCSKY() const {
1027 return getArch() == Triple::csky;
1028 }
1029
1030 /// Tests whether the target is the Apple "arm64e" AArch64 subarch.
1031 bool isArm64e() const {
1032 return getArch() == Triple::aarch64 &&
1034 }
1035
1036 /// Tests whether the target is X32.
1037 bool isX32() const {
1039 return Env == Triple::GNUX32 || Env == Triple::MuslX32;
1040 }
1041
1042 /// Tests whether the target is eBPF.
1043 bool isBPF() const {
1044 return getArch() == Triple::bpfel || getArch() == Triple::bpfeb;
1045 }
1046
1047 /// Tests whether the target supports comdat
1048 bool supportsCOMDAT() const {
1049 return !(isOSBinFormatMachO() || isOSBinFormatXCOFF() ||
1051 }
1052
1053 /// Tests whether the target uses emulated TLS as default.
1054 ///
1055 /// Note: Android API level 29 (10) introduced ELF TLS.
1057 return (isAndroid() && isAndroidVersionLT(29)) || isOSOpenBSD() ||
1059 }
1060
1061 /// True if the target supports both general-dynamic and TLSDESC, and TLSDESC
1062 /// is enabled by default.
1063 bool hasDefaultTLSDESC() const { return isAndroid() && isRISCV64(); }
1064
1065 /// Tests whether the target uses -data-sections as default.
1067 return isOSBinFormatXCOFF() || isWasm();
1068 }
1069
1070 /// Tests if the environment supports dllimport/export annotations.
1071 bool hasDLLImportExport() const { return isOSWindows() || isPS(); }
1072
1073 /// @}
1074 /// @name Mutators
1075 /// @{
1076
1077 /// Set the architecture (first) component of the triple to a known type.
1078 void setArch(ArchType Kind, SubArchType SubArch = NoSubArch);
1079
1080 /// Set the vendor (second) component of the triple to a known type.
1081 void setVendor(VendorType Kind);
1082
1083 /// Set the operating system (third) component of the triple to a known type.
1084 void setOS(OSType Kind);
1085
1086 /// Set the environment (fourth) component of the triple to a known type.
1088
1089 /// Set the object file format.
1091
1092 /// Set all components to the new triple \p Str.
1093 void setTriple(const Twine &Str);
1094
1095 /// Set the architecture (first) component of the triple by name.
1096 void setArchName(StringRef Str);
1097
1098 /// Set the vendor (second) component of the triple by name.
1099 void setVendorName(StringRef Str);
1100
1101 /// Set the operating system (third) component of the triple by name.
1102 void setOSName(StringRef Str);
1103
1104 /// Set the optional environment (fourth) component of the triple by name.
1105 void setEnvironmentName(StringRef Str);
1106
1107 /// Set the operating system and optional environment components with a single
1108 /// string.
1110
1111 /// @}
1112 /// @name Helpers to build variants of a particular triple.
1113 /// @{
1114
1115 /// Form a triple with a 32-bit variant of the current architecture.
1116 ///
1117 /// This can be used to move across "families" of architectures where useful.
1118 ///
1119 /// \returns A new triple with a 32-bit architecture or an unknown
1120 /// architecture if no such variant can be found.
1122
1123 /// Form a triple with a 64-bit variant of the current architecture.
1124 ///
1125 /// This can be used to move across "families" of architectures where useful.
1126 ///
1127 /// \returns A new triple with a 64-bit architecture or an unknown
1128 /// architecture if no such variant can be found.
1130
1131 /// Form a triple with a big endian variant of the current architecture.
1132 ///
1133 /// This can be used to move across "families" of architectures where useful.
1134 ///
1135 /// \returns A new triple with a big endian architecture or an unknown
1136 /// architecture if no such variant can be found.
1138
1139 /// Form a triple with a little endian variant of the current architecture.
1140 ///
1141 /// This can be used to move across "families" of architectures where useful.
1142 ///
1143 /// \returns A new triple with a little endian architecture or an unknown
1144 /// architecture if no such variant can be found.
1146
1147 /// Tests whether the target triple is little endian.
1148 ///
1149 /// \returns true if the triple is little endian, false otherwise.
1150 bool isLittleEndian() const;
1151
1152 /// Test whether target triples are compatible.
1153 bool isCompatibleWith(const Triple &Other) const;
1154
1155 /// Merge target triples.
1156 std::string merge(const Triple &Other) const;
1157
1158 /// Some platforms have different minimum supported OS versions that
1159 /// varies by the architecture specified in the triple. This function
1160 /// returns the minimum supported OS version for this triple if one an exists,
1161 /// or an invalid version tuple if this triple doesn't have one.
1163
1164 /// @}
1165 /// @name Static helpers for IDs.
1166 /// @{
1167
1168 /// Get the canonical name for the \p Kind architecture.
1169 static StringRef getArchTypeName(ArchType Kind);
1170
1171 /// Get the architecture name based on \p Kind and \p SubArch.
1172 static StringRef getArchName(ArchType Kind, SubArchType SubArch = NoSubArch);
1173
1174 /// Get the "prefix" canonical name for the \p Kind architecture. This is the
1175 /// prefix used by the architecture specific builtins, and is suitable for
1176 /// passing to \see Intrinsic::getIntrinsicForClangBuiltin().
1177 ///
1178 /// \return - The architecture prefix, or 0 if none is defined.
1180
1181 /// Get the canonical name for the \p Kind vendor.
1183
1184 /// Get the canonical name for the \p Kind operating system.
1185 static StringRef getOSTypeName(OSType Kind);
1186
1187 /// Get the canonical name for the \p Kind environment.
1189
1190 /// Get the name for the \p Object format.
1192
1193 /// @}
1194 /// @name Static helpers for converting alternate architecture names.
1195 /// @{
1196
1197 /// The canonical type for the given LLVM architecture name (e.g., "x86").
1199
1200 /// @}
1201
1202 /// Returns a canonicalized OS version number for the specified OS.
1204 const VersionTuple &Version);
1205};
1206
1207} // End llvm namespace
1208
1209
1210#endif
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Defines the llvm::VersionTuple class, which represents a version in the form major[....
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
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:2025
VersionTuple getOSVersion() const
Parse the version number from the OS name component of the triple, if present.
Definition: Triple.cpp:1358
bool isPPC() const
Tests whether the target is PowerPC (32- or 64-bit LE or BE).
Definition: Triple.h:953
bool isOSDragonFly() const
Definition: Triple.h:592
StringRef getVendorName() const
Get the vendor (second) component of the triple.
Definition: Triple.cpp:1303
VersionTuple getWatchOSVersion() const
Parse the version number as with getOSVersion.
Definition: Triple.cpp:1447
void setArchName(StringRef Str)
Set the architecture (first) component of the triple by name.
Definition: Triple.cpp:1552
bool isTargetMachineMac() const
Returns true for targets that run on a macOS machine.
Definition: Triple.h:571
bool isArmT32() const
Tests whether the target is T32.
Definition: Triple.h:876
bool isOSNaCl() const
Tests whether the OS is NaCl (Native Client)
Definition: Triple.h:673
void setObjectFormat(ObjectFormatType Kind)
Set the object file format.
Definition: Triple.cpp:1544
bool isAndroidVersionLT(unsigned Major) const
Definition: Triple.h:771
llvm::Triple get32BitArchVariant() const
Form a triple with a 32-bit variant of the current architecture.
Definition: Triple.cpp:1671
bool isOSCygMing() const
Tests for either Cygwin or MinGW OS.
Definition: Triple.h:662
bool isWatchABI() const
Definition: Triple.h:545
Triple()=default
Default constructor is the same as an empty string and leaves all triple fields unknown.
@ RayGeneration
Definition: Triple.h:284
@ LastEnvironmentType
Definition: Triple.h:295
@ UnknownEnvironment
Definition: Triple.h:245
@ ClosestHit
Definition: Triple.h:287
@ MuslEABIHF
Definition: Triple.h:263
@ Amplification
Definition: Triple.h:291
@ Intersection
Definition: Triple.h:285
bool isThumb() const
Tests whether the target is Thumb (little and big endian).
Definition: Triple.h:852
std::string normalize() const
Return the normalized form of this triple's string.
Definition: Triple.h:366
bool isPS4() const
Tests whether the target is the PS4 platform.
Definition: Triple.h:752
bool isPPC64ELFv2ABI() const
Tests whether the target 64-bit PowerPC big endian ABI is ELFv2.
Definition: Triple.h:969
bool isOSWASI() const
Tests whether the OS is WASI.
Definition: Triple.h:693
bool isSPIR() const
Tests whether the target is SPIR (32- or 64-bit).
Definition: Triple.h:824
bool isOSBinFormatWasm() const
Tests whether the OS uses the Wasm binary format.
Definition: Triple.h:737
bool isDriverKit() const
Is this an Apple DriverKit triple.
Definition: Triple.h:553
unsigned getArchPointerBitWidth() const
Returns the pointer width of this architecture.
Definition: Triple.h:475
llvm::Triple getLittleEndianArchVariant() const
Form a triple with a little endian variant of the current architecture.
Definition: Triple.cpp:1901
bool isOSHurd() const
Tests whether the OS is Hurd.
Definition: Triple.h:688
bool isBPF() const
Tests whether the target is eBPF.
Definition: Triple.h:1043
bool isX32() const
Tests whether the target is X32.
Definition: Triple.h:1037
static StringRef getVendorTypeName(VendorType Kind)
Get the canonical name for the Kind vendor.
Definition: Triple.cpp:239
ObjectFormatType getObjectFormat() const
Get the object format for this triple.
Definition: Triple.h:399
bool isAArch64(int PointerWidth) const
Tests whether the target is AArch64 and pointers are the size specified by PointerWidth.
Definition: Triple.h:918
SubArchType getSubArch() const
get the parsed subarchitecture type for this triple.
Definition: Triple.h:376
bool isX86() const
Tests whether the target is x86 (32- or 64-bit).
Definition: Triple.h:1011
bool isArm64e() const
Tests whether the target is the Apple "arm64e" AArch64 subarch.
Definition: Triple.h:1031
bool isTargetEHABICompatible() const
Tests whether the target supports the EHABI exception handling standard.
Definition: Triple.h:863
bool isOSBinFormatGOFF() const
Tests whether the OS uses the GOFF binary format.
Definition: Triple.h:729
bool isWindowsGNUEnvironment() const
Definition: Triple.h:657
void setVendorName(StringRef Str)
Set the vendor (second) component of the triple by name.
Definition: Triple.cpp:1563
@ LastOSType
Definition: Triple.h:242
@ HermitCore
Definition: Triple.h:234
@ ShaderModel
Definition: Triple.h:238
@ Emscripten
Definition: Triple.h:237
bool isOSNetBSD() const
Definition: Triple.h:576
void setOSAndEnvironmentName(StringRef Str)
Set the operating system and optional environment components with a single string.
Definition: Triple.cpp:1580
bool isAndroid() const
Tests whether the target is Android.
Definition: Triple.h:769
bool hasDefaultTLSDESC() const
True if the target supports both general-dynamic and TLSDESC, and TLSDESC is enabled by default.
Definition: Triple.h:1063
llvm::Triple get64BitArchVariant() const
Form a triple with a 64-bit variant of the current architecture.
Definition: Triple.cpp:1752
bool isOSMSVCRT() const
Is this a "Windows" OS targeting a "MSVCRT.dll" environment.
Definition: Triple.h:667
bool isOSBinFormatMachO() const
Tests whether the environment is MachO.
Definition: Triple.h:732
bool isLittleEndian() const
Tests whether the target triple is little endian.
Definition: Triple.cpp:1938
void setEnvironment(EnvironmentType Kind)
Set the environment (fourth) component of the triple to a known type.
Definition: Triple.cpp:1536
StringRef getOSName() const
Get the operating system (third) component of the triple.
Definition: Triple.cpp:1308
bool supportsCOMDAT() const
Tests whether the target supports comdat.
Definition: Triple.h:1048
bool isWindowsCoreCLREnvironment() const
Definition: Triple.h:645
bool isMIPS64() const
Tests whether the target is MIPS 64-bit (little and big endian).
Definition: Triple.h:943
@ loongarch32
Definition: Triple.h:61
@ LastArchType
Definition: Triple.h:110
@ renderscript64
Definition: Triple.h:108
@ UnknownArch
Definition: Triple.h:47
@ aarch64_be
Definition: Triple.h:52
@ loongarch64
Definition: Triple.h:62
@ renderscript32
Definition: Triple.h:107
@ mips64el
Definition: Triple.h:67
@ aarch64_32
Definition: Triple.h:53
bool hasDefaultDataSections() const
Tests whether the target uses -data-sections as default.
Definition: Triple.h:1066
bool isOSSolaris() const
Definition: Triple.h:594
bool isRISCV32() const
Tests whether the target is 32-bit RISC-V.
Definition: Triple.h:986
bool isOSKFreeBSD() const
Tests whether the OS is kFreeBSD.
Definition: Triple.h:683
void setTriple(const Twine &Str)
Set all components to the new triple Str.
Definition: Triple.cpp:1520
OSType getOS() const
Get the parsed operating system type of this triple.
Definition: Triple.h:382
VersionTuple getEnvironmentVersion() const
Parse the version number from the OS name component of the triple, if present.
Definition: Triple.cpp:1331
static ArchType getArchTypeForLLVMName(StringRef Str)
The canonical type for the given LLVM architecture name (e.g., "x86").
Definition: Triple.cpp:390
bool isOSVersionLT(const Triple &Other) const
Definition: Triple.h:511
bool isPPC32() const
Tests whether the target is 32-bit PowerPC (little and big endian).
Definition: Triple.h:959
ArchType getArch() const
Get the parsed architecture type of this triple.
Definition: Triple.h:373
bool isOSBinFormatCOFF() const
Tests whether the OS uses the COFF binary format.
Definition: Triple.h:724
bool isRISCV64() const
Tests whether the target is 64-bit RISC-V.
Definition: Triple.h:989
bool isCSKY() const
Definition: Triple.h:1026
bool isLoongArch64() const
Tests whether the target is 64-bit LoongArch.
Definition: Triple.h:932
StringRef getEnvironmentName() const
Get the optional environment (fourth) component of the triple, or "" if empty.
Definition: Triple.cpp:1314
bool isSPARC32() const
Tests whether the target is 32-bit SPARC (little and big endian).
Definition: Triple.h:995
bool isSimulatorEnvironment() const
Definition: Triple.h:562
VersionTuple getDXILVersion() const
Parse the DXIL version number from the DXIL version (SubArch).
Definition: Triple.cpp:1509
const std::string & str() const
Definition: Triple.h:440
bool isOSzOS() const
Definition: Triple.h:555
bool isOSSerenity() const
Definition: Triple.h:714
bool isOHOSFamily() const
Tests whether the target is OHOS LiteOS default enviroment is also OHOS, but omited on triple.
Definition: Triple.h:794
EnvironmentType getEnvironment() const
Get the parsed environment type of this triple.
Definition: Triple.h:390
bool isOSOpenBSD() const
Definition: Triple.h:580
VersionTuple getVulkanVersion() const
Parse the Vulkan version number from the OSVersion and SPIR-V version (SubArch).
Definition: Triple.cpp:1484
bool isOSUnknown() const
Definition: Triple.h:602
VersionTuple getDriverKitVersion() const
Parse the version number as with getOSVersion.
Definition: Triple.cpp:1472
bool isMIPS32() const
Tests whether the target is MIPS 32-bit (little and big endian).
Definition: Triple.h:938
bool isShaderModelOS() const
Definition: Triple.h:805
bool isUEFI() const
Tests whether the OS is UEFI.
Definition: Triple.h:619
bool isOSWindows() const
Tests whether the OS is Windows.
Definition: Triple.h:624
bool isMusl() const
Tests whether the environment is musl-libc.
Definition: Triple.h:784
const std::string & getTriple() const
Definition: Triple.h:442
static StringRef getArchTypeName(ArchType Kind)
Get the canonical name for the Kind architecture.
Definition: Triple.cpp:24
bool isOSBinFormatDXContainer() const
Tests whether the OS uses the DXContainer binary format.
Definition: Triple.h:747
bool isOSBinFormatXCOFF() const
Tests whether the OS uses the XCOFF binary format.
Definition: Triple.h:742
static StringRef getOSTypeName(OSType Kind)
Get the canonical name for the Kind operating system.
Definition: Triple.cpp:261
ObjectFormatType
Definition: Triple.h:297
@ DXContainer
Definition: Triple.h:301
@ UnknownObjectFormat
Definition: Triple.h:298
bool isARM() const
Tests whether the target is ARM (little and big endian).
Definition: Triple.h:857
std::string merge(const Triple &Other) const
Merge target triples.
Definition: Triple.cpp:2016
bool isArmMClass() const
Tests whether the target is an M-class.
Definition: Triple.h:896
bool isOSLinux() const
Tests whether the OS is Linux.
Definition: Triple.h:678
bool isRISCV() const
Tests whether the target is RISC-V (32- and 64-bit).
Definition: Triple.h:992
bool isAMDGCN() const
Tests whether the target is AMDGCN.
Definition: Triple.h:845
bool isAMDGPU() const
Definition: Triple.h:847
bool isLoongArch32() const
Tests whether the target is 32-bit LoongArch.
Definition: Triple.h:929
bool isOSLiteOS() const
Definition: Triple.h:798
@ UnknownVendor
Definition: Triple.h:182
@ OpenEmbedded
Definition: Triple.h:196
@ ImaginationTechnologies
Definition: Triple.h:189
@ LastVendorType
Definition: Triple.h:197
@ MipsTechnologies
Definition: Triple.h:190
bool isNVPTX() const
Tests whether the target is NVPTX (32- or 64-bit).
Definition: Triple.h:840
bool isOSAIX() const
Tests whether the OS is AIX.
Definition: Triple.h:710
VersionTuple getMinimumSupportedOSVersion() const
Some platforms have different minimum supported OS versions that varies by the architecture specified...
Definition: Triple.cpp:2042
bool isArch64Bit() const
Test whether the architecture is 64-bit.
Definition: Triple.cpp:1659
StringRef getOSAndEnvironmentName() const
Get the operating system and optional environment components as a single string (separated by a '-' i...
Definition: Triple.cpp:1320
@ ARMSubArch_v6t2
Definition: Triple.h:144
@ MipsSubArch_r6
Definition: Triple.h:156
@ DXILSubArch_v1_2
Definition: Triple.h:172
@ ARMSubArch_v7
Definition: Triple.h:135
@ ARMSubArch_v8m_mainline
Definition: Triple.h:133
@ ARMSubArch_v8r
Definition: Triple.h:131
@ ARMSubArch_v9_1a
Definition: Triple.h:119
@ DXILSubArch_v1_1
Definition: Triple.h:171
@ LatestDXILSubArch
Definition: Triple.h:179
@ SPIRVSubArch_v10
Definition: Triple.h:161
@ SPIRVSubArch_v13
Definition: Triple.h:164
@ ARMSubArch_v7k
Definition: Triple.h:139
@ ARMSubArch_v8_7a
Definition: Triple.h:123
@ ARMSubArch_v8
Definition: Triple.h:130
@ SPIRVSubArch_v16
Definition: Triple.h:167
@ ARMSubArch_v8_1a
Definition: Triple.h:129
@ ARMSubArch_v9_2a
Definition: Triple.h:118
@ DXILSubArch_v1_3
Definition: Triple.h:173
@ SPIRVSubArch_v15
Definition: Triple.h:166
@ ARMSubArch_v7m
Definition: Triple.h:137
@ ARMSubArch_v6k
Definition: Triple.h:143
@ ARMSubArch_v5
Definition: Triple.h:145
@ AArch64SubArch_arm64e
Definition: Triple.h:149
@ ARMSubArch_v6
Definition: Triple.h:141
@ ARMSubArch_v9_5a
Definition: Triple.h:115
@ ARMSubArch_v7ve
Definition: Triple.h:140
@ ARMSubArch_v8m_baseline
Definition: Triple.h:132
@ ARMSubArch_v8_8a
Definition: Triple.h:122
@ ARMSubArch_v8_2a
Definition: Triple.h:128
@ ARMSubArch_v7s
Definition: Triple.h:138
@ DXILSubArch_v1_0
Definition: Triple.h:170
@ DXILSubArch_v1_7
Definition: Triple.h:177
@ KalimbaSubArch_v3
Definition: Triple.h:152
@ DXILSubArch_v1_5
Definition: Triple.h:175
@ ARMSubArch_v8_4a
Definition: Triple.h:126
@ ARMSubArch_v8_9a
Definition: Triple.h:121
@ ARMSubArch_v7em
Definition: Triple.h:136
@ SPIRVSubArch_v12
Definition: Triple.h:163
@ SPIRVSubArch_v14
Definition: Triple.h:165
@ KalimbaSubArch_v4
Definition: Triple.h:153
@ ARMSubArch_v8_1m_mainline
Definition: Triple.h:134
@ ARMSubArch_v8_3a
Definition: Triple.h:127
@ AArch64SubArch_arm64ec
Definition: Triple.h:150
@ ARMSubArch_v8_6a
Definition: Triple.h:124
@ ARMSubArch_v5te
Definition: Triple.h:146
@ KalimbaSubArch_v5
Definition: Triple.h:154
@ ARMSubArch_v4t
Definition: Triple.h:147
@ DXILSubArch_v1_6
Definition: Triple.h:176
@ DXILSubArch_v1_8
Definition: Triple.h:178
@ ARMSubArch_v9_4a
Definition: Triple.h:116
@ ARMSubArch_v8_5a
Definition: Triple.h:125
@ ARMSubArch_v6m
Definition: Triple.h:142
@ ARMSubArch_v9_3a
Definition: Triple.h:117
@ ARMSubArch_v9
Definition: Triple.h:120
@ DXILSubArch_v1_4
Definition: Triple.h:174
@ SPIRVSubArch_v11
Definition: Triple.h:162
@ PPCSubArch_spe
Definition: Triple.h:158
bool getMacOSXVersion(VersionTuple &Version) const
Parse the version number as with getOSVersion and then translate generic "darwin" versions to the cor...
Definition: Triple.cpp:1372
bool isSPARC64() const
Tests whether the target is 64-bit SPARC (big endian).
Definition: Triple.h:1000
bool isWindowsCygwinEnvironment() const
Definition: Triple.h:653
bool isMacOSX() const
Is this a Mac OS X triple.
Definition: Triple.h:522
bool isOSFreeBSD() const
Definition: Triple.h:584
bool isXROS() const
Is this an Apple XROS triple.
Definition: Triple.h:550
void setEnvironmentName(StringRef Str)
Set the optional environment (fourth) component of the triple by name.
Definition: Triple.cpp:1575
void setOS(OSType Kind)
Set the operating system (third) component of the triple to a known type.
Definition: Triple.cpp:1532
void setOSName(StringRef Str)
Set the operating system (third) component of the triple by name.
Definition: Triple.cpp:1567
VendorType getVendor() const
Get the parsed vendor type of this triple.
Definition: Triple.h:379
bool isSPARC() const
Tests whether the target is SPARC.
Definition: Triple.h:1003
bool isPPC64() const
Tests whether the target is 64-bit PowerPC (little and big endian).
Definition: Triple.h:964
bool isOSDarwin() const
Is this a "Darwin" OS (macOS, iOS, tvOS, watchOS, XROS, or DriverKit).
Definition: Triple.h:558
bool hasDLLImportExport() const
Tests if the environment supports dllimport/export annotations.
Definition: Triple.h:1071
bool isSPIRVLogical() const
Tests whether the target is SPIR-V Logical.
Definition: Triple.h:835
static StringRef getEnvironmentTypeName(EnvironmentType Kind)
Get the canonical name for the Kind environment.
Definition: Triple.cpp:310
bool isOSVersionLT(unsigned Major, unsigned Minor=0, unsigned Micro=0) const
Helper function for doing comparisons against version numbers included in the target triple.
Definition: Triple.h:500
bool isTvOS() const
Is this an Apple tvOS triple.
Definition: Triple.h:536
bool isOSEmscripten() const
Tests whether the OS is Emscripten.
Definition: Triple.h:698
bool isWindowsArm64EC() const
Definition: Triple.h:640
bool operator==(const Triple &Other) const
Definition: Triple.h:344
bool isWatchOS() const
Is this an Apple watchOS triple.
Definition: Triple.h:541
bool isiOS() const
Is this an iOS triple.
Definition: Triple.h:531
bool isMIPS() const
Tests whether the target is MIPS (little and big endian, 32- or 64-bit).
Definition: Triple.h:948
bool isOSGlibc() const
Tests whether the OS uses glibc.
Definition: Triple.h:703
static VersionTuple getCanonicalVersionForOS(OSType OSKind, const VersionTuple &Version)
Returns a canonicalized OS version number for the specified OS.
Definition: Triple.cpp:2076
bool isPS() const
Tests whether the target is the PS4 or PS5 platform.
Definition: Triple.h:766
bool isWasm() const
Tests whether the target is wasm (32- and 64-bit).
Definition: Triple.h:1021
bool isVulkanOS() const
Definition: Triple.h:809
StringRef getArchName() const
Get the architecture (first) component of the triple.
Definition: Triple.cpp:1299
bool isOSIAMCU() const
Definition: Triple.h:598
bool isOpenHOS() const
Definition: Triple.h:796
bool isMacCatalystEnvironment() const
Definition: Triple.h:566
bool isPS5() const
Tests whether the target is the PS5 platform.
Definition: Triple.h:759
bool isSPIRV() const
Tests whether the target is SPIR-V (32/64-bit/Logical).
Definition: Triple.h:829
bool isAArch64() const
Tests whether the target is AArch64 (little and big endian).
Definition: Triple.h:911
static StringRef getObjectFormatTypeName(ObjectFormatType ObjectFormat)
Get the name for the Object format.
Definition: Triple.cpp:360
bool isArch16Bit() const
Test whether the architecture is 16-bit.
Definition: Triple.cpp:1667
llvm::Triple getBigEndianArchVariant() const
Form a triple with a big endian variant of the current architecture.
Definition: Triple.cpp:1833
VersionTuple getiOSVersion() const
Parse the version number as with getOSVersion.
Definition: Triple.cpp:1417
bool hasDefaultEmulatedTLS() const
Tests whether the target uses emulated TLS as default.
Definition: Triple.h:1056
bool isSystemZ() const
Tests whether the target is SystemZ.
Definition: Triple.h:1006
StringRef getEnvironmentVersionString() const
Get the version component of the environment component as a single string (the version after the envi...
Definition: Triple.cpp:1335
bool isPPC32SecurePlt() const
Tests whether the target 32-bit PowerPC uses Secure PLT.
Definition: Triple.h:977
bool isArch32Bit() const
Test whether the architecture is 32-bit.
Definition: Triple.cpp:1663
bool operator!=(const Triple &Other) const
Definition: Triple.h:351
unsigned getOSMajorVersion() const
Return just the major version number, this is specialized because it is a common query.
Definition: Triple.h:409
bool isCompatibleWith(const Triple &Other) const
Test whether target triples are compatible.
Definition: Triple.cpp:1992
bool isOSFuchsia() const
Definition: Triple.h:588
bool isOSBinFormatELF() const
Tests whether the OS uses the ELF binary format.
Definition: Triple.h:719
bool isWindowsMSVCEnvironment() const
Checks if the environment could be MSVC.
Definition: Triple.h:634
bool hasEnvironment() const
Does this triple have the optional environment (fourth) component?
Definition: Triple.h:385
bool isKnownWindowsMSVCEnvironment() const
Checks if the environment is MSVC.
Definition: Triple.h:629
static StringRef getArchTypePrefix(ArchType Kind)
Get the "prefix" canonical name for the Kind architecture.
Definition: Triple.cpp:149
bool isOSHaiku() const
Tests whether the OS is Haiku.
Definition: Triple.h:614
void setArch(ArchType Kind, SubArchType SubArch=NoSubArch)
Set the architecture (first) component of the triple to a known type.
Definition: Triple.cpp:1524
bool isDXIL() const
Tests whether the target is DXIL.
Definition: Triple.h:801
void setVendor(VendorType Kind)
Set the vendor (second) component of the triple to a known type.
Definition: Triple.cpp:1528
bool isGNUEnvironment() const
Definition: Triple.h:604
bool isLoongArch() const
Tests whether the target is LoongArch (32- and 64-bit).
Definition: Triple.h:935
bool isShaderStageEnvironment() const
Definition: Triple.h:811
bool isWindowsItaniumEnvironment() const
Definition: Triple.h:649
bool isVE() const
Tests whether the target is VE.
Definition: Triple.h:1016
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:81
Represents a version number in the form major[.minor[.subminor[.build]]].
Definition: VersionTuple.h:29
unsigned getMajor() const
Retrieve the major version number.
Definition: VersionTuple.h:71
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
@ Other
Any other memory.