Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:44:37

0001 //===-- llvm/TargetParser/Triple.h - Target triple helper class--*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef LLVM_TARGETPARSER_TRIPLE_H
0010 #define LLVM_TARGETPARSER_TRIPLE_H
0011 
0012 #include "llvm/ADT/Twine.h"
0013 #include "llvm/Support/VersionTuple.h"
0014 
0015 // Some system headers or GCC predefined macros conflict with identifiers in
0016 // this file.  Undefine them here.
0017 #undef NetBSD
0018 #undef mips
0019 #undef sparc
0020 
0021 namespace llvm {
0022 
0023 /// Triple - Helper class for working with autoconf configuration names. For
0024 /// historical reasons, we also call these 'triples' (they used to contain
0025 /// exactly three fields).
0026 ///
0027 /// Configuration names are strings in the canonical form:
0028 ///   ARCHITECTURE-VENDOR-OPERATING_SYSTEM
0029 /// or
0030 ///   ARCHITECTURE-VENDOR-OPERATING_SYSTEM-ENVIRONMENT
0031 ///
0032 /// This class is used for clients which want to support arbitrary
0033 /// configuration names, but also want to implement certain special
0034 /// behavior for particular configurations. This class isolates the mapping
0035 /// from the components of the configuration name to well known IDs.
0036 ///
0037 /// At its core the Triple class is designed to be a wrapper for a triple
0038 /// string; the constructor does not change or normalize the triple string.
0039 /// Clients that need to handle the non-canonical triples that users often
0040 /// specify should use the normalize method.
0041 ///
0042 /// See autoconf/config.guess for a glimpse into what configuration names
0043 /// look like in practice.
0044 class Triple {
0045 public:
0046   enum ArchType {
0047     UnknownArch,
0048 
0049     arm,            // ARM (little endian): arm, armv.*, xscale
0050     armeb,          // ARM (big endian): armeb
0051     aarch64,        // AArch64 (little endian): aarch64
0052     aarch64_be,     // AArch64 (big endian): aarch64_be
0053     aarch64_32,     // AArch64 (little endian) ILP32: aarch64_32
0054     arc,            // ARC: Synopsys ARC
0055     avr,            // AVR: Atmel AVR microcontroller
0056     bpfel,          // eBPF or extended BPF or 64-bit BPF (little endian)
0057     bpfeb,          // eBPF or extended BPF or 64-bit BPF (big endian)
0058     csky,           // CSKY: csky
0059     dxil,           // DXIL 32-bit DirectX bytecode
0060     hexagon,        // Hexagon: hexagon
0061     loongarch32,    // LoongArch (32-bit): loongarch32
0062     loongarch64,    // LoongArch (64-bit): loongarch64
0063     m68k,           // M68k: Motorola 680x0 family
0064     mips,           // MIPS: mips, mipsallegrex, mipsr6
0065     mipsel,         // MIPSEL: mipsel, mipsallegrexe, mipsr6el
0066     mips64,         // MIPS64: mips64, mips64r6, mipsn32, mipsn32r6
0067     mips64el,       // MIPS64EL: mips64el, mips64r6el, mipsn32el, mipsn32r6el
0068     msp430,         // MSP430: msp430
0069     ppc,            // PPC: powerpc
0070     ppcle,          // PPCLE: powerpc (little endian)
0071     ppc64,          // PPC64: powerpc64, ppu
0072     ppc64le,        // PPC64LE: powerpc64le
0073     r600,           // R600: AMD GPUs HD2XXX - HD6XXX
0074     amdgcn,         // AMDGCN: AMD GCN GPUs
0075     riscv32,        // RISC-V (32-bit): riscv32
0076     riscv64,        // RISC-V (64-bit): riscv64
0077     sparc,          // Sparc: sparc
0078     sparcv9,        // Sparcv9: Sparcv9
0079     sparcel,        // Sparc: (endianness = little). NB: 'Sparcle' is a CPU variant
0080     systemz,        // SystemZ: s390x
0081     tce,            // TCE (http://tce.cs.tut.fi/): tce
0082     tcele,          // TCE little endian (http://tce.cs.tut.fi/): tcele
0083     thumb,          // Thumb (little endian): thumb, thumbv.*
0084     thumbeb,        // Thumb (big endian): thumbeb
0085     x86,            // X86: i[3-9]86
0086     x86_64,         // X86-64: amd64, x86_64
0087     xcore,          // XCore: xcore
0088     xtensa,         // Tensilica: Xtensa
0089     nvptx,          // NVPTX: 32-bit
0090     nvptx64,        // NVPTX: 64-bit
0091     amdil,          // AMDIL
0092     amdil64,        // AMDIL with 64-bit pointers
0093     hsail,          // AMD HSAIL
0094     hsail64,        // AMD HSAIL with 64-bit pointers
0095     spir,           // SPIR: standard portable IR for OpenCL 32-bit version
0096     spir64,         // SPIR: standard portable IR for OpenCL 64-bit version
0097     spirv,          // SPIR-V with logical memory layout.
0098     spirv32,        // SPIR-V with 32-bit pointers
0099     spirv64,        // SPIR-V with 64-bit pointers
0100     kalimba,        // Kalimba: generic kalimba
0101     shave,          // SHAVE: Movidius vector VLIW processors
0102     lanai,          // Lanai: Lanai 32-bit
0103     wasm32,         // WebAssembly with 32-bit pointers
0104     wasm64,         // WebAssembly with 64-bit pointers
0105     renderscript32, // 32-bit RenderScript
0106     renderscript64, // 64-bit RenderScript
0107     ve,             // NEC SX-Aurora Vector Engine
0108     LastArchType = ve
0109   };
0110   enum SubArchType {
0111     NoSubArch,
0112 
0113     ARMSubArch_v9_6a,
0114     ARMSubArch_v9_5a,
0115     ARMSubArch_v9_4a,
0116     ARMSubArch_v9_3a,
0117     ARMSubArch_v9_2a,
0118     ARMSubArch_v9_1a,
0119     ARMSubArch_v9,
0120     ARMSubArch_v8_9a,
0121     ARMSubArch_v8_8a,
0122     ARMSubArch_v8_7a,
0123     ARMSubArch_v8_6a,
0124     ARMSubArch_v8_5a,
0125     ARMSubArch_v8_4a,
0126     ARMSubArch_v8_3a,
0127     ARMSubArch_v8_2a,
0128     ARMSubArch_v8_1a,
0129     ARMSubArch_v8,
0130     ARMSubArch_v8r,
0131     ARMSubArch_v8m_baseline,
0132     ARMSubArch_v8m_mainline,
0133     ARMSubArch_v8_1m_mainline,
0134     ARMSubArch_v7,
0135     ARMSubArch_v7em,
0136     ARMSubArch_v7m,
0137     ARMSubArch_v7s,
0138     ARMSubArch_v7k,
0139     ARMSubArch_v7ve,
0140     ARMSubArch_v6,
0141     ARMSubArch_v6m,
0142     ARMSubArch_v6k,
0143     ARMSubArch_v6t2,
0144     ARMSubArch_v5,
0145     ARMSubArch_v5te,
0146     ARMSubArch_v4t,
0147 
0148     AArch64SubArch_arm64e,
0149     AArch64SubArch_arm64ec,
0150 
0151     KalimbaSubArch_v3,
0152     KalimbaSubArch_v4,
0153     KalimbaSubArch_v5,
0154 
0155     MipsSubArch_r6,
0156 
0157     PPCSubArch_spe,
0158 
0159     // SPIR-V sub-arch corresponds to its version.
0160     SPIRVSubArch_v10,
0161     SPIRVSubArch_v11,
0162     SPIRVSubArch_v12,
0163     SPIRVSubArch_v13,
0164     SPIRVSubArch_v14,
0165     SPIRVSubArch_v15,
0166     SPIRVSubArch_v16,
0167 
0168     // DXIL sub-arch corresponds to its version.
0169     DXILSubArch_v1_0,
0170     DXILSubArch_v1_1,
0171     DXILSubArch_v1_2,
0172     DXILSubArch_v1_3,
0173     DXILSubArch_v1_4,
0174     DXILSubArch_v1_5,
0175     DXILSubArch_v1_6,
0176     DXILSubArch_v1_7,
0177     DXILSubArch_v1_8,
0178     LatestDXILSubArch = DXILSubArch_v1_8,
0179   };
0180   enum VendorType {
0181     UnknownVendor,
0182 
0183     Apple,
0184     PC,
0185     SCEI,
0186     Freescale,
0187     IBM,
0188     ImaginationTechnologies,
0189     MipsTechnologies,
0190     NVIDIA,
0191     CSR,
0192     AMD,
0193     Mesa,
0194     SUSE,
0195     OpenEmbedded,
0196     Intel,
0197     LastVendorType = Intel
0198   };
0199   enum OSType {
0200     UnknownOS,
0201 
0202     Darwin,
0203     DragonFly,
0204     FreeBSD,
0205     Fuchsia,
0206     IOS,
0207     KFreeBSD,
0208     Linux,
0209     Lv2, // PS3
0210     MacOSX,
0211     NetBSD,
0212     OpenBSD,
0213     Solaris,
0214     UEFI,
0215     Win32,
0216     ZOS,
0217     Haiku,
0218     RTEMS,
0219     NaCl, // Native Client
0220     AIX,
0221     CUDA,   // NVIDIA CUDA
0222     NVCL,   // NVIDIA OpenCL
0223     AMDHSA, // AMD HSA Runtime
0224     PS4,
0225     PS5,
0226     ELFIAMCU,
0227     TvOS,      // Apple tvOS
0228     WatchOS,   // Apple watchOS
0229     BridgeOS,  // Apple bridgeOS
0230     DriverKit, // Apple DriverKit
0231     XROS,      // Apple XROS
0232     Mesa3D,
0233     AMDPAL,     // AMD PAL Runtime
0234     HermitCore, // HermitCore Unikernel/Multikernel
0235     Hurd,       // GNU/Hurd
0236     WASI,       // Experimental WebAssembly OS
0237     Emscripten,
0238     ShaderModel, // DirectX ShaderModel
0239     LiteOS,
0240     Serenity,
0241     Vulkan, // Vulkan SPIR-V
0242     LastOSType = Vulkan
0243   };
0244   enum EnvironmentType {
0245     UnknownEnvironment,
0246 
0247     GNU,
0248     GNUT64,
0249     GNUABIN32,
0250     GNUABI64,
0251     GNUEABI,
0252     GNUEABIT64,
0253     GNUEABIHF,
0254     GNUEABIHFT64,
0255     GNUF32,
0256     GNUF64,
0257     GNUSF,
0258     GNUX32,
0259     GNUILP32,
0260     CODE16,
0261     EABI,
0262     EABIHF,
0263     Android,
0264     Musl,
0265     MuslABIN32,
0266     MuslABI64,
0267     MuslEABI,
0268     MuslEABIHF,
0269     MuslF32,
0270     MuslSF,
0271     MuslX32,
0272     LLVM,
0273 
0274     MSVC,
0275     Itanium,
0276     Cygnus,
0277     CoreCLR,
0278     Simulator, // Simulator variants of other systems, e.g., Apple's iOS
0279     MacABI,    // Mac Catalyst variant of Apple's iOS deployment target.
0280 
0281     // Shader Stages
0282     // The order of these values matters, and must be kept in sync with the
0283     // language options enum in Clang. The ordering is enforced in
0284     // static_asserts in Triple.cpp and in Clang.
0285     Pixel,
0286     Vertex,
0287     Geometry,
0288     Hull,
0289     Domain,
0290     Compute,
0291     Library,
0292     RayGeneration,
0293     Intersection,
0294     AnyHit,
0295     ClosestHit,
0296     Miss,
0297     Callable,
0298     Mesh,
0299     Amplification,
0300     OpenCL,
0301     OpenHOS,
0302 
0303     PAuthTest,
0304 
0305     LastEnvironmentType = PAuthTest
0306   };
0307   enum ObjectFormatType {
0308     UnknownObjectFormat,
0309 
0310     COFF,
0311     DXContainer,
0312     ELF,
0313     GOFF,
0314     MachO,
0315     SPIRV,
0316     Wasm,
0317     XCOFF,
0318   };
0319 
0320 private:
0321   std::string Data;
0322 
0323   /// The parsed arch type.
0324   ArchType Arch{};
0325 
0326   /// The parsed subarchitecture type.
0327   SubArchType SubArch{};
0328 
0329   /// The parsed vendor type.
0330   VendorType Vendor{};
0331 
0332   /// The parsed OS type.
0333   OSType OS{};
0334 
0335   /// The parsed Environment type.
0336   EnvironmentType Environment{};
0337 
0338   /// The object format type.
0339   ObjectFormatType ObjectFormat{};
0340 
0341 public:
0342   /// @name Constructors
0343   /// @{
0344 
0345   /// Default constructor is the same as an empty string and leaves all
0346   /// triple fields unknown.
0347   Triple() = default;
0348 
0349   explicit Triple(const Twine &Str);
0350   Triple(const Twine &ArchStr, const Twine &VendorStr, const Twine &OSStr);
0351   Triple(const Twine &ArchStr, const Twine &VendorStr, const Twine &OSStr,
0352          const Twine &EnvironmentStr);
0353 
0354   bool operator==(const Triple &Other) const {
0355     return Arch == Other.Arch && SubArch == Other.SubArch &&
0356            Vendor == Other.Vendor && OS == Other.OS &&
0357            Environment == Other.Environment &&
0358            ObjectFormat == Other.ObjectFormat;
0359   }
0360 
0361   bool operator!=(const Triple &Other) const {
0362     return !(*this == Other);
0363   }
0364 
0365   /// @}
0366   /// @name Normalization
0367   /// @{
0368 
0369   /// Canonical form
0370   enum class CanonicalForm {
0371     ANY = 0,
0372     THREE_IDENT = 3, // ARCHITECTURE-VENDOR-OPERATING_SYSTEM
0373     FOUR_IDENT = 4,  // ARCHITECTURE-VENDOR-OPERATING_SYSTEM-ENVIRONMENT
0374     FIVE_IDENT = 5,  // ARCHITECTURE-VENDOR-OPERATING_SYSTEM-ENVIRONMENT-FORMAT
0375   };
0376 
0377   /// Turn an arbitrary machine specification into the canonical triple form (or
0378   /// something sensible that the Triple class understands if nothing better can
0379   /// reasonably be done).  In particular, it handles the common case in which
0380   /// otherwise valid components are in the wrong order. \p Form is used to
0381   /// specify the output canonical form.
0382   static std::string normalize(StringRef Str,
0383                                CanonicalForm Form = CanonicalForm::ANY);
0384 
0385   /// Return the normalized form of this triple's string.
0386   std::string normalize(CanonicalForm Form = CanonicalForm::ANY) const {
0387     return normalize(Data, Form);
0388   }
0389 
0390   /// @}
0391   /// @name Typed Component Access
0392   /// @{
0393 
0394   /// Get the parsed architecture type of this triple.
0395   ArchType getArch() const { return Arch; }
0396 
0397   /// get the parsed subarchitecture type for this triple.
0398   SubArchType getSubArch() const { return SubArch; }
0399 
0400   /// Get the parsed vendor type of this triple.
0401   VendorType getVendor() const { return Vendor; }
0402 
0403   /// Get the parsed operating system type of this triple.
0404   OSType getOS() const { return OS; }
0405 
0406   /// Does this triple have the optional environment (fourth) component?
0407   bool hasEnvironment() const {
0408     return getEnvironmentName() != "";
0409   }
0410 
0411   /// Get the parsed environment type of this triple.
0412   EnvironmentType getEnvironment() const { return Environment; }
0413 
0414   /// Parse the version number from the OS name component of the
0415   /// triple, if present.
0416   ///
0417   /// For example, "fooos1.2.3" would return (1, 2, 3).
0418   VersionTuple getEnvironmentVersion() const;
0419 
0420   /// Get the object format for this triple.
0421   ObjectFormatType getObjectFormat() const { return ObjectFormat; }
0422 
0423   /// Parse the version number from the OS name component of the triple, if
0424   /// present.
0425   ///
0426   /// For example, "fooos1.2.3" would return (1, 2, 3).
0427   VersionTuple getOSVersion() const;
0428 
0429   /// Return just the major version number, this is specialized because it is a
0430   /// common query.
0431   unsigned getOSMajorVersion() const { return getOSVersion().getMajor(); }
0432 
0433   /// Parse the version number as with getOSVersion and then translate generic
0434   /// "darwin" versions to the corresponding OS X versions.  This may also be
0435   /// called with IOS triples but the OS X version number is just set to a
0436   /// constant 10.4.0 in that case.  Returns true if successful.
0437   bool getMacOSXVersion(VersionTuple &Version) const;
0438 
0439   /// Parse the version number as with getOSVersion.  This should only be called
0440   /// with IOS or generic triples.
0441   VersionTuple getiOSVersion() const;
0442 
0443   /// Parse the version number as with getOSVersion.  This should only be called
0444   /// with WatchOS or generic triples.
0445   VersionTuple getWatchOSVersion() const;
0446 
0447   /// Parse the version number as with getOSVersion.
0448   VersionTuple getDriverKitVersion() const;
0449 
0450   /// Parse the Vulkan version number from the OSVersion and SPIR-V version
0451   /// (SubArch).  This should only be called with Vulkan SPIR-V triples.
0452   VersionTuple getVulkanVersion() const;
0453 
0454   /// Parse the DXIL version number from the OSVersion and DXIL version
0455   /// (SubArch).  This should only be called with DXIL triples.
0456   VersionTuple getDXILVersion() const;
0457 
0458   /// @}
0459   /// @name Direct Component Access
0460   /// @{
0461 
0462   const std::string &str() const { return Data; }
0463 
0464   const std::string &getTriple() const { return Data; }
0465 
0466   /// Get the architecture (first) component of the triple.
0467   StringRef getArchName() const;
0468 
0469   /// Get the vendor (second) component of the triple.
0470   StringRef getVendorName() const;
0471 
0472   /// Get the operating system (third) component of the triple.
0473   StringRef getOSName() const;
0474 
0475   /// Get the optional environment (fourth) component of the triple, or "" if
0476   /// empty.
0477   StringRef getEnvironmentName() const;
0478 
0479   /// Get the operating system and optional environment components as a single
0480   /// string (separated by a '-' if the environment component is present).
0481   StringRef getOSAndEnvironmentName() const;
0482 
0483   /// Get the version component of the environment component as a single
0484   /// string (the version after the environment).
0485   ///
0486   /// For example, "fooos1.2.3" would return "1.2.3".
0487   StringRef getEnvironmentVersionString() const;
0488 
0489   /// @}
0490   /// @name Convenience Predicates
0491   /// @{
0492 
0493   /// Returns the pointer width of this architecture.
0494   static unsigned getArchPointerBitWidth(llvm::Triple::ArchType Arch);
0495 
0496   /// Returns the pointer width of this architecture.
0497   unsigned getArchPointerBitWidth() const {
0498     return getArchPointerBitWidth(getArch());
0499   }
0500 
0501   /// Returns the trampoline size in bytes for this configuration.
0502   unsigned getTrampolineSize() const;
0503 
0504   /// Test whether the architecture is 64-bit
0505   ///
0506   /// Note that this tests for 64-bit pointer width, and nothing else. Note
0507   /// that we intentionally expose only three predicates, 64-bit, 32-bit, and
0508   /// 16-bit. The inner details of pointer width for particular architectures
0509   /// is not summed up in the triple, and so only a coarse grained predicate
0510   /// system is provided.
0511   bool isArch64Bit() const;
0512 
0513   /// Test whether the architecture is 32-bit
0514   ///
0515   /// Note that this tests for 32-bit pointer width, and nothing else.
0516   bool isArch32Bit() const;
0517 
0518   /// Test whether the architecture is 16-bit
0519   ///
0520   /// Note that this tests for 16-bit pointer width, and nothing else.
0521   bool isArch16Bit() const;
0522 
0523   /// Helper function for doing comparisons against version numbers included in
0524   /// the target triple.
0525   bool isOSVersionLT(unsigned Major, unsigned Minor = 0,
0526                      unsigned Micro = 0) const {
0527     if (Minor == 0) {
0528       return getOSVersion() < VersionTuple(Major);
0529     }
0530     if (Micro == 0) {
0531       return getOSVersion() < VersionTuple(Major, Minor);
0532     }
0533     return getOSVersion() < VersionTuple(Major, Minor, Micro);
0534   }
0535 
0536   bool isOSVersionLT(const Triple &Other) const {
0537     return getOSVersion() < Other.getOSVersion();
0538   }
0539 
0540   /// Comparison function for checking OS X version compatibility, which handles
0541   /// supporting skewed version numbering schemes used by the "darwin" triples.
0542   bool isMacOSXVersionLT(unsigned Major, unsigned Minor = 0,
0543                          unsigned Micro = 0) const;
0544 
0545   /// Is this a Mac OS X triple. For legacy reasons, we support both "darwin"
0546   /// and "osx" as OS X triples.
0547   bool isMacOSX() const {
0548     return getOS() == Triple::Darwin || getOS() == Triple::MacOSX;
0549   }
0550 
0551   /// Is this an iOS triple.
0552   /// Note: This identifies tvOS as a variant of iOS. If that ever
0553   /// changes, i.e., if the two operating systems diverge or their version
0554   /// numbers get out of sync, that will need to be changed.
0555   /// watchOS has completely different version numbers so it is not included.
0556   bool isiOS() const {
0557     return getOS() == Triple::IOS || isTvOS();
0558   }
0559 
0560   /// Is this an Apple tvOS triple.
0561   bool isTvOS() const {
0562     return getOS() == Triple::TvOS;
0563   }
0564 
0565   /// Is this an Apple watchOS triple.
0566   bool isWatchOS() const {
0567     return getOS() == Triple::WatchOS;
0568   }
0569 
0570   bool isWatchABI() const {
0571     return getSubArch() == Triple::ARMSubArch_v7k;
0572   }
0573 
0574   /// Is this an Apple XROS triple.
0575   bool isXROS() const { return getOS() == Triple::XROS; }
0576 
0577   /// Is this an Apple DriverKit triple.
0578   bool isDriverKit() const { return getOS() == Triple::DriverKit; }
0579 
0580   bool isOSzOS() const { return getOS() == Triple::ZOS; }
0581 
0582   /// Is this an Apple MachO triple.
0583   bool isAppleMachO() const {
0584     return (getVendor() == Triple::Apple) && isOSBinFormatMachO();
0585   }
0586 
0587   /// Is this a "Darwin" OS (macOS, iOS, tvOS, watchOS, XROS, or DriverKit).
0588   bool isOSDarwin() const {
0589     return isMacOSX() || isiOS() || isWatchOS() || isDriverKit() || isXROS();
0590   }
0591 
0592   bool isSimulatorEnvironment() const {
0593     return getEnvironment() == Triple::Simulator;
0594   }
0595 
0596   bool isMacCatalystEnvironment() const {
0597     return getEnvironment() == Triple::MacABI;
0598   }
0599 
0600   /// Returns true for targets that run on a macOS machine.
0601   bool isTargetMachineMac() const {
0602     return isMacOSX() || (isOSDarwin() && (isSimulatorEnvironment() ||
0603                                            isMacCatalystEnvironment()));
0604   }
0605 
0606   bool isOSNetBSD() const {
0607     return getOS() == Triple::NetBSD;
0608   }
0609 
0610   bool isOSOpenBSD() const {
0611     return getOS() == Triple::OpenBSD;
0612   }
0613 
0614   bool isOSFreeBSD() const {
0615     return getOS() == Triple::FreeBSD;
0616   }
0617 
0618   bool isOSFuchsia() const {
0619     return getOS() == Triple::Fuchsia;
0620   }
0621 
0622   bool isOSDragonFly() const { return getOS() == Triple::DragonFly; }
0623 
0624   bool isOSSolaris() const {
0625     return getOS() == Triple::Solaris;
0626   }
0627 
0628   bool isOSIAMCU() const {
0629     return getOS() == Triple::ELFIAMCU;
0630   }
0631 
0632   bool isOSUnknown() const { return getOS() == Triple::UnknownOS; }
0633 
0634   bool isGNUEnvironment() const {
0635     EnvironmentType Env = getEnvironment();
0636     return Env == Triple::GNU || Env == Triple::GNUT64 ||
0637            Env == Triple::GNUABIN32 || Env == Triple::GNUABI64 ||
0638            Env == Triple::GNUEABI || Env == Triple::GNUEABIT64 ||
0639            Env == Triple::GNUEABIHF || Env == Triple::GNUEABIHFT64 ||
0640            Env == Triple::GNUF32 || Env == Triple::GNUF64 ||
0641            Env == Triple::GNUSF || Env == Triple::GNUX32;
0642   }
0643 
0644   /// Tests whether the OS is Haiku.
0645   bool isOSHaiku() const {
0646     return getOS() == Triple::Haiku;
0647   }
0648 
0649   /// Tests whether the OS is UEFI.
0650   bool isUEFI() const {
0651     return getOS() == Triple::UEFI;
0652   }
0653 
0654   /// Tests whether the OS is Windows.
0655   bool isOSWindows() const {
0656     return getOS() == Triple::Win32;
0657   }
0658 
0659   /// Tests whether the OS is Windows or UEFI.
0660   bool isOSWindowsOrUEFI() const { return isOSWindows() || isUEFI(); }
0661 
0662   /// Checks if the environment is MSVC.
0663   bool isKnownWindowsMSVCEnvironment() const {
0664     return isOSWindows() && getEnvironment() == Triple::MSVC;
0665   }
0666 
0667   /// Checks if the environment could be MSVC.
0668   bool isWindowsMSVCEnvironment() const {
0669     return isKnownWindowsMSVCEnvironment() ||
0670            (isOSWindows() && getEnvironment() == Triple::UnknownEnvironment);
0671   }
0672 
0673   // Checks if we're using the Windows Arm64EC ABI.
0674   bool isWindowsArm64EC() const {
0675     return getArch() == Triple::aarch64 &&
0676            getSubArch() == Triple::AArch64SubArch_arm64ec;
0677   }
0678 
0679   bool isWindowsCoreCLREnvironment() const {
0680     return isOSWindows() && getEnvironment() == Triple::CoreCLR;
0681   }
0682 
0683   bool isWindowsItaniumEnvironment() const {
0684     return isOSWindows() && getEnvironment() == Triple::Itanium;
0685   }
0686 
0687   bool isWindowsCygwinEnvironment() const {
0688     return isOSWindows() && getEnvironment() == Triple::Cygnus;
0689   }
0690 
0691   bool isWindowsGNUEnvironment() const {
0692     return isOSWindows() && getEnvironment() == Triple::GNU;
0693   }
0694 
0695   /// Tests for either Cygwin or MinGW OS
0696   bool isOSCygMing() const {
0697     return isWindowsCygwinEnvironment() || isWindowsGNUEnvironment();
0698   }
0699 
0700   /// Is this a "Windows" OS targeting a "MSVCRT.dll" environment.
0701   bool isOSMSVCRT() const {
0702     return isWindowsMSVCEnvironment() || isWindowsGNUEnvironment() ||
0703            isWindowsItaniumEnvironment();
0704   }
0705 
0706   /// Tests whether the OS is NaCl (Native Client)
0707   bool isOSNaCl() const {
0708     return getOS() == Triple::NaCl;
0709   }
0710 
0711   /// Tests whether the OS is Linux.
0712   bool isOSLinux() const {
0713     return getOS() == Triple::Linux;
0714   }
0715 
0716   /// Tests whether the OS is kFreeBSD.
0717   bool isOSKFreeBSD() const {
0718     return getOS() == Triple::KFreeBSD;
0719   }
0720 
0721   /// Tests whether the OS is Hurd.
0722   bool isOSHurd() const {
0723     return getOS() == Triple::Hurd;
0724   }
0725 
0726   /// Tests whether the OS is WASI.
0727   bool isOSWASI() const {
0728     return getOS() == Triple::WASI;
0729   }
0730 
0731   /// Tests whether the OS is Emscripten.
0732   bool isOSEmscripten() const {
0733     return getOS() == Triple::Emscripten;
0734   }
0735 
0736   /// Tests whether the OS uses glibc.
0737   bool isOSGlibc() const {
0738     return (getOS() == Triple::Linux || getOS() == Triple::KFreeBSD ||
0739             getOS() == Triple::Hurd) &&
0740            !isAndroid();
0741   }
0742 
0743   /// Tests whether the OS is AIX.
0744   bool isOSAIX() const {
0745     return getOS() == Triple::AIX;
0746   }
0747 
0748   bool isOSSerenity() const {
0749     return getOS() == Triple::Serenity;
0750   }
0751 
0752   /// Tests whether the OS uses the ELF binary format.
0753   bool isOSBinFormatELF() const {
0754     return getObjectFormat() == Triple::ELF;
0755   }
0756 
0757   /// Tests whether the OS uses the COFF binary format.
0758   bool isOSBinFormatCOFF() const {
0759     return getObjectFormat() == Triple::COFF;
0760   }
0761 
0762   /// Tests whether the OS uses the GOFF binary format.
0763   bool isOSBinFormatGOFF() const { return getObjectFormat() == Triple::GOFF; }
0764 
0765   /// Tests whether the environment is MachO.
0766   bool isOSBinFormatMachO() const {
0767     return getObjectFormat() == Triple::MachO;
0768   }
0769 
0770   /// Tests whether the OS uses the Wasm binary format.
0771   bool isOSBinFormatWasm() const {
0772     return getObjectFormat() == Triple::Wasm;
0773   }
0774 
0775   /// Tests whether the OS uses the XCOFF binary format.
0776   bool isOSBinFormatXCOFF() const {
0777     return getObjectFormat() == Triple::XCOFF;
0778   }
0779 
0780   /// Tests whether the OS uses the DXContainer binary format.
0781   bool isOSBinFormatDXContainer() const {
0782     return getObjectFormat() == Triple::DXContainer;
0783   }
0784 
0785   /// Tests whether the target is the PS4 platform.
0786   bool isPS4() const {
0787     return getArch() == Triple::x86_64 &&
0788            getVendor() == Triple::SCEI &&
0789            getOS() == Triple::PS4;
0790   }
0791 
0792   /// Tests whether the target is the PS5 platform.
0793   bool isPS5() const {
0794     return getArch() == Triple::x86_64 &&
0795       getVendor() == Triple::SCEI &&
0796       getOS() == Triple::PS5;
0797   }
0798 
0799   /// Tests whether the target is the PS4 or PS5 platform.
0800   bool isPS() const { return isPS4() || isPS5(); }
0801 
0802   /// Tests whether the target is Android
0803   bool isAndroid() const { return getEnvironment() == Triple::Android; }
0804 
0805   bool isAndroidVersionLT(unsigned Major) const {
0806     assert(isAndroid() && "Not an Android triple!");
0807 
0808     VersionTuple Version = getEnvironmentVersion();
0809 
0810     // 64-bit targets did not exist before API level 21 (Lollipop).
0811     if (isArch64Bit() && Version.getMajor() < 21)
0812       return VersionTuple(21) < VersionTuple(Major);
0813 
0814     return Version < VersionTuple(Major);
0815   }
0816 
0817   /// Tests whether the environment is musl-libc
0818   bool isMusl() const {
0819     return getEnvironment() == Triple::Musl ||
0820            getEnvironment() == Triple::MuslABIN32 ||
0821            getEnvironment() == Triple::MuslABI64 ||
0822            getEnvironment() == Triple::MuslEABI ||
0823            getEnvironment() == Triple::MuslEABIHF ||
0824            getEnvironment() == Triple::MuslF32 ||
0825            getEnvironment() == Triple::MuslSF ||
0826            getEnvironment() == Triple::MuslX32 ||
0827            getEnvironment() == Triple::OpenHOS || isOSLiteOS();
0828   }
0829 
0830   /// Tests whether the target is OHOS
0831   /// LiteOS default enviroment is also OHOS, but omited on triple.
0832   bool isOHOSFamily() const { return isOpenHOS() || isOSLiteOS(); }
0833 
0834   bool isOpenHOS() const { return getEnvironment() == Triple::OpenHOS; }
0835 
0836   bool isOSLiteOS() const { return getOS() == Triple::LiteOS; }
0837 
0838   /// Tests whether the target is DXIL.
0839   bool isDXIL() const {
0840     return getArch() == Triple::dxil;
0841   }
0842 
0843   bool isShaderModelOS() const {
0844     return getOS() == Triple::ShaderModel;
0845   }
0846 
0847   bool isVulkanOS() const { return getOS() == Triple::Vulkan; }
0848 
0849   bool isShaderStageEnvironment() const {
0850     EnvironmentType Env = getEnvironment();
0851     return Env == Triple::Pixel || Env == Triple::Vertex ||
0852            Env == Triple::Geometry || Env == Triple::Hull ||
0853            Env == Triple::Domain || Env == Triple::Compute ||
0854            Env == Triple::Library || Env == Triple::RayGeneration ||
0855            Env == Triple::Intersection || Env == Triple::AnyHit ||
0856            Env == Triple::ClosestHit || Env == Triple::Miss ||
0857            Env == Triple::Callable || Env == Triple::Mesh ||
0858            Env == Triple::Amplification;
0859   }
0860 
0861   /// Tests whether the target is SPIR (32- or 64-bit).
0862   bool isSPIR() const {
0863     return getArch() == Triple::spir || getArch() == Triple::spir64;
0864   }
0865 
0866   /// Tests whether the target is SPIR-V (32/64-bit/Logical).
0867   bool isSPIRV() const {
0868     return getArch() == Triple::spirv32 || getArch() == Triple::spirv64 ||
0869            getArch() == Triple::spirv;
0870   }
0871 
0872   // Tests whether the target is SPIR-V or SPIR.
0873   bool isSPIROrSPIRV() const { return isSPIR() || isSPIRV(); }
0874 
0875   /// Tests whether the target is SPIR-V Logical
0876   bool isSPIRVLogical() const {
0877     return getArch() == Triple::spirv;
0878   }
0879 
0880   /// Tests whether the target is NVPTX (32- or 64-bit).
0881   bool isNVPTX() const {
0882     return getArch() == Triple::nvptx || getArch() == Triple::nvptx64;
0883   }
0884 
0885   /// Tests whether the target is AMDGCN
0886   bool isAMDGCN() const { return getArch() == Triple::amdgcn; }
0887 
0888   bool isAMDGPU() const {
0889     return getArch() == Triple::r600 || getArch() == Triple::amdgcn;
0890   }
0891 
0892   /// Tests whether the target is Thumb (little and big endian).
0893   bool isThumb() const {
0894     return getArch() == Triple::thumb || getArch() == Triple::thumbeb;
0895   }
0896 
0897   /// Tests whether the target is ARM (little and big endian).
0898   bool isARM() const {
0899     return getArch() == Triple::arm || getArch() == Triple::armeb;
0900   }
0901 
0902   /// Tests whether the target supports the EHABI exception
0903   /// handling standard.
0904   bool isTargetEHABICompatible() const {
0905     return (isARM() || isThumb()) &&
0906            (getEnvironment() == Triple::EABI ||
0907             getEnvironment() == Triple::GNUEABI ||
0908             getEnvironment() == Triple::GNUEABIT64 ||
0909             getEnvironment() == Triple::MuslEABI ||
0910             getEnvironment() == Triple::EABIHF ||
0911             getEnvironment() == Triple::GNUEABIHF ||
0912             getEnvironment() == Triple::GNUEABIHFT64 ||
0913             getEnvironment() == Triple::OpenHOS ||
0914             getEnvironment() == Triple::MuslEABIHF || isAndroid()) &&
0915            isOSBinFormatELF();
0916   }
0917 
0918   /// Tests whether the target is T32.
0919   bool isArmT32() const {
0920     switch (getSubArch()) {
0921     case Triple::ARMSubArch_v8m_baseline:
0922     case Triple::ARMSubArch_v7s:
0923     case Triple::ARMSubArch_v7k:
0924     case Triple::ARMSubArch_v7ve:
0925     case Triple::ARMSubArch_v6:
0926     case Triple::ARMSubArch_v6m:
0927     case Triple::ARMSubArch_v6k:
0928     case Triple::ARMSubArch_v6t2:
0929     case Triple::ARMSubArch_v5:
0930     case Triple::ARMSubArch_v5te:
0931     case Triple::ARMSubArch_v4t:
0932       return false;
0933     default:
0934       return true;
0935     }
0936   }
0937 
0938   /// Tests whether the target is an M-class.
0939   bool isArmMClass() const {
0940     switch (getSubArch()) {
0941     case Triple::ARMSubArch_v6m:
0942     case Triple::ARMSubArch_v7m:
0943     case Triple::ARMSubArch_v7em:
0944     case Triple::ARMSubArch_v8m_mainline:
0945     case Triple::ARMSubArch_v8m_baseline:
0946     case Triple::ARMSubArch_v8_1m_mainline:
0947       return true;
0948     default:
0949       return false;
0950     }
0951   }
0952 
0953   /// Tests whether the target is AArch64 (little and big endian).
0954   bool isAArch64() const {
0955     return getArch() == Triple::aarch64 || getArch() == Triple::aarch64_be ||
0956            getArch() == Triple::aarch64_32;
0957   }
0958 
0959   /// Tests whether the target is AArch64 and pointers are the size specified by
0960   /// \p PointerWidth.
0961   bool isAArch64(int PointerWidth) const {
0962     assert(PointerWidth == 64 || PointerWidth == 32);
0963     if (!isAArch64())
0964       return false;
0965     return getArch() == Triple::aarch64_32 ||
0966                    getEnvironment() == Triple::GNUILP32
0967                ? PointerWidth == 32
0968                : PointerWidth == 64;
0969   }
0970 
0971   /// Tests whether the target is 32-bit LoongArch.
0972   bool isLoongArch32() const { return getArch() == Triple::loongarch32; }
0973 
0974   /// Tests whether the target is 64-bit LoongArch.
0975   bool isLoongArch64() const { return getArch() == Triple::loongarch64; }
0976 
0977   /// Tests whether the target is LoongArch (32- and 64-bit).
0978   bool isLoongArch() const { return isLoongArch32() || isLoongArch64(); }
0979 
0980   /// Tests whether the target is MIPS 32-bit (little and big endian).
0981   bool isMIPS32() const {
0982     return getArch() == Triple::mips || getArch() == Triple::mipsel;
0983   }
0984 
0985   /// Tests whether the target is MIPS 64-bit (little and big endian).
0986   bool isMIPS64() const {
0987     return getArch() == Triple::mips64 || getArch() == Triple::mips64el;
0988   }
0989 
0990   /// Tests whether the target is MIPS (little and big endian, 32- or 64-bit).
0991   bool isMIPS() const {
0992     return isMIPS32() || isMIPS64();
0993   }
0994 
0995   /// Tests whether the target is PowerPC (32- or 64-bit LE or BE).
0996   bool isPPC() const {
0997     return getArch() == Triple::ppc || getArch() == Triple::ppc64 ||
0998            getArch() == Triple::ppcle || getArch() == Triple::ppc64le;
0999   }
1000 
1001   /// Tests whether the target is 32-bit PowerPC (little and big endian).
1002   bool isPPC32() const {
1003     return getArch() == Triple::ppc || getArch() == Triple::ppcle;
1004   }
1005 
1006   /// Tests whether the target is 64-bit PowerPC (little and big endian).
1007   bool isPPC64() const {
1008     return getArch() == Triple::ppc64 || getArch() == Triple::ppc64le;
1009   }
1010 
1011   /// Tests whether the target 64-bit PowerPC big endian ABI is ELFv2.
1012   bool isPPC64ELFv2ABI() const {
1013     return (getArch() == Triple::ppc64 &&
1014             ((getOS() == Triple::FreeBSD &&
1015               (getOSMajorVersion() >= 13 || getOSVersion().empty())) ||
1016              getOS() == Triple::OpenBSD || isMusl()));
1017   }
1018 
1019   /// Tests whether the target 32-bit PowerPC uses Secure PLT.
1020   bool isPPC32SecurePlt() const {
1021     return ((getArch() == Triple::ppc || getArch() == Triple::ppcle) &&
1022             ((getOS() == Triple::FreeBSD &&
1023               (getOSMajorVersion() >= 13 || getOSVersion().empty())) ||
1024              getOS() == Triple::NetBSD || getOS() == Triple::OpenBSD ||
1025              isMusl()));
1026   }
1027 
1028   /// Tests whether the target is 32-bit RISC-V.
1029   bool isRISCV32() const { return getArch() == Triple::riscv32; }
1030 
1031   /// Tests whether the target is 64-bit RISC-V.
1032   bool isRISCV64() const { return getArch() == Triple::riscv64; }
1033 
1034   /// Tests whether the target is RISC-V (32- and 64-bit).
1035   bool isRISCV() const { return isRISCV32() || isRISCV64(); }
1036 
1037   /// Tests whether the target is 32-bit SPARC (little and big endian).
1038   bool isSPARC32() const {
1039     return getArch() == Triple::sparc || getArch() == Triple::sparcel;
1040   }
1041 
1042   /// Tests whether the target is 64-bit SPARC (big endian).
1043   bool isSPARC64() const { return getArch() == Triple::sparcv9; }
1044 
1045   /// Tests whether the target is SPARC.
1046   bool isSPARC() const { return isSPARC32() || isSPARC64(); }
1047 
1048   /// Tests whether the target is SystemZ.
1049   bool isSystemZ() const {
1050     return getArch() == Triple::systemz;
1051   }
1052 
1053   /// Tests whether the target is x86 (32- or 64-bit).
1054   bool isX86() const {
1055     return getArch() == Triple::x86 || getArch() == Triple::x86_64;
1056   }
1057 
1058   /// Tests whether the target is VE
1059   bool isVE() const {
1060     return getArch() == Triple::ve;
1061   }
1062 
1063   /// Tests whether the target is wasm (32- and 64-bit).
1064   bool isWasm() const {
1065     return getArch() == Triple::wasm32 || getArch() == Triple::wasm64;
1066   }
1067 
1068   // Tests whether the target is CSKY
1069   bool isCSKY() const {
1070     return getArch() == Triple::csky;
1071   }
1072 
1073   /// Tests whether the target is the Apple "arm64e" AArch64 subarch.
1074   bool isArm64e() const {
1075     return getArch() == Triple::aarch64 &&
1076            getSubArch() == Triple::AArch64SubArch_arm64e;
1077   }
1078 
1079   // Tests whether the target is N32.
1080   bool isABIN32() const {
1081     EnvironmentType Env = getEnvironment();
1082     return Env == Triple::GNUABIN32 || Env == Triple::MuslABIN32;
1083   }
1084 
1085   /// Tests whether the target is X32.
1086   bool isX32() const {
1087     EnvironmentType Env = getEnvironment();
1088     return Env == Triple::GNUX32 || Env == Triple::MuslX32;
1089   }
1090 
1091   /// Tests whether the target is eBPF.
1092   bool isBPF() const {
1093     return getArch() == Triple::bpfel || getArch() == Triple::bpfeb;
1094   }
1095 
1096   /// Tests if the target forces 64-bit time_t on a 32-bit architecture.
1097   bool isTime64ABI() const {
1098     EnvironmentType Env = getEnvironment();
1099     return Env == Triple::GNUT64 || Env == Triple::GNUEABIT64 ||
1100            Env == Triple::GNUEABIHFT64;
1101   }
1102 
1103   /// Tests if the target forces hardfloat.
1104   bool isHardFloatABI() const {
1105     EnvironmentType Env = getEnvironment();
1106     return Env == llvm::Triple::GNUEABIHF ||
1107            Env == llvm::Triple::GNUEABIHFT64 ||
1108            Env == llvm::Triple::MuslEABIHF ||
1109            Env == llvm::Triple::EABIHF;
1110   }
1111 
1112   /// Tests whether the target supports comdat
1113   bool supportsCOMDAT() const {
1114     return !(isOSBinFormatMachO() || isOSBinFormatXCOFF() ||
1115              isOSBinFormatDXContainer());
1116   }
1117 
1118   /// Tests whether the target uses emulated TLS as default.
1119   ///
1120   /// Note: Android API level 29 (10) introduced ELF TLS.
1121   bool hasDefaultEmulatedTLS() const {
1122     return (isAndroid() && isAndroidVersionLT(29)) || isOSOpenBSD() ||
1123            isWindowsCygwinEnvironment() || isOHOSFamily();
1124   }
1125 
1126   /// True if the target supports both general-dynamic and TLSDESC, and TLSDESC
1127   /// is enabled by default.
1128   bool hasDefaultTLSDESC() const { return isAndroid() && isRISCV64(); }
1129 
1130   /// Tests whether the target uses -data-sections as default.
1131   bool hasDefaultDataSections() const {
1132     return isOSBinFormatXCOFF() || isWasm();
1133   }
1134 
1135   /// Tests if the environment supports dllimport/export annotations.
1136   bool hasDLLImportExport() const { return isOSWindows() || isPS(); }
1137 
1138   /// @}
1139   /// @name Mutators
1140   /// @{
1141 
1142   /// Set the architecture (first) component of the triple to a known type.
1143   void setArch(ArchType Kind, SubArchType SubArch = NoSubArch);
1144 
1145   /// Set the vendor (second) component of the triple to a known type.
1146   void setVendor(VendorType Kind);
1147 
1148   /// Set the operating system (third) component of the triple to a known type.
1149   void setOS(OSType Kind);
1150 
1151   /// Set the environment (fourth) component of the triple to a known type.
1152   void setEnvironment(EnvironmentType Kind);
1153 
1154   /// Set the object file format.
1155   void setObjectFormat(ObjectFormatType Kind);
1156 
1157   /// Set all components to the new triple \p Str.
1158   void setTriple(const Twine &Str);
1159 
1160   /// Set the architecture (first) component of the triple by name.
1161   void setArchName(StringRef Str);
1162 
1163   /// Set the vendor (second) component of the triple by name.
1164   void setVendorName(StringRef Str);
1165 
1166   /// Set the operating system (third) component of the triple by name.
1167   void setOSName(StringRef Str);
1168 
1169   /// Set the optional environment (fourth) component of the triple by name.
1170   void setEnvironmentName(StringRef Str);
1171 
1172   /// Set the operating system and optional environment components with a single
1173   /// string.
1174   void setOSAndEnvironmentName(StringRef Str);
1175 
1176   /// @}
1177   /// @name Helpers to build variants of a particular triple.
1178   /// @{
1179 
1180   /// Form a triple with a 32-bit variant of the current architecture.
1181   ///
1182   /// This can be used to move across "families" of architectures where useful.
1183   ///
1184   /// \returns A new triple with a 32-bit architecture or an unknown
1185   ///          architecture if no such variant can be found.
1186   llvm::Triple get32BitArchVariant() const;
1187 
1188   /// Form a triple with a 64-bit variant of the current architecture.
1189   ///
1190   /// This can be used to move across "families" of architectures where useful.
1191   ///
1192   /// \returns A new triple with a 64-bit architecture or an unknown
1193   ///          architecture if no such variant can be found.
1194   llvm::Triple get64BitArchVariant() const;
1195 
1196   /// Form a triple with a big endian variant of the current architecture.
1197   ///
1198   /// This can be used to move across "families" of architectures where useful.
1199   ///
1200   /// \returns A new triple with a big endian architecture or an unknown
1201   ///          architecture if no such variant can be found.
1202   llvm::Triple getBigEndianArchVariant() const;
1203 
1204   /// Form a triple with a little endian variant of the current architecture.
1205   ///
1206   /// This can be used to move across "families" of architectures where useful.
1207   ///
1208   /// \returns A new triple with a little endian architecture or an unknown
1209   ///          architecture if no such variant can be found.
1210   llvm::Triple getLittleEndianArchVariant() const;
1211 
1212   /// Tests whether the target triple is little endian.
1213   ///
1214   /// \returns true if the triple is little endian, false otherwise.
1215   bool isLittleEndian() const;
1216 
1217   /// Test whether target triples are compatible.
1218   bool isCompatibleWith(const Triple &Other) const;
1219 
1220   /// Merge target triples.
1221   std::string merge(const Triple &Other) const;
1222 
1223   /// Some platforms have different minimum supported OS versions that
1224   /// varies by the architecture specified in the triple. This function
1225   /// returns the minimum supported OS version for this triple if one an exists,
1226   /// or an invalid version tuple if this triple doesn't have one.
1227   VersionTuple getMinimumSupportedOSVersion() const;
1228 
1229   /// @}
1230   /// @name Static helpers for IDs.
1231   /// @{
1232 
1233   /// Get the canonical name for the \p Kind architecture.
1234   static StringRef getArchTypeName(ArchType Kind);
1235 
1236   /// Get the architecture name based on \p Kind and \p SubArch.
1237   static StringRef getArchName(ArchType Kind, SubArchType SubArch = NoSubArch);
1238 
1239   /// Get the "prefix" canonical name for the \p Kind architecture. This is the
1240   /// prefix used by the architecture specific builtins, and is suitable for
1241   /// passing to \see Intrinsic::getIntrinsicForClangBuiltin().
1242   ///
1243   /// \return - The architecture prefix, or 0 if none is defined.
1244   static StringRef getArchTypePrefix(ArchType Kind);
1245 
1246   /// Get the canonical name for the \p Kind vendor.
1247   static StringRef getVendorTypeName(VendorType Kind);
1248 
1249   /// Get the canonical name for the \p Kind operating system.
1250   static StringRef getOSTypeName(OSType Kind);
1251 
1252   /// Get the canonical name for the \p Kind environment.
1253   static StringRef getEnvironmentTypeName(EnvironmentType Kind);
1254 
1255   /// Get the name for the \p Object format.
1256   static StringRef getObjectFormatTypeName(ObjectFormatType ObjectFormat);
1257 
1258   /// @}
1259   /// @name Static helpers for converting alternate architecture names.
1260   /// @{
1261 
1262   /// The canonical type for the given LLVM architecture name (e.g., "x86").
1263   static ArchType getArchTypeForLLVMName(StringRef Str);
1264 
1265   /// @}
1266 
1267   /// Returns a canonicalized OS version number for the specified OS.
1268   static VersionTuple getCanonicalVersionForOS(OSType OSKind,
1269                                                const VersionTuple &Version);
1270 };
1271 
1272 } // End llvm namespace
1273 
1274 
1275 #endif