LLVM 20.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 amdil, // AMDIL
92 amdil64, // AMDIL with 64-bit pointers
93 hsail, // AMD HSAIL
94 hsail64, // AMD HSAIL with 64-bit pointers
95 spir, // SPIR: standard portable IR for OpenCL 32-bit version
96 spir64, // SPIR: standard portable IR for OpenCL 64-bit version
97 spirv, // SPIR-V with logical memory layout.
98 spirv32, // SPIR-V with 32-bit pointers
99 spirv64, // SPIR-V with 64-bit pointers
100 kalimba, // Kalimba: generic kalimba
101 shave, // SHAVE: Movidius vector VLIW processors
102 lanai, // Lanai: Lanai 32-bit
103 wasm32, // WebAssembly with 32-bit pointers
104 wasm64, // WebAssembly with 64-bit pointers
105 renderscript32, // 32-bit RenderScript
106 renderscript64, // 64-bit RenderScript
107 ve, // NEC SX-Aurora Vector Engine
109 };
112
147
150
154
156
158
159 // SPIR-V sub-arch corresponds to its version.
167
168 // DXIL sub-arch corresponds to its version.
179 };
182
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
273
278 Simulator, // Simulator variants of other systems, e.g., Apple's iOS
279 MacABI, // Mac Catalyst variant of Apple's iOS deployment target.
280
281 // Shader Stages
282 // The order of these values matters, and must be kept in sync with the
283 // language options enum in Clang. The ordering is enforced in
284 // static_asserts in Triple.cpp and in Clang.
302
304
306 };
309
318 };
319
320private:
321 std::string Data;
322
323 /// The parsed arch type.
324 ArchType Arch{};
325
326 /// The parsed subarchitecture type.
327 SubArchType SubArch{};
328
329 /// The parsed vendor type.
330 VendorType Vendor{};
331
332 /// The parsed OS type.
333 OSType OS{};
334
335 /// The parsed Environment type.
336 EnvironmentType Environment{};
337
338 /// The object format type.
339 ObjectFormatType ObjectFormat{};
340
341public:
342 /// @name Constructors
343 /// @{
344
345 /// Default constructor is the same as an empty string and leaves all
346 /// triple fields unknown.
347 Triple() = default;
348
349 explicit Triple(const Twine &Str);
350 Triple(const Twine &ArchStr, const Twine &VendorStr, const Twine &OSStr);
351 Triple(const Twine &ArchStr, const Twine &VendorStr, const Twine &OSStr,
352 const Twine &EnvironmentStr);
353
354 bool operator==(const Triple &Other) const {
355 return Arch == Other.Arch && SubArch == Other.SubArch &&
356 Vendor == Other.Vendor && OS == Other.OS &&
357 Environment == Other.Environment &&
358 ObjectFormat == Other.ObjectFormat;
359 }
360
361 bool operator!=(const Triple &Other) const {
362 return !(*this == Other);
363 }
364
365 /// @}
366 /// @name Normalization
367 /// @{
368
369 /// Canonical form
370 enum class CanonicalForm {
371 ANY = 0,
372 THREE_IDENT = 3, // ARCHITECTURE-VENDOR-OPERATING_SYSTEM
373 FOUR_IDENT = 4, // ARCHITECTURE-VENDOR-OPERATING_SYSTEM-ENVIRONMENT
374 FIVE_IDENT = 5, // ARCHITECTURE-VENDOR-OPERATING_SYSTEM-ENVIRONMENT-FORMAT
375 };
376
377 /// Turn an arbitrary machine specification into the canonical triple form (or
378 /// something sensible that the Triple class understands if nothing better can
379 /// reasonably be done). In particular, it handles the common case in which
380 /// otherwise valid components are in the wrong order. \p Form is used to
381 /// specify the output canonical form.
382 static std::string normalize(StringRef Str,
384
385 /// Return the normalized form of this triple's string.
386 std::string normalize(CanonicalForm Form = CanonicalForm::ANY) const {
387 return normalize(Data, Form);
388 }
389
390 /// @}
391 /// @name Typed Component Access
392 /// @{
393
394 /// Get the parsed architecture type of this triple.
395 ArchType getArch() const { return Arch; }
396
397 /// get the parsed subarchitecture type for this triple.
398 SubArchType getSubArch() const { return SubArch; }
399
400 /// Get the parsed vendor type of this triple.
401 VendorType getVendor() const { return Vendor; }
402
403 /// Get the parsed operating system type of this triple.
404 OSType getOS() const { return OS; }
405
406 /// Does this triple have the optional environment (fourth) component?
407 bool hasEnvironment() const {
408 return getEnvironmentName() != "";
409 }
410
411 /// Get the parsed environment type of this triple.
412 EnvironmentType getEnvironment() const { return Environment; }
413
414 /// Parse the version number from the OS name component of the
415 /// triple, if present.
416 ///
417 /// For example, "fooos1.2.3" would return (1, 2, 3).
419
420 /// Get the object format for this triple.
421 ObjectFormatType getObjectFormat() const { return ObjectFormat; }
422
423 /// Parse the version number from the OS name component of the triple, if
424 /// present.
425 ///
426 /// For example, "fooos1.2.3" would return (1, 2, 3).
428
429 /// Return just the major version number, this is specialized because it is a
430 /// common query.
431 unsigned getOSMajorVersion() const { return getOSVersion().getMajor(); }
432
433 /// Parse the version number as with getOSVersion and then translate generic
434 /// "darwin" versions to the corresponding OS X versions. This may also be
435 /// called with IOS triples but the OS X version number is just set to a
436 /// constant 10.4.0 in that case. Returns true if successful.
438
439 /// Parse the version number as with getOSVersion. This should only be called
440 /// with IOS or generic triples.
442
443 /// Parse the version number as with getOSVersion. This should only be called
444 /// with WatchOS or generic triples.
446
447 /// Parse the version number as with getOSVersion.
449
450 /// Parse the Vulkan version number from the OSVersion and SPIR-V version
451 /// (SubArch). This should only be called with Vulkan SPIR-V triples.
453
454 /// Parse the DXIL version number from the OSVersion and DXIL version
455 /// (SubArch). This should only be called with DXIL triples.
457
458 /// @}
459 /// @name Direct Component Access
460 /// @{
461
462 const std::string &str() const { return Data; }
463
464 const std::string &getTriple() const { return Data; }
465
466 /// Get the architecture (first) component of the triple.
467 StringRef getArchName() const;
468
469 /// Get the vendor (second) component of the triple.
470 StringRef getVendorName() const;
471
472 /// Get the operating system (third) component of the triple.
473 StringRef getOSName() const;
474
475 /// Get the optional environment (fourth) component of the triple, or "" if
476 /// empty.
478
479 /// Get the operating system and optional environment components as a single
480 /// string (separated by a '-' if the environment component is present).
482
483 /// Get the version component of the environment component as a single
484 /// string (the version after the environment).
485 ///
486 /// For example, "fooos1.2.3" would return "1.2.3".
488
489 /// @}
490 /// @name Convenience Predicates
491 /// @{
492
493 /// Returns the pointer width of this architecture.
495
496 /// Returns the pointer width of this architecture.
497 unsigned getArchPointerBitWidth() const {
499 }
500
501 /// Test whether the architecture is 64-bit
502 ///
503 /// Note that this tests for 64-bit pointer width, and nothing else. Note
504 /// that we intentionally expose only three predicates, 64-bit, 32-bit, and
505 /// 16-bit. The inner details of pointer width for particular architectures
506 /// is not summed up in the triple, and so only a coarse grained predicate
507 /// system is provided.
508 bool isArch64Bit() const;
509
510 /// Test whether the architecture is 32-bit
511 ///
512 /// Note that this tests for 32-bit pointer width, and nothing else.
513 bool isArch32Bit() const;
514
515 /// Test whether the architecture is 16-bit
516 ///
517 /// Note that this tests for 16-bit pointer width, and nothing else.
518 bool isArch16Bit() const;
519
520 /// Helper function for doing comparisons against version numbers included in
521 /// the target triple.
522 bool isOSVersionLT(unsigned Major, unsigned Minor = 0,
523 unsigned Micro = 0) const {
524 if (Minor == 0) {
525 return getOSVersion() < VersionTuple(Major);
526 }
527 if (Micro == 0) {
528 return getOSVersion() < VersionTuple(Major, Minor);
529 }
530 return getOSVersion() < VersionTuple(Major, Minor, Micro);
531 }
532
533 bool isOSVersionLT(const Triple &Other) const {
534 return getOSVersion() < Other.getOSVersion();
535 }
536
537 /// Comparison function for checking OS X version compatibility, which handles
538 /// supporting skewed version numbering schemes used by the "darwin" triples.
539 bool isMacOSXVersionLT(unsigned Major, unsigned Minor = 0,
540 unsigned Micro = 0) const;
541
542 /// Is this a Mac OS X triple. For legacy reasons, we support both "darwin"
543 /// and "osx" as OS X triples.
544 bool isMacOSX() const {
545 return getOS() == Triple::Darwin || getOS() == Triple::MacOSX;
546 }
547
548 /// Is this an iOS triple.
549 /// Note: This identifies tvOS as a variant of iOS. If that ever
550 /// changes, i.e., if the two operating systems diverge or their version
551 /// numbers get out of sync, that will need to be changed.
552 /// watchOS has completely different version numbers so it is not included.
553 bool isiOS() const {
554 return getOS() == Triple::IOS || isTvOS();
555 }
556
557 /// Is this an Apple tvOS triple.
558 bool isTvOS() const {
559 return getOS() == Triple::TvOS;
560 }
561
562 /// Is this an Apple watchOS triple.
563 bool isWatchOS() const {
564 return getOS() == Triple::WatchOS;
565 }
566
567 bool isWatchABI() const {
569 }
570
571 /// Is this an Apple XROS triple.
572 bool isXROS() const { return getOS() == Triple::XROS; }
573
574 /// Is this an Apple DriverKit triple.
575 bool isDriverKit() const { return getOS() == Triple::DriverKit; }
576
577 bool isOSzOS() const { return getOS() == Triple::ZOS; }
578
579 /// Is this an Apple MachO triple.
580 bool isAppleMachO() const {
581 return (getVendor() == Triple::Apple) && isOSBinFormatMachO();
582 }
583
584 /// Is this a "Darwin" OS (macOS, iOS, tvOS, watchOS, XROS, or DriverKit).
585 bool isOSDarwin() const {
586 return isMacOSX() || isiOS() || isWatchOS() || isDriverKit() || isXROS();
587 }
588
591 }
592
594 return getEnvironment() == Triple::MacABI;
595 }
596
597 /// Returns true for targets that run on a macOS machine.
598 bool isTargetMachineMac() const {
599 return isMacOSX() || (isOSDarwin() && (isSimulatorEnvironment() ||
601 }
602
603 bool isOSNetBSD() const {
604 return getOS() == Triple::NetBSD;
605 }
606
607 bool isOSOpenBSD() const {
608 return getOS() == Triple::OpenBSD;
609 }
610
611 bool isOSFreeBSD() const {
612 return getOS() == Triple::FreeBSD;
613 }
614
615 bool isOSFuchsia() const {
616 return getOS() == Triple::Fuchsia;
617 }
618
619 bool isOSDragonFly() const { return getOS() == Triple::DragonFly; }
620
621 bool isOSSolaris() const {
622 return getOS() == Triple::Solaris;
623 }
624
625 bool isOSIAMCU() const {
626 return getOS() == Triple::ELFIAMCU;
627 }
628
629 bool isOSUnknown() const { return getOS() == Triple::UnknownOS; }
630
631 bool isGNUEnvironment() const {
633 return Env == Triple::GNU || Env == Triple::GNUT64 ||
634 Env == Triple::GNUABIN32 || Env == Triple::GNUABI64 ||
635 Env == Triple::GNUEABI || Env == Triple::GNUEABIT64 ||
636 Env == Triple::GNUEABIHF || Env == Triple::GNUEABIHFT64 ||
637 Env == Triple::GNUF32 || Env == Triple::GNUF64 ||
638 Env == Triple::GNUSF || Env == Triple::GNUX32;
639 }
640
641 /// Tests whether the OS is Haiku.
642 bool isOSHaiku() const {
643 return getOS() == Triple::Haiku;
644 }
645
646 /// Tests whether the OS is UEFI.
647 bool isUEFI() const {
648 return getOS() == Triple::UEFI;
649 }
650
651 /// Tests whether the OS is Windows.
652 bool isOSWindows() const {
653 return getOS() == Triple::Win32;
654 }
655
656 /// Checks if the environment is MSVC.
658 return isOSWindows() && getEnvironment() == Triple::MSVC;
659 }
660
661 /// Checks if the environment could be MSVC.
665 }
666
667 // Checks if we're using the Windows Arm64EC ABI.
668 bool isWindowsArm64EC() const {
669 return getArch() == Triple::aarch64 &&
671 }
672
675 }
676
679 }
680
683 }
684
686 return isOSWindows() && getEnvironment() == Triple::GNU;
687 }
688
689 /// Tests for either Cygwin or MinGW OS
690 bool isOSCygMing() const {
692 }
693
694 /// Is this a "Windows" OS targeting a "MSVCRT.dll" environment.
695 bool isOSMSVCRT() const {
698 }
699
700 /// Tests whether the OS is NaCl (Native Client)
701 bool isOSNaCl() const {
702 return getOS() == Triple::NaCl;
703 }
704
705 /// Tests whether the OS is Linux.
706 bool isOSLinux() const {
707 return getOS() == Triple::Linux;
708 }
709
710 /// Tests whether the OS is kFreeBSD.
711 bool isOSKFreeBSD() const {
712 return getOS() == Triple::KFreeBSD;
713 }
714
715 /// Tests whether the OS is Hurd.
716 bool isOSHurd() const {
717 return getOS() == Triple::Hurd;
718 }
719
720 /// Tests whether the OS is WASI.
721 bool isOSWASI() const {
722 return getOS() == Triple::WASI;
723 }
724
725 /// Tests whether the OS is Emscripten.
726 bool isOSEmscripten() const {
727 return getOS() == Triple::Emscripten;
728 }
729
730 /// Tests whether the OS uses glibc.
731 bool isOSGlibc() const {
732 return (getOS() == Triple::Linux || getOS() == Triple::KFreeBSD ||
733 getOS() == Triple::Hurd) &&
734 !isAndroid();
735 }
736
737 /// Tests whether the OS is AIX.
738 bool isOSAIX() const {
739 return getOS() == Triple::AIX;
740 }
741
742 bool isOSSerenity() const {
743 return getOS() == Triple::Serenity;
744 }
745
746 /// Tests whether the OS uses the ELF binary format.
747 bool isOSBinFormatELF() const {
748 return getObjectFormat() == Triple::ELF;
749 }
750
751 /// Tests whether the OS uses the COFF binary format.
752 bool isOSBinFormatCOFF() const {
753 return getObjectFormat() == Triple::COFF;
754 }
755
756 /// Tests whether the OS uses the GOFF binary format.
757 bool isOSBinFormatGOFF() const { return getObjectFormat() == Triple::GOFF; }
758
759 /// Tests whether the environment is MachO.
760 bool isOSBinFormatMachO() const {
761 return getObjectFormat() == Triple::MachO;
762 }
763
764 /// Tests whether the OS uses the Wasm binary format.
765 bool isOSBinFormatWasm() const {
766 return getObjectFormat() == Triple::Wasm;
767 }
768
769 /// Tests whether the OS uses the XCOFF binary format.
770 bool isOSBinFormatXCOFF() const {
771 return getObjectFormat() == Triple::XCOFF;
772 }
773
774 /// Tests whether the OS uses the DXContainer binary format.
777 }
778
779 /// Tests whether the target is the PS4 platform.
780 bool isPS4() const {
781 return getArch() == Triple::x86_64 &&
782 getVendor() == Triple::SCEI &&
783 getOS() == Triple::PS4;
784 }
785
786 /// Tests whether the target is the PS5 platform.
787 bool isPS5() const {
788 return getArch() == Triple::x86_64 &&
789 getVendor() == Triple::SCEI &&
790 getOS() == Triple::PS5;
791 }
792
793 /// Tests whether the target is the PS4 or PS5 platform.
794 bool isPS() const { return isPS4() || isPS5(); }
795
796 /// Tests whether the target is Android
797 bool isAndroid() const { return getEnvironment() == Triple::Android; }
798
799 bool isAndroidVersionLT(unsigned Major) const {
800 assert(isAndroid() && "Not an Android triple!");
801
803
804 // 64-bit targets did not exist before API level 21 (Lollipop).
805 if (isArch64Bit() && Version.getMajor() < 21)
806 return VersionTuple(21) < VersionTuple(Major);
807
808 return Version < VersionTuple(Major);
809 }
810
811 /// Tests whether the environment is musl-libc
812 bool isMusl() const {
813 return getEnvironment() == Triple::Musl ||
822 }
823
824 /// Tests whether the target is OHOS
825 /// LiteOS default enviroment is also OHOS, but omited on triple.
826 bool isOHOSFamily() const { return isOpenHOS() || isOSLiteOS(); }
827
828 bool isOpenHOS() const { return getEnvironment() == Triple::OpenHOS; }
829
830 bool isOSLiteOS() const { return getOS() == Triple::LiteOS; }
831
832 /// Tests whether the target is DXIL.
833 bool isDXIL() const {
834 return getArch() == Triple::dxil;
835 }
836
837 bool isShaderModelOS() const {
838 return getOS() == Triple::ShaderModel;
839 }
840
841 bool isVulkanOS() const { return getOS() == Triple::Vulkan; }
842
845 return Env == Triple::Pixel || Env == Triple::Vertex ||
846 Env == Triple::Geometry || Env == Triple::Hull ||
847 Env == Triple::Domain || Env == Triple::Compute ||
848 Env == Triple::Library || Env == Triple::RayGeneration ||
849 Env == Triple::Intersection || Env == Triple::AnyHit ||
850 Env == Triple::ClosestHit || Env == Triple::Miss ||
851 Env == Triple::Callable || Env == Triple::Mesh ||
853 }
854
855 /// Tests whether the target is SPIR (32- or 64-bit).
856 bool isSPIR() const {
857 return getArch() == Triple::spir || getArch() == Triple::spir64;
858 }
859
860 /// Tests whether the target is SPIR-V (32/64-bit/Logical).
861 bool isSPIRV() const {
862 return getArch() == Triple::spirv32 || getArch() == Triple::spirv64 ||
864 }
865
866 // Tests whether the target is SPIR-V or SPIR.
867 bool isSPIROrSPIRV() const { return isSPIR() || isSPIRV(); }
868
869 /// Tests whether the target is SPIR-V Logical
870 bool isSPIRVLogical() const {
871 return getArch() == Triple::spirv;
872 }
873
874 /// Tests whether the target is NVPTX (32- or 64-bit).
875 bool isNVPTX() const {
876 return getArch() == Triple::nvptx || getArch() == Triple::nvptx64;
877 }
878
879 /// Tests whether the target is AMDGCN
880 bool isAMDGCN() const { return getArch() == Triple::amdgcn; }
881
882 bool isAMDGPU() const {
883 return getArch() == Triple::r600 || getArch() == Triple::amdgcn;
884 }
885
886 /// Tests whether the target is Thumb (little and big endian).
887 bool isThumb() const {
888 return getArch() == Triple::thumb || getArch() == Triple::thumbeb;
889 }
890
891 /// Tests whether the target is ARM (little and big endian).
892 bool isARM() const {
893 return getArch() == Triple::arm || getArch() == Triple::armeb;
894 }
895
896 /// Tests whether the target supports the EHABI exception
897 /// handling standard.
899 return (isARM() || isThumb()) &&
910 }
911
912 /// Tests whether the target is T32.
913 bool isArmT32() const {
914 switch (getSubArch()) {
926 return false;
927 default:
928 return true;
929 }
930 }
931
932 /// Tests whether the target is an M-class.
933 bool isArmMClass() const {
934 switch (getSubArch()) {
941 return true;
942 default:
943 return false;
944 }
945 }
946
947 /// Tests whether the target is AArch64 (little and big endian).
948 bool isAArch64() const {
951 }
952
953 /// Tests whether the target is AArch64 and pointers are the size specified by
954 /// \p PointerWidth.
955 bool isAArch64(int PointerWidth) const {
956 assert(PointerWidth == 64 || PointerWidth == 32);
957 if (!isAArch64())
958 return false;
959 return getArch() == Triple::aarch64_32 ||
961 ? PointerWidth == 32
962 : PointerWidth == 64;
963 }
964
965 /// Tests whether the target is 32-bit LoongArch.
966 bool isLoongArch32() const { return getArch() == Triple::loongarch32; }
967
968 /// Tests whether the target is 64-bit LoongArch.
969 bool isLoongArch64() const { return getArch() == Triple::loongarch64; }
970
971 /// Tests whether the target is LoongArch (32- and 64-bit).
972 bool isLoongArch() const { return isLoongArch32() || isLoongArch64(); }
973
974 /// Tests whether the target is MIPS 32-bit (little and big endian).
975 bool isMIPS32() const {
976 return getArch() == Triple::mips || getArch() == Triple::mipsel;
977 }
978
979 /// Tests whether the target is MIPS 64-bit (little and big endian).
980 bool isMIPS64() const {
982 }
983
984 /// Tests whether the target is MIPS (little and big endian, 32- or 64-bit).
985 bool isMIPS() const {
986 return isMIPS32() || isMIPS64();
987 }
988
989 /// Tests whether the target is PowerPC (32- or 64-bit LE or BE).
990 bool isPPC() const {
991 return getArch() == Triple::ppc || getArch() == Triple::ppc64 ||
993 }
994
995 /// Tests whether the target is 32-bit PowerPC (little and big endian).
996 bool isPPC32() const {
997 return getArch() == Triple::ppc || getArch() == Triple::ppcle;
998 }
999
1000 /// Tests whether the target is 64-bit PowerPC (little and big endian).
1001 bool isPPC64() const {
1002 return getArch() == Triple::ppc64 || getArch() == Triple::ppc64le;
1003 }
1004
1005 /// Tests whether the target 64-bit PowerPC big endian ABI is ELFv2.
1006 bool isPPC64ELFv2ABI() const {
1007 return (getArch() == Triple::ppc64 &&
1008 ((getOS() == Triple::FreeBSD &&
1009 (getOSMajorVersion() >= 13 || getOSVersion().empty())) ||
1010 getOS() == Triple::OpenBSD || isMusl()));
1011 }
1012
1013 /// Tests whether the target 32-bit PowerPC uses Secure PLT.
1014 bool isPPC32SecurePlt() const {
1015 return ((getArch() == Triple::ppc || getArch() == Triple::ppcle) &&
1016 ((getOS() == Triple::FreeBSD &&
1017 (getOSMajorVersion() >= 13 || getOSVersion().empty())) ||
1019 isMusl()));
1020 }
1021
1022 /// Tests whether the target is 32-bit RISC-V.
1023 bool isRISCV32() const { return getArch() == Triple::riscv32; }
1024
1025 /// Tests whether the target is 64-bit RISC-V.
1026 bool isRISCV64() const { return getArch() == Triple::riscv64; }
1027
1028 /// Tests whether the target is RISC-V (32- and 64-bit).
1029 bool isRISCV() const { return isRISCV32() || isRISCV64(); }
1030
1031 /// Tests whether the target is 32-bit SPARC (little and big endian).
1032 bool isSPARC32() const {
1033 return getArch() == Triple::sparc || getArch() == Triple::sparcel;
1034 }
1035
1036 /// Tests whether the target is 64-bit SPARC (big endian).
1037 bool isSPARC64() const { return getArch() == Triple::sparcv9; }
1038
1039 /// Tests whether the target is SPARC.
1040 bool isSPARC() const { return isSPARC32() || isSPARC64(); }
1041
1042 /// Tests whether the target is SystemZ.
1043 bool isSystemZ() const {
1044 return getArch() == Triple::systemz;
1045 }
1046
1047 /// Tests whether the target is x86 (32- or 64-bit).
1048 bool isX86() const {
1049 return getArch() == Triple::x86 || getArch() == Triple::x86_64;
1050 }
1051
1052 /// Tests whether the target is VE
1053 bool isVE() const {
1054 return getArch() == Triple::ve;
1055 }
1056
1057 /// Tests whether the target is wasm (32- and 64-bit).
1058 bool isWasm() const {
1059 return getArch() == Triple::wasm32 || getArch() == Triple::wasm64;
1060 }
1061
1062 // Tests whether the target is CSKY
1063 bool isCSKY() const {
1064 return getArch() == Triple::csky;
1065 }
1066
1067 /// Tests whether the target is the Apple "arm64e" AArch64 subarch.
1068 bool isArm64e() const {
1069 return getArch() == Triple::aarch64 &&
1071 }
1072
1073 // Tests whether the target is N32.
1074 bool isABIN32() const {
1076 return Env == Triple::GNUABIN32 || Env == Triple::MuslABIN32;
1077 }
1078
1079 /// Tests whether the target is X32.
1080 bool isX32() const {
1082 return Env == Triple::GNUX32 || Env == Triple::MuslX32;
1083 }
1084
1085 /// Tests whether the target is eBPF.
1086 bool isBPF() const {
1087 return getArch() == Triple::bpfel || getArch() == Triple::bpfeb;
1088 }
1089
1090 /// Tests if the target forces 64-bit time_t on a 32-bit architecture.
1091 bool isTime64ABI() const {
1093 return Env == Triple::GNUT64 || Env == Triple::GNUEABIT64 ||
1094 Env == Triple::GNUEABIHFT64;
1095 }
1096
1097 /// Tests if the target forces hardfloat.
1098 bool isHardFloatABI() const {
1100 return Env == llvm::Triple::GNUEABIHF ||
1102 Env == llvm::Triple::MuslEABIHF ||
1103 Env == llvm::Triple::EABIHF;
1104 }
1105
1106 /// Tests whether the target supports comdat
1107 bool supportsCOMDAT() const {
1108 return !(isOSBinFormatMachO() || isOSBinFormatXCOFF() ||
1110 }
1111
1112 /// Tests whether the target uses emulated TLS as default.
1113 ///
1114 /// Note: Android API level 29 (10) introduced ELF TLS.
1116 return (isAndroid() && isAndroidVersionLT(29)) || isOSOpenBSD() ||
1118 }
1119
1120 /// True if the target supports both general-dynamic and TLSDESC, and TLSDESC
1121 /// is enabled by default.
1122 bool hasDefaultTLSDESC() const { return isAndroid() && isRISCV64(); }
1123
1124 /// Tests whether the target uses -data-sections as default.
1126 return isOSBinFormatXCOFF() || isWasm();
1127 }
1128
1129 /// Tests if the environment supports dllimport/export annotations.
1130 bool hasDLLImportExport() const { return isOSWindows() || isPS(); }
1131
1132 /// @}
1133 /// @name Mutators
1134 /// @{
1135
1136 /// Set the architecture (first) component of the triple to a known type.
1137 void setArch(ArchType Kind, SubArchType SubArch = NoSubArch);
1138
1139 /// Set the vendor (second) component of the triple to a known type.
1140 void setVendor(VendorType Kind);
1141
1142 /// Set the operating system (third) component of the triple to a known type.
1143 void setOS(OSType Kind);
1144
1145 /// Set the environment (fourth) component of the triple to a known type.
1147
1148 /// Set the object file format.
1150
1151 /// Set all components to the new triple \p Str.
1152 void setTriple(const Twine &Str);
1153
1154 /// Set the architecture (first) component of the triple by name.
1155 void setArchName(StringRef Str);
1156
1157 /// Set the vendor (second) component of the triple by name.
1158 void setVendorName(StringRef Str);
1159
1160 /// Set the operating system (third) component of the triple by name.
1161 void setOSName(StringRef Str);
1162
1163 /// Set the optional environment (fourth) component of the triple by name.
1164 void setEnvironmentName(StringRef Str);
1165
1166 /// Set the operating system and optional environment components with a single
1167 /// string.
1169
1170 /// @}
1171 /// @name Helpers to build variants of a particular triple.
1172 /// @{
1173
1174 /// Form a triple with a 32-bit variant of the current architecture.
1175 ///
1176 /// This can be used to move across "families" of architectures where useful.
1177 ///
1178 /// \returns A new triple with a 32-bit architecture or an unknown
1179 /// architecture if no such variant can be found.
1181
1182 /// Form a triple with a 64-bit variant of the current architecture.
1183 ///
1184 /// This can be used to move across "families" of architectures where useful.
1185 ///
1186 /// \returns A new triple with a 64-bit architecture or an unknown
1187 /// architecture if no such variant can be found.
1189
1190 /// Form a triple with a big endian variant of the current architecture.
1191 ///
1192 /// This can be used to move across "families" of architectures where useful.
1193 ///
1194 /// \returns A new triple with a big endian architecture or an unknown
1195 /// architecture if no such variant can be found.
1197
1198 /// Form a triple with a little endian variant of the current architecture.
1199 ///
1200 /// This can be used to move across "families" of architectures where useful.
1201 ///
1202 /// \returns A new triple with a little endian architecture or an unknown
1203 /// architecture if no such variant can be found.
1205
1206 /// Tests whether the target triple is little endian.
1207 ///
1208 /// \returns true if the triple is little endian, false otherwise.
1209 bool isLittleEndian() const;
1210
1211 /// Test whether target triples are compatible.
1212 bool isCompatibleWith(const Triple &Other) const;
1213
1214 /// Merge target triples.
1215 std::string merge(const Triple &Other) const;
1216
1217 /// Some platforms have different minimum supported OS versions that
1218 /// varies by the architecture specified in the triple. This function
1219 /// returns the minimum supported OS version for this triple if one an exists,
1220 /// or an invalid version tuple if this triple doesn't have one.
1222
1223 /// @}
1224 /// @name Static helpers for IDs.
1225 /// @{
1226
1227 /// Get the canonical name for the \p Kind architecture.
1228 static StringRef getArchTypeName(ArchType Kind);
1229
1230 /// Get the architecture name based on \p Kind and \p SubArch.
1231 static StringRef getArchName(ArchType Kind, SubArchType SubArch = NoSubArch);
1232
1233 /// Get the "prefix" canonical name for the \p Kind architecture. This is the
1234 /// prefix used by the architecture specific builtins, and is suitable for
1235 /// passing to \see Intrinsic::getIntrinsicForClangBuiltin().
1236 ///
1237 /// \return - The architecture prefix, or 0 if none is defined.
1239
1240 /// Get the canonical name for the \p Kind vendor.
1242
1243 /// Get the canonical name for the \p Kind operating system.
1244 static StringRef getOSTypeName(OSType Kind);
1245
1246 /// Get the canonical name for the \p Kind environment.
1248
1249 /// Get the name for the \p Object format.
1251
1252 /// @}
1253 /// @name Static helpers for converting alternate architecture names.
1254 /// @{
1255
1256 /// The canonical type for the given LLVM architecture name (e.g., "x86").
1258
1259 /// @}
1260
1261 /// Returns a canonicalized OS version number for the specified OS.
1263 const VersionTuple &Version);
1264};
1265
1266} // End llvm namespace
1267
1268
1269#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:51
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:2083
VersionTuple getOSVersion() const
Parse the version number from the OS name component of the triple, if present.
Definition: Triple.cpp:1413
bool isPPC() const
Tests whether the target is PowerPC (32- or 64-bit LE or BE).
Definition: Triple.h:990
bool isOSDragonFly() const
Definition: Triple.h:619
StringRef getVendorName() const
Get the vendor (second) component of the triple.
Definition: Triple.cpp:1358
VersionTuple getWatchOSVersion() const
Parse the version number as with getOSVersion.
Definition: Triple.cpp:1502
void setArchName(StringRef Str)
Set the architecture (first) component of the triple by name.
Definition: Triple.cpp:1609
bool isTargetMachineMac() const
Returns true for targets that run on a macOS machine.
Definition: Triple.h:598
bool isArmT32() const
Tests whether the target is T32.
Definition: Triple.h:913
bool isOSNaCl() const
Tests whether the OS is NaCl (Native Client)
Definition: Triple.h:701
void setObjectFormat(ObjectFormatType Kind)
Set the object file format.
Definition: Triple.cpp:1601
bool isAndroidVersionLT(unsigned Major) const
Definition: Triple.h:799
llvm::Triple get32BitArchVariant() const
Form a triple with a 32-bit variant of the current architecture.
Definition: Triple.cpp:1726
bool isOSCygMing() const
Tests for either Cygwin or MinGW OS.
Definition: Triple.h:690
bool isWatchABI() const
Definition: Triple.h:567
Triple()=default
Default constructor is the same as an empty string and leaves all triple fields unknown.
@ MuslABIN32
Definition: Triple.h:265
@ RayGeneration
Definition: Triple.h:292
@ GNUEABIT64
Definition: Triple.h:252
@ LastEnvironmentType
Definition: Triple.h:305
@ UnknownEnvironment
Definition: Triple.h:245
@ ClosestHit
Definition: Triple.h:295
@ MuslEABIHF
Definition: Triple.h:268
@ Amplification
Definition: Triple.h:299
@ Intersection
Definition: Triple.h:293
@ GNUEABIHFT64
Definition: Triple.h:254
bool isThumb() const
Tests whether the target is Thumb (little and big endian).
Definition: Triple.h:887
bool isPS4() const
Tests whether the target is the PS4 platform.
Definition: Triple.h:780
bool isPPC64ELFv2ABI() const
Tests whether the target 64-bit PowerPC big endian ABI is ELFv2.
Definition: Triple.h:1006
bool isOSWASI() const
Tests whether the OS is WASI.
Definition: Triple.h:721
bool isSPIR() const
Tests whether the target is SPIR (32- or 64-bit).
Definition: Triple.h:856
CanonicalForm
Canonical form.
Definition: Triple.h:370
bool isOSBinFormatWasm() const
Tests whether the OS uses the Wasm binary format.
Definition: Triple.h:765
bool isDriverKit() const
Is this an Apple DriverKit triple.
Definition: Triple.h:575
unsigned getArchPointerBitWidth() const
Returns the pointer width of this architecture.
Definition: Triple.h:497
llvm::Triple getLittleEndianArchVariant() const
Form a triple with a little endian variant of the current architecture.
Definition: Triple.cpp:1950
bool isOSHurd() const
Tests whether the OS is Hurd.
Definition: Triple.h:716
bool isHardFloatABI() const
Tests if the target forces hardfloat.
Definition: Triple.h:1098
bool isBPF() const
Tests whether the target is eBPF.
Definition: Triple.h:1086
bool isX32() const
Tests whether the target is X32.
Definition: Triple.h:1080
static StringRef getVendorTypeName(VendorType Kind)
Get the canonical name for the Kind vendor.
Definition: Triple.cpp:254
ObjectFormatType getObjectFormat() const
Get the object format for this triple.
Definition: Triple.h:421
bool isAArch64(int PointerWidth) const
Tests whether the target is AArch64 and pointers are the size specified by PointerWidth.
Definition: Triple.h:955
SubArchType getSubArch() const
get the parsed subarchitecture type for this triple.
Definition: Triple.h:398
bool isX86() const
Tests whether the target is x86 (32- or 64-bit).
Definition: Triple.h:1048
bool isArm64e() const
Tests whether the target is the Apple "arm64e" AArch64 subarch.
Definition: Triple.h:1068
std::string normalize(CanonicalForm Form=CanonicalForm::ANY) const
Return the normalized form of this triple's string.
Definition: Triple.h:386
bool isTargetEHABICompatible() const
Tests whether the target supports the EHABI exception handling standard.
Definition: Triple.h:898
bool isOSBinFormatGOFF() const
Tests whether the OS uses the GOFF binary format.
Definition: Triple.h:757
bool isWindowsGNUEnvironment() const
Definition: Triple.h:685
void setVendorName(StringRef Str)
Set the vendor (second) component of the triple by name.
Definition: Triple.cpp:1620
@ 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:603
void setOSAndEnvironmentName(StringRef Str)
Set the operating system and optional environment components with a single string.
Definition: Triple.cpp:1637
bool isAndroid() const
Tests whether the target is Android.
Definition: Triple.h:797
bool hasDefaultTLSDESC() const
True if the target supports both general-dynamic and TLSDESC, and TLSDESC is enabled by default.
Definition: Triple.h:1122
llvm::Triple get64BitArchVariant() const
Form a triple with a 64-bit variant of the current architecture.
Definition: Triple.cpp:1805
bool isOSMSVCRT() const
Is this a "Windows" OS targeting a "MSVCRT.dll" environment.
Definition: Triple.h:695
bool isOSBinFormatMachO() const
Tests whether the environment is MachO.
Definition: Triple.h:760
bool isLittleEndian() const
Tests whether the target triple is little endian.
Definition: Triple.cpp:1987
void setEnvironment(EnvironmentType Kind)
Set the environment (fourth) component of the triple to a known type.
Definition: Triple.cpp:1593
bool isABIN32() const
Definition: Triple.h:1074
StringRef getOSName() const
Get the operating system (third) component of the triple.
Definition: Triple.cpp:1363
bool supportsCOMDAT() const
Tests whether the target supports comdat.
Definition: Triple.h:1107
bool isWindowsCoreCLREnvironment() const
Definition: Triple.h:673
bool isSPIROrSPIRV() const
Definition: Triple.h:867
bool isMIPS64() const
Tests whether the target is MIPS 64-bit (little and big endian).
Definition: Triple.h:980
@ loongarch32
Definition: Triple.h:61
@ LastArchType
Definition: Triple.h:108
@ renderscript64
Definition: Triple.h:106
@ UnknownArch
Definition: Triple.h:47
@ aarch64_be
Definition: Triple.h:52
@ loongarch64
Definition: Triple.h:62
@ renderscript32
Definition: Triple.h:105
@ 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:1125
bool isOSSolaris() const
Definition: Triple.h:621
bool isRISCV32() const
Tests whether the target is 32-bit RISC-V.
Definition: Triple.h:1023
bool isOSKFreeBSD() const
Tests whether the OS is kFreeBSD.
Definition: Triple.h:711
void setTriple(const Twine &Str)
Set all components to the new triple Str.
Definition: Triple.cpp:1577
OSType getOS() const
Get the parsed operating system type of this triple.
Definition: Triple.h:404
VersionTuple getEnvironmentVersion() const
Parse the version number from the OS name component of the triple, if present.
Definition: Triple.cpp:1386
static 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:1131
static ArchType getArchTypeForLLVMName(StringRef Str)
The canonical type for the given LLVM architecture name (e.g., "x86").
Definition: Triple.cpp:422
bool isOSVersionLT(const Triple &Other) const
Definition: Triple.h:533
bool isPPC32() const
Tests whether the target is 32-bit PowerPC (little and big endian).
Definition: Triple.h:996
ArchType getArch() const
Get the parsed architecture type of this triple.
Definition: Triple.h:395
bool isOSBinFormatCOFF() const
Tests whether the OS uses the COFF binary format.
Definition: Triple.h:752
bool isRISCV64() const
Tests whether the target is 64-bit RISC-V.
Definition: Triple.h:1026
bool isCSKY() const
Definition: Triple.h:1063
bool isLoongArch64() const
Tests whether the target is 64-bit LoongArch.
Definition: Triple.h:969
StringRef getEnvironmentName() const
Get the optional environment (fourth) component of the triple, or "" if empty.
Definition: Triple.cpp:1369
bool isSPARC32() const
Tests whether the target is 32-bit SPARC (little and big endian).
Definition: Triple.h:1032
bool isSimulatorEnvironment() const
Definition: Triple.h:589
VersionTuple getDXILVersion() const
Parse the DXIL version number from the OSVersion and DXIL version (SubArch).
Definition: Triple.cpp:1564
const std::string & str() const
Definition: Triple.h:462
bool isOSzOS() const
Definition: Triple.h:577
bool isOSSerenity() const
Definition: Triple.h:742
bool isOHOSFamily() const
Tests whether the target is OHOS LiteOS default enviroment is also OHOS, but omited on triple.
Definition: Triple.h:826
EnvironmentType getEnvironment() const
Get the parsed environment type of this triple.
Definition: Triple.h:412
bool isOSOpenBSD() const
Definition: Triple.h:607
VersionTuple getVulkanVersion() const
Parse the Vulkan version number from the OSVersion and SPIR-V version (SubArch).
Definition: Triple.cpp:1539
bool isOSUnknown() const
Definition: Triple.h:629
VersionTuple getDriverKitVersion() const
Parse the version number as with getOSVersion.
Definition: Triple.cpp:1527
bool isMIPS32() const
Tests whether the target is MIPS 32-bit (little and big endian).
Definition: Triple.h:975
bool isShaderModelOS() const
Definition: Triple.h:837
bool isUEFI() const
Tests whether the OS is UEFI.
Definition: Triple.h:647
bool isOSWindows() const
Tests whether the OS is Windows.
Definition: Triple.h:652
bool isMusl() const
Tests whether the environment is musl-libc.
Definition: Triple.h:812
const std::string & getTriple() const
Definition: Triple.h:464
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:775
bool isOSBinFormatXCOFF() const
Tests whether the OS uses the XCOFF binary format.
Definition: Triple.h:770
static StringRef getOSTypeName(OSType Kind)
Get the canonical name for the Kind operating system.
Definition: Triple.cpp:278
ObjectFormatType
Definition: Triple.h:307
@ DXContainer
Definition: Triple.h:311
@ UnknownObjectFormat
Definition: Triple.h:308
bool isARM() const
Tests whether the target is ARM (little and big endian).
Definition: Triple.h:892
std::string merge(const Triple &Other) const
Merge target triples.
Definition: Triple.cpp:2074
bool isArmMClass() const
Tests whether the target is an M-class.
Definition: Triple.h:933
bool isOSLinux() const
Tests whether the OS is Linux.
Definition: Triple.h:706
bool isRISCV() const
Tests whether the target is RISC-V (32- and 64-bit).
Definition: Triple.h:1029
bool isAMDGCN() const
Tests whether the target is AMDGCN.
Definition: Triple.h:880
bool isAMDGPU() const
Definition: Triple.h:882
bool isLoongArch32() const
Tests whether the target is 32-bit LoongArch.
Definition: Triple.h:966
bool isOSLiteOS() const
Definition: Triple.h:830
@ UnknownVendor
Definition: Triple.h:181
@ OpenEmbedded
Definition: Triple.h:195
@ ImaginationTechnologies
Definition: Triple.h:188
@ LastVendorType
Definition: Triple.h:197
@ MipsTechnologies
Definition: Triple.h:189
bool isNVPTX() const
Tests whether the target is NVPTX (32- or 64-bit).
Definition: Triple.h:875
bool isOSAIX() const
Tests whether the OS is AIX.
Definition: Triple.h:738
VersionTuple getMinimumSupportedOSVersion() const
Some platforms have different minimum supported OS versions that varies by the architecture specified...
Definition: Triple.cpp:2100
bool isArch64Bit() const
Test whether the architecture is 64-bit.
Definition: Triple.cpp:1714
StringRef getOSAndEnvironmentName() const
Get the operating system and optional environment components as a single string (separated by a '-' i...
Definition: Triple.cpp:1375
@ ARMSubArch_v6t2
Definition: Triple.h:143
@ MipsSubArch_r6
Definition: Triple.h:155
@ DXILSubArch_v1_2
Definition: Triple.h:171
@ ARMSubArch_v7
Definition: Triple.h:134
@ ARMSubArch_v8m_mainline
Definition: Triple.h:132
@ ARMSubArch_v9_6a
Definition: Triple.h:113
@ ARMSubArch_v8r
Definition: Triple.h:130
@ ARMSubArch_v9_1a
Definition: Triple.h:118
@ DXILSubArch_v1_1
Definition: Triple.h:170
@ LatestDXILSubArch
Definition: Triple.h:178
@ SPIRVSubArch_v10
Definition: Triple.h:160
@ SPIRVSubArch_v13
Definition: Triple.h:163
@ ARMSubArch_v7k
Definition: Triple.h:138
@ ARMSubArch_v8_7a
Definition: Triple.h:122
@ ARMSubArch_v8
Definition: Triple.h:129
@ SPIRVSubArch_v16
Definition: Triple.h:166
@ ARMSubArch_v8_1a
Definition: Triple.h:128
@ ARMSubArch_v9_2a
Definition: Triple.h:117
@ DXILSubArch_v1_3
Definition: Triple.h:172
@ SPIRVSubArch_v15
Definition: Triple.h:165
@ ARMSubArch_v7m
Definition: Triple.h:136
@ ARMSubArch_v6k
Definition: Triple.h:142
@ ARMSubArch_v5
Definition: Triple.h:144
@ AArch64SubArch_arm64e
Definition: Triple.h:148
@ ARMSubArch_v6
Definition: Triple.h:140
@ ARMSubArch_v9_5a
Definition: Triple.h:114
@ ARMSubArch_v7ve
Definition: Triple.h:139
@ ARMSubArch_v8m_baseline
Definition: Triple.h:131
@ ARMSubArch_v8_8a
Definition: Triple.h:121
@ ARMSubArch_v8_2a
Definition: Triple.h:127
@ ARMSubArch_v7s
Definition: Triple.h:137
@ DXILSubArch_v1_0
Definition: Triple.h:169
@ DXILSubArch_v1_7
Definition: Triple.h:176
@ KalimbaSubArch_v3
Definition: Triple.h:151
@ DXILSubArch_v1_5
Definition: Triple.h:174
@ ARMSubArch_v8_4a
Definition: Triple.h:125
@ ARMSubArch_v8_9a
Definition: Triple.h:120
@ ARMSubArch_v7em
Definition: Triple.h:135
@ SPIRVSubArch_v12
Definition: Triple.h:162
@ SPIRVSubArch_v14
Definition: Triple.h:164
@ KalimbaSubArch_v4
Definition: Triple.h:152
@ ARMSubArch_v8_1m_mainline
Definition: Triple.h:133
@ ARMSubArch_v8_3a
Definition: Triple.h:126
@ AArch64SubArch_arm64ec
Definition: Triple.h:149
@ ARMSubArch_v8_6a
Definition: Triple.h:123
@ ARMSubArch_v5te
Definition: Triple.h:145
@ KalimbaSubArch_v5
Definition: Triple.h:153
@ ARMSubArch_v4t
Definition: Triple.h:146
@ DXILSubArch_v1_6
Definition: Triple.h:175
@ DXILSubArch_v1_8
Definition: Triple.h:177
@ ARMSubArch_v9_4a
Definition: Triple.h:115
@ ARMSubArch_v8_5a
Definition: Triple.h:124
@ ARMSubArch_v6m
Definition: Triple.h:141
@ ARMSubArch_v9_3a
Definition: Triple.h:116
@ ARMSubArch_v9
Definition: Triple.h:119
@ DXILSubArch_v1_4
Definition: Triple.h:173
@ SPIRVSubArch_v11
Definition: Triple.h:161
@ PPCSubArch_spe
Definition: Triple.h:157
bool getMacOSXVersion(VersionTuple &Version) const
Parse the version number as with getOSVersion and then translate generic "darwin" versions to the cor...
Definition: Triple.cpp:1427
bool isSPARC64() const
Tests whether the target is 64-bit SPARC (big endian).
Definition: Triple.h:1037
bool isWindowsCygwinEnvironment() const
Definition: Triple.h:681
bool isMacOSX() const
Is this a Mac OS X triple.
Definition: Triple.h:544
bool isOSFreeBSD() const
Definition: Triple.h:611
bool isXROS() const
Is this an Apple XROS triple.
Definition: Triple.h:572
void setEnvironmentName(StringRef Str)
Set the optional environment (fourth) component of the triple by name.
Definition: Triple.cpp:1632
void setOS(OSType Kind)
Set the operating system (third) component of the triple to a known type.
Definition: Triple.cpp:1589
void setOSName(StringRef Str)
Set the operating system (third) component of the triple by name.
Definition: Triple.cpp:1624
VendorType getVendor() const
Get the parsed vendor type of this triple.
Definition: Triple.h:401
bool isSPARC() const
Tests whether the target is SPARC.
Definition: Triple.h:1040
bool isPPC64() const
Tests whether the target is 64-bit PowerPC (little and big endian).
Definition: Triple.h:1001
bool isOSDarwin() const
Is this a "Darwin" OS (macOS, iOS, tvOS, watchOS, XROS, or DriverKit).
Definition: Triple.h:585
bool hasDLLImportExport() const
Tests if the environment supports dllimport/export annotations.
Definition: Triple.h:1130
bool isSPIRVLogical() const
Tests whether the target is SPIR-V Logical.
Definition: Triple.h:870
static StringRef getEnvironmentTypeName(EnvironmentType Kind)
Get the canonical name for the Kind environment.
Definition: Triple.cpp:327
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:522
bool isTvOS() const
Is this an Apple tvOS triple.
Definition: Triple.h:558
bool isOSEmscripten() const
Tests whether the OS is Emscripten.
Definition: Triple.h:726
bool isWindowsArm64EC() const
Definition: Triple.h:668
bool operator==(const Triple &Other) const
Definition: Triple.h:354
bool isWatchOS() const
Is this an Apple watchOS triple.
Definition: Triple.h:563
bool isiOS() const
Is this an iOS triple.
Definition: Triple.h:553
bool isMIPS() const
Tests whether the target is MIPS (little and big endian, 32- or 64-bit).
Definition: Triple.h:985
bool isOSGlibc() const
Tests whether the OS uses glibc.
Definition: Triple.h:731
static VersionTuple getCanonicalVersionForOS(OSType OSKind, const VersionTuple &Version)
Returns a canonicalized OS version number for the specified OS.
Definition: Triple.cpp:2134
bool isPS() const
Tests whether the target is the PS4 or PS5 platform.
Definition: Triple.h:794
bool isWasm() const
Tests whether the target is wasm (32- and 64-bit).
Definition: Triple.h:1058
bool isVulkanOS() const
Definition: Triple.h:841
StringRef getArchName() const
Get the architecture (first) component of the triple.
Definition: Triple.cpp:1354
bool isOSIAMCU() const
Definition: Triple.h:625
bool isOpenHOS() const
Definition: Triple.h:828
bool isMacCatalystEnvironment() const
Definition: Triple.h:593
bool isPS5() const
Tests whether the target is the PS5 platform.
Definition: Triple.h:787
bool isSPIRV() const
Tests whether the target is SPIR-V (32/64-bit/Logical).
Definition: Triple.h:861
bool isAArch64() const
Tests whether the target is AArch64 (little and big endian).
Definition: Triple.h:948
static StringRef getObjectFormatTypeName(ObjectFormatType ObjectFormat)
Get the name for the Object format.
Definition: Triple.cpp:392
bool isAppleMachO() const
Is this an Apple MachO triple.
Definition: Triple.h:580
bool isArch16Bit() const
Test whether the architecture is 16-bit.
Definition: Triple.cpp:1722
llvm::Triple getBigEndianArchVariant() const
Form a triple with a big endian variant of the current architecture.
Definition: Triple.cpp:1884
VersionTuple getiOSVersion() const
Parse the version number as with getOSVersion.
Definition: Triple.cpp:1472
bool hasDefaultEmulatedTLS() const
Tests whether the target uses emulated TLS as default.
Definition: Triple.h:1115
bool isSystemZ() const
Tests whether the target is SystemZ.
Definition: Triple.h:1043
StringRef getEnvironmentVersionString() const
Get the version component of the environment component as a single string (the version after the envi...
Definition: Triple.cpp:1390
bool isPPC32SecurePlt() const
Tests whether the target 32-bit PowerPC uses Secure PLT.
Definition: Triple.h:1014
bool isTime64ABI() const
Tests if the target forces 64-bit time_t on a 32-bit architecture.
Definition: Triple.h:1091
bool isArch32Bit() const
Test whether the architecture is 32-bit.
Definition: Triple.cpp:1718
bool operator!=(const Triple &Other) const
Definition: Triple.h:361
unsigned getOSMajorVersion() const
Return just the major version number, this is specialized because it is a common query.
Definition: Triple.h:431
bool isCompatibleWith(const Triple &Other) const
Test whether target triples are compatible.
Definition: Triple.cpp:2039
bool isOSFuchsia() const
Definition: Triple.h:615
bool isOSBinFormatELF() const
Tests whether the OS uses the ELF binary format.
Definition: Triple.h:747
bool isWindowsMSVCEnvironment() const
Checks if the environment could be MSVC.
Definition: Triple.h:662
bool hasEnvironment() const
Does this triple have the optional environment (fourth) component?
Definition: Triple.h:407
bool isKnownWindowsMSVCEnvironment() const
Checks if the environment is MSVC.
Definition: Triple.h:657
static StringRef getArchTypePrefix(ArchType Kind)
Get the "prefix" canonical name for the Kind architecture.
Definition: Triple.cpp:167
bool isOSHaiku() const
Tests whether the OS is Haiku.
Definition: Triple.h:642
void setArch(ArchType Kind, SubArchType SubArch=NoSubArch)
Set the architecture (first) component of the triple to a known type.
Definition: Triple.cpp:1581
bool isDXIL() const
Tests whether the target is DXIL.
Definition: Triple.h:833
void setVendor(VendorType Kind)
Set the vendor (second) component of the triple to a known type.
Definition: Triple.cpp:1585
bool isGNUEnvironment() const
Definition: Triple.h:631
bool isLoongArch() const
Tests whether the target is LoongArch (32- and 64-bit).
Definition: Triple.h:972
bool isShaderStageEnvironment() const
Definition: Triple.h:843
bool isWindowsItaniumEnvironment() const
Definition: Triple.h:677
bool isVE() const
Tests whether the target is VE.
Definition: Triple.h:1053
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.