1 //===-- llvm/ADT/Triple.h - Target triple helper class ----------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_ADT_TRIPLE_H
10 #define LLVM_ADT_TRIPLE_H
12 #include "llvm/ADT/Twine.h"
14 // Some system headers or GCC predefined macros conflict with identifiers in
15 // this file. Undefine them here.
24 /// Triple - Helper class for working with autoconf configuration names. For
25 /// historical reasons, we also call these 'triples' (they used to contain
26 /// exactly three fields).
28 /// Configuration names are strings in the canonical form:
29 /// ARCHITECTURE-VENDOR-OPERATING_SYSTEM
31 /// ARCHITECTURE-VENDOR-OPERATING_SYSTEM-ENVIRONMENT
33 /// This class is used for clients which want to support arbitrary
34 /// configuration names, but also want to implement certain special
35 /// behavior for particular configurations. This class isolates the mapping
36 /// from the components of the configuration name to well known IDs.
38 /// At its core the Triple class is designed to be a wrapper for a triple
39 /// string; the constructor does not change or normalize the triple string.
40 /// Clients that need to handle the non-canonical triples that users often
41 /// specify should use the normalize method.
43 /// See autoconf/config.guess for a glimpse into what configuration names
44 /// look like in practice.
50 arm, // ARM (little endian): arm, armv.*, xscale
51 armeb, // ARM (big endian): armeb
52 aarch64, // AArch64 (little endian): aarch64
53 aarch64_be, // AArch64 (big endian): aarch64_be
54 aarch64_32, // AArch64 (little endian) ILP32: aarch64_32
55 arc, // ARC: Synopsys ARC
56 avr, // AVR: Atmel AVR microcontroller
57 bpfel, // eBPF or extended BPF or 64-bit BPF (little endian)
58 bpfeb, // eBPF or extended BPF or 64-bit BPF (big endian)
59 hexagon, // Hexagon: hexagon
60 mips, // MIPS: mips, mipsallegrex, mipsr6
61 mipsel, // MIPSEL: mipsel, mipsallegrexe, mipsr6el
62 mips64, // MIPS64: mips64, mips64r6, mipsn32, mipsn32r6
63 mips64el, // MIPS64EL: mips64el, mips64r6el, mipsn32el, mipsn32r6el
64 msp430, // MSP430: msp430
66 ppc64, // PPC64: powerpc64, ppu
67 ppc64le, // PPC64LE: powerpc64le
68 r600, // R600: AMD GPUs HD2XXX - HD6XXX
69 amdgcn, // AMDGCN: AMD GCN GPUs
70 riscv32, // RISC-V (32-bit): riscv32
71 riscv64, // RISC-V (64-bit): riscv64
72 sparc, // Sparc: sparc
73 sparcv9, // Sparcv9: Sparcv9
74 sparcel, // Sparc: (endianness = little). NB: 'Sparcle' is a CPU variant
75 systemz, // SystemZ: s390x
76 tce, // TCE (http://tce.cs.tut.fi/): tce
77 tcele, // TCE little endian (http://tce.cs.tut.fi/): tcele
78 thumb, // Thumb (little endian): thumb, thumbv.*
79 thumbeb, // Thumb (big endian): thumbeb
81 x86_64, // X86-64: amd64, x86_64
82 xcore, // XCore: xcore
83 nvptx, // NVPTX: 32-bit
84 nvptx64, // NVPTX: 64-bit
85 le32, // le32: generic little-endian 32-bit CPU (PNaCl)
86 le64, // le64: generic little-endian 64-bit CPU (PNaCl)
88 amdil64, // AMDIL with 64-bit pointers
90 hsail64, // AMD HSAIL with 64-bit pointers
91 spir, // SPIR: standard portable IR for OpenCL 32-bit version
92 spir64, // SPIR: standard portable IR for OpenCL 64-bit version
93 kalimba, // Kalimba: generic kalimba
94 shave, // SHAVE: Movidius vector VLIW processors
95 lanai, // Lanai: Lanai 32-bit
96 wasm32, // WebAssembly with 32-bit pointers
97 wasm64, // WebAssembly with 64-bit pointers
98 renderscript32, // 32-bit RenderScript
99 renderscript64, // 64-bit RenderScript
100 ve, // NEC SX-Aurora Vector Engine
114 ARMSubArch_v8m_baseline,
115 ARMSubArch_v8m_mainline,
116 ARMSubArch_v8_1m_mainline,
149 ImaginationTechnologies,
158 LastVendorType = OpenEmbedded
181 NaCl, // Native Client
182 CNK, // BG/P Compute-Node Kernel
185 NVCL, // NVIDIA OpenCL
186 AMDHSA, // AMD HSA Runtime
190 WatchOS, // Apple watchOS
193 AMDPAL, // AMD PAL Runtime
194 HermitCore, // HermitCore Unikernel/Multikernel
196 WASI, // Experimental WebAssembly OS
198 LastOSType = Emscripten
200 enum EnvironmentType {
221 Simulator, // Simulator variants of other systems, e.g., Apple's iOS
222 MacABI, // Mac Catalyst variant of Apple's iOS deployment target.
223 LastEnvironmentType = MacABI
225 enum ObjectFormatType {
238 /// The parsed arch type.
241 /// The parsed subarchitecture type.
244 /// The parsed vendor type.
247 /// The parsed OS type.
250 /// The parsed Environment type.
251 EnvironmentType Environment;
253 /// The object format type.
254 ObjectFormatType ObjectFormat;
257 /// @name Constructors
260 /// Default constructor is the same as an empty string and leaves all
261 /// triple fields unknown.
263 : Data(), Arch(), SubArch(), Vendor(), OS(), Environment(),
266 explicit Triple(const Twine &Str);
267 Triple(const Twine &ArchStr, const Twine &VendorStr, const Twine &OSStr);
268 Triple(const Twine &ArchStr, const Twine &VendorStr, const Twine &OSStr,
269 const Twine &EnvironmentStr);
271 bool operator==(const Triple &Other) const {
272 return Arch == Other.Arch && SubArch == Other.SubArch &&
273 Vendor == Other.Vendor && OS == Other.OS &&
274 Environment == Other.Environment &&
275 ObjectFormat == Other.ObjectFormat;
278 bool operator!=(const Triple &Other) const {
279 return !(*this == Other);
283 /// @name Normalization
286 /// normalize - Turn an arbitrary machine specification into the canonical
287 /// triple form (or something sensible that the Triple class understands if
288 /// nothing better can reasonably be done). In particular, it handles the
289 /// common case in which otherwise valid components are in the wrong order.
290 static std::string normalize(StringRef Str);
292 /// Return the normalized form of this triple's string.
293 std::string normalize() const { return normalize(Data); }
296 /// @name Typed Component Access
299 /// getArch - Get the parsed architecture type of this triple.
300 ArchType getArch() const { return Arch; }
302 /// getSubArch - get the parsed subarchitecture type for this triple.
303 SubArchType getSubArch() const { return SubArch; }
305 /// getVendor - Get the parsed vendor type of this triple.
306 VendorType getVendor() const { return Vendor; }
308 /// getOS - Get the parsed operating system type of this triple.
309 OSType getOS() const { return OS; }
311 /// hasEnvironment - Does this triple have the optional environment
312 /// (fourth) component?
313 bool hasEnvironment() const {
314 return getEnvironmentName() != "";
317 /// getEnvironment - Get the parsed environment type of this triple.
318 EnvironmentType getEnvironment() const { return Environment; }
320 /// Parse the version number from the OS name component of the
321 /// triple, if present.
323 /// For example, "fooos1.2.3" would return (1, 2, 3).
325 /// If an entry is not defined, it will be returned as 0.
326 void getEnvironmentVersion(unsigned &Major, unsigned &Minor,
327 unsigned &Micro) const;
329 /// getFormat - Get the object format for this triple.
330 ObjectFormatType getObjectFormat() const { return ObjectFormat; }
332 /// getOSVersion - Parse the version number from the OS name component of the
333 /// triple, if present.
335 /// For example, "fooos1.2.3" would return (1, 2, 3).
337 /// If an entry is not defined, it will be returned as 0.
338 void getOSVersion(unsigned &Major, unsigned &Minor, unsigned &Micro) const;
340 /// getOSMajorVersion - Return just the major version number, this is
341 /// specialized because it is a common query.
342 unsigned getOSMajorVersion() const {
343 unsigned Maj, Min, Micro;
344 getOSVersion(Maj, Min, Micro);
348 /// getMacOSXVersion - Parse the version number as with getOSVersion and then
349 /// translate generic "darwin" versions to the corresponding OS X versions.
350 /// This may also be called with IOS triples but the OS X version number is
351 /// just set to a constant 10.4.0 in that case. Returns true if successful.
352 bool getMacOSXVersion(unsigned &Major, unsigned &Minor,
353 unsigned &Micro) const;
355 /// getiOSVersion - Parse the version number as with getOSVersion. This should
356 /// only be called with IOS or generic triples.
357 void getiOSVersion(unsigned &Major, unsigned &Minor,
358 unsigned &Micro) const;
360 /// getWatchOSVersion - Parse the version number as with getOSVersion. This
361 /// should only be called with WatchOS or generic triples.
362 void getWatchOSVersion(unsigned &Major, unsigned &Minor,
363 unsigned &Micro) const;
366 /// @name Direct Component Access
369 const std::string &str() const { return Data; }
371 const std::string &getTriple() const { return Data; }
373 /// getArchName - Get the architecture (first) component of the
375 StringRef getArchName() const;
377 /// getVendorName - Get the vendor (second) component of the triple.
378 StringRef getVendorName() const;
380 /// getOSName - Get the operating system (third) component of the
382 StringRef getOSName() const;
384 /// getEnvironmentName - Get the optional environment (fourth)
385 /// component of the triple, or "" if empty.
386 StringRef getEnvironmentName() const;
388 /// getOSAndEnvironmentName - Get the operating system and optional
389 /// environment components as a single string (separated by a '-'
390 /// if the environment component is present).
391 StringRef getOSAndEnvironmentName() const;
394 /// @name Convenience Predicates
397 /// Test whether the architecture is 64-bit
399 /// Note that this tests for 64-bit pointer width, and nothing else. Note
400 /// that we intentionally expose only three predicates, 64-bit, 32-bit, and
401 /// 16-bit. The inner details of pointer width for particular architectures
402 /// is not summed up in the triple, and so only a coarse grained predicate
403 /// system is provided.
404 bool isArch64Bit() const;
406 /// Test whether the architecture is 32-bit
408 /// Note that this tests for 32-bit pointer width, and nothing else.
409 bool isArch32Bit() const;
411 /// Test whether the architecture is 16-bit
413 /// Note that this tests for 16-bit pointer width, and nothing else.
414 bool isArch16Bit() const;
416 /// isOSVersionLT - Helper function for doing comparisons against version
417 /// numbers included in the target triple.
418 bool isOSVersionLT(unsigned Major, unsigned Minor = 0,
419 unsigned Micro = 0) const {
421 getOSVersion(LHS[0], LHS[1], LHS[2]);
424 return LHS[0] < Major;
426 return LHS[1] < Minor;
428 return LHS[2] < Micro;
433 bool isOSVersionLT(const Triple &Other) const {
435 Other.getOSVersion(RHS[0], RHS[1], RHS[2]);
436 return isOSVersionLT(RHS[0], RHS[1], RHS[2]);
439 /// isMacOSXVersionLT - Comparison function for checking OS X version
440 /// compatibility, which handles supporting skewed version numbering schemes
441 /// used by the "darwin" triples.
442 bool isMacOSXVersionLT(unsigned Major, unsigned Minor = 0,
443 unsigned Micro = 0) const;
445 /// isMacOSX - Is this a Mac OS X triple. For legacy reasons, we support both
446 /// "darwin" and "osx" as OS X triples.
447 bool isMacOSX() const {
448 return getOS() == Triple::Darwin || getOS() == Triple::MacOSX;
451 /// Is this an iOS triple.
452 /// Note: This identifies tvOS as a variant of iOS. If that ever
453 /// changes, i.e., if the two operating systems diverge or their version
454 /// numbers get out of sync, that will need to be changed.
455 /// watchOS has completely different version numbers so it is not included.
457 return getOS() == Triple::IOS || isTvOS();
460 /// Is this an Apple tvOS triple.
461 bool isTvOS() const {
462 return getOS() == Triple::TvOS;
465 /// Is this an Apple watchOS triple.
466 bool isWatchOS() const {
467 return getOS() == Triple::WatchOS;
470 bool isWatchABI() const {
471 return getSubArch() == Triple::ARMSubArch_v7k;
474 /// isOSDarwin - Is this a "Darwin" OS (macOS, iOS, tvOS or watchOS).
475 bool isOSDarwin() const {
476 return isMacOSX() || isiOS() || isWatchOS();
479 bool isSimulatorEnvironment() const {
480 return getEnvironment() == Triple::Simulator;
483 bool isMacCatalystEnvironment() const {
484 return getEnvironment() == Triple::MacABI;
487 bool isOSNetBSD() const {
488 return getOS() == Triple::NetBSD;
491 bool isOSOpenBSD() const {
492 return getOS() == Triple::OpenBSD;
495 bool isOSFreeBSD() const {
496 return getOS() == Triple::FreeBSD;
499 bool isOSFuchsia() const {
500 return getOS() == Triple::Fuchsia;
503 bool isOSDragonFly() const { return getOS() == Triple::DragonFly; }
505 bool isOSSolaris() const {
506 return getOS() == Triple::Solaris;
509 bool isOSIAMCU() const {
510 return getOS() == Triple::ELFIAMCU;
513 bool isOSUnknown() const { return getOS() == Triple::UnknownOS; }
515 bool isGNUEnvironment() const {
516 EnvironmentType Env = getEnvironment();
517 return Env == Triple::GNU || Env == Triple::GNUABIN32 ||
518 Env == Triple::GNUABI64 || Env == Triple::GNUEABI ||
519 Env == Triple::GNUEABIHF || Env == Triple::GNUX32;
522 bool isOSContiki() const {
523 return getOS() == Triple::Contiki;
526 /// Tests whether the OS is Haiku.
527 bool isOSHaiku() const {
528 return getOS() == Triple::Haiku;
531 /// Tests whether the OS is Windows.
532 bool isOSWindows() const {
533 return getOS() == Triple::Win32;
536 /// Checks if the environment is MSVC.
537 bool isKnownWindowsMSVCEnvironment() const {
538 return isOSWindows() && getEnvironment() == Triple::MSVC;
541 /// Checks if the environment could be MSVC.
542 bool isWindowsMSVCEnvironment() const {
543 return isKnownWindowsMSVCEnvironment() ||
544 (isOSWindows() && getEnvironment() == Triple::UnknownEnvironment);
547 bool isWindowsCoreCLREnvironment() const {
548 return isOSWindows() && getEnvironment() == Triple::CoreCLR;
551 bool isWindowsItaniumEnvironment() const {
552 return isOSWindows() && getEnvironment() == Triple::Itanium;
555 bool isWindowsCygwinEnvironment() const {
556 return isOSWindows() && getEnvironment() == Triple::Cygnus;
559 bool isWindowsGNUEnvironment() const {
560 return isOSWindows() && getEnvironment() == Triple::GNU;
563 /// Tests for either Cygwin or MinGW OS
564 bool isOSCygMing() const {
565 return isWindowsCygwinEnvironment() || isWindowsGNUEnvironment();
568 /// Is this a "Windows" OS targeting a "MSVCRT.dll" environment.
569 bool isOSMSVCRT() const {
570 return isWindowsMSVCEnvironment() || isWindowsGNUEnvironment() ||
571 isWindowsItaniumEnvironment();
574 /// Tests whether the OS is NaCl (Native Client)
575 bool isOSNaCl() const {
576 return getOS() == Triple::NaCl;
579 /// Tests whether the OS is Linux.
580 bool isOSLinux() const {
581 return getOS() == Triple::Linux;
584 /// Tests whether the OS is kFreeBSD.
585 bool isOSKFreeBSD() const {
586 return getOS() == Triple::KFreeBSD;
589 /// Tests whether the OS is Hurd.
590 bool isOSHurd() const {
591 return getOS() == Triple::Hurd;
594 /// Tests whether the OS is WASI.
595 bool isOSWASI() const {
596 return getOS() == Triple::WASI;
599 /// Tests whether the OS is Emscripten.
600 bool isOSEmscripten() const {
601 return getOS() == Triple::Emscripten;
604 /// Tests whether the OS uses glibc.
605 bool isOSGlibc() const {
606 return (getOS() == Triple::Linux || getOS() == Triple::KFreeBSD ||
607 getOS() == Triple::Hurd) &&
611 /// Tests whether the OS is AIX.
612 bool isOSAIX() const {
613 return getOS() == Triple::AIX;
616 /// Tests whether the OS uses the ELF binary format.
617 bool isOSBinFormatELF() const {
618 return getObjectFormat() == Triple::ELF;
621 /// Tests whether the OS uses the COFF binary format.
622 bool isOSBinFormatCOFF() const {
623 return getObjectFormat() == Triple::COFF;
626 /// Tests whether the environment is MachO.
627 bool isOSBinFormatMachO() const {
628 return getObjectFormat() == Triple::MachO;
631 /// Tests whether the OS uses the Wasm binary format.
632 bool isOSBinFormatWasm() const {
633 return getObjectFormat() == Triple::Wasm;
636 /// Tests whether the OS uses the XCOFF binary format.
637 bool isOSBinFormatXCOFF() const {
638 return getObjectFormat() == Triple::XCOFF;
641 /// Tests whether the target is the PS4 CPU
642 bool isPS4CPU() const {
643 return getArch() == Triple::x86_64 &&
644 getVendor() == Triple::SCEI &&
645 getOS() == Triple::PS4;
648 /// Tests whether the target is the PS4 platform
650 return getVendor() == Triple::SCEI &&
651 getOS() == Triple::PS4;
654 /// Tests whether the target is Android
655 bool isAndroid() const { return getEnvironment() == Triple::Android; }
657 bool isAndroidVersionLT(unsigned Major) const {
658 assert(isAndroid() && "Not an Android triple!");
661 getEnvironmentVersion(Env[0], Env[1], Env[2]);
663 // 64-bit targets did not exist before API level 21 (Lollipop).
664 if (isArch64Bit() && Env[0] < 21)
667 return Env[0] < Major;
670 /// Tests whether the environment is musl-libc
671 bool isMusl() const {
672 return getEnvironment() == Triple::Musl ||
673 getEnvironment() == Triple::MuslEABI ||
674 getEnvironment() == Triple::MuslEABIHF;
677 /// Tests whether the target is SPIR (32- or 64-bit).
678 bool isSPIR() const {
679 return getArch() == Triple::spir || getArch() == Triple::spir64;
682 /// Tests whether the target is NVPTX (32- or 64-bit).
683 bool isNVPTX() const {
684 return getArch() == Triple::nvptx || getArch() == Triple::nvptx64;
687 /// Tests whether the target is AMDGCN
688 bool isAMDGCN() const { return getArch() == Triple::amdgcn; }
690 bool isAMDGPU() const {
691 return getArch() == Triple::r600 || getArch() == Triple::amdgcn;
694 /// Tests whether the target is Thumb (little and big endian).
695 bool isThumb() const {
696 return getArch() == Triple::thumb || getArch() == Triple::thumbeb;
699 /// Tests whether the target is ARM (little and big endian).
701 return getArch() == Triple::arm || getArch() == Triple::armeb;
704 /// Tests whether the target is AArch64 (little and big endian).
705 bool isAArch64() const {
706 return getArch() == Triple::aarch64 || getArch() == Triple::aarch64_be;
709 /// Tests whether the target is MIPS 32-bit (little and big endian).
710 bool isMIPS32() const {
711 return getArch() == Triple::mips || getArch() == Triple::mipsel;
714 /// Tests whether the target is MIPS 64-bit (little and big endian).
715 bool isMIPS64() const {
716 return getArch() == Triple::mips64 || getArch() == Triple::mips64el;
719 /// Tests whether the target is MIPS (little and big endian, 32- or 64-bit).
720 bool isMIPS() const {
721 return isMIPS32() || isMIPS64();
724 /// Tests whether the target is 64-bit PowerPC (little and big endian).
725 bool isPPC64() const {
726 return getArch() == Triple::ppc64 || getArch() == Triple::ppc64le;
729 /// Tests whether the target is RISC-V (32- and 64-bit).
730 bool isRISCV() const {
731 return getArch() == Triple::riscv32 || getArch() == Triple::riscv64;
734 /// Tests whether the target is SystemZ.
735 bool isSystemZ() const {
736 return getArch() == Triple::systemz;
739 /// Tests whether the target is x86 (32- or 64-bit).
741 return getArch() == Triple::x86 || getArch() == Triple::x86_64;
744 /// Tests whether the target is VE
746 return getArch() == Triple::ve;
749 /// Tests whether the target is wasm (32- and 64-bit).
750 bool isWasm() const {
751 return getArch() == Triple::wasm32 || getArch() == Triple::wasm64;
754 /// Tests whether the target supports comdat
755 bool supportsCOMDAT() const {
756 return !(isOSBinFormatMachO() || isOSBinFormatXCOFF());
759 /// Tests whether the target uses emulated TLS as default.
760 bool hasDefaultEmulatedTLS() const {
761 return isAndroid() || isOSOpenBSD() || isWindowsCygwinEnvironment();
768 /// setArch - Set the architecture (first) component of the triple
770 void setArch(ArchType Kind);
772 /// setVendor - Set the vendor (second) component of the triple to a
774 void setVendor(VendorType Kind);
776 /// setOS - Set the operating system (third) component of the triple
778 void setOS(OSType Kind);
780 /// setEnvironment - Set the environment (fourth) component of the triple
782 void setEnvironment(EnvironmentType Kind);
784 /// setObjectFormat - Set the object file format
785 void setObjectFormat(ObjectFormatType Kind);
787 /// setTriple - Set all components to the new triple \p Str.
788 void setTriple(const Twine &Str);
790 /// setArchName - Set the architecture (first) component of the
792 void setArchName(StringRef Str);
794 /// setVendorName - Set the vendor (second) component of the triple
796 void setVendorName(StringRef Str);
798 /// setOSName - Set the operating system (third) component of the
800 void setOSName(StringRef Str);
802 /// setEnvironmentName - Set the optional environment (fourth)
803 /// component of the triple by name.
804 void setEnvironmentName(StringRef Str);
806 /// setOSAndEnvironmentName - Set the operating system and optional
807 /// environment components with a single string.
808 void setOSAndEnvironmentName(StringRef Str);
811 /// @name Helpers to build variants of a particular triple.
814 /// Form a triple with a 32-bit variant of the current architecture.
816 /// This can be used to move across "families" of architectures where useful.
818 /// \returns A new triple with a 32-bit architecture or an unknown
819 /// architecture if no such variant can be found.
820 llvm::Triple get32BitArchVariant() const;
822 /// Form a triple with a 64-bit variant of the current architecture.
824 /// This can be used to move across "families" of architectures where useful.
826 /// \returns A new triple with a 64-bit architecture or an unknown
827 /// architecture if no such variant can be found.
828 llvm::Triple get64BitArchVariant() const;
830 /// Form a triple with a big endian variant of the current architecture.
832 /// This can be used to move across "families" of architectures where useful.
834 /// \returns A new triple with a big endian architecture or an unknown
835 /// architecture if no such variant can be found.
836 llvm::Triple getBigEndianArchVariant() const;
838 /// Form a triple with a little endian variant of the current architecture.
840 /// This can be used to move across "families" of architectures where useful.
842 /// \returns A new triple with a little endian architecture or an unknown
843 /// architecture if no such variant can be found.
844 llvm::Triple getLittleEndianArchVariant() const;
846 /// Get the (LLVM) name of the minimum ARM CPU for the arch we are targeting.
848 /// \param Arch the architecture name (e.g., "armv7s"). If it is an empty
849 /// string then the triple's arch name is used.
850 StringRef getARMCPUForArch(StringRef Arch = StringRef()) const;
852 /// Tests whether the target triple is little endian.
854 /// \returns true if the triple is little endian, false otherwise.
855 bool isLittleEndian() const;
857 /// Test whether target triples are compatible.
858 bool isCompatibleWith(const Triple &Other) const;
860 /// Merge target triples.
861 std::string merge(const Triple &Other) const;
863 /// Some platforms have different minimum supported OS versions that
864 /// varies by the architecture specified in the triple. This function
865 /// returns the minimum supported OS version for this triple if one an exists,
866 /// or an invalid version tuple if this triple doesn't have one.
867 VersionTuple getMinimumSupportedOSVersion() const;
870 /// @name Static helpers for IDs.
873 /// getArchTypeName - Get the canonical name for the \p Kind architecture.
874 static StringRef getArchTypeName(ArchType Kind);
876 /// getArchTypePrefix - Get the "prefix" canonical name for the \p Kind
877 /// architecture. This is the prefix used by the architecture specific
878 /// builtins, and is suitable for passing to \see
879 /// Intrinsic::getIntrinsicForGCCBuiltin().
881 /// \return - The architecture prefix, or 0 if none is defined.
882 static StringRef getArchTypePrefix(ArchType Kind);
884 /// getVendorTypeName - Get the canonical name for the \p Kind vendor.
885 static StringRef getVendorTypeName(VendorType Kind);
887 /// getOSTypeName - Get the canonical name for the \p Kind operating system.
888 static StringRef getOSTypeName(OSType Kind);
890 /// getEnvironmentTypeName - Get the canonical name for the \p Kind
892 static StringRef getEnvironmentTypeName(EnvironmentType Kind);
895 /// @name Static helpers for converting alternate architecture names.
898 /// getArchTypeForLLVMName - The canonical type for the given LLVM
899 /// architecture name (e.g., "x86").
900 static ArchType getArchTypeForLLVMName(StringRef Str);
904 /// Returns a canonicalized OS version number for the specified OS.
905 static VersionTuple getCanonicalVersionForOS(OSType OSKind,
906 const VersionTuple &Version);
909 } // End llvm namespace