LLVM  13.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"
13 
14 // Some system headers or GCC predefined macros conflict with identifiers in
15 // this file. Undefine them here.
16 #undef NetBSD
17 #undef mips
18 #undef sparc
19 
20 namespace llvm {
21 
22 class VersionTuple;
23 
24 /// Triple - Helper class for working with autoconf configuration names. For
25 /// historical reasons, we also call these 'triples' (they used to contain
26 /// exactly three fields).
27 ///
28 /// Configuration names are strings in the canonical form:
29 /// ARCHITECTURE-VENDOR-OPERATING_SYSTEM
30 /// or
31 /// ARCHITECTURE-VENDOR-OPERATING_SYSTEM-ENVIRONMENT
32 ///
33 /// This class is used for clients which want to support arbitrary
34 /// configuration names, but also want to implement certain special
35 /// behavior for particular configurations. This class isolates the mapping
36 /// from the components of the configuration name to well known IDs.
37 ///
38 /// At its core the Triple class is designed to be a wrapper for a triple
39 /// string; the constructor does not change or normalize the triple string.
40 /// Clients that need to handle the non-canonical triples that users often
41 /// specify should use the normalize method.
42 ///
43 /// See autoconf/config.guess for a glimpse into what configuration names
44 /// look like in practice.
45 class Triple {
46 public:
47  enum ArchType {
49 
50  arm, // ARM (little endian): arm, armv.*, xscale
51  armeb, // ARM (big endian): armeb
52  aarch64, // AArch64 (little endian): aarch64
53  aarch64_be, // AArch64 (big endian): aarch64_be
54  aarch64_32, // AArch64 (little endian) ILP32: aarch64_32
55  arc, // ARC: Synopsys ARC
56  avr, // AVR: Atmel AVR microcontroller
57  bpfel, // eBPF or extended BPF or 64-bit BPF (little endian)
58  bpfeb, // eBPF or extended BPF or 64-bit BPF (big endian)
59  csky, // CSKY: csky
60  hexagon, // Hexagon: hexagon
61  mips, // MIPS: mips, mipsallegrex, mipsr6
62  mipsel, // MIPSEL: mipsel, mipsallegrexe, mipsr6el
63  mips64, // MIPS64: mips64, mips64r6, mipsn32, mipsn32r6
64  mips64el, // MIPS64EL: mips64el, mips64r6el, mipsn32el, mipsn32r6el
65  msp430, // MSP430: msp430
66  ppc, // PPC: powerpc
67  ppcle, // PPCLE: powerpc (little endian)
68  ppc64, // PPC64: powerpc64, ppu
69  ppc64le, // PPC64LE: powerpc64le
70  r600, // R600: AMD GPUs HD2XXX - HD6XXX
71  amdgcn, // AMDGCN: AMD GCN GPUs
72  riscv32, // RISC-V (32-bit): riscv32
73  riscv64, // RISC-V (64-bit): riscv64
74  sparc, // Sparc: sparc
75  sparcv9, // Sparcv9: Sparcv9
76  sparcel, // Sparc: (endianness = little). NB: 'Sparcle' is a CPU variant
77  systemz, // SystemZ: s390x
78  tce, // TCE (http://tce.cs.tut.fi/): tce
79  tcele, // TCE little endian (http://tce.cs.tut.fi/): tcele
80  thumb, // Thumb (little endian): thumb, thumbv.*
81  thumbeb, // Thumb (big endian): thumbeb
82  x86, // X86: i[3-9]86
83  x86_64, // X86-64: amd64, x86_64
84  xcore, // XCore: xcore
85  nvptx, // NVPTX: 32-bit
86  nvptx64, // NVPTX: 64-bit
87  le32, // le32: generic little-endian 32-bit CPU (PNaCl)
88  le64, // le64: generic little-endian 64-bit CPU (PNaCl)
89  amdil, // AMDIL
90  amdil64, // AMDIL with 64-bit pointers
91  hsail, // AMD HSAIL
92  hsail64, // AMD HSAIL with 64-bit pointers
93  spir, // SPIR: standard portable IR for OpenCL 32-bit version
94  spir64, // SPIR: standard portable IR for OpenCL 64-bit version
95  kalimba, // Kalimba: generic kalimba
96  shave, // SHAVE: Movidius vector VLIW processors
97  lanai, // Lanai: Lanai 32-bit
98  wasm32, // WebAssembly with 32-bit pointers
99  wasm64, // WebAssembly with 64-bit pointers
100  renderscript32, // 32-bit RenderScript
101  renderscript64, // 64-bit RenderScript
102  ve, // NEC SX-Aurora Vector Engine
104  };
105  enum SubArchType {
107 
133 
135 
139 
141 
143  };
144  enum VendorType {
146 
148  PC,
162  };
163  enum OSType {
165 
175  Lv2, // PS3
185  NaCl, // Native Client
187  CUDA, // NVIDIA CUDA
188  NVCL, // NVIDIA OpenCL
189  AMDHSA, // AMD HSA Runtime
192  TvOS, // Apple tvOS
193  WatchOS, // Apple watchOS
196  AMDPAL, // AMD PAL Runtime
197  HermitCore, // HermitCore Unikernel/Multikernel
198  Hurd, // GNU/Hurd
199  WASI, // Experimental WebAssembly OS
202  };
205 
220 
225  Simulator, // Simulator variants of other systems, e.g., Apple's iOS
226  MacABI, // Mac Catalyst variant of Apple's iOS deployment target.
228  };
231 
238  };
239 
240 private:
241  std::string Data;
242 
243  /// The parsed arch type.
244  ArchType Arch;
245 
246  /// The parsed subarchitecture type.
247  SubArchType SubArch;
248 
249  /// The parsed vendor type.
250  VendorType Vendor;
251 
252  /// The parsed OS type.
253  OSType OS;
254 
255  /// The parsed Environment type.
256  EnvironmentType Environment;
257 
258  /// The object format type.
259  ObjectFormatType ObjectFormat;
260 
261 public:
262  /// @name Constructors
263  /// @{
264 
265  /// Default constructor is the same as an empty string and leaves all
266  /// triple fields unknown.
268  : Data(), Arch(), SubArch(), Vendor(), OS(), Environment(),
269  ObjectFormat() {}
270 
271  explicit Triple(const Twine &Str);
272  Triple(const Twine &ArchStr, const Twine &VendorStr, const Twine &OSStr);
273  Triple(const Twine &ArchStr, const Twine &VendorStr, const Twine &OSStr,
274  const Twine &EnvironmentStr);
275 
276  bool operator==(const Triple &Other) const {
277  return Arch == Other.Arch && SubArch == Other.SubArch &&
278  Vendor == Other.Vendor && OS == Other.OS &&
279  Environment == Other.Environment &&
280  ObjectFormat == Other.ObjectFormat;
281  }
282 
283  bool operator!=(const Triple &Other) const {
284  return !(*this == Other);
285  }
286 
287  /// @}
288  /// @name Normalization
289  /// @{
290 
291  /// normalize - Turn an arbitrary machine specification into the canonical
292  /// triple form (or something sensible that the Triple class understands if
293  /// nothing better can reasonably be done). In particular, it handles the
294  /// common case in which otherwise valid components are in the wrong order.
295  static std::string normalize(StringRef Str);
296 
297  /// Return the normalized form of this triple's string.
298  std::string normalize() const { return normalize(Data); }
299 
300  /// @}
301  /// @name Typed Component Access
302  /// @{
303 
304  /// getArch - Get the parsed architecture type of this triple.
305  ArchType getArch() const { return Arch; }
306 
307  /// getSubArch - get the parsed subarchitecture type for this triple.
308  SubArchType getSubArch() const { return SubArch; }
309 
310  /// getVendor - Get the parsed vendor type of this triple.
311  VendorType getVendor() const { return Vendor; }
312 
313  /// getOS - Get the parsed operating system type of this triple.
314  OSType getOS() const { return OS; }
315 
316  /// hasEnvironment - Does this triple have the optional environment
317  /// (fourth) component?
318  bool hasEnvironment() const {
319  return getEnvironmentName() != "";
320  }
321 
322  /// getEnvironment - Get the parsed environment type of this triple.
323  EnvironmentType getEnvironment() const { return Environment; }
324 
325  /// Parse the version number from the OS name component of the
326  /// triple, if present.
327  ///
328  /// For example, "fooos1.2.3" would return (1, 2, 3).
329  ///
330  /// If an entry is not defined, it will be returned as 0.
331  void getEnvironmentVersion(unsigned &Major, unsigned &Minor,
332  unsigned &Micro) const;
333 
334  /// getFormat - Get the object format for this triple.
335  ObjectFormatType getObjectFormat() const { return ObjectFormat; }
336 
337  /// getOSVersion - Parse the version number from the OS name component of the
338  /// triple, if present.
339  ///
340  /// For example, "fooos1.2.3" would return (1, 2, 3).
341  ///
342  /// If an entry is not defined, it will be returned as 0.
343  void getOSVersion(unsigned &Major, unsigned &Minor, unsigned &Micro) const;
344 
345  /// getOSMajorVersion - Return just the major version number, this is
346  /// specialized because it is a common query.
347  unsigned getOSMajorVersion() const {
348  unsigned Maj, Min, Micro;
349  getOSVersion(Maj, Min, Micro);
350  return Maj;
351  }
352 
353  /// getMacOSXVersion - Parse the version number as with getOSVersion and then
354  /// translate generic "darwin" versions to the corresponding OS X versions.
355  /// This may also be called with IOS triples but the OS X version number is
356  /// just set to a constant 10.4.0 in that case. Returns true if successful.
357  bool getMacOSXVersion(unsigned &Major, unsigned &Minor,
358  unsigned &Micro) const;
359 
360  /// getiOSVersion - Parse the version number as with getOSVersion. This should
361  /// only be called with IOS or generic triples.
362  void getiOSVersion(unsigned &Major, unsigned &Minor,
363  unsigned &Micro) const;
364 
365  /// getWatchOSVersion - Parse the version number as with getOSVersion. This
366  /// should only be called with WatchOS or generic triples.
367  void getWatchOSVersion(unsigned &Major, unsigned &Minor,
368  unsigned &Micro) const;
369 
370  /// @}
371  /// @name Direct Component Access
372  /// @{
373 
374  const std::string &str() const { return Data; }
375 
376  const std::string &getTriple() const { return Data; }
377 
378  /// getArchName - Get the architecture (first) component of the
379  /// triple.
380  StringRef getArchName() const;
381 
382  /// getVendorName - Get the vendor (second) component of the triple.
383  StringRef getVendorName() const;
384 
385  /// getOSName - Get the operating system (third) component of the
386  /// triple.
387  StringRef getOSName() const;
388 
389  /// getEnvironmentName - Get the optional environment (fourth)
390  /// component of the triple, or "" if empty.
392 
393  /// getOSAndEnvironmentName - Get the operating system and optional
394  /// environment components as a single string (separated by a '-'
395  /// if the environment component is present).
397 
398  /// @}
399  /// @name Convenience Predicates
400  /// @{
401 
402  /// Test whether the architecture is 64-bit
403  ///
404  /// Note that this tests for 64-bit pointer width, and nothing else. Note
405  /// that we intentionally expose only three predicates, 64-bit, 32-bit, and
406  /// 16-bit. The inner details of pointer width for particular architectures
407  /// is not summed up in the triple, and so only a coarse grained predicate
408  /// system is provided.
409  bool isArch64Bit() const;
410 
411  /// Test whether the architecture is 32-bit
412  ///
413  /// Note that this tests for 32-bit pointer width, and nothing else.
414  bool isArch32Bit() const;
415 
416  /// Test whether the architecture is 16-bit
417  ///
418  /// Note that this tests for 16-bit pointer width, and nothing else.
419  bool isArch16Bit() const;
420 
421  /// isOSVersionLT - Helper function for doing comparisons against version
422  /// numbers included in the target triple.
423  bool isOSVersionLT(unsigned Major, unsigned Minor = 0,
424  unsigned Micro = 0) const {
425  unsigned LHS[3];
426  getOSVersion(LHS[0], LHS[1], LHS[2]);
427 
428  if (LHS[0] != Major)
429  return LHS[0] < Major;
430  if (LHS[1] != Minor)
431  return LHS[1] < Minor;
432  if (LHS[2] != Micro)
433  return LHS[2] < Micro;
434 
435  return false;
436  }
437 
438  bool isOSVersionLT(const Triple &Other) const {
439  unsigned RHS[3];
440  Other.getOSVersion(RHS[0], RHS[1], RHS[2]);
441  return isOSVersionLT(RHS[0], RHS[1], RHS[2]);
442  }
443 
444  /// isMacOSXVersionLT - Comparison function for checking OS X version
445  /// compatibility, which handles supporting skewed version numbering schemes
446  /// used by the "darwin" triples.
447  bool isMacOSXVersionLT(unsigned Major, unsigned Minor = 0,
448  unsigned Micro = 0) const;
449 
450  /// isMacOSX - Is this a Mac OS X triple. For legacy reasons, we support both
451  /// "darwin" and "osx" as OS X triples.
452  bool isMacOSX() const {
453  return getOS() == Triple::Darwin || getOS() == Triple::MacOSX;
454  }
455 
456  /// Is this an iOS triple.
457  /// Note: This identifies tvOS as a variant of iOS. If that ever
458  /// changes, i.e., if the two operating systems diverge or their version
459  /// numbers get out of sync, that will need to be changed.
460  /// watchOS has completely different version numbers so it is not included.
461  bool isiOS() const {
462  return getOS() == Triple::IOS || isTvOS();
463  }
464 
465  /// Is this an Apple tvOS triple.
466  bool isTvOS() const {
467  return getOS() == Triple::TvOS;
468  }
469 
470  /// Is this an Apple watchOS triple.
471  bool isWatchOS() const {
472  return getOS() == Triple::WatchOS;
473  }
474 
475  bool isWatchABI() const {
477  }
478 
479  bool isOSzOS() const { return getOS() == Triple::ZOS; }
480 
481  /// isOSDarwin - Is this a "Darwin" OS (macOS, iOS, tvOS or watchOS).
482  bool isOSDarwin() const {
483  return isMacOSX() || isiOS() || isWatchOS();
484  }
485 
486  bool isSimulatorEnvironment() const {
487  return getEnvironment() == Triple::Simulator;
488  }
489 
491  return getEnvironment() == Triple::MacABI;
492  }
493 
494  /// Returns true for targets that run on a macOS machine.
495  bool isTargetMachineMac() const {
496  return isMacOSX() || (isOSDarwin() && (isSimulatorEnvironment() ||
498  }
499 
500  bool isOSNetBSD() const {
501  return getOS() == Triple::NetBSD;
502  }
503 
504  bool isOSOpenBSD() const {
505  return getOS() == Triple::OpenBSD;
506  }
507 
508  bool isOSFreeBSD() const {
509  return getOS() == Triple::FreeBSD;
510  }
511 
512  bool isOSFuchsia() const {
513  return getOS() == Triple::Fuchsia;
514  }
515 
516  bool isOSDragonFly() const { return getOS() == Triple::DragonFly; }
517 
518  bool isOSSolaris() const {
519  return getOS() == Triple::Solaris;
520  }
521 
522  bool isOSIAMCU() const {
523  return getOS() == Triple::ELFIAMCU;
524  }
525 
526  bool isOSUnknown() const { return getOS() == Triple::UnknownOS; }
527 
528  bool isGNUEnvironment() const {
530  return Env == Triple::GNU || Env == Triple::GNUABIN32 ||
531  Env == Triple::GNUABI64 || Env == Triple::GNUEABI ||
532  Env == Triple::GNUEABIHF || Env == Triple::GNUX32;
533  }
534 
535  bool isOSContiki() const {
536  return getOS() == Triple::Contiki;
537  }
538 
539  /// Tests whether the OS is Haiku.
540  bool isOSHaiku() const {
541  return getOS() == Triple::Haiku;
542  }
543 
544  /// Tests whether the OS is Windows.
545  bool isOSWindows() const {
546  return getOS() == Triple::Win32;
547  }
548 
549  /// Checks if the environment is MSVC.
551  return isOSWindows() && getEnvironment() == Triple::MSVC;
552  }
553 
554  /// Checks if the environment could be MSVC.
558  }
559 
561  return isOSWindows() && getEnvironment() == Triple::CoreCLR;
562  }
563 
565  return isOSWindows() && getEnvironment() == Triple::Itanium;
566  }
567 
569  return isOSWindows() && getEnvironment() == Triple::Cygnus;
570  }
571 
572  bool isWindowsGNUEnvironment() const {
573  return isOSWindows() && getEnvironment() == Triple::GNU;
574  }
575 
576  /// Tests for either Cygwin or MinGW OS
577  bool isOSCygMing() const {
579  }
580 
581  /// Is this a "Windows" OS targeting a "MSVCRT.dll" environment.
582  bool isOSMSVCRT() const {
585  }
586 
587  /// Tests whether the OS is NaCl (Native Client)
588  bool isOSNaCl() const {
589  return getOS() == Triple::NaCl;
590  }
591 
592  /// Tests whether the OS is Linux.
593  bool isOSLinux() const {
594  return getOS() == Triple::Linux;
595  }
596 
597  /// Tests whether the OS is kFreeBSD.
598  bool isOSKFreeBSD() const {
599  return getOS() == Triple::KFreeBSD;
600  }
601 
602  /// Tests whether the OS is Hurd.
603  bool isOSHurd() const {
604  return getOS() == Triple::Hurd;
605  }
606 
607  /// Tests whether the OS is WASI.
608  bool isOSWASI() const {
609  return getOS() == Triple::WASI;
610  }
611 
612  /// Tests whether the OS is Emscripten.
613  bool isOSEmscripten() const {
614  return getOS() == Triple::Emscripten;
615  }
616 
617  /// Tests whether the OS uses glibc.
618  bool isOSGlibc() const {
619  return (getOS() == Triple::Linux || getOS() == Triple::KFreeBSD ||
620  getOS() == Triple::Hurd) &&
621  !isAndroid();
622  }
623 
624  /// Tests whether the OS is AIX.
625  bool isOSAIX() const {
626  return getOS() == Triple::AIX;
627  }
628 
629  /// Tests whether the OS uses the ELF binary format.
630  bool isOSBinFormatELF() const {
631  return getObjectFormat() == Triple::ELF;
632  }
633 
634  /// Tests whether the OS uses the COFF binary format.
635  bool isOSBinFormatCOFF() const {
636  return getObjectFormat() == Triple::COFF;
637  }
638 
639  /// Tests whether the OS uses the GOFF binary format.
640  bool isOSBinFormatGOFF() const { return getObjectFormat() == Triple::GOFF; }
641 
642  /// Tests whether the environment is MachO.
643  bool isOSBinFormatMachO() const {
644  return getObjectFormat() == Triple::MachO;
645  }
646 
647  /// Tests whether the OS uses the Wasm binary format.
648  bool isOSBinFormatWasm() const {
649  return getObjectFormat() == Triple::Wasm;
650  }
651 
652  /// Tests whether the OS uses the XCOFF binary format.
653  bool isOSBinFormatXCOFF() const {
654  return getObjectFormat() == Triple::XCOFF;
655  }
656 
657  /// Tests whether the target is the PS4 CPU
658  bool isPS4CPU() const {
659  return getArch() == Triple::x86_64 &&
660  getVendor() == Triple::SCEI &&
661  getOS() == Triple::PS4;
662  }
663 
664  /// Tests whether the target is the PS4 platform
665  bool isPS4() const {
666  return getVendor() == Triple::SCEI &&
667  getOS() == Triple::PS4;
668  }
669 
670  /// Tests whether the target is Android
671  bool isAndroid() const { return getEnvironment() == Triple::Android; }
672 
673  bool isAndroidVersionLT(unsigned Major) const {
674  assert(isAndroid() && "Not an Android triple!");
675 
676  unsigned Env[3];
677  getEnvironmentVersion(Env[0], Env[1], Env[2]);
678 
679  // 64-bit targets did not exist before API level 21 (Lollipop).
680  if (isArch64Bit() && Env[0] < 21)
681  Env[0] = 21;
682 
683  return Env[0] < Major;
684  }
685 
686  /// Tests whether the environment is musl-libc
687  bool isMusl() const {
688  return getEnvironment() == Triple::Musl ||
691  }
692 
693  /// Tests whether the target is SPIR (32- or 64-bit).
694  bool isSPIR() const {
695  return getArch() == Triple::spir || getArch() == Triple::spir64;
696  }
697 
698  /// Tests whether the target is NVPTX (32- or 64-bit).
699  bool isNVPTX() const {
700  return getArch() == Triple::nvptx || getArch() == Triple::nvptx64;
701  }
702 
703  /// Tests whether the target is AMDGCN
704  bool isAMDGCN() const { return getArch() == Triple::amdgcn; }
705 
706  bool isAMDGPU() const {
707  return getArch() == Triple::r600 || getArch() == Triple::amdgcn;
708  }
709 
710  /// Tests whether the target is Thumb (little and big endian).
711  bool isThumb() const {
712  return getArch() == Triple::thumb || getArch() == Triple::thumbeb;
713  }
714 
715  /// Tests whether the target is ARM (little and big endian).
716  bool isARM() const {
717  return getArch() == Triple::arm || getArch() == Triple::armeb;
718  }
719 
720  /// Tests whether the target is AArch64 (little and big endian).
721  bool isAArch64() const {
722  return getArch() == Triple::aarch64 || getArch() == Triple::aarch64_be ||
724  }
725 
726  /// Tests whether the target is AArch64 and pointers are the size specified by
727  /// \p PointerWidth.
728  bool isAArch64(int PointerWidth) const {
729  assert(PointerWidth == 64 || PointerWidth == 32);
730  if (!isAArch64())
731  return false;
732  return getArch() == Triple::aarch64_32 ||
734  ? PointerWidth == 32
735  : PointerWidth == 64;
736  }
737 
738  /// Tests whether the target is MIPS 32-bit (little and big endian).
739  bool isMIPS32() const {
740  return getArch() == Triple::mips || getArch() == Triple::mipsel;
741  }
742 
743  /// Tests whether the target is MIPS 64-bit (little and big endian).
744  bool isMIPS64() const {
745  return getArch() == Triple::mips64 || getArch() == Triple::mips64el;
746  }
747 
748  /// Tests whether the target is MIPS (little and big endian, 32- or 64-bit).
749  bool isMIPS() const {
750  return isMIPS32() || isMIPS64();
751  }
752 
753  /// Tests whether the target is PowerPC (32- or 64-bit LE or BE).
754  bool isPPC() const {
755  return getArch() == Triple::ppc || getArch() == Triple::ppc64 ||
757  }
758 
759  /// Tests whether the target is 32-bit PowerPC (little and big endian).
760  bool isPPC32() const {
761  return getArch() == Triple::ppc || getArch() == Triple::ppcle;
762  }
763 
764  /// Tests whether the target is 64-bit PowerPC (little and big endian).
765  bool isPPC64() const {
766  return getArch() == Triple::ppc64 || getArch() == Triple::ppc64le;
767  }
768 
769  /// Tests whether the target is RISC-V (32- and 64-bit).
770  bool isRISCV() const {
771  return getArch() == Triple::riscv32 || getArch() == Triple::riscv64;
772  }
773 
774  /// Tests whether the target is SystemZ.
775  bool isSystemZ() const {
776  return getArch() == Triple::systemz;
777  }
778 
779  /// Tests whether the target is x86 (32- or 64-bit).
780  bool isX86() const {
781  return getArch() == Triple::x86 || getArch() == Triple::x86_64;
782  }
783 
784  /// Tests whether the target is VE
785  bool isVE() const {
786  return getArch() == Triple::ve;
787  }
788 
789  /// Tests whether the target is wasm (32- and 64-bit).
790  bool isWasm() const {
791  return getArch() == Triple::wasm32 || getArch() == Triple::wasm64;
792  }
793 
794  // Tests whether the target is CSKY
795  bool isCSKY() const {
796  return getArch() == Triple::csky;
797  }
798 
799  /// Tests whether the target is the Apple "arm64e" AArch64 subarch.
800  bool isArm64e() const {
801  return getArch() == Triple::aarch64 &&
803  }
804 
805  /// Tests whether the target supports comdat
806  bool supportsCOMDAT() const {
807  return !(isOSBinFormatMachO() || isOSBinFormatXCOFF());
808  }
809 
810  /// Tests whether the target uses emulated TLS as default.
811  bool hasDefaultEmulatedTLS() const {
813  }
814 
815  /// Tests whether the target uses -data-sections as default.
816  bool hasDefaultDataSections() const {
817  return isOSBinFormatXCOFF() || isWasm();
818  }
819 
820  /// Tests if the environment supports dllimport/export annotations.
821  bool hasDLLImportExport() const { return isOSWindows() || isPS4CPU(); }
822 
823  /// @}
824  /// @name Mutators
825  /// @{
826 
827  /// setArch - Set the architecture (first) component of the triple
828  /// to a known type.
829  void setArch(ArchType Kind);
830 
831  /// setVendor - Set the vendor (second) component of the triple to a
832  /// known type.
833  void setVendor(VendorType Kind);
834 
835  /// setOS - Set the operating system (third) component of the triple
836  /// to a known type.
837  void setOS(OSType Kind);
838 
839  /// setEnvironment - Set the environment (fourth) component of the triple
840  /// to a known type.
842 
843  /// setObjectFormat - Set the object file format
845 
846  /// setTriple - Set all components to the new triple \p Str.
847  void setTriple(const Twine &Str);
848 
849  /// setArchName - Set the architecture (first) component of the
850  /// triple by name.
851  void setArchName(StringRef Str);
852 
853  /// setVendorName - Set the vendor (second) component of the triple
854  /// by name.
855  void setVendorName(StringRef Str);
856 
857  /// setOSName - Set the operating system (third) component of the
858  /// triple by name.
859  void setOSName(StringRef Str);
860 
861  /// setEnvironmentName - Set the optional environment (fourth)
862  /// component of the triple by name.
863  void setEnvironmentName(StringRef Str);
864 
865  /// setOSAndEnvironmentName - Set the operating system and optional
866  /// environment components with a single string.
868 
869  /// @}
870  /// @name Helpers to build variants of a particular triple.
871  /// @{
872 
873  /// Form a triple with a 32-bit variant of the current architecture.
874  ///
875  /// This can be used to move across "families" of architectures where useful.
876  ///
877  /// \returns A new triple with a 32-bit architecture or an unknown
878  /// architecture if no such variant can be found.
880 
881  /// Form a triple with a 64-bit variant of the current architecture.
882  ///
883  /// This can be used to move across "families" of architectures where useful.
884  ///
885  /// \returns A new triple with a 64-bit architecture or an unknown
886  /// architecture if no such variant can be found.
888 
889  /// Form a triple with a big endian variant of the current architecture.
890  ///
891  /// This can be used to move across "families" of architectures where useful.
892  ///
893  /// \returns A new triple with a big endian architecture or an unknown
894  /// architecture if no such variant can be found.
896 
897  /// Form a triple with a little endian variant of the current architecture.
898  ///
899  /// This can be used to move across "families" of architectures where useful.
900  ///
901  /// \returns A new triple with a little endian architecture or an unknown
902  /// architecture if no such variant can be found.
904 
905  /// Get the (LLVM) name of the minimum ARM CPU for the arch we are targeting.
906  ///
907  /// \param Arch the architecture name (e.g., "armv7s"). If it is an empty
908  /// string then the triple's arch name is used.
910 
911  /// Tests whether the target triple is little endian.
912  ///
913  /// \returns true if the triple is little endian, false otherwise.
914  bool isLittleEndian() const;
915 
916  /// Test whether target triples are compatible.
917  bool isCompatibleWith(const Triple &Other) const;
918 
919  /// Merge target triples.
920  std::string merge(const Triple &Other) const;
921 
922  /// Some platforms have different minimum supported OS versions that
923  /// varies by the architecture specified in the triple. This function
924  /// returns the minimum supported OS version for this triple if one an exists,
925  /// or an invalid version tuple if this triple doesn't have one.
927 
928  /// @}
929  /// @name Static helpers for IDs.
930  /// @{
931 
932  /// getArchTypeName - Get the canonical name for the \p Kind architecture.
934 
935  /// getArchTypePrefix - Get the "prefix" canonical name for the \p Kind
936  /// architecture. This is the prefix used by the architecture specific
937  /// builtins, and is suitable for passing to \see
938  /// Intrinsic::getIntrinsicForGCCBuiltin().
939  ///
940  /// \return - The architecture prefix, or 0 if none is defined.
942 
943  /// getVendorTypeName - Get the canonical name for the \p Kind vendor.
945 
946  /// getOSTypeName - Get the canonical name for the \p Kind operating system.
948 
949  /// getEnvironmentTypeName - Get the canonical name for the \p Kind
950  /// environment.
952 
953  /// @}
954  /// @name Static helpers for converting alternate architecture names.
955  /// @{
956 
957  /// getArchTypeForLLVMName - The canonical type for the given LLVM
958  /// architecture name (e.g., "x86").
960 
961  /// @}
962 
963  /// Returns a canonicalized OS version number for the specified OS.
965  const VersionTuple &Version);
966 };
967 
968 } // End llvm namespace
969 
970 
971 #endif
llvm::Triple::setEnvironment
void setEnvironment(EnvironmentType Kind)
setEnvironment - Set the environment (fourth) component of the triple to a known type.
Definition: Triple.cpp:1212
llvm::Triple::isMacOSXVersionLT
bool isMacOSXVersionLT(unsigned Major, unsigned Minor=0, unsigned Micro=0) const
isMacOSXVersionLT - Comparison function for checking OS X version compatibility, which handles suppor...
Definition: Triple.cpp:1642
llvm::Triple::setVendorName
void setVendorName(StringRef Str)
setVendorName - Set the vendor (second) component of the triple by name.
Definition: Triple.cpp:1239
llvm::EngineKind::Kind
Kind
Definition: ExecutionEngine.h:524
llvm::Triple::riscv64
@ riscv64
Definition: Triple.h:73
llvm::Triple::Wasm
@ Wasm
Definition: Triple.h:236
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:1691
llvm::Triple::spir64
@ spir64
Definition: Triple.h:94
llvm::Triple::setTriple
void setTriple(const Twine &Str)
setTriple - Set all components to the new triple Str.
Definition: Triple.cpp:1196
llvm::Triple::Mesa
@ Mesa
Definition: Triple.h:158
llvm
This class represents lattice values for constants.
Definition: AllocatorList.h:23
llvm::Triple::getOSVersion
void getOSVersion(unsigned &Major, unsigned &Minor, unsigned &Micro) const
getOSVersion - Parse the version number from the OS name component of the triple, if present.
Definition: Triple.cpp:1086
llvm::Triple::GNUILP32
@ GNUILP32
Definition: Triple.h:212
llvm::Triple::bpfeb
@ bpfeb
Definition: Triple.h:58
llvm::Triple::Lv2
@ Lv2
Definition: Triple.h:175
llvm::Triple::isMIPS32
bool isMIPS32() const
Tests whether the target is MIPS 32-bit (little and big endian).
Definition: Triple.h:739
llvm::Triple::UnknownArch
@ UnknownArch
Definition: Triple.h:48
llvm::Triple::hsail
@ hsail
Definition: Triple.h:91
llvm::Triple::isPS4
bool isPS4() const
Tests whether the target is the PS4 platform.
Definition: Triple.h:665
llvm::Triple::HermitCore
@ HermitCore
Definition: Triple.h:197
llvm::Triple::isOSBinFormatCOFF
bool isOSBinFormatCOFF() const
Tests whether the OS uses the COFF binary format.
Definition: Triple.h:635
llvm::Triple::wasm32
@ wasm32
Definition: Triple.h:98
llvm::Triple::CUDA
@ CUDA
Definition: Triple.h:187
llvm::Triple::Darwin
@ Darwin
Definition: Triple.h:168
llvm::Triple::KalimbaSubArch_v3
@ KalimbaSubArch_v3
Definition: Triple.h:136
llvm::Triple::getiOSVersion
void getiOSVersion(unsigned &Major, unsigned &Minor, unsigned &Micro) const
getiOSVersion - Parse the version number as with getOSVersion.
Definition: Triple.cpp:1146
llvm::Triple::EnvironmentType
EnvironmentType
Definition: Triple.h:203
llvm::Triple::ARMSubArch_v8m_mainline
@ ARMSubArch_v8m_mainline
Definition: Triple.h:118
llvm::Triple::x86
@ x86
Definition: Triple.h:82
llvm::Triple::isGNUEnvironment
bool isGNUEnvironment() const
Definition: Triple.h:528
llvm::Triple::SubArchType
SubArchType
Definition: Triple.h:105
llvm::Triple::getOSMajorVersion
unsigned getOSMajorVersion() const
getOSMajorVersion - Return just the major version number, this is specialized because it is a common ...
Definition: Triple.h:347
llvm::Triple::amdgcn
@ amdgcn
Definition: Triple.h:71
llvm::Triple::Simulator
@ Simulator
Definition: Triple.h:225
llvm::Triple::amdil
@ amdil
Definition: Triple.h:89
llvm::Triple::MuslEABIHF
@ MuslEABIHF
Definition: Triple.h:219
llvm::Triple::kalimba
@ kalimba
Definition: Triple.h:95
llvm::Triple::getArchTypeForLLVMName
static ArchType getArchTypeForLLVMName(StringRef Str)
getArchTypeForLLVMName - The canonical type for the given LLVM architecture name (e....
Definition: Triple.cpp:271
llvm::Triple::get32BitArchVariant
llvm::Triple get32BitArchVariant() const
Form a triple with a 32-bit variant of the current architecture.
Definition: Triple.cpp:1339
llvm::Triple::IOS
@ IOS
Definition: Triple.h:172
llvm::Triple::isRISCV
bool isRISCV() const
Tests whether the target is RISC-V (32- and 64-bit).
Definition: Triple.h:770
llvm::Triple
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:45
llvm::Triple::renderscript32
@ renderscript32
Definition: Triple.h:100
llvm::Triple::getOSAndEnvironmentName
StringRef getOSAndEnvironmentName() const
getOSAndEnvironmentName - Get the operating system and optional environment components as a single st...
Definition: Triple.cpp:1036
llvm::Triple::Minix
@ Minix
Definition: Triple.h:183
llvm::Triple::KalimbaSubArch_v5
@ KalimbaSubArch_v5
Definition: Triple.h:138
llvm::Triple::isWindowsItaniumEnvironment
bool isWindowsItaniumEnvironment() const
Definition: Triple.h:564
llvm::Triple::x86_64
@ x86_64
Definition: Triple.h:83
llvm::Triple::getMacOSXVersion
bool getMacOSXVersion(unsigned &Major, unsigned &Minor, unsigned &Micro) const
getMacOSXVersion - Parse the version number as with getOSVersion and then translate generic "darwin" ...
Definition: Triple.cpp:1099
llvm::Triple::CSR
@ CSR
Definition: Triple.h:155
llvm::Triple::isTvOS
bool isTvOS() const
Is this an Apple tvOS triple.
Definition: Triple.h:466
llvm::Triple::OpenBSD
@ OpenBSD
Definition: Triple.h:178
llvm::Triple::Ananas
@ Ananas
Definition: Triple.h:166
llvm::Triple::getMinimumSupportedOSVersion
VersionTuple getMinimumSupportedOSVersion() const
Some platforms have different minimum supported OS versions that varies by the architecture specified...
Definition: Triple.cpp:1659
llvm::Triple::ppc
@ ppc
Definition: Triple.h:66
llvm::Triple::isOSBinFormatXCOFF
bool isOSBinFormatXCOFF() const
Tests whether the OS uses the XCOFF binary format.
Definition: Triple.h:653
llvm::Triple::nvptx
@ nvptx
Definition: Triple.h:85
llvm::Triple::hexagon
@ hexagon
Definition: Triple.h:60
llvm::Triple::XCOFF
@ XCOFF
Definition: Triple.h:237
llvm::Triple::isOSLinux
bool isOSLinux() const
Tests whether the OS is Linux.
Definition: Triple.h:593
llvm::Triple::hasDefaultDataSections
bool hasDefaultDataSections() const
Tests whether the target uses -data-sections as default.
Definition: Triple.h:816
llvm::Triple::hasDefaultEmulatedTLS
bool hasDefaultEmulatedTLS() const
Tests whether the target uses emulated TLS as default.
Definition: Triple.h:811
llvm::Triple::isNVPTX
bool isNVPTX() const
Tests whether the target is NVPTX (32- or 64-bit).
Definition: Triple.h:699
llvm::Triple::KalimbaSubArch_v4
@ KalimbaSubArch_v4
Definition: Triple.h:137
llvm::Triple::isAMDGPU
bool isAMDGPU() const
Definition: Triple.h:706
llvm::Triple::merge
std::string merge(const Triple &Other) const
Merge target triples.
Definition: Triple.cpp:1633
llvm::Triple::NVIDIA
@ NVIDIA
Definition: Triple.h:154
llvm::Triple::LastVendorType
@ LastVendorType
Definition: Triple.h:161
llvm::Triple::avr
@ avr
Definition: Triple.h:56
llvm::Triple::isOSContiki
bool isOSContiki() const
Definition: Triple.h:535
llvm::Triple::aarch64_32
@ aarch64_32
Definition: Triple.h:54
llvm::Triple::isPS4CPU
bool isPS4CPU() const
Tests whether the target is the PS4 CPU.
Definition: Triple.h:658
llvm::Triple::isOSEmscripten
bool isOSEmscripten() const
Tests whether the OS is Emscripten.
Definition: Triple.h:613
llvm::Triple::le32
@ le32
Definition: Triple.h:87
llvm::Triple::isOSBinFormatWasm
bool isOSBinFormatWasm() const
Tests whether the OS uses the Wasm binary format.
Definition: Triple.h:648
llvm::Triple::mips64
@ mips64
Definition: Triple.h:63
llvm::Triple::DragonFly
@ DragonFly
Definition: Triple.h:169
llvm::Data
@ Data
Definition: SIMachineScheduler.h:56
llvm::Triple::WatchOS
@ WatchOS
Definition: Triple.h:193
llvm::Triple::GNUEABI
@ GNUEABI
Definition: Triple.h:209
llvm::Triple::ARMSubArch_v8m_baseline
@ ARMSubArch_v8m_baseline
Definition: Triple.h:117
llvm::Triple::getCanonicalVersionForOS
static VersionTuple getCanonicalVersionForOS(OSType OSKind, const VersionTuple &Version)
Returns a canonicalized OS version number for the specified OS.
Definition: Triple.cpp:1756
llvm::Triple::setOSAndEnvironmentName
void setOSAndEnvironmentName(StringRef Str)
setOSAndEnvironmentName - Set the operating system and optional environment components with a single ...
Definition: Triple.cpp:1256
llvm::Triple::isWindowsMSVCEnvironment
bool isWindowsMSVCEnvironment() const
Checks if the environment could be MSVC.
Definition: Triple.h:555
llvm::Triple::isArch64Bit
bool isArch64Bit() const
Test whether the architecture is 64-bit.
Definition: Triple.cpp:1327
llvm::Triple::GNU
@ GNU
Definition: Triple.h:206
llvm::Triple::ARMSubArch_v8_1m_mainline
@ ARMSubArch_v8_1m_mainline
Definition: Triple.h:119
llvm::Triple::isMacOSX
bool isMacOSX() const
isMacOSX - Is this a Mac OS X triple.
Definition: Triple.h:452
llvm::Triple::hsail64
@ hsail64
Definition: Triple.h:92
llvm::Triple::isCompatibleWith
bool isCompatibleWith(const Triple &Other) const
Test whether target triples are compatible.
Definition: Triple.cpp:1609
llvm::Triple::isLittleEndian
bool isLittleEndian() const
Tests whether the target triple is little endian.
Definition: Triple.cpp:1562
llvm::Triple::isOSUnknown
bool isOSUnknown() const
Definition: Triple.h:526
llvm::Triple::isAndroid
bool isAndroid() const
Tests whether the target is Android.
Definition: Triple.h:671
llvm::Triple::sparc
@ sparc
Definition: Triple.h:74
llvm::Triple::Musl
@ Musl
Definition: Triple.h:217
llvm::Triple::isOSBinFormatELF
bool isOSBinFormatELF() const
Tests whether the OS uses the ELF binary format.
Definition: Triple.h:630
llvm::Triple::FreeBSD
@ FreeBSD
Definition: Triple.h:170
llvm::Triple::sparcv9
@ sparcv9
Definition: Triple.h:75
llvm::Triple::sparcel
@ sparcel
Definition: Triple.h:76
llvm::Triple::get64BitArchVariant
llvm::Triple get64BitArchVariant() const
Form a triple with a 64-bit variant of the current architecture.
Definition: Triple.cpp:1406
llvm::Triple::ARMSubArch_v8_2a
@ ARMSubArch_v8_2a
Definition: Triple.h:113
llvm::Triple::ArchType
ArchType
Definition: Triple.h:47
llvm::Triple::ARMSubArch_v5
@ ARMSubArch_v5
Definition: Triple.h:130
llvm::Triple::GNUABI64
@ GNUABI64
Definition: Triple.h:208
llvm::Triple::TvOS
@ TvOS
Definition: Triple.h:192
llvm::Triple::str
const std::string & str() const
Definition: Triple.h:374
llvm::Triple::isOSDarwin
bool isOSDarwin() const
isOSDarwin - Is this a "Darwin" OS (macOS, iOS, tvOS or watchOS).
Definition: Triple.h:482
llvm::Triple::ARMSubArch_v8_4a
@ ARMSubArch_v8_4a
Definition: Triple.h:111
llvm::Triple::Cygnus
@ Cygnus
Definition: Triple.h:223
llvm::Triple::ARMSubArch_v8r
@ ARMSubArch_v8r
Definition: Triple.h:116
llvm::Triple::Mesa3D
@ Mesa3D
Definition: Triple.h:194
llvm::Triple::mips64el
@ mips64el
Definition: Triple.h:64
llvm::Triple::PC
@ PC
Definition: Triple.h:148
Twine.h
llvm::Triple::isAArch64
bool isAArch64() const
Tests whether the target is AArch64 (little and big endian).
Definition: Triple.h:721
llvm::Triple::CODE16
@ CODE16
Definition: Triple.h:213
llvm::Triple::nvptx64
@ nvptx64
Definition: Triple.h:86
llvm::Triple::PS4
@ PS4
Definition: Triple.h:190
llvm::Triple::isTargetMachineMac
bool isTargetMachineMac() const
Returns true for targets that run on a macOS machine.
Definition: Triple.h:495
llvm::Triple::OpenEmbedded
@ OpenEmbedded
Definition: Triple.h:160
llvm::Triple::le64
@ le64
Definition: Triple.h:88
llvm::Triple::Emscripten
@ Emscripten
Definition: Triple.h:200
llvm::Triple::Haiku
@ Haiku
Definition: Triple.h:182
llvm::Triple::isVE
bool isVE() const
Tests whether the target is VE.
Definition: Triple.h:785
llvm::Triple::MipsSubArch_r6
@ MipsSubArch_r6
Definition: Triple.h:140
llvm::Triple::Freescale
@ Freescale
Definition: Triple.h:150
llvm::Triple::supportsCOMDAT
bool supportsCOMDAT() const
Tests whether the target supports comdat.
Definition: Triple.h:806
llvm::Triple::ppc64
@ ppc64
Definition: Triple.h:68
llvm::Triple::NaCl
@ NaCl
Definition: Triple.h:185
llvm::Triple::NetBSD
@ NetBSD
Definition: Triple.h:177
llvm::Triple::isOSBinFormatMachO
bool isOSBinFormatMachO() const
Tests whether the environment is MachO.
Definition: Triple.h:643
llvm::Triple::xcore
@ xcore
Definition: Triple.h:84
llvm::Triple::setVendor
void setVendor(VendorType Kind)
setVendor - Set the vendor (second) component of the triple to a known type.
Definition: Triple.cpp:1204
llvm::Triple::setEnvironmentName
void setEnvironmentName(StringRef Str)
setEnvironmentName - Set the optional environment (fourth) component of the triple by name.
Definition: Triple.cpp:1251
llvm::Triple::r600
@ r600
Definition: Triple.h:70
llvm::Triple::Win32
@ Win32
Definition: Triple.h:180
llvm::Triple::isOSIAMCU
bool isOSIAMCU() const
Definition: Triple.h:522
llvm::Triple::getObjectFormat
ObjectFormatType getObjectFormat() const
getFormat - Get the object format for this triple.
Definition: Triple.h:335
llvm::Triple::KFreeBSD
@ KFreeBSD
Definition: Triple.h:173
llvm::Triple::isOSzOS
bool isOSzOS() const
Definition: Triple.h:479
llvm::Triple::RTEMS
@ RTEMS
Definition: Triple.h:184
llvm::Triple::isCSKY
bool isCSKY() const
Definition: Triple.h:795
llvm::Triple::UnknownEnvironment
@ UnknownEnvironment
Definition: Triple.h:204
llvm::VersionTuple
Represents a version number in the form major[.minor[.subminor[.build]]].
Definition: VersionTuple.h:27
llvm::IndexedInstrProf::Version
const uint64_t Version
Definition: InstrProf.h:991
llvm::Triple::LastEnvironmentType
@ LastEnvironmentType
Definition: Triple.h:227
llvm::Triple::getArchName
StringRef getArchName() const
getArchName - Get the architecture (first) component of the triple.
Definition: Triple.cpp:1015
llvm::Triple::isPPC32
bool isPPC32() const
Tests whether the target is 32-bit PowerPC (little and big endian).
Definition: Triple.h:760
llvm::Triple::isOSBinFormatGOFF
bool isOSBinFormatGOFF() const
Tests whether the OS uses the GOFF binary format.
Definition: Triple.h:640
llvm::Triple::lanai
@ lanai
Definition: Triple.h:97
llvm::Triple::MuslEABI
@ MuslEABI
Definition: Triple.h:218
llvm::Triple::getEnvironmentTypeName
static StringRef getEnvironmentTypeName(EnvironmentType Kind)
getEnvironmentTypeName - Get the canonical name for the Kind environment.
Definition: Triple.cpp:228
llvm::Triple::isOSAIX
bool isOSAIX() const
Tests whether the OS is AIX.
Definition: Triple.h:625
llvm::Triple::getArch
ArchType getArch() const
getArch - Get the parsed architecture type of this triple.
Definition: Triple.h:305
llvm::Triple::GOFF
@ GOFF
Definition: Triple.h:234
llvm::Triple::getTriple
const std::string & getTriple() const
Definition: Triple.h:376
llvm::Triple::ARMSubArch_v8_5a
@ ARMSubArch_v8_5a
Definition: Triple.h:110
llvm::Triple::ARMSubArch_v7s
@ ARMSubArch_v7s
Definition: Triple.h:123
llvm::Triple::isOSNaCl
bool isOSNaCl() const
Tests whether the OS is NaCl (Native Client)
Definition: Triple.h:588
llvm::Triple::csky
@ csky
Definition: Triple.h:59
llvm::Triple::CoreCLR
@ CoreCLR
Definition: Triple.h:224
llvm::Triple::isOSMSVCRT
bool isOSMSVCRT() const
Is this a "Windows" OS targeting a "MSVCRT.dll" environment.
Definition: Triple.h:582
llvm::Triple::hasDLLImportExport
bool hasDLLImportExport() const
Tests if the environment supports dllimport/export annotations.
Definition: Triple.h:821
llvm::Triple::renderscript64
@ renderscript64
Definition: Triple.h:101
llvm::Triple::ARMSubArch_v6k
@ ARMSubArch_v6k
Definition: Triple.h:128
llvm::Triple::isOSVersionLT
bool isOSVersionLT(unsigned Major, unsigned Minor=0, unsigned Micro=0) const
isOSVersionLT - Helper function for doing comparisons against version numbers included in the target ...
Definition: Triple.h:423
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:728
llvm::Triple::isOSFuchsia
bool isOSFuchsia() const
Definition: Triple.h:512
llvm::Triple::AMDHSA
@ AMDHSA
Definition: Triple.h:189
llvm::Triple::AArch64SubArch_arm64e
@ AArch64SubArch_arm64e
Definition: Triple.h:134
llvm::Triple::ppc64le
@ ppc64le
Definition: Triple.h:69
llvm::Triple::MacOSX
@ MacOSX
Definition: Triple.h:176
llvm::Triple::isOSHaiku
bool isOSHaiku() const
Tests whether the OS is Haiku.
Definition: Triple.h:540
llvm::Triple::isOSSolaris
bool isOSSolaris() const
Definition: Triple.h:518
llvm::Triple::getEnvironmentVersion
void getEnvironmentVersion(unsigned &Major, unsigned &Minor, unsigned &Micro) const
Parse the version number from the OS name component of the triple, if present.
Definition: Triple.cpp:1076
llvm::Triple::isThumb
bool isThumb() const
Tests whether the target is Thumb (little and big endian).
Definition: Triple.h:711
llvm::Triple::ELF
@ ELF
Definition: Triple.h:233
llvm::Triple::isOSDragonFly
bool isOSDragonFly() const
Definition: Triple.h:516
llvm::Triple::GNUX32
@ GNUX32
Definition: Triple.h:211
llvm::Triple::isARM
bool isARM() const
Tests whether the target is ARM (little and big endian).
Definition: Triple.h:716
llvm::Triple::isOSCygMing
bool isOSCygMing() const
Tests for either Cygwin or MinGW OS.
Definition: Triple.h:577
llvm::Triple::ARMSubArch_v7ve
@ ARMSubArch_v7ve
Definition: Triple.h:125
llvm::Triple::isArch16Bit
bool isArch16Bit() const
Test whether the architecture is 16-bit.
Definition: Triple.cpp:1335
llvm::Triple::isMIPS64
bool isMIPS64() const
Tests whether the target is MIPS 64-bit (little and big endian).
Definition: Triple.h:744
llvm::Triple::Android
@ Android
Definition: Triple.h:216
llvm::Triple::Hurd
@ Hurd
Definition: Triple.h:198
llvm::Triple::getOS
OSType getOS() const
getOS - Get the parsed operating system type of this triple.
Definition: Triple.h:314
llvm::Triple::arc
@ arc
Definition: Triple.h:55
llvm::Triple::isOSFreeBSD
bool isOSFreeBSD() const
Definition: Triple.h:508
llvm::Triple::normalize
std::string normalize() const
Return the normalized form of this triple's string.
Definition: Triple.h:298
llvm::Triple::isSPIR
bool isSPIR() const
Tests whether the target is SPIR (32- or 64-bit).
Definition: Triple.h:694
llvm::Triple::isArch32Bit
bool isArch32Bit() const
Test whether the architecture is 32-bit.
Definition: Triple.cpp:1331
llvm::Triple::MSVC
@ MSVC
Definition: Triple.h:221
llvm::Triple::IBM
@ IBM
Definition: Triple.h:151
llvm::Triple::ARMSubArch_v7k
@ ARMSubArch_v7k
Definition: Triple.h:124
llvm::Triple::NVCL
@ NVCL
Definition: Triple.h:188
llvm::Triple::Linux
@ Linux
Definition: Triple.h:174
llvm::Triple::Solaris
@ Solaris
Definition: Triple.h:179
llvm::Triple::getVendorName
StringRef getVendorName() const
getVendorName - Get the vendor (second) component of the triple.
Definition: Triple.cpp:1019
llvm::Triple::isOSOpenBSD
bool isOSOpenBSD() const
Definition: Triple.h:504
llvm::Triple::ARMSubArch_v7m
@ ARMSubArch_v7m
Definition: Triple.h:122
llvm::Triple::isOSGlibc
bool isOSGlibc() const
Tests whether the OS uses glibc.
Definition: Triple.h:618
llvm::Triple::ARMSubArch_v4t
@ ARMSubArch_v4t
Definition: Triple.h:132
llvm::Triple::isWatchABI
bool isWatchABI() const
Definition: Triple.h:475
llvm::Triple::isSimulatorEnvironment
bool isSimulatorEnvironment() const
Definition: Triple.h:486
llvm::Triple::ImaginationTechnologies
@ ImaginationTechnologies
Definition: Triple.h:152
llvm::Triple::isOSHurd
bool isOSHurd() const
Tests whether the OS is Hurd.
Definition: Triple.h:603
llvm::Triple::ARMSubArch_v8
@ ARMSubArch_v8
Definition: Triple.h:115
llvm::Triple::isWindowsCoreCLREnvironment
bool isWindowsCoreCLREnvironment() const
Definition: Triple.h:560
llvm::Triple::ARMSubArch_v6m
@ ARMSubArch_v6m
Definition: Triple.h:127
llvm::Triple::isAMDGCN
bool isAMDGCN() const
Tests whether the target is AMDGCN.
Definition: Triple.h:704
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::Triple::operator!=
bool operator!=(const Triple &Other) const
Definition: Triple.h:283
llvm::Triple::ZOS
@ ZOS
Definition: Triple.h:181
llvm::Triple::bpfel
@ bpfel
Definition: Triple.h:57
llvm::Triple::AMD
@ AMD
Definition: Triple.h:157
llvm::Triple::ARMSubArch_v5te
@ ARMSubArch_v5te
Definition: Triple.h:131
llvm::Triple::SCEI
@ SCEI
Definition: Triple.h:149
llvm::Triple::armeb
@ armeb
Definition: Triple.h:51
llvm::Triple::GNUABIN32
@ GNUABIN32
Definition: Triple.h:207
llvm::Triple::isPPC
bool isPPC() const
Tests whether the target is PowerPC (32- or 64-bit LE or BE).
Definition: Triple.h:754
llvm::Triple::arm
@ arm
Definition: Triple.h:50
llvm::Triple::isMusl
bool isMusl() const
Tests whether the environment is musl-libc.
Definition: Triple.h:687
llvm::Triple::aarch64_be
@ aarch64_be
Definition: Triple.h:53
llvm::Triple::msp430
@ msp430
Definition: Triple.h:65
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:57
llvm::Triple::setArch
void setArch(ArchType Kind)
setArch - Set the architecture (first) component of the triple to a known type.
Definition: Triple.cpp:1200
llvm::Triple::ppcle
@ ppcle
Definition: Triple.h:67
llvm::Triple::ARMSubArch_v8_7a
@ ARMSubArch_v8_7a
Definition: Triple.h:108
llvm::Triple::ARMSubArch_v8_3a
@ ARMSubArch_v8_3a
Definition: Triple.h:112
llvm::Triple::thumb
@ thumb
Definition: Triple.h:80
llvm::Triple::isX86
bool isX86() const
Tests whether the target is x86 (32- or 64-bit).
Definition: Triple.h:780
llvm::Triple::isiOS
bool isiOS() const
Is this an iOS triple.
Definition: Triple.h:461
llvm::Triple::UnknownVendor
@ UnknownVendor
Definition: Triple.h:145
llvm::Triple::ve
@ ve
Definition: Triple.h:102
llvm::Triple::ObjectFormatType
ObjectFormatType
Definition: Triple.h:229
llvm::Triple::isWatchOS
bool isWatchOS() const
Is this an Apple watchOS triple.
Definition: Triple.h:471
llvm::Triple::ARMSubArch_v7
@ ARMSubArch_v7
Definition: Triple.h:120
llvm::Triple::isOSWindows
bool isOSWindows() const
Tests whether the OS is Windows.
Definition: Triple.h:545
llvm::Triple::amdil64
@ amdil64
Definition: Triple.h:90
llvm::Triple::setOS
void setOS(OSType Kind)
setOS - Set the operating system (third) component of the triple to a known type.
Definition: Triple.cpp:1208
llvm::Twine
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:80
llvm::Triple::WASI
@ WASI
Definition: Triple.h:199
llvm::Triple::OSType
OSType
Definition: Triple.h:163
llvm::Triple::Itanium
@ Itanium
Definition: Triple.h:222
llvm::Triple::VendorType
VendorType
Definition: Triple.h:144
llvm::Triple::ARMSubArch_v8_6a
@ ARMSubArch_v8_6a
Definition: Triple.h:109
llvm::Triple::getOSName
StringRef getOSName() const
getOSName - Get the operating system (third) component of the triple.
Definition: Triple.cpp:1024
llvm::Triple::ARMSubArch_v6t2
@ ARMSubArch_v6t2
Definition: Triple.h:129
llvm::Triple::MipsTechnologies
@ MipsTechnologies
Definition: Triple.h:153
llvm::Triple::getSubArch
SubArchType getSubArch() const
getSubArch - get the parsed subarchitecture type for this triple.
Definition: Triple.h:308
llvm::Triple::isOSVersionLT
bool isOSVersionLT(const Triple &Other) const
Definition: Triple.h:438
llvm::Triple::Fuchsia
@ Fuchsia
Definition: Triple.h:171
llvm::Triple::riscv32
@ riscv32
Definition: Triple.h:72
llvm::Triple::AMDPAL
@ AMDPAL
Definition: Triple.h:196
llvm::Triple::setOSName
void setOSName(StringRef Str)
setOSName - Set the operating system (third) component of the triple by name.
Definition: Triple.cpp:1243
llvm::Triple::MachO
@ MachO
Definition: Triple.h:235
llvm::Triple::LastArchType
@ LastArchType
Definition: Triple.h:103
llvm::Triple::Contiki
@ Contiki
Definition: Triple.h:195
llvm::Triple::isWindowsGNUEnvironment
bool isWindowsGNUEnvironment() const
Definition: Triple.h:572
llvm::Triple::Triple
Triple()
Default constructor is the same as an empty string and leaves all triple fields unknown.
Definition: Triple.h:267
llvm::Triple::getOSTypeName
static StringRef getOSTypeName(OSType Kind)
getOSTypeName - Get the canonical name for the Kind operating system.
Definition: Triple.cpp:184
llvm::Triple::isArm64e
bool isArm64e() const
Tests whether the target is the Apple "arm64e" AArch64 subarch.
Definition: Triple.h:800
llvm::Triple::mipsel
@ mipsel
Definition: Triple.h:62
llvm::Triple::ELFIAMCU
@ ELFIAMCU
Definition: Triple.h:191
llvm::Triple::operator==
bool operator==(const Triple &Other) const
Definition: Triple.h:276
llvm::Triple::getArchTypePrefix
static StringRef getArchTypePrefix(ArchType Kind)
getArchTypePrefix - Get the "prefix" canonical name for the Kind architecture.
Definition: Triple.cpp:85
llvm::Triple::ARMSubArch_v7em
@ ARMSubArch_v7em
Definition: Triple.h:121
llvm::Triple::shave
@ shave
Definition: Triple.h:96
llvm::Triple::AIX
@ AIX
Definition: Triple.h:186
llvm::Triple::tcele
@ tcele
Definition: Triple.h:79
llvm::Triple::systemz
@ systemz
Definition: Triple.h:77
llvm::Triple::isOSWASI
bool isOSWASI() const
Tests whether the OS is WASI.
Definition: Triple.h:608
llvm::Triple::Myriad
@ Myriad
Definition: Triple.h:156
llvm::Triple::ARMSubArch_v8_1a
@ ARMSubArch_v8_1a
Definition: Triple.h:114
llvm::Triple::isAndroidVersionLT
bool isAndroidVersionLT(unsigned Major) const
Definition: Triple.h:673
llvm::Triple::getVendorTypeName
static StringRef getVendorTypeName(VendorType Kind)
getVendorTypeName - Get the canonical name for the Kind vendor.
Definition: Triple.cpp:161
llvm::Triple::isMacCatalystEnvironment
bool isMacCatalystEnvironment() const
Definition: Triple.h:490
llvm::Triple::COFF
@ COFF
Definition: Triple.h:232
llvm::Triple::spir
@ spir
Definition: Triple.h:93
llvm::Triple::setArchName
void setArchName(StringRef Str)
setArchName - Set the architecture (first) component of the triple by name.
Definition: Triple.cpp:1228
llvm::Triple::hasEnvironment
bool hasEnvironment() const
hasEnvironment - Does this triple have the optional environment (fourth) component?
Definition: Triple.h:318
llvm::Triple::MacABI
@ MacABI
Definition: Triple.h:226
llvm::Triple::isOSNetBSD
bool isOSNetBSD() const
Definition: Triple.h:500
llvm::Triple::thumbeb
@ thumbeb
Definition: Triple.h:81
llvm::Triple::CloudABI
@ CloudABI
Definition: Triple.h:167
llvm::Triple::getArchTypeName
static StringRef getArchTypeName(ArchType Kind)
getArchTypeName - Get the canonical name for the Kind architecture.
Definition: Triple.cpp:23
llvm::Triple::ARMSubArch_v6
@ ARMSubArch_v6
Definition: Triple.h:126
llvm::Triple::getEnvironment
EnvironmentType getEnvironment() const
getEnvironment - Get the parsed environment type of this triple.
Definition: Triple.h:323
llvm::Triple::isSystemZ
bool isSystemZ() const
Tests whether the target is SystemZ.
Definition: Triple.h:775
llvm::Triple::isMIPS
bool isMIPS() const
Tests whether the target is MIPS (little and big endian, 32- or 64-bit).
Definition: Triple.h:749
llvm::Triple::EABIHF
@ EABIHF
Definition: Triple.h:215
llvm::Triple::getVendor
VendorType getVendor() const
getVendor - Get the parsed vendor type of this triple.
Definition: Triple.h:311
llvm::Triple::SUSE
@ SUSE
Definition: Triple.h:159
llvm::Triple::GNUEABIHF
@ GNUEABIHF
Definition: Triple.h:210
llvm::Triple::getBigEndianArchVariant
llvm::Triple getBigEndianArchVariant() const
Form a triple with a big endian variant of the current architecture.
Definition: Triple.cpp:1473
llvm::Triple::UnknownOS
@ UnknownOS
Definition: Triple.h:164
llvm::Triple::NoSubArch
@ NoSubArch
Definition: Triple.h:106
llvm::Triple::LastOSType
@ LastOSType
Definition: Triple.h:201
llvm::Triple::isWasm
bool isWasm() const
Tests whether the target is wasm (32- and 64-bit).
Definition: Triple.h:790
llvm::Triple::EABI
@ EABI
Definition: Triple.h:214
llvm::Triple::wasm64
@ wasm64
Definition: Triple.h:99
llvm::Triple::getLittleEndianArchVariant
llvm::Triple getLittleEndianArchVariant() const
Form a triple with a little endian variant of the current architecture.
Definition: Triple.cpp:1530
llvm::Triple::isPPC64
bool isPPC64() const
Tests whether the target is 64-bit PowerPC (little and big endian).
Definition: Triple.h:765
llvm::Triple::tce
@ tce
Definition: Triple.h:78
llvm::Triple::getWatchOSVersion
void getWatchOSVersion(unsigned &Major, unsigned &Minor, unsigned &Micro) const
getWatchOSVersion - Parse the version number as with getOSVersion.
Definition: Triple.cpp:1172
llvm::Triple::isOSKFreeBSD
bool isOSKFreeBSD() const
Tests whether the OS is kFreeBSD.
Definition: Triple.h:598
llvm::Triple::mips
@ mips
Definition: Triple.h:61
llvm::Triple::isWindowsCygwinEnvironment
bool isWindowsCygwinEnvironment() const
Definition: Triple.h:568
llvm::Triple::aarch64
@ aarch64
Definition: Triple.h:52
llvm::Triple::setObjectFormat
void setObjectFormat(ObjectFormatType Kind)
setObjectFormat - Set the object file format
Definition: Triple.cpp:1220
llvm::Triple::isKnownWindowsMSVCEnvironment
bool isKnownWindowsMSVCEnvironment() const
Checks if the environment is MSVC.
Definition: Triple.h:550
Other
Optional< std::vector< StOtherPiece > > Other
Definition: ELFYAML.cpp:1131
llvm::Triple::Apple
@ Apple
Definition: Triple.h:147
llvm::Triple::PPCSubArch_spe
@ PPCSubArch_spe
Definition: Triple.h:142
llvm::Triple::UnknownObjectFormat
@ UnknownObjectFormat
Definition: Triple.h:230
llvm::Triple::getEnvironmentName
StringRef getEnvironmentName() const
getEnvironmentName - Get the optional environment (fourth) component of the triple,...
Definition: Triple.cpp:1030