LLVM  16.0.0git
Triple.h
Go to the documentation of this file.
1 //===-- llvm/ADT/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_ADT_TRIPLE_H
10 #define LLVM_ADT_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 
21 namespace 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.
44 class Triple {
45 public:
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  nvptx, // NVPTX: 32-bit
89  nvptx64, // NVPTX: 64-bit
90  le32, // le32: generic little-endian 32-bit CPU (PNaCl)
91  le64, // le64: generic little-endian 64-bit CPU (PNaCl)
92  amdil, // AMDIL
93  amdil64, // AMDIL with 64-bit pointers
94  hsail, // AMD HSAIL
95  hsail64, // AMD HSAIL with 64-bit pointers
96  spir, // SPIR: standard portable IR for OpenCL 32-bit version
97  spir64, // SPIR: standard portable IR for OpenCL 64-bit version
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  };
110  enum SubArchType {
112 
143 
146 
150 
152 
154 
155  // SPIR-V sub-arch corresponds to its version.
162  };
163  enum VendorType {
165 
167  PC,
181  };
182  enum OSType {
184 
194  Lv2, // PS3
204  NaCl, // Native Client
206  CUDA, // NVIDIA CUDA
207  NVCL, // NVIDIA OpenCL
208  AMDHSA, // AMD HSA Runtime
212  TvOS, // Apple tvOS
213  WatchOS, // Apple watchOS
214  DriverKit, // Apple DriverKit
217  AMDPAL, // AMD PAL Runtime
218  HermitCore, // HermitCore Unikernel/Multikernel
219  Hurd, // GNU/Hurd
220  WASI, // Experimental WebAssembly OS
222  ShaderModel, // DirectX ShaderModel
224  };
227 
243 
248  Simulator, // Simulator variants of other systems, e.g., Apple's iOS
249  MacABI, // Mac Catalyst variant of Apple's iOS deployment target.
250 
251  // Shader Stages
267 
269  };
272 
281  };
282 
283 private:
284  std::string Data;
285 
286  /// The parsed arch type.
287  ArchType Arch{};
288 
289  /// The parsed subarchitecture type.
290  SubArchType SubArch{};
291 
292  /// The parsed vendor type.
293  VendorType Vendor{};
294 
295  /// The parsed OS type.
296  OSType OS{};
297 
298  /// The parsed Environment type.
299  EnvironmentType Environment{};
300 
301  /// The object format type.
302  ObjectFormatType ObjectFormat{};
303 
304 public:
305  /// @name Constructors
306  /// @{
307 
308  /// Default constructor is the same as an empty string and leaves all
309  /// triple fields unknown.
310  Triple() = default;
311 
312  explicit Triple(const Twine &Str);
313  Triple(const Twine &ArchStr, const Twine &VendorStr, const Twine &OSStr);
314  Triple(const Twine &ArchStr, const Twine &VendorStr, const Twine &OSStr,
315  const Twine &EnvironmentStr);
316 
317  bool operator==(const Triple &Other) const {
318  return Arch == Other.Arch && SubArch == Other.SubArch &&
319  Vendor == Other.Vendor && OS == Other.OS &&
320  Environment == Other.Environment &&
321  ObjectFormat == Other.ObjectFormat;
322  }
323 
324  bool operator!=(const Triple &Other) const {
325  return !(*this == Other);
326  }
327 
328  /// @}
329  /// @name Normalization
330  /// @{
331 
332  /// Turn an arbitrary machine specification into the canonical triple form (or
333  /// something sensible that the Triple class understands if nothing better can
334  /// reasonably be done). In particular, it handles the common case in which
335  /// otherwise valid components are in the wrong order.
336  static std::string normalize(StringRef Str);
337 
338  /// Return the normalized form of this triple's string.
339  std::string normalize() const { return normalize(Data); }
340 
341  /// @}
342  /// @name Typed Component Access
343  /// @{
344 
345  /// Get the parsed architecture type of this triple.
346  ArchType getArch() const { return Arch; }
347 
348  /// get the parsed subarchitecture type for this triple.
349  SubArchType getSubArch() const { return SubArch; }
350 
351  /// Get the parsed vendor type of this triple.
352  VendorType getVendor() const { return Vendor; }
353 
354  /// Get the parsed operating system type of this triple.
355  OSType getOS() const { return OS; }
356 
357  /// Does this triple have the optional environment (fourth) component?
358  bool hasEnvironment() const {
359  return getEnvironmentName() != "";
360  }
361 
362  /// Get the parsed environment type of this triple.
363  EnvironmentType getEnvironment() const { return Environment; }
364 
365  /// Parse the version number from the OS name component of the
366  /// triple, if present.
367  ///
368  /// For example, "fooos1.2.3" would return (1, 2, 3).
370 
371  /// Get the object format for this triple.
372  ObjectFormatType getObjectFormat() const { return ObjectFormat; }
373 
374  /// Parse the version number from the OS name component of the triple, if
375  /// present.
376  ///
377  /// For example, "fooos1.2.3" would return (1, 2, 3).
378  VersionTuple getOSVersion() const;
379 
380  /// Return just the major version number, this is specialized because it is a
381  /// common query.
382  unsigned getOSMajorVersion() const { return getOSVersion().getMajor(); }
383 
384  /// Parse the version number as with getOSVersion and then translate generic
385  /// "darwin" versions to the corresponding OS X versions. This may also be
386  /// called with IOS triples but the OS X version number is just set to a
387  /// constant 10.4.0 in that case. Returns true if successful.
389 
390  /// Parse the version number as with getOSVersion. This should only be called
391  /// with IOS or generic triples.
392  VersionTuple getiOSVersion() const;
393 
394  /// Parse the version number as with getOSVersion. This should only be called
395  /// with WatchOS or generic triples.
397 
398  /// Parse the version number as with getOSVersion.
400 
401  /// @}
402  /// @name Direct Component Access
403  /// @{
404 
405  const std::string &str() const { return Data; }
406 
407  const std::string &getTriple() const { return Data; }
408 
409  /// Get the architecture (first) component of the triple.
410  StringRef getArchName() const;
411 
412  /// Get the architecture name based on Kind and SubArch.
414 
415  /// Get the vendor (second) component of the triple.
416  StringRef getVendorName() const;
417 
418  /// Get the operating system (third) component of the triple.
419  StringRef getOSName() const;
420 
421  /// Get the optional environment (fourth) component of the triple, or "" if
422  /// empty.
424 
425  /// Get the operating system and optional environment components as a single
426  /// string (separated by a '-' if the environment component is present).
428 
429  /// @}
430  /// @name Convenience Predicates
431  /// @{
432 
433  /// Test whether the architecture is 64-bit
434  ///
435  /// Note that this tests for 64-bit pointer width, and nothing else. Note
436  /// that we intentionally expose only three predicates, 64-bit, 32-bit, and
437  /// 16-bit. The inner details of pointer width for particular architectures
438  /// is not summed up in the triple, and so only a coarse grained predicate
439  /// system is provided.
440  bool isArch64Bit() const;
441 
442  /// Test whether the architecture is 32-bit
443  ///
444  /// Note that this tests for 32-bit pointer width, and nothing else.
445  bool isArch32Bit() const;
446 
447  /// Test whether the architecture is 16-bit
448  ///
449  /// Note that this tests for 16-bit pointer width, and nothing else.
450  bool isArch16Bit() const;
451 
452  /// Helper function for doing comparisons against version numbers included in
453  /// the target triple.
454  bool isOSVersionLT(unsigned Major, unsigned Minor = 0,
455  unsigned Micro = 0) const {
456  if (Minor == 0) {
457  return getOSVersion() < VersionTuple(Major);
458  }
459  if (Micro == 0) {
460  return getOSVersion() < VersionTuple(Major, Minor);
461  }
462  return getOSVersion() < VersionTuple(Major, Minor, Micro);
463  }
464 
465  bool isOSVersionLT(const Triple &Other) const {
466  return getOSVersion() < Other.getOSVersion();
467  }
468 
469  /// Comparison function for checking OS X version compatibility, which handles
470  /// supporting skewed version numbering schemes used by the "darwin" triples.
471  bool isMacOSXVersionLT(unsigned Major, unsigned Minor = 0,
472  unsigned Micro = 0) const;
473 
474  /// Is this a Mac OS X triple. For legacy reasons, we support both "darwin"
475  /// and "osx" as OS X triples.
476  bool isMacOSX() const {
477  return getOS() == Triple::Darwin || getOS() == Triple::MacOSX;
478  }
479 
480  /// Is this an iOS triple.
481  /// Note: This identifies tvOS as a variant of iOS. If that ever
482  /// changes, i.e., if the two operating systems diverge or their version
483  /// numbers get out of sync, that will need to be changed.
484  /// watchOS has completely different version numbers so it is not included.
485  bool isiOS() const {
486  return getOS() == Triple::IOS || isTvOS();
487  }
488 
489  /// Is this an Apple tvOS triple.
490  bool isTvOS() const {
491  return getOS() == Triple::TvOS;
492  }
493 
494  /// Is this an Apple watchOS triple.
495  bool isWatchOS() const {
496  return getOS() == Triple::WatchOS;
497  }
498 
499  bool isWatchABI() const {
501  }
502 
503  /// Is this an Apple DriverKit triple.
504  bool isDriverKit() const { return getOS() == Triple::DriverKit; }
505 
506  bool isOSzOS() const { return getOS() == Triple::ZOS; }
507 
508  /// Is this a "Darwin" OS (macOS, iOS, tvOS, watchOS, or DriverKit).
509  bool isOSDarwin() const {
510  return isMacOSX() || isiOS() || isWatchOS() || isDriverKit();
511  }
512 
513  bool isSimulatorEnvironment() const {
514  return getEnvironment() == Triple::Simulator;
515  }
516 
518  return getEnvironment() == Triple::MacABI;
519  }
520 
521  /// Returns true for targets that run on a macOS machine.
522  bool isTargetMachineMac() const {
523  return isMacOSX() || (isOSDarwin() && (isSimulatorEnvironment() ||
525  }
526 
527  bool isOSNetBSD() const {
528  return getOS() == Triple::NetBSD;
529  }
530 
531  bool isOSOpenBSD() const {
532  return getOS() == Triple::OpenBSD;
533  }
534 
535  bool isOSFreeBSD() const {
536  return getOS() == Triple::FreeBSD;
537  }
538 
539  bool isOSFuchsia() const {
540  return getOS() == Triple::Fuchsia;
541  }
542 
543  bool isOSDragonFly() const { return getOS() == Triple::DragonFly; }
544 
545  bool isOSSolaris() const {
546  return getOS() == Triple::Solaris;
547  }
548 
549  bool isOSIAMCU() const {
550  return getOS() == Triple::ELFIAMCU;
551  }
552 
553  bool isOSUnknown() const { return getOS() == Triple::UnknownOS; }
554 
555  bool isGNUEnvironment() const {
557  return Env == Triple::GNU || Env == Triple::GNUABIN32 ||
558  Env == Triple::GNUABI64 || Env == Triple::GNUEABI ||
559  Env == Triple::GNUEABIHF || Env == Triple::GNUX32;
560  }
561 
562  bool isOSContiki() const {
563  return getOS() == Triple::Contiki;
564  }
565 
566  /// Tests whether the OS is Haiku.
567  bool isOSHaiku() const {
568  return getOS() == Triple::Haiku;
569  }
570 
571  /// Tests whether the OS is Windows.
572  bool isOSWindows() const {
573  return getOS() == Triple::Win32;
574  }
575 
576  /// Checks if the environment is MSVC.
578  return isOSWindows() && getEnvironment() == Triple::MSVC;
579  }
580 
581  /// Checks if the environment could be MSVC.
585  }
586 
587  // Checks if we're using the Windows Arm64EC ABI.
588  bool isWindowsArm64EC() const {
589  return getArch() == Triple::aarch64 &&
591  }
592 
594  return isOSWindows() && getEnvironment() == Triple::CoreCLR;
595  }
596 
598  return isOSWindows() && getEnvironment() == Triple::Itanium;
599  }
600 
602  return isOSWindows() && getEnvironment() == Triple::Cygnus;
603  }
604 
605  bool isWindowsGNUEnvironment() const {
606  return isOSWindows() && getEnvironment() == Triple::GNU;
607  }
608 
609  /// Tests for either Cygwin or MinGW OS
610  bool isOSCygMing() const {
612  }
613 
614  /// Is this a "Windows" OS targeting a "MSVCRT.dll" environment.
615  bool isOSMSVCRT() const {
618  }
619 
620  /// Tests whether the OS is NaCl (Native Client)
621  bool isOSNaCl() const {
622  return getOS() == Triple::NaCl;
623  }
624 
625  /// Tests whether the OS is Linux.
626  bool isOSLinux() const {
627  return getOS() == Triple::Linux;
628  }
629 
630  /// Tests whether the OS is kFreeBSD.
631  bool isOSKFreeBSD() const {
632  return getOS() == Triple::KFreeBSD;
633  }
634 
635  /// Tests whether the OS is Hurd.
636  bool isOSHurd() const {
637  return getOS() == Triple::Hurd;
638  }
639 
640  /// Tests whether the OS is WASI.
641  bool isOSWASI() const {
642  return getOS() == Triple::WASI;
643  }
644 
645  /// Tests whether the OS is Emscripten.
646  bool isOSEmscripten() const {
647  return getOS() == Triple::Emscripten;
648  }
649 
650  /// Tests whether the OS uses glibc.
651  bool isOSGlibc() const {
652  return (getOS() == Triple::Linux || getOS() == Triple::KFreeBSD ||
653  getOS() == Triple::Hurd) &&
654  !isAndroid();
655  }
656 
657  /// Tests whether the OS is AIX.
658  bool isOSAIX() const {
659  return getOS() == Triple::AIX;
660  }
661 
662  /// Tests whether the OS uses the ELF binary format.
663  bool isOSBinFormatELF() const {
664  return getObjectFormat() == Triple::ELF;
665  }
666 
667  /// Tests whether the OS uses the COFF binary format.
668  bool isOSBinFormatCOFF() const {
669  return getObjectFormat() == Triple::COFF;
670  }
671 
672  /// Tests whether the OS uses the GOFF binary format.
673  bool isOSBinFormatGOFF() const { return getObjectFormat() == Triple::GOFF; }
674 
675  /// Tests whether the environment is MachO.
676  bool isOSBinFormatMachO() const {
677  return getObjectFormat() == Triple::MachO;
678  }
679 
680  /// Tests whether the OS uses the Wasm binary format.
681  bool isOSBinFormatWasm() const {
682  return getObjectFormat() == Triple::Wasm;
683  }
684 
685  /// Tests whether the OS uses the XCOFF binary format.
686  bool isOSBinFormatXCOFF() const {
687  return getObjectFormat() == Triple::XCOFF;
688  }
689 
690  /// Tests whether the OS uses the DXContainer binary format.
693  }
694 
695  /// Tests whether the target is the PS4 platform.
696  bool isPS4() const {
697  return getArch() == Triple::x86_64 &&
698  getVendor() == Triple::SCEI &&
699  getOS() == Triple::PS4;
700  }
701 
702  /// Tests whether the target is the PS5 platform.
703  bool isPS5() const {
704  return getArch() == Triple::x86_64 &&
705  getVendor() == Triple::SCEI &&
706  getOS() == Triple::PS5;
707  }
708 
709  /// Tests whether the target is the PS4 or PS5 platform.
710  bool isPS() const { return isPS4() || isPS5(); }
711 
712  /// Tests whether the target is Android
713  bool isAndroid() const { return getEnvironment() == Triple::Android; }
714 
715  bool isAndroidVersionLT(unsigned Major) const {
716  assert(isAndroid() && "Not an Android triple!");
717 
719 
720  // 64-bit targets did not exist before API level 21 (Lollipop).
721  if (isArch64Bit() && Version.getMajor() < 21)
722  return VersionTuple(21) < VersionTuple(Major);
723 
724  return Version < VersionTuple(Major);
725  }
726 
727  /// Tests whether the environment is musl-libc
728  bool isMusl() const {
729  return getEnvironment() == Triple::Musl ||
733  }
734 
735  /// Tests whether the target is DXIL.
736  bool isDXIL() const {
737  return getArch() == Triple::dxil;
738  }
739 
740  /// Tests whether the target is SPIR (32- or 64-bit).
741  bool isSPIR() const {
742  return getArch() == Triple::spir || getArch() == Triple::spir64;
743  }
744 
745  /// Tests whether the target is SPIR-V (32/64-bit).
746  bool isSPIRV() const {
747  return getArch() == Triple::spirv32 || getArch() == Triple::spirv64;
748  }
749 
750  /// Tests whether the target is NVPTX (32- or 64-bit).
751  bool isNVPTX() const {
752  return getArch() == Triple::nvptx || getArch() == Triple::nvptx64;
753  }
754 
755  /// Tests whether the target is AMDGCN
756  bool isAMDGCN() const { return getArch() == Triple::amdgcn; }
757 
758  bool isAMDGPU() const {
759  return getArch() == Triple::r600 || getArch() == Triple::amdgcn;
760  }
761 
762  /// Tests whether the target is Thumb (little and big endian).
763  bool isThumb() const {
764  return getArch() == Triple::thumb || getArch() == Triple::thumbeb;
765  }
766 
767  /// Tests whether the target is ARM (little and big endian).
768  bool isARM() const {
769  return getArch() == Triple::arm || getArch() == Triple::armeb;
770  }
771 
772  /// Tests whether the target supports the EHABI exception
773  /// handling standard.
774  bool isTargetEHABICompatible() const {
775  return (isARM() || isThumb()) &&
783  }
784 
785  /// Tests whether the target is T32.
786  bool isArmT32() const {
787  switch (getSubArch()) {
799  return false;
800  default:
801  return true;
802  }
803  }
804 
805  /// Tests whether the target is an M-class.
806  bool isArmMClass() const {
807  switch (getSubArch()) {
814  return true;
815  default:
816  return false;
817  }
818  }
819 
820  /// Tests whether the target is AArch64 (little and big endian).
821  bool isAArch64() const {
822  return getArch() == Triple::aarch64 || getArch() == Triple::aarch64_be ||
824  }
825 
826  /// Tests whether the target is AArch64 and pointers are the size specified by
827  /// \p PointerWidth.
828  bool isAArch64(int PointerWidth) const {
829  assert(PointerWidth == 64 || PointerWidth == 32);
830  if (!isAArch64())
831  return false;
832  return getArch() == Triple::aarch64_32 ||
834  ? PointerWidth == 32
835  : PointerWidth == 64;
836  }
837 
838  /// Tests whether the target is LoongArch (32- and 64-bit).
839  bool isLoongArch() const {
841  }
842 
843  /// Tests whether the target is MIPS 32-bit (little and big endian).
844  bool isMIPS32() const {
845  return getArch() == Triple::mips || getArch() == Triple::mipsel;
846  }
847 
848  /// Tests whether the target is MIPS 64-bit (little and big endian).
849  bool isMIPS64() const {
850  return getArch() == Triple::mips64 || getArch() == Triple::mips64el;
851  }
852 
853  /// Tests whether the target is MIPS (little and big endian, 32- or 64-bit).
854  bool isMIPS() const {
855  return isMIPS32() || isMIPS64();
856  }
857 
858  /// Tests whether the target is PowerPC (32- or 64-bit LE or BE).
859  bool isPPC() const {
860  return getArch() == Triple::ppc || getArch() == Triple::ppc64 ||
862  }
863 
864  /// Tests whether the target is 32-bit PowerPC (little and big endian).
865  bool isPPC32() const {
866  return getArch() == Triple::ppc || getArch() == Triple::ppcle;
867  }
868 
869  /// Tests whether the target is 64-bit PowerPC (little and big endian).
870  bool isPPC64() const {
871  return getArch() == Triple::ppc64 || getArch() == Triple::ppc64le;
872  }
873 
874  /// Tests whether the target is 32-bit RISC-V.
875  bool isRISCV32() const { return getArch() == Triple::riscv32; }
876 
877  /// Tests whether the target is 64-bit RISC-V.
878  bool isRISCV64() const { return getArch() == Triple::riscv64; }
879 
880  /// Tests whether the target is RISC-V (32- and 64-bit).
881  bool isRISCV() const { return isRISCV32() || isRISCV64(); }
882 
883  /// Tests whether the target is 32-bit SPARC (little and big endian).
884  bool isSPARC32() const {
885  return getArch() == Triple::sparc || getArch() == Triple::sparcel;
886  }
887 
888  /// Tests whether the target is 64-bit SPARC (big endian).
889  bool isSPARC64() const { return getArch() == Triple::sparcv9; }
890 
891  /// Tests whether the target is SPARC.
892  bool isSPARC() const { return isSPARC32() || isSPARC64(); }
893 
894  /// Tests whether the target is SystemZ.
895  bool isSystemZ() const {
896  return getArch() == Triple::systemz;
897  }
898 
899  /// Tests whether the target is x86 (32- or 64-bit).
900  bool isX86() const {
901  return getArch() == Triple::x86 || getArch() == Triple::x86_64;
902  }
903 
904  /// Tests whether the target is VE
905  bool isVE() const {
906  return getArch() == Triple::ve;
907  }
908 
909  /// Tests whether the target is wasm (32- and 64-bit).
910  bool isWasm() const {
911  return getArch() == Triple::wasm32 || getArch() == Triple::wasm64;
912  }
913 
914  // Tests whether the target is CSKY
915  bool isCSKY() const {
916  return getArch() == Triple::csky;
917  }
918 
919  /// Tests whether the target is the Apple "arm64e" AArch64 subarch.
920  bool isArm64e() const {
921  return getArch() == Triple::aarch64 &&
923  }
924 
925  /// Tests whether the target is X32.
926  bool isX32() const {
928  return Env == Triple::GNUX32 || Env == Triple::MuslX32;
929  }
930 
931  /// Tests whether the target supports comdat
932  bool supportsCOMDAT() const {
933  return !(isOSBinFormatMachO() || isOSBinFormatXCOFF() ||
935  }
936 
937  /// Tests whether the target uses emulated TLS as default.
938  bool hasDefaultEmulatedTLS() const {
940  }
941 
942  /// Tests whether the target uses -data-sections as default.
943  bool hasDefaultDataSections() const {
944  return isOSBinFormatXCOFF() || isWasm();
945  }
946 
947  /// Tests if the environment supports dllimport/export annotations.
948  bool hasDLLImportExport() const { return isOSWindows() || isPS(); }
949 
950  /// @}
951  /// @name Mutators
952  /// @{
953 
954  /// Set the architecture (first) component of the triple to a known type.
955  void setArch(ArchType Kind, SubArchType SubArch = NoSubArch);
956 
957  /// Set the vendor (second) component of the triple to a known type.
958  void setVendor(VendorType Kind);
959 
960  /// Set the operating system (third) component of the triple to a known type.
961  void setOS(OSType Kind);
962 
963  /// Set the environment (fourth) component of the triple to a known type.
965 
966  /// Set the object file format.
968 
969  /// Set all components to the new triple \p Str.
970  void setTriple(const Twine &Str);
971 
972  /// Set the architecture (first) component of the triple by name.
973  void setArchName(StringRef Str);
974 
975  /// Set the vendor (second) component of the triple by name.
976  void setVendorName(StringRef Str);
977 
978  /// Set the operating system (third) component of the triple by name.
979  void setOSName(StringRef Str);
980 
981  /// Set the optional environment (fourth) component of the triple by name.
982  void setEnvironmentName(StringRef Str);
983 
984  /// Set the operating system and optional environment components with a single
985  /// string.
987 
988  /// @}
989  /// @name Helpers to build variants of a particular triple.
990  /// @{
991 
992  /// Form a triple with a 32-bit variant of the current architecture.
993  ///
994  /// This can be used to move across "families" of architectures where useful.
995  ///
996  /// \returns A new triple with a 32-bit architecture or an unknown
997  /// architecture if no such variant can be found.
999 
1000  /// Form a triple with a 64-bit variant of the current architecture.
1001  ///
1002  /// This can be used to move across "families" of architectures where useful.
1003  ///
1004  /// \returns A new triple with a 64-bit architecture or an unknown
1005  /// architecture if no such variant can be found.
1007 
1008  /// Form a triple with a big endian variant of the current architecture.
1009  ///
1010  /// This can be used to move across "families" of architectures where useful.
1011  ///
1012  /// \returns A new triple with a big endian architecture or an unknown
1013  /// architecture if no such variant can be found.
1015 
1016  /// Form a triple with a little endian variant of the current architecture.
1017  ///
1018  /// This can be used to move across "families" of architectures where useful.
1019  ///
1020  /// \returns A new triple with a little endian architecture or an unknown
1021  /// architecture if no such variant can be found.
1023 
1024  /// Get the (LLVM) name of the minimum ARM CPU for the arch we are targeting.
1025  ///
1026  /// \param Arch the architecture name (e.g., "armv7s"). If it is an empty
1027  /// string then the triple's arch name is used.
1029 
1030  /// Tests whether the target triple is little endian.
1031  ///
1032  /// \returns true if the triple is little endian, false otherwise.
1033  bool isLittleEndian() const;
1034 
1035  /// Test whether target triples are compatible.
1036  bool isCompatibleWith(const Triple &Other) const;
1037 
1038  /// Merge target triples.
1039  std::string merge(const Triple &Other) const;
1040 
1041  /// Some platforms have different minimum supported OS versions that
1042  /// varies by the architecture specified in the triple. This function
1043  /// returns the minimum supported OS version for this triple if one an exists,
1044  /// or an invalid version tuple if this triple doesn't have one.
1046 
1047  /// @}
1048  /// @name Static helpers for IDs.
1049  /// @{
1050 
1051  /// Get the canonical name for the \p Kind architecture.
1053 
1054  /// Get the "prefix" canonical name for the \p Kind architecture. This is the
1055  /// prefix used by the architecture specific builtins, and is suitable for
1056  /// passing to \see Intrinsic::getIntrinsicForClangBuiltin().
1057  ///
1058  /// \return - The architecture prefix, or 0 if none is defined.
1060 
1061  /// Get the canonical name for the \p Kind vendor.
1063 
1064  /// Get the canonical name for the \p Kind operating system.
1066 
1067  /// Get the canonical name for the \p Kind environment.
1069 
1070  /// @}
1071  /// @name Static helpers for converting alternate architecture names.
1072  /// @{
1073 
1074  /// The canonical type for the given LLVM architecture name (e.g., "x86").
1076 
1077  /// @}
1078 
1079  /// Returns a canonicalized OS version number for the specified OS.
1081  const VersionTuple &Version);
1082 };
1083 
1084 } // End llvm namespace
1085 
1086 
1087 #endif
llvm::Triple::setEnvironment
void setEnvironment(EnvironmentType Kind)
Set the environment (fourth) component of the triple to a known type.
Definition: Triple.cpp:1326
llvm::Triple::getMacOSXVersion
bool getMacOSXVersion(VersionTuple &Version) const
Parse the version number as with getOSVersion and then translate generic "darwin" versions to the cor...
Definition: Triple.cpp:1207
llvm::Triple::DXContainer
@ DXContainer
Definition: Triple.h:274
llvm::Triple::isMacOSXVersionLT
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:1805
llvm::Triple::setVendorName
void setVendorName(StringRef Str)
Set the vendor (second) component of the triple by name.
Definition: Triple.cpp:1353
llvm::Triple::riscv64
@ riscv64
Definition: Triple.h:76
llvm::Triple::Wasm
@ Wasm
Definition: Triple.h:279
llvm::Triple::getARMCPUForArch
StringRef getARMCPUForArch(StringRef Arch=StringRef()) const
Get the (LLVM) name of the minimum ARM CPU for the arch we are targeting.
Definition: Triple.cpp:1856
llvm::Triple::spir64
@ spir64
Definition: Triple.h:97
llvm::Triple::setTriple
void setTriple(const Twine &Str)
Set all components to the new triple Str.
Definition: Triple.cpp:1310
llvm::Triple::isPS5
bool isPS5() const
Tests whether the target is the PS5 platform.
Definition: Triple.h:703
llvm::Triple::Mesa
@ Mesa
Definition: Triple.h:177
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
llvm::Triple::GNUILP32
@ GNUILP32
Definition: Triple.h:234
llvm::Triple::bpfeb
@ bpfeb
Definition: Triple.h:57
llvm::Triple::Lv2
@ Lv2
Definition: Triple.h:194
llvm::Triple::isMIPS32
bool isMIPS32() const
Tests whether the target is MIPS 32-bit (little and big endian).
Definition: Triple.h:844
llvm::Triple::UnknownArch
@ UnknownArch
Definition: Triple.h:47
llvm::Triple::hsail
@ hsail
Definition: Triple.h:94
llvm::Triple::isPS4
bool isPS4() const
Tests whether the target is the PS4 platform.
Definition: Triple.h:696
llvm::Triple::HermitCore
@ HermitCore
Definition: Triple.h:218
llvm::Triple::isOSBinFormatCOFF
bool isOSBinFormatCOFF() const
Tests whether the OS uses the COFF binary format.
Definition: Triple.h:668
llvm::Triple::wasm32
@ wasm32
Definition: Triple.h:103
llvm::Triple::Amplification
@ Amplification
Definition: Triple.h:266
llvm::Triple::Callable
@ Callable
Definition: Triple.h:264
llvm::Triple::SPIRVSubArch_v12
@ SPIRVSubArch_v12
Definition: Triple.h:158
llvm::Triple::CUDA
@ CUDA
Definition: Triple.h:206
llvm::Triple::Darwin
@ Darwin
Definition: Triple.h:187
llvm::Triple::KalimbaSubArch_v3
@ KalimbaSubArch_v3
Definition: Triple.h:147
llvm::Triple::EnvironmentType
EnvironmentType
Definition: Triple.h:225
llvm::Triple::ARMSubArch_v8m_mainline
@ ARMSubArch_v8m_mainline
Definition: Triple.h:128
llvm::Triple::x86
@ x86
Definition: Triple.h:85
llvm::Triple::isPS
bool isPS() const
Tests whether the target is the PS4 or PS5 platform.
Definition: Triple.h:710
llvm::Triple::isGNUEnvironment
bool isGNUEnvironment() const
Definition: Triple.h:555
llvm::Triple::getWatchOSVersion
VersionTuple getWatchOSVersion() const
Parse the version number as with getOSVersion.
Definition: Triple.cpp:1275
llvm::Triple::SubArchType
SubArchType
Definition: Triple.h:110
llvm::Triple::getOSMajorVersion
unsigned getOSMajorVersion() const
Return just the major version number, this is specialized because it is a common query.
Definition: Triple.h:382
llvm::Triple::amdgcn
@ amdgcn
Definition: Triple.h:74
llvm::Triple::Simulator
@ Simulator
Definition: Triple.h:248
llvm::Triple::amdil
@ amdil
Definition: Triple.h:92
VersionTuple.h
llvm::Triple::MuslEABIHF
@ MuslEABIHF
Definition: Triple.h:241
llvm::Triple::kalimba
@ kalimba
Definition: Triple.h:100
llvm::Triple::getArchTypeForLLVMName
static ArchType getArchTypeForLLVMName(StringRef Str)
The canonical type for the given LLVM architecture name (e.g., "x86").
Definition: Triple.cpp:306
llvm::Triple::get32BitArchVariant
llvm::Triple get32BitArchVariant() const
Form a triple with a 32-bit variant of the current architecture.
Definition: Triple.cpp:1459
llvm::Triple::IOS
@ IOS
Definition: Triple.h:191
llvm::Triple::isRISCV
bool isRISCV() const
Tests whether the target is RISC-V (32- and 64-bit).
Definition: Triple.h:881
llvm::Triple
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
llvm::Triple::renderscript32
@ renderscript32
Definition: Triple.h:105
llvm::Triple::getEnvironmentVersion
VersionTuple getEnvironmentVersion() const
Parse the version number from the OS name component of the triple, if present.
Definition: Triple.cpp:1186
llvm::Triple::getOSAndEnvironmentName
StringRef getOSAndEnvironmentName() const
Get the operating system and optional environment components as a single string (separated by a '-' i...
Definition: Triple.cpp:1175
llvm::Triple::Minix
@ Minix
Definition: Triple.h:202
llvm::Triple::isDriverKit
bool isDriverKit() const
Is this an Apple DriverKit triple.
Definition: Triple.h:504
llvm::Triple::SPIRVSubArch_v15
@ SPIRVSubArch_v15
Definition: Triple.h:161
llvm::Triple::KalimbaSubArch_v5
@ KalimbaSubArch_v5
Definition: Triple.h:149
llvm::Triple::isWindowsItaniumEnvironment
bool isWindowsItaniumEnvironment() const
Definition: Triple.h:597
llvm::Triple::x86_64
@ x86_64
Definition: Triple.h:86
llvm::Triple::CSR
@ CSR
Definition: Triple.h:174
llvm::Triple::isTvOS
bool isTvOS() const
Is this an Apple tvOS triple.
Definition: Triple.h:490
llvm::Triple::OpenBSD
@ OpenBSD
Definition: Triple.h:197
llvm::Triple::Ananas
@ Ananas
Definition: Triple.h:185
llvm::Triple::getMinimumSupportedOSVersion
VersionTuple getMinimumSupportedOSVersion() const
Some platforms have different minimum supported OS versions that varies by the architecture specified...
Definition: Triple.cpp:1822
llvm::Triple::SPIRV
@ SPIRV
Definition: Triple.h:278
llvm::Triple::ppc
@ ppc
Definition: Triple.h:69
llvm::Triple::isOSBinFormatXCOFF
bool isOSBinFormatXCOFF() const
Tests whether the OS uses the XCOFF binary format.
Definition: Triple.h:686
llvm::Triple::nvptx
@ nvptx
Definition: Triple.h:88
llvm::Triple::hexagon
@ hexagon
Definition: Triple.h:60
llvm::Triple::XCOFF
@ XCOFF
Definition: Triple.h:280
llvm::Triple::isOSLinux
bool isOSLinux() const
Tests whether the OS is Linux.
Definition: Triple.h:626
llvm::Triple::hasDefaultDataSections
bool hasDefaultDataSections() const
Tests whether the target uses -data-sections as default.
Definition: Triple.h:943
llvm::Triple::hasDefaultEmulatedTLS
bool hasDefaultEmulatedTLS() const
Tests whether the target uses emulated TLS as default.
Definition: Triple.h:938
llvm::Triple::isNVPTX
bool isNVPTX() const
Tests whether the target is NVPTX (32- or 64-bit).
Definition: Triple.h:751
llvm::Triple::KalimbaSubArch_v4
@ KalimbaSubArch_v4
Definition: Triple.h:148
llvm::Triple::isAMDGPU
bool isAMDGPU() const
Definition: Triple.h:758
llvm::Triple::merge
std::string merge(const Triple &Other) const
Merge target triples.
Definition: Triple.cpp:1796
llvm::Triple::NVIDIA
@ NVIDIA
Definition: Triple.h:173
llvm::Triple::LastVendorType
@ LastVendorType
Definition: Triple.h:180
llvm::Triple::spirv32
@ spirv32
Definition: Triple.h:98
llvm::Triple::avr
@ avr
Definition: Triple.h:55
llvm::Triple::isOSContiki
bool isOSContiki() const
Definition: Triple.h:562
llvm::Triple::aarch64_32
@ aarch64_32
Definition: Triple.h:53
llvm::Triple::isOSEmscripten
bool isOSEmscripten() const
Tests whether the OS is Emscripten.
Definition: Triple.h:646
llvm::Triple::le32
@ le32
Definition: Triple.h:90
llvm::Triple::isOSBinFormatWasm
bool isOSBinFormatWasm() const
Tests whether the OS uses the Wasm binary format.
Definition: Triple.h:681
llvm::Triple::mips64
@ mips64
Definition: Triple.h:66
llvm::Triple::DragonFly
@ DragonFly
Definition: Triple.h:188
llvm::Data
@ Data
Definition: SIMachineScheduler.h:55
llvm::Triple::WatchOS
@ WatchOS
Definition: Triple.h:213
llvm::Triple::GNUEABI
@ GNUEABI
Definition: Triple.h:231
llvm::Triple::ARMSubArch_v8m_baseline
@ ARMSubArch_v8m_baseline
Definition: Triple.h:127
llvm::Triple::getCanonicalVersionForOS
static VersionTuple getCanonicalVersionForOS(OSType OSKind, const VersionTuple &Version)
Returns a canonicalized OS version number for the specified OS.
Definition: Triple.cpp:1925
llvm::Triple::setOSAndEnvironmentName
void setOSAndEnvironmentName(StringRef Str)
Set the operating system and optional environment components with a single string.
Definition: Triple.cpp:1370
llvm::Triple::isWindowsMSVCEnvironment
bool isWindowsMSVCEnvironment() const
Checks if the environment could be MSVC.
Definition: Triple.h:582
llvm::Triple::isArch64Bit
bool isArch64Bit() const
Test whether the architecture is 64-bit.
Definition: Triple.cpp:1447
llvm::VersionTuple::getMajor
unsigned getMajor() const
Retrieve the major version number.
Definition: VersionTuple.h:72
llvm::Triple::GNU
@ GNU
Definition: Triple.h:228
llvm::Triple::ShaderModel
@ ShaderModel
Definition: Triple.h:222
llvm::Triple::ARMSubArch_v8_1m_mainline
@ ARMSubArch_v8_1m_mainline
Definition: Triple.h:129
llvm::Triple::SPIRVSubArch_v10
@ SPIRVSubArch_v10
Definition: Triple.h:156
llvm::Triple::ARMSubArch_v9
@ ARMSubArch_v9
Definition: Triple.h:116
llvm::Triple::Vertex
@ Vertex
Definition: Triple.h:253
llvm::Triple::isMacOSX
bool isMacOSX() const
Is this a Mac OS X triple.
Definition: Triple.h:476
llvm::Triple::hsail64
@ hsail64
Definition: Triple.h:95
llvm::Triple::isCompatibleWith
bool isCompatibleWith(const Triple &Other) const
Test whether target triples are compatible.
Definition: Triple.cpp:1772
llvm::Triple::isLittleEndian
bool isLittleEndian() const
Tests whether the target triple is little endian.
Definition: Triple.cpp:1720
llvm::Triple::isOSUnknown
bool isOSUnknown() const
Definition: Triple.h:553
llvm::Triple::isAndroid
bool isAndroid() const
Tests whether the target is Android.
Definition: Triple.h:713
llvm::Triple::sparc
@ sparc
Definition: Triple.h:77
llvm::Triple::Musl
@ Musl
Definition: Triple.h:239
llvm::Triple::isOSBinFormatELF
bool isOSBinFormatELF() const
Tests whether the OS uses the ELF binary format.
Definition: Triple.h:663
llvm::Triple::FreeBSD
@ FreeBSD
Definition: Triple.h:189
llvm::Triple::sparcv9
@ sparcv9
Definition: Triple.h:78
llvm::Triple::SPIRVSubArch_v11
@ SPIRVSubArch_v11
Definition: Triple.h:157
llvm::Triple::sparcel
@ sparcel
Definition: Triple.h:79
llvm::Triple::get64BitArchVariant
llvm::Triple get64BitArchVariant() const
Form a triple with a 64-bit variant of the current architecture.
Definition: Triple.cpp:1538
llvm::Triple::ARMSubArch_v8_2a
@ ARMSubArch_v8_2a
Definition: Triple.h:123
llvm::Triple::ArchType
ArchType
Definition: Triple.h:46
llvm::Triple::ARMSubArch_v5
@ ARMSubArch_v5
Definition: Triple.h:140
llvm::Triple::GNUABI64
@ GNUABI64
Definition: Triple.h:230
llvm::Triple::TvOS
@ TvOS
Definition: Triple.h:212
llvm::Triple::str
const std::string & str() const
Definition: Triple.h:405
llvm::Triple::isOSDarwin
bool isOSDarwin() const
Is this a "Darwin" OS (macOS, iOS, tvOS, watchOS, or DriverKit).
Definition: Triple.h:509
llvm::Triple::ARMSubArch_v8_4a
@ ARMSubArch_v8_4a
Definition: Triple.h:121
llvm::Triple::Cygnus
@ Cygnus
Definition: Triple.h:246
llvm::Triple::ARMSubArch_v8r
@ ARMSubArch_v8r
Definition: Triple.h:126
llvm::Triple::getOSVersion
VersionTuple getOSVersion() const
Parse the version number from the OS name component of the triple, if present.
Definition: Triple.cpp:1195
llvm::Triple::Mesa3D
@ Mesa3D
Definition: Triple.h:215
llvm::Triple::mips64el
@ mips64el
Definition: Triple.h:67
llvm::Triple::PC
@ PC
Definition: Triple.h:167
Twine.h
llvm::Triple::isAArch64
bool isAArch64() const
Tests whether the target is AArch64 (little and big endian).
Definition: Triple.h:821
llvm::Triple::CODE16
@ CODE16
Definition: Triple.h:235
llvm::Triple::isSPARC
bool isSPARC() const
Tests whether the target is SPARC.
Definition: Triple.h:892
llvm::Triple::nvptx64
@ nvptx64
Definition: Triple.h:89
llvm::Triple::PS4
@ PS4
Definition: Triple.h:209
llvm::Triple::isTargetMachineMac
bool isTargetMachineMac() const
Returns true for targets that run on a macOS machine.
Definition: Triple.h:522
llvm::Triple::OpenEmbedded
@ OpenEmbedded
Definition: Triple.h:179
llvm::Triple::le64
@ le64
Definition: Triple.h:91
llvm::Triple::Emscripten
@ Emscripten
Definition: Triple.h:221
llvm::Triple::Haiku
@ Haiku
Definition: Triple.h:201
llvm::Triple::isVE
bool isVE() const
Tests whether the target is VE.
Definition: Triple.h:905
llvm::Triple::MipsSubArch_r6
@ MipsSubArch_r6
Definition: Triple.h:151
llvm::Triple::Freescale
@ Freescale
Definition: Triple.h:169
llvm::Triple::supportsCOMDAT
bool supportsCOMDAT() const
Tests whether the target supports comdat.
Definition: Triple.h:932
llvm::Triple::RayGeneration
@ RayGeneration
Definition: Triple.h:259
llvm::Triple::isLoongArch
bool isLoongArch() const
Tests whether the target is LoongArch (32- and 64-bit).
Definition: Triple.h:839
llvm::Triple::ppc64
@ ppc64
Definition: Triple.h:71
llvm::Triple::NaCl
@ NaCl
Definition: Triple.h:204
llvm::Triple::NetBSD
@ NetBSD
Definition: Triple.h:196
llvm::Triple::isSPIRV
bool isSPIRV() const
Tests whether the target is SPIR-V (32/64-bit).
Definition: Triple.h:746
llvm::Triple::isOSBinFormatMachO
bool isOSBinFormatMachO() const
Tests whether the environment is MachO.
Definition: Triple.h:676
llvm::Triple::xcore
@ xcore
Definition: Triple.h:87
llvm::Triple::ARMSubArch_v9_1a
@ ARMSubArch_v9_1a
Definition: Triple.h:115
llvm::Triple::setVendor
void setVendor(VendorType Kind)
Set the vendor (second) component of the triple to a known type.
Definition: Triple.cpp:1318
llvm::Triple::setEnvironmentName
void setEnvironmentName(StringRef Str)
Set the optional environment (fourth) component of the triple by name.
Definition: Triple.cpp:1365
llvm::Triple::r600
@ r600
Definition: Triple.h:73
llvm::Triple::Win32
@ Win32
Definition: Triple.h:199
llvm::Triple::isOSIAMCU
bool isOSIAMCU() const
Definition: Triple.h:549
llvm::Triple::getObjectFormat
ObjectFormatType getObjectFormat() const
Get the object format for this triple.
Definition: Triple.h:372
llvm::Triple::KFreeBSD
@ KFreeBSD
Definition: Triple.h:192
llvm::Triple::isOSzOS
bool isOSzOS() const
Definition: Triple.h:506
llvm::Triple::RTEMS
@ RTEMS
Definition: Triple.h:203
llvm::Triple::Geometry
@ Geometry
Definition: Triple.h:254
llvm::Triple::DriverKit
@ DriverKit
Definition: Triple.h:214
llvm::Triple::m68k
@ m68k
Definition: Triple.h:63
llvm::Triple::SPIRVSubArch_v14
@ SPIRVSubArch_v14
Definition: Triple.h:160
llvm::Triple::isCSKY
bool isCSKY() const
Definition: Triple.h:915
llvm::Triple::UnknownEnvironment
@ UnknownEnvironment
Definition: Triple.h:226
llvm::Triple::Intersection
@ Intersection
Definition: Triple.h:260
llvm::VersionTuple
Represents a version number in the form major[.minor[.subminor[.build]]].
Definition: VersionTuple.h:31
llvm::IndexedInstrProf::Version
const uint64_t Version
Definition: InstrProf.h:1056
llvm::Triple::LastEnvironmentType
@ LastEnvironmentType
Definition: Triple.h:268
llvm::Triple::Hull
@ Hull
Definition: Triple.h:255
llvm::Triple::getArchName
StringRef getArchName() const
Get the architecture (first) component of the triple.
Definition: Triple.cpp:1130
llvm::Triple::isPPC32
bool isPPC32() const
Tests whether the target is 32-bit PowerPC (little and big endian).
Definition: Triple.h:865
llvm::Triple::isOSBinFormatGOFF
bool isOSBinFormatGOFF() const
Tests whether the OS uses the GOFF binary format.
Definition: Triple.h:673
llvm::Triple::isRISCV32
bool isRISCV32() const
Tests whether the target is 32-bit RISC-V.
Definition: Triple.h:875
llvm::Triple::lanai
@ lanai
Definition: Triple.h:102
llvm::Triple::MuslEABI
@ MuslEABI
Definition: Triple.h:240
llvm::Triple::getEnvironmentTypeName
static StringRef getEnvironmentTypeName(EnvironmentType Kind)
Get the canonical name for the Kind environment.
Definition: Triple.cpp:247
llvm::Triple::isOSAIX
bool isOSAIX() const
Tests whether the OS is AIX.
Definition: Triple.h:658
llvm::Triple::getArch
ArchType getArch() const
Get the parsed architecture type of this triple.
Definition: Triple.h:346
llvm::Triple::GOFF
@ GOFF
Definition: Triple.h:276
llvm::Triple::getTriple
const std::string & getTriple() const
Definition: Triple.h:407
llvm::Triple::ARMSubArch_v8_5a
@ ARMSubArch_v8_5a
Definition: Triple.h:120
llvm::Triple::ARMSubArch_v7s
@ ARMSubArch_v7s
Definition: Triple.h:133
llvm::Triple::Compute
@ Compute
Definition: Triple.h:257
llvm::Triple::getiOSVersion
VersionTuple getiOSVersion() const
Parse the version number as with getOSVersion.
Definition: Triple.cpp:1250
llvm::Triple::Miss
@ Miss
Definition: Triple.h:263
llvm::lltok::Kind
Kind
Definition: LLToken.h:18
llvm::Triple::isOSNaCl
bool isOSNaCl() const
Tests whether the OS is NaCl (Native Client)
Definition: Triple.h:621
llvm::Triple::csky
@ csky
Definition: Triple.h:58
llvm::Triple::isDXIL
bool isDXIL() const
Tests whether the target is DXIL.
Definition: Triple.h:736
llvm::Triple::CoreCLR
@ CoreCLR
Definition: Triple.h:247
llvm::Triple::isOSMSVCRT
bool isOSMSVCRT() const
Is this a "Windows" OS targeting a "MSVCRT.dll" environment.
Definition: Triple.h:615
llvm::Triple::hasDLLImportExport
bool hasDLLImportExport() const
Tests if the environment supports dllimport/export annotations.
Definition: Triple.h:948
llvm::Triple::renderscript64
@ renderscript64
Definition: Triple.h:106
llvm::Triple::ARMSubArch_v6k
@ ARMSubArch_v6k
Definition: Triple.h:138
llvm::Triple::isOSVersionLT
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:454
llvm::Triple::MuslX32
@ MuslX32
Definition: Triple.h:242
llvm::Triple::isAArch64
bool isAArch64(int PointerWidth) const
Tests whether the target is AArch64 and pointers are the size specified by PointerWidth.
Definition: Triple.h:828
llvm::Triple::isOSFuchsia
bool isOSFuchsia() const
Definition: Triple.h:539
llvm::Triple::AMDHSA
@ AMDHSA
Definition: Triple.h:208
llvm::Triple::getDriverKitVersion
VersionTuple getDriverKitVersion() const
Parse the version number as with getOSVersion.
Definition: Triple.cpp:1298
llvm::Triple::AArch64SubArch_arm64e
@ AArch64SubArch_arm64e
Definition: Triple.h:144
llvm::Triple::ppc64le
@ ppc64le
Definition: Triple.h:72
llvm::Triple::MacOSX
@ MacOSX
Definition: Triple.h:195
llvm::Triple::isArmT32
bool isArmT32() const
Tests whether the target is T32.
Definition: Triple.h:786
llvm::Triple::isOSHaiku
bool isOSHaiku() const
Tests whether the OS is Haiku.
Definition: Triple.h:567
llvm::Triple::isOSBinFormatDXContainer
bool isOSBinFormatDXContainer() const
Tests whether the OS uses the DXContainer binary format.
Definition: Triple.h:691
llvm::Triple::isTargetEHABICompatible
bool isTargetEHABICompatible() const
Tests whether the target supports the EHABI exception handling standard.
Definition: Triple.h:774
llvm::Triple::isOSSolaris
bool isOSSolaris() const
Definition: Triple.h:545
llvm::Triple::isThumb
bool isThumb() const
Tests whether the target is Thumb (little and big endian).
Definition: Triple.h:763
llvm::Triple::ELF
@ ELF
Definition: Triple.h:275
llvm::Triple::isOSDragonFly
bool isOSDragonFly() const
Definition: Triple.h:543
llvm::Triple::Triple
Triple()=default
Default constructor is the same as an empty string and leaves all triple fields unknown.
llvm::Triple::ARMSubArch_v8_8a
@ ARMSubArch_v8_8a
Definition: Triple.h:117
llvm::Triple::GNUX32
@ GNUX32
Definition: Triple.h:233
llvm::Triple::isWindowsArm64EC
bool isWindowsArm64EC() const
Definition: Triple.h:588
llvm::Triple::isARM
bool isARM() const
Tests whether the target is ARM (little and big endian).
Definition: Triple.h:768
llvm::Triple::isOSCygMing
bool isOSCygMing() const
Tests for either Cygwin or MinGW OS.
Definition: Triple.h:610
llvm::Triple::ARMSubArch_v7ve
@ ARMSubArch_v7ve
Definition: Triple.h:135
llvm::Triple::isArch16Bit
bool isArch16Bit() const
Test whether the architecture is 16-bit.
Definition: Triple.cpp:1455
llvm::Triple::isMIPS64
bool isMIPS64() const
Tests whether the target is MIPS 64-bit (little and big endian).
Definition: Triple.h:849
llvm::Triple::Android
@ Android
Definition: Triple.h:238
llvm::Triple::Hurd
@ Hurd
Definition: Triple.h:219
llvm::Triple::getOS
OSType getOS() const
Get the parsed operating system type of this triple.
Definition: Triple.h:355
llvm::Triple::arc
@ arc
Definition: Triple.h:54
llvm::Triple::isOSFreeBSD
bool isOSFreeBSD() const
Definition: Triple.h:535
llvm::Triple::normalize
std::string normalize() const
Return the normalized form of this triple's string.
Definition: Triple.h:339
llvm::Triple::isSPIR
bool isSPIR() const
Tests whether the target is SPIR (32- or 64-bit).
Definition: Triple.h:741
llvm::Triple::isArch32Bit
bool isArch32Bit() const
Test whether the architecture is 32-bit.
Definition: Triple.cpp:1451
llvm::Triple::MSVC
@ MSVC
Definition: Triple.h:244
llvm::Triple::IBM
@ IBM
Definition: Triple.h:170
llvm::Triple::ARMSubArch_v7k
@ ARMSubArch_v7k
Definition: Triple.h:134
llvm::Triple::NVCL
@ NVCL
Definition: Triple.h:207
llvm::Triple::Linux
@ Linux
Definition: Triple.h:193
llvm::Triple::Solaris
@ Solaris
Definition: Triple.h:198
llvm::Triple::getVendorName
StringRef getVendorName() const
Get the vendor (second) component of the triple.
Definition: Triple.cpp:1158
llvm::Triple::isOSOpenBSD
bool isOSOpenBSD() const
Definition: Triple.h:531
llvm::Triple::ARMSubArch_v7m
@ ARMSubArch_v7m
Definition: Triple.h:132
llvm::Triple::isOSGlibc
bool isOSGlibc() const
Tests whether the OS uses glibc.
Definition: Triple.h:651
llvm::Triple::ARMSubArch_v4t
@ ARMSubArch_v4t
Definition: Triple.h:142
llvm::Triple::isWatchABI
bool isWatchABI() const
Definition: Triple.h:499
llvm::Triple::isSimulatorEnvironment
bool isSimulatorEnvironment() const
Definition: Triple.h:513
llvm::Triple::ImaginationTechnologies
@ ImaginationTechnologies
Definition: Triple.h:171
llvm::Triple::isOSHurd
bool isOSHurd() const
Tests whether the OS is Hurd.
Definition: Triple.h:636
llvm::Triple::ARMSubArch_v8
@ ARMSubArch_v8
Definition: Triple.h:125
llvm::Triple::isWindowsCoreCLREnvironment
bool isWindowsCoreCLREnvironment() const
Definition: Triple.h:593
llvm::Triple::ARMSubArch_v6m
@ ARMSubArch_v6m
Definition: Triple.h:137
llvm::Triple::isAMDGCN
bool isAMDGCN() const
Tests whether the target is AMDGCN.
Definition: Triple.h:756
llvm::Triple::setArch
void setArch(ArchType Kind, SubArchType SubArch=NoSubArch)
Set the architecture (first) component of the triple to a known type.
Definition: Triple.cpp:1314
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::Triple::operator!=
bool operator!=(const Triple &Other) const
Definition: Triple.h:324
llvm::Triple::ZOS
@ ZOS
Definition: Triple.h:200
llvm::Triple::bpfel
@ bpfel
Definition: Triple.h:56
llvm::Triple::AMD
@ AMD
Definition: Triple.h:176
llvm::Triple::ClosestHit
@ ClosestHit
Definition: Triple.h:262
llvm::Triple::ARMSubArch_v5te
@ ARMSubArch_v5te
Definition: Triple.h:141
llvm::Triple::SCEI
@ SCEI
Definition: Triple.h:168
llvm::Triple::armeb
@ armeb
Definition: Triple.h:50
llvm::Triple::GNUABIN32
@ GNUABIN32
Definition: Triple.h:229
llvm::Triple::isPPC
bool isPPC() const
Tests whether the target is PowerPC (32- or 64-bit LE or BE).
Definition: Triple.h:859
llvm::Triple::loongarch32
@ loongarch32
Definition: Triple.h:61
llvm::Triple::Pixel
@ Pixel
Definition: Triple.h:252
llvm::Triple::arm
@ arm
Definition: Triple.h:49
llvm::Triple::isMusl
bool isMusl() const
Tests whether the environment is musl-libc.
Definition: Triple.h:728
llvm::Triple::PS5
@ PS5
Definition: Triple.h:210
llvm::Triple::aarch64_be
@ aarch64_be
Definition: Triple.h:52
llvm::Triple::msp430
@ msp430
Definition: Triple.h:68
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
llvm::Triple::ppcle
@ ppcle
Definition: Triple.h:70
llvm::Triple::ARMSubArch_v8_7a
@ ARMSubArch_v8_7a
Definition: Triple.h:118
llvm::Triple::ARMSubArch_v8_3a
@ ARMSubArch_v8_3a
Definition: Triple.h:122
llvm::Triple::thumb
@ thumb
Definition: Triple.h:83
llvm::Triple::AnyHit
@ AnyHit
Definition: Triple.h:261
llvm::Triple::dxil
@ dxil
Definition: Triple.h:59
llvm::Triple::isX86
bool isX86() const
Tests whether the target is x86 (32- or 64-bit).
Definition: Triple.h:900
llvm::Triple::isiOS
bool isiOS() const
Is this an iOS triple.
Definition: Triple.h:485
llvm::Triple::UnknownVendor
@ UnknownVendor
Definition: Triple.h:164
llvm::Triple::ARMSubArch_v9_3a
@ ARMSubArch_v9_3a
Definition: Triple.h:113
llvm::Triple::ve
@ ve
Definition: Triple.h:107
llvm::Triple::ObjectFormatType
ObjectFormatType
Definition: Triple.h:270
llvm::Triple::isWatchOS
bool isWatchOS() const
Is this an Apple watchOS triple.
Definition: Triple.h:495
llvm::Triple::isSPARC64
bool isSPARC64() const
Tests whether the target is 64-bit SPARC (big endian).
Definition: Triple.h:889
llvm::Triple::ARMSubArch_v7
@ ARMSubArch_v7
Definition: Triple.h:130
llvm::Triple::isOSWindows
bool isOSWindows() const
Tests whether the OS is Windows.
Definition: Triple.h:572
llvm::Triple::amdil64
@ amdil64
Definition: Triple.h:93
llvm::Triple::setOS
void setOS(OSType Kind)
Set the operating system (third) component of the triple to a known type.
Definition: Triple.cpp:1322
llvm::Twine
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:81
llvm::Triple::WASI
@ WASI
Definition: Triple.h:220
llvm::Triple::Mesh
@ Mesh
Definition: Triple.h:265
llvm::Triple::OSType
OSType
Definition: Triple.h:182
llvm::Triple::Itanium
@ Itanium
Definition: Triple.h:245
llvm::Triple::VendorType
VendorType
Definition: Triple.h:163
llvm::Triple::ARMSubArch_v8_6a
@ ARMSubArch_v8_6a
Definition: Triple.h:119
llvm::Triple::isSPARC32
bool isSPARC32() const
Tests whether the target is 32-bit SPARC (little and big endian).
Definition: Triple.h:884
llvm::Triple::getOSName
StringRef getOSName() const
Get the operating system (third) component of the triple.
Definition: Triple.cpp:1163
llvm::Triple::ARMSubArch_v6t2
@ ARMSubArch_v6t2
Definition: Triple.h:139
llvm::Triple::MipsTechnologies
@ MipsTechnologies
Definition: Triple.h:172
llvm::Triple::getSubArch
SubArchType getSubArch() const
get the parsed subarchitecture type for this triple.
Definition: Triple.h:349
llvm::Triple::isOSVersionLT
bool isOSVersionLT(const Triple &Other) const
Definition: Triple.h:465
llvm::Triple::Fuchsia
@ Fuchsia
Definition: Triple.h:190
llvm::Triple::SPIRVSubArch_v13
@ SPIRVSubArch_v13
Definition: Triple.h:159
llvm::Triple::riscv32
@ riscv32
Definition: Triple.h:75
llvm::Triple::AMDPAL
@ AMDPAL
Definition: Triple.h:217
llvm::Triple::setOSName
void setOSName(StringRef Str)
Set the operating system (third) component of the triple by name.
Definition: Triple.cpp:1357
llvm::Triple::MachO
@ MachO
Definition: Triple.h:277
llvm::Triple::LastArchType
@ LastArchType
Definition: Triple.h:108
llvm::Triple::Contiki
@ Contiki
Definition: Triple.h:216
llvm::Triple::isWindowsGNUEnvironment
bool isWindowsGNUEnvironment() const
Definition: Triple.h:605
llvm::Triple::getOSTypeName
static StringRef getOSTypeName(OSType Kind)
Get the canonical name for the Kind operating system.
Definition: Triple.cpp:200
llvm::Triple::isArm64e
bool isArm64e() const
Tests whether the target is the Apple "arm64e" AArch64 subarch.
Definition: Triple.h:920
llvm::Triple::mipsel
@ mipsel
Definition: Triple.h:65
llvm::Triple::ELFIAMCU
@ ELFIAMCU
Definition: Triple.h:211
llvm::Triple::operator==
bool operator==(const Triple &Other) const
Definition: Triple.h:317
llvm::Triple::getArchTypePrefix
static StringRef getArchTypePrefix(ArchType Kind)
Get the "prefix" canonical name for the Kind architecture.
Definition: Triple.cpp:90
llvm::Triple::ARMSubArch_v7em
@ ARMSubArch_v7em
Definition: Triple.h:131
llvm::Triple::shave
@ shave
Definition: Triple.h:101
llvm::Triple::AIX
@ AIX
Definition: Triple.h:205
llvm::Triple::loongarch64
@ loongarch64
Definition: Triple.h:62
llvm::Triple::tcele
@ tcele
Definition: Triple.h:82
llvm::Triple::spirv64
@ spirv64
Definition: Triple.h:99
llvm::Triple::systemz
@ systemz
Definition: Triple.h:80
llvm::Triple::isOSWASI
bool isOSWASI() const
Tests whether the OS is WASI.
Definition: Triple.h:641
llvm::Triple::Myriad
@ Myriad
Definition: Triple.h:175
llvm::Triple::ARMSubArch_v8_1a
@ ARMSubArch_v8_1a
Definition: Triple.h:124
llvm::Triple::isAndroidVersionLT
bool isAndroidVersionLT(unsigned Major) const
Definition: Triple.h:715
llvm::Triple::getVendorTypeName
static StringRef getVendorTypeName(VendorType Kind)
Get the canonical name for the Kind vendor.
Definition: Triple.cpp:177
llvm::Triple::isMacCatalystEnvironment
bool isMacCatalystEnvironment() const
Definition: Triple.h:517
llvm::Triple::COFF
@ COFF
Definition: Triple.h:273
llvm::Triple::spir
@ spir
Definition: Triple.h:96
llvm::Triple::setArchName
void setArchName(StringRef Str)
Set the architecture (first) component of the triple by name.
Definition: Triple.cpp:1342
llvm::Triple::hasEnvironment
bool hasEnvironment() const
Does this triple have the optional environment (fourth) component?
Definition: Triple.h:358
llvm::Triple::MacABI
@ MacABI
Definition: Triple.h:249
llvm::Triple::isOSNetBSD
bool isOSNetBSD() const
Definition: Triple.h:527
llvm::Triple::thumbeb
@ thumbeb
Definition: Triple.h:84
llvm::Triple::CloudABI
@ CloudABI
Definition: Triple.h:186
llvm::Triple::isX32
bool isX32() const
Tests whether the target is X32.
Definition: Triple.h:926
llvm::Triple::getArchTypeName
static StringRef getArchTypeName(ArchType Kind)
Get the canonical name for the Kind architecture.
Definition: Triple.cpp:22
llvm::Triple::ARMSubArch_v6
@ ARMSubArch_v6
Definition: Triple.h:136
llvm::Triple::getEnvironment
EnvironmentType getEnvironment() const
Get the parsed environment type of this triple.
Definition: Triple.h:363
llvm::Triple::isSystemZ
bool isSystemZ() const
Tests whether the target is SystemZ.
Definition: Triple.h:895
llvm::Triple::isMIPS
bool isMIPS() const
Tests whether the target is MIPS (little and big endian, 32- or 64-bit).
Definition: Triple.h:854
llvm::Triple::EABIHF
@ EABIHF
Definition: Triple.h:237
llvm::Triple::getVendor
VendorType getVendor() const
Get the parsed vendor type of this triple.
Definition: Triple.h:352
llvm::Triple::SUSE
@ SUSE
Definition: Triple.h:178
llvm::Triple::GNUEABIHF
@ GNUEABIHF
Definition: Triple.h:232
llvm::Triple::getBigEndianArchVariant
llvm::Triple getBigEndianArchVariant() const
Form a triple with a big endian variant of the current architecture.
Definition: Triple.cpp:1617
llvm::Triple::Library
@ Library
Definition: Triple.h:258
llvm::Triple::UnknownOS
@ UnknownOS
Definition: Triple.h:183
llvm::Triple::NoSubArch
@ NoSubArch
Definition: Triple.h:111
llvm::Triple::LastOSType
@ LastOSType
Definition: Triple.h:223
llvm::Triple::isWasm
bool isWasm() const
Tests whether the target is wasm (32- and 64-bit).
Definition: Triple.h:910
llvm::Triple::EABI
@ EABI
Definition: Triple.h:236
llvm::Triple::wasm64
@ wasm64
Definition: Triple.h:104
llvm::Triple::getLittleEndianArchVariant
llvm::Triple getLittleEndianArchVariant() const
Form a triple with a little endian variant of the current architecture.
Definition: Triple.cpp:1683
llvm::Triple::isPPC64
bool isPPC64() const
Tests whether the target is 64-bit PowerPC (little and big endian).
Definition: Triple.h:870
llvm::Triple::AArch64SubArch_arm64ec
@ AArch64SubArch_arm64ec
Definition: Triple.h:145
llvm::Triple::tce
@ tce
Definition: Triple.h:81
llvm::Triple::isOSKFreeBSD
bool isOSKFreeBSD() const
Tests whether the OS is kFreeBSD.
Definition: Triple.h:631
llvm::Triple::ARMSubArch_v9_2a
@ ARMSubArch_v9_2a
Definition: Triple.h:114
llvm::Triple::isArmMClass
bool isArmMClass() const
Tests whether the target is an M-class.
Definition: Triple.h:806
llvm::Triple::mips
@ mips
Definition: Triple.h:64
llvm::Triple::isWindowsCygwinEnvironment
bool isWindowsCygwinEnvironment() const
Definition: Triple.h:601
llvm::Triple::aarch64
@ aarch64
Definition: Triple.h:51
llvm::Triple::setObjectFormat
void setObjectFormat(ObjectFormatType Kind)
Set the object file format.
Definition: Triple.cpp:1334
llvm::Triple::isKnownWindowsMSVCEnvironment
bool isKnownWindowsMSVCEnvironment() const
Checks if the environment is MSVC.
Definition: Triple.h:577
Other
Optional< std::vector< StOtherPiece > > Other
Definition: ELFYAML.cpp:1247
llvm::Triple::Domain
@ Domain
Definition: Triple.h:256
llvm::Triple::Apple
@ Apple
Definition: Triple.h:166
llvm::Triple::isRISCV64
bool isRISCV64() const
Tests whether the target is 64-bit RISC-V.
Definition: Triple.h:878
llvm::Triple::PPCSubArch_spe
@ PPCSubArch_spe
Definition: Triple.h:153
llvm::Triple::UnknownObjectFormat
@ UnknownObjectFormat
Definition: Triple.h:271
llvm::Triple::getEnvironmentName
StringRef getEnvironmentName() const
Get the optional environment (fourth) component of the triple, or "" if empty.
Definition: Triple.cpp:1169