LLVM  6.0.0svn
Triple.h
Go to the documentation of this file.
1 //===-- llvm/ADT/Triple.h - Target triple helper class ----------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef LLVM_ADT_TRIPLE_H
11 #define LLVM_ADT_TRIPLE_H
12 
13 #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  arc, // ARC: Synopsys ARC
54  avr, // AVR: Atmel AVR microcontroller
55  bpfel, // eBPF or extended BPF or 64-bit BPF (little endian)
56  bpfeb, // eBPF or extended BPF or 64-bit BPF (big endian)
57  hexagon, // Hexagon: hexagon
58  mips, // MIPS: mips, mipsallegrex
59  mipsel, // MIPSEL: mipsel, mipsallegrexel
60  mips64, // MIPS64: mips64
61  mips64el, // MIPS64EL: mips64el
62  msp430, // MSP430: msp430
63  nios2, // NIOSII: nios2
64  ppc, // PPC: powerpc
65  ppc64, // PPC64: powerpc64, ppu
66  ppc64le, // PPC64LE: powerpc64le
67  r600, // R600: AMD GPUs HD2XXX - HD6XXX
68  amdgcn, // AMDGCN: AMD GCN GPUs
69  riscv32, // RISC-V (32-bit): riscv32
70  riscv64, // RISC-V (64-bit): riscv64
71  sparc, // Sparc: sparc
72  sparcv9, // Sparcv9: Sparcv9
73  sparcel, // Sparc: (endianness = little). NB: 'Sparcle' is a CPU variant
74  systemz, // SystemZ: s390x
75  tce, // TCE (http://tce.cs.tut.fi/): tce
76  tcele, // TCE little endian (http://tce.cs.tut.fi/): tcele
77  thumb, // Thumb (little endian): thumb, thumbv.*
78  thumbeb, // Thumb (big endian): thumbeb
79  x86, // X86: i[3-9]86
80  x86_64, // X86-64: amd64, x86_64
81  xcore, // XCore: xcore
82  nvptx, // NVPTX: 32-bit
83  nvptx64, // NVPTX: 64-bit
84  le32, // le32: generic little-endian 32-bit CPU (PNaCl)
85  le64, // le64: generic little-endian 64-bit CPU (PNaCl)
86  amdil, // AMDIL
87  amdil64, // AMDIL with 64-bit pointers
88  hsail, // AMD HSAIL
89  hsail64, // AMD HSAIL with 64-bit pointers
90  spir, // SPIR: standard portable IR for OpenCL 32-bit version
91  spir64, // SPIR: standard portable IR for OpenCL 64-bit version
92  kalimba, // Kalimba: generic kalimba
93  shave, // SHAVE: Movidius vector VLIW processors
94  lanai, // Lanai: Lanai 32-bit
95  wasm32, // WebAssembly with 32-bit pointers
96  wasm64, // WebAssembly with 64-bit pointers
97  renderscript32, // 32-bit RenderScript
98  renderscript64, // 64-bit RenderScript
100  };
101  enum SubArchType {
103 
124 
128  };
129  enum VendorType {
131 
133  PC,
148  };
149  enum OSType {
151 
161  Lv2, // PS3
170  NaCl, // Native Client
171  CNK, // BG/P Compute-Node Kernel
173  CUDA, // NVIDIA CUDA
174  NVCL, // NVIDIA OpenCL
175  AMDHSA, // AMD HSA Runtime
178  TvOS, // Apple tvOS
179  WatchOS, // Apple watchOS
182  AMDPAL, // AMD PAL Runtime
184  };
187 
201 
208  Simulator, // Simulator variants of other systems, e.g., Apple's iOS
210  };
213 
218  };
219 
220 private:
221  std::string Data;
222 
223  /// The parsed arch type.
224  ArchType Arch;
225 
226  /// The parsed subarchitecture type.
227  SubArchType SubArch;
228 
229  /// The parsed vendor type.
230  VendorType Vendor;
231 
232  /// The parsed OS type.
233  OSType OS;
234 
235  /// The parsed Environment type.
236  EnvironmentType Environment;
237 
238  /// The object format type.
239  ObjectFormatType ObjectFormat;
240 
241 public:
242  /// @name Constructors
243  /// @{
244 
245  /// Default constructor is the same as an empty string and leaves all
246  /// triple fields unknown.
248  : Data(), Arch(), SubArch(), Vendor(), OS(), Environment(),
249  ObjectFormat() {}
250 
251  explicit Triple(const Twine &Str);
252  Triple(const Twine &ArchStr, const Twine &VendorStr, const Twine &OSStr);
253  Triple(const Twine &ArchStr, const Twine &VendorStr, const Twine &OSStr,
254  const Twine &EnvironmentStr);
255 
256  bool operator==(const Triple &Other) const {
257  return Arch == Other.Arch && SubArch == Other.SubArch &&
258  Vendor == Other.Vendor && OS == Other.OS &&
259  Environment == Other.Environment &&
260  ObjectFormat == Other.ObjectFormat;
261  }
262 
263  bool operator!=(const Triple &Other) const {
264  return !(*this == Other);
265  }
266 
267  /// @}
268  /// @name Normalization
269  /// @{
270 
271  /// normalize - Turn an arbitrary machine specification into the canonical
272  /// triple form (or something sensible that the Triple class understands if
273  /// nothing better can reasonably be done). In particular, it handles the
274  /// common case in which otherwise valid components are in the wrong order.
275  static std::string normalize(StringRef Str);
276 
277  /// Return the normalized form of this triple's string.
278  std::string normalize() const { return normalize(Data); }
279 
280  /// @}
281  /// @name Typed Component Access
282  /// @{
283 
284  /// getArch - Get the parsed architecture type of this triple.
285  ArchType getArch() const { return Arch; }
286 
287  /// getSubArch - get the parsed subarchitecture type for this triple.
288  SubArchType getSubArch() const { return SubArch; }
289 
290  /// getVendor - Get the parsed vendor type of this triple.
291  VendorType getVendor() const { return Vendor; }
292 
293  /// getOS - Get the parsed operating system type of this triple.
294  OSType getOS() const { return OS; }
295 
296  /// hasEnvironment - Does this triple have the optional environment
297  /// (fourth) component?
298  bool hasEnvironment() const {
299  return getEnvironmentName() != "";
300  }
301 
302  /// getEnvironment - Get the parsed environment type of this triple.
303  EnvironmentType getEnvironment() const { return Environment; }
304 
305  /// Parse the version number from the OS name component of the
306  /// triple, if present.
307  ///
308  /// For example, "fooos1.2.3" would return (1, 2, 3).
309  ///
310  /// If an entry is not defined, it will be returned as 0.
311  void getEnvironmentVersion(unsigned &Major, unsigned &Minor,
312  unsigned &Micro) const;
313 
314  /// getFormat - Get the object format for this triple.
315  ObjectFormatType getObjectFormat() const { return ObjectFormat; }
316 
317  /// getOSVersion - Parse the version number from the OS name component of the
318  /// triple, if present.
319  ///
320  /// For example, "fooos1.2.3" would return (1, 2, 3).
321  ///
322  /// If an entry is not defined, it will be returned as 0.
323  void getOSVersion(unsigned &Major, unsigned &Minor, unsigned &Micro) const;
324 
325  /// getOSMajorVersion - Return just the major version number, this is
326  /// specialized because it is a common query.
327  unsigned getOSMajorVersion() const {
328  unsigned Maj, Min, Micro;
329  getOSVersion(Maj, Min, Micro);
330  return Maj;
331  }
332 
333  /// getMacOSXVersion - Parse the version number as with getOSVersion and then
334  /// translate generic "darwin" versions to the corresponding OS X versions.
335  /// This may also be called with IOS triples but the OS X version number is
336  /// just set to a constant 10.4.0 in that case. Returns true if successful.
337  bool getMacOSXVersion(unsigned &Major, unsigned &Minor,
338  unsigned &Micro) const;
339 
340  /// getiOSVersion - Parse the version number as with getOSVersion. This should
341  /// only be called with IOS or generic triples.
342  void getiOSVersion(unsigned &Major, unsigned &Minor,
343  unsigned &Micro) const;
344 
345  /// getWatchOSVersion - Parse the version number as with getOSVersion. This
346  /// should only be called with WatchOS or generic triples.
347  void getWatchOSVersion(unsigned &Major, unsigned &Minor,
348  unsigned &Micro) const;
349 
350  /// @}
351  /// @name Direct Component Access
352  /// @{
353 
354  const std::string &str() const { return Data; }
355 
356  const std::string &getTriple() const { return Data; }
357 
358  /// getArchName - Get the architecture (first) component of the
359  /// triple.
360  StringRef getArchName() const;
361 
362  /// getVendorName - Get the vendor (second) component of the triple.
363  StringRef getVendorName() const;
364 
365  /// getOSName - Get the operating system (third) component of the
366  /// triple.
367  StringRef getOSName() const;
368 
369  /// getEnvironmentName - Get the optional environment (fourth)
370  /// component of the triple, or "" if empty.
372 
373  /// getOSAndEnvironmentName - Get the operating system and optional
374  /// environment components as a single string (separated by a '-'
375  /// if the environment component is present).
377 
378  /// @}
379  /// @name Convenience Predicates
380  /// @{
381 
382  /// Test whether the architecture is 64-bit
383  ///
384  /// Note that this tests for 64-bit pointer width, and nothing else. Note
385  /// that we intentionally expose only three predicates, 64-bit, 32-bit, and
386  /// 16-bit. The inner details of pointer width for particular architectures
387  /// is not summed up in the triple, and so only a coarse grained predicate
388  /// system is provided.
389  bool isArch64Bit() const;
390 
391  /// Test whether the architecture is 32-bit
392  ///
393  /// Note that this tests for 32-bit pointer width, and nothing else.
394  bool isArch32Bit() const;
395 
396  /// Test whether the architecture is 16-bit
397  ///
398  /// Note that this tests for 16-bit pointer width, and nothing else.
399  bool isArch16Bit() const;
400 
401  /// isOSVersionLT - Helper function for doing comparisons against version
402  /// numbers included in the target triple.
403  bool isOSVersionLT(unsigned Major, unsigned Minor = 0,
404  unsigned Micro = 0) const {
405  unsigned LHS[3];
406  getOSVersion(LHS[0], LHS[1], LHS[2]);
407 
408  if (LHS[0] != Major)
409  return LHS[0] < Major;
410  if (LHS[1] != Minor)
411  return LHS[1] < Minor;
412  if (LHS[2] != Micro)
413  return LHS[1] < Micro;
414 
415  return false;
416  }
417 
418  bool isOSVersionLT(const Triple &Other) const {
419  unsigned RHS[3];
420  Other.getOSVersion(RHS[0], RHS[1], RHS[2]);
421  return isOSVersionLT(RHS[0], RHS[1], RHS[2]);
422  }
423 
424  /// isMacOSXVersionLT - Comparison function for checking OS X version
425  /// compatibility, which handles supporting skewed version numbering schemes
426  /// used by the "darwin" triples.
427  bool isMacOSXVersionLT(unsigned Major, unsigned Minor = 0,
428  unsigned Micro = 0) const {
429  assert(isMacOSX() && "Not an OS X triple!");
430 
431  // If this is OS X, expect a sane version number.
432  if (getOS() == Triple::MacOSX)
433  return isOSVersionLT(Major, Minor, Micro);
434 
435  // Otherwise, compare to the "Darwin" number.
436  assert(Major == 10 && "Unexpected major version");
437  return isOSVersionLT(Minor + 4, Micro, 0);
438  }
439 
440  /// isMacOSX - Is this a Mac OS X triple. For legacy reasons, we support both
441  /// "darwin" and "osx" as OS X triples.
442  bool isMacOSX() const {
443  return getOS() == Triple::Darwin || getOS() == Triple::MacOSX;
444  }
445 
446  /// Is this an iOS triple.
447  /// Note: This identifies tvOS as a variant of iOS. If that ever
448  /// changes, i.e., if the two operating systems diverge or their version
449  /// numbers get out of sync, that will need to be changed.
450  /// watchOS has completely different version numbers so it is not included.
451  bool isiOS() const {
452  return getOS() == Triple::IOS || isTvOS();
453  }
454 
455  /// Is this an Apple tvOS triple.
456  bool isTvOS() const {
457  return getOS() == Triple::TvOS;
458  }
459 
460  /// Is this an Apple watchOS triple.
461  bool isWatchOS() const {
462  return getOS() == Triple::WatchOS;
463  }
464 
465  bool isWatchABI() const {
467  }
468 
469  /// isOSDarwin - Is this a "Darwin" OS (OS X, iOS, or watchOS).
470  bool isOSDarwin() const {
471  return isMacOSX() || isiOS() || isWatchOS();
472  }
473 
474  bool isSimulatorEnvironment() const {
475  return getEnvironment() == Triple::Simulator;
476  }
477 
478  bool isOSNetBSD() const {
479  return getOS() == Triple::NetBSD;
480  }
481 
482  bool isOSOpenBSD() const {
483  return getOS() == Triple::OpenBSD;
484  }
485 
486  bool isOSFreeBSD() const {
487  return getOS() == Triple::FreeBSD;
488  }
489 
490  bool isOSFuchsia() const {
491  return getOS() == Triple::Fuchsia;
492  }
493 
494  bool isOSDragonFly() const { return getOS() == Triple::DragonFly; }
495 
496  bool isOSSolaris() const {
497  return getOS() == Triple::Solaris;
498  }
499 
500  bool isOSIAMCU() const {
501  return getOS() == Triple::ELFIAMCU;
502  }
503 
504  bool isOSUnknown() const { return getOS() == Triple::UnknownOS; }
505 
506  bool isGNUEnvironment() const {
508  return Env == Triple::GNU || Env == Triple::GNUABIN32 ||
509  Env == Triple::GNUABI64 || Env == Triple::GNUEABI ||
510  Env == Triple::GNUEABIHF || Env == Triple::GNUX32;
511  }
512 
513  bool isOSContiki() const {
514  return getOS() == Triple::Contiki;
515  }
516 
517  /// Tests whether the OS is Haiku.
518  bool isOSHaiku() const {
519  return getOS() == Triple::Haiku;
520  }
521 
522  /// Checks if the environment could be MSVC.
524  return getOS() == Triple::Win32 &&
527  }
528 
529  /// Checks if the environment is MSVC.
531  return getOS() == Triple::Win32 && getEnvironment() == Triple::MSVC;
532  }
533 
536  }
537 
540  }
541 
543  return getOS() == Triple::Win32 && getEnvironment() == Triple::Cygnus;
544  }
545 
546  bool isWindowsGNUEnvironment() const {
547  return getOS() == Triple::Win32 && getEnvironment() == Triple::GNU;
548  }
549 
550  /// Tests for either Cygwin or MinGW OS
551  bool isOSCygMing() const {
553  }
554 
555  /// Is this a "Windows" OS targeting a "MSVCRT.dll" environment.
556  bool isOSMSVCRT() const {
559  }
560 
561  /// Tests whether the OS is Windows.
562  bool isOSWindows() const {
563  return getOS() == Triple::Win32;
564  }
565 
566  /// Tests whether the OS is NaCl (Native Client)
567  bool isOSNaCl() const {
568  return getOS() == Triple::NaCl;
569  }
570 
571  /// Tests whether the OS is Linux.
572  bool isOSLinux() const {
573  return getOS() == Triple::Linux;
574  }
575 
576  /// Tests whether the OS is kFreeBSD.
577  bool isOSKFreeBSD() const {
578  return getOS() == Triple::KFreeBSD;
579  }
580 
581  /// Tests whether the OS uses glibc.
582  bool isOSGlibc() const {
583  return (getOS() == Triple::Linux || getOS() == Triple::KFreeBSD) &&
584  !isAndroid();
585  }
586 
587  /// Tests whether the OS uses the ELF binary format.
588  bool isOSBinFormatELF() const {
589  return getObjectFormat() == Triple::ELF;
590  }
591 
592  /// Tests whether the OS uses the COFF binary format.
593  bool isOSBinFormatCOFF() const {
594  return getObjectFormat() == Triple::COFF;
595  }
596 
597  /// Tests whether the environment is MachO.
598  bool isOSBinFormatMachO() const {
599  return getObjectFormat() == Triple::MachO;
600  }
601 
602  /// Tests whether the OS uses the Wasm binary format.
603  bool isOSBinFormatWasm() const {
604  return getObjectFormat() == Triple::Wasm;
605  }
606 
607  /// Tests whether the target is the PS4 CPU
608  bool isPS4CPU() const {
609  return getArch() == Triple::x86_64 &&
610  getVendor() == Triple::SCEI &&
611  getOS() == Triple::PS4;
612  }
613 
614  /// Tests whether the target is the PS4 platform
615  bool isPS4() const {
616  return getVendor() == Triple::SCEI &&
617  getOS() == Triple::PS4;
618  }
619 
620  /// Tests whether the target is Android
621  bool isAndroid() const { return getEnvironment() == Triple::Android; }
622 
623  bool isAndroidVersionLT(unsigned Major) const {
624  assert(isAndroid() && "Not an Android triple!");
625 
626  unsigned Env[3];
627  getEnvironmentVersion(Env[0], Env[1], Env[2]);
628 
629  // 64-bit targets did not exist before API level 21 (Lollipop).
630  if (isArch64Bit() && Env[0] < 21)
631  Env[0] = 21;
632 
633  return Env[0] < Major;
634  }
635 
636  /// Tests whether the environment is musl-libc
637  bool isMusl() const {
638  return getEnvironment() == Triple::Musl ||
641  }
642 
643  /// Tests whether the target is NVPTX (32- or 64-bit).
644  bool isNVPTX() const {
645  return getArch() == Triple::nvptx || getArch() == Triple::nvptx64;
646  }
647 
648  /// Tests whether the target is Thumb (little and big endian).
649  bool isThumb() const {
650  return getArch() == Triple::thumb || getArch() == Triple::thumbeb;
651  }
652 
653  /// Tests whether the target is ARM (little and big endian).
654  bool isARM() const {
655  return getArch() == Triple::arm || getArch() == Triple::armeb;
656  }
657 
658  /// Tests whether the target is AArch64 (little and big endian).
659  bool isAArch64() const {
661  }
662 
663  /// Tests wether the target supports comdat
664  bool supportsCOMDAT() const {
665  return !isOSBinFormatMachO() && !isOSBinFormatWasm();
666  }
667 
668  /// @}
669  /// @name Mutators
670  /// @{
671 
672  /// setArch - Set the architecture (first) component of the triple
673  /// to a known type.
674  void setArch(ArchType Kind);
675 
676  /// setVendor - Set the vendor (second) component of the triple to a
677  /// known type.
678  void setVendor(VendorType Kind);
679 
680  /// setOS - Set the operating system (third) component of the triple
681  /// to a known type.
682  void setOS(OSType Kind);
683 
684  /// setEnvironment - Set the environment (fourth) component of the triple
685  /// to a known type.
686  void setEnvironment(EnvironmentType Kind);
687 
688  /// setObjectFormat - Set the object file format
690 
691  /// setTriple - Set all components to the new triple \p Str.
692  void setTriple(const Twine &Str);
693 
694  /// setArchName - Set the architecture (first) component of the
695  /// triple by name.
696  void setArchName(StringRef Str);
697 
698  /// setVendorName - Set the vendor (second) component of the triple
699  /// by name.
700  void setVendorName(StringRef Str);
701 
702  /// setOSName - Set the operating system (third) component of the
703  /// triple by name.
704  void setOSName(StringRef Str);
705 
706  /// setEnvironmentName - Set the optional environment (fourth)
707  /// component of the triple by name.
708  void setEnvironmentName(StringRef Str);
709 
710  /// setOSAndEnvironmentName - Set the operating system and optional
711  /// environment components with a single string.
713 
714  /// @}
715  /// @name Helpers to build variants of a particular triple.
716  /// @{
717 
718  /// Form a triple with a 32-bit variant of the current architecture.
719  ///
720  /// This can be used to move across "families" of architectures where useful.
721  ///
722  /// \returns A new triple with a 32-bit architecture or an unknown
723  /// architecture if no such variant can be found.
725 
726  /// Form a triple with a 64-bit variant of the current architecture.
727  ///
728  /// This can be used to move across "families" of architectures where useful.
729  ///
730  /// \returns A new triple with a 64-bit architecture or an unknown
731  /// architecture if no such variant can be found.
733 
734  /// Form a triple with a big endian variant of the current architecture.
735  ///
736  /// This can be used to move across "families" of architectures where useful.
737  ///
738  /// \returns A new triple with a big endian architecture or an unknown
739  /// architecture if no such variant can be found.
741 
742  /// Form a triple with a little endian variant of the current architecture.
743  ///
744  /// This can be used to move across "families" of architectures where useful.
745  ///
746  /// \returns A new triple with a little endian architecture or an unknown
747  /// architecture if no such variant can be found.
749 
750  /// Get the (LLVM) name of the minimum ARM CPU for the arch we are targeting.
751  ///
752  /// \param Arch the architecture name (e.g., "armv7s"). If it is an empty
753  /// string then the triple's arch name is used.
755 
756  /// Tests whether the target triple is little endian.
757  ///
758  /// \returns true if the triple is little endian, false otherwise.
759  bool isLittleEndian() const;
760 
761  /// Test whether target triples are compatible.
762  bool isCompatibleWith(const Triple &Other) const;
763 
764  /// Merge target triples.
765  std::string merge(const Triple &Other) const;
766 
767  /// @}
768  /// @name Static helpers for IDs.
769  /// @{
770 
771  /// getArchTypeName - Get the canonical name for the \p Kind architecture.
772  static StringRef getArchTypeName(ArchType Kind);
773 
774  /// getArchTypePrefix - Get the "prefix" canonical name for the \p Kind
775  /// architecture. This is the prefix used by the architecture specific
776  /// builtins, and is suitable for passing to \see
777  /// Intrinsic::getIntrinsicForGCCBuiltin().
778  ///
779  /// \return - The architecture prefix, or 0 if none is defined.
780  static StringRef getArchTypePrefix(ArchType Kind);
781 
782  /// getVendorTypeName - Get the canonical name for the \p Kind vendor.
784 
785  /// getOSTypeName - Get the canonical name for the \p Kind operating system.
786  static StringRef getOSTypeName(OSType Kind);
787 
788  /// getEnvironmentTypeName - Get the canonical name for the \p Kind
789  /// environment.
791 
792  /// @}
793  /// @name Static helpers for converting alternate architecture names.
794  /// @{
795 
796  /// getArchTypeForLLVMName - The canonical type for the given LLVM
797  /// architecture name (e.g., "x86").
799 
800  /// @}
801 };
802 
803 } // End llvm namespace
804 
805 
806 #endif
bool isOSDarwin() const
isOSDarwin - Is this a "Darwin" OS (OS X, iOS, or watchOS).
Definition: Triple.h:470
bool isOSHaiku() const
Tests whether the OS is Haiku.
Definition: Triple.h:518
void getiOSVersion(unsigned &Major, unsigned &Minor, unsigned &Micro) const
getiOSVersion - Parse the version number as with getOSVersion.
Definition: Triple.cpp:1065
bool isOSMSVCRT() const
Is this a "Windows" OS targeting a "MSVCRT.dll" environment.
Definition: Triple.h:556
bool supportsCOMDAT() const
Tests wether the target supports comdat.
Definition: Triple.h:664
static StringRef getVendorTypeName(VendorType Kind)
getVendorTypeName - Get the canonical name for the Kind vendor.
Definition: Triple.cpp:152
Compute iterated dominance frontiers using a linear time algorithm.
Definition: AllocatorList.h:24
bool isMacOSX() const
isMacOSX - Is this a Mac OS X triple.
Definition: Triple.h:442
bool isOSBinFormatELF() const
Tests whether the OS uses the ELF binary format.
Definition: Triple.h:588
OSType getOS() const
getOS - Get the parsed operating system type of this triple.
Definition: Triple.h:294
void setVendor(VendorType Kind)
setVendor - Set the vendor (second) component of the triple to a known type.
Definition: Triple.cpp:1123
bool isArch16Bit() const
Test whether the architecture is 16-bit.
Definition: Triple.cpp:1251
bool isOSNaCl() const
Tests whether the OS is NaCl (Native Client)
Definition: Triple.h:567
bool isWatchOS() const
Is this an Apple watchOS triple.
Definition: Triple.h:461
bool hasEnvironment() const
hasEnvironment - Does this triple have the optional environment (fourth) component?
Definition: Triple.h:298
void setOS(OSType Kind)
setOS - Set the operating system (third) component of the triple to a known type. ...
Definition: Triple.cpp:1127
bool isOSFuchsia() const
Definition: Triple.h:490
void setEnvironment(EnvironmentType Kind)
setEnvironment - Set the environment (fourth) component of the triple to a known type.
Definition: Triple.cpp:1131
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:1001
bool isWindowsCygwinEnvironment() const
Definition: Triple.h:542
StringRef getARMCPUForArch(StringRef Arch=StringRef()) const
Get the (LLVM) name of the minimum ARM CPU for the arch we are targeting.
Definition: Triple.cpp:1547
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:81
bool isAArch64() const
Tests whether the target is AArch64 (little and big endian).
Definition: Triple.h:659
static StringRef getArchTypeName(ArchType Kind)
getArchTypeName - Get the canonical name for the Kind architecture.
Definition: Triple.cpp:20
bool isKnownWindowsMSVCEnvironment() const
Checks if the environment is MSVC.
Definition: Triple.h:530
void setVendorName(StringRef Str)
setVendorName - Set the vendor (second) component of the triple by name.
Definition: Triple.cpp:1158
bool isOSSolaris() const
Definition: Triple.h:496
ELFYAML::ELF_STO Other
Definition: ELFYAML.cpp:736
Triple()
Default constructor is the same as an empty string and leaves all triple fields unknown.
Definition: Triple.h:247
SubArchType getSubArch() const
getSubArch - get the parsed subarchitecture type for this triple.
Definition: Triple.h:288
ArchType getArch() const
getArch - Get the parsed architecture type of this triple.
Definition: Triple.h:285
bool isArch32Bit() const
Test whether the architecture is 32-bit.
Definition: Triple.cpp:1247
bool isiOS() const
Is this an iOS triple.
Definition: Triple.h:451
bool isPS4() const
Tests whether the target is the PS4 platform.
Definition: Triple.h:615
bool isOSNetBSD() const
Definition: Triple.h:478
bool isWindowsItaniumEnvironment() const
Definition: Triple.h:538
bool isWindowsGNUEnvironment() const
Definition: Triple.h:546
static StringRef getOSTypeName(OSType Kind)
getOSTypeName - Get the canonical name for the Kind operating system.
Definition: Triple.cpp:176
bool isWindowsCoreCLREnvironment() const
Definition: Triple.h:534
const std::string & str() const
Definition: Triple.h:354
bool isOSDragonFly() const
Definition: Triple.h:494
bool isOSWindows() const
Tests whether the OS is Windows.
Definition: Triple.h:562
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:1011
bool isMusl() const
Tests whether the environment is musl-libc.
Definition: Triple.h:637
void setObjectFormat(ObjectFormatType Kind)
setObjectFormat - Set the object file format
Definition: Triple.cpp:1139
StringRef getOSAndEnvironmentName() const
getOSAndEnvironmentName - Get the operating system and optional environment components as a single st...
Definition: Triple.cpp:961
llvm::Triple get32BitArchVariant() const
Form a triple with a 32-bit variant of the current architecture.
Definition: Triple.cpp:1255
bool isLittleEndian() const
Tests whether the target triple is little endian.
Definition: Triple.cpp:1470
VendorType getVendor() const
getVendor - Get the parsed vendor type of this triple.
Definition: Triple.h:291
bool isOSBinFormatCOFF() const
Tests whether the OS uses the COFF binary format.
Definition: Triple.h:593
void setEnvironmentName(StringRef Str)
setEnvironmentName - Set the optional environment (fourth) component of the triple by name...
Definition: Triple.cpp:1170
bool isOSOpenBSD() const
Definition: Triple.h:482
llvm::Triple getBigEndianArchVariant() const
Form a triple with a big endian variant of the current architecture.
Definition: Triple.cpp:1383
bool isWatchABI() const
Definition: Triple.h:465
void setTriple(const Twine &Str)
setTriple - Set all components to the new triple Str.
Definition: Triple.cpp:1115
bool operator==(const Triple &Other) const
Definition: Triple.h:256
bool isCompatibleWith(const Triple &Other) const
Test whether target triples are compatible.
Definition: Triple.cpp:1514
static StringRef getArchTypePrefix(ArchType Kind)
getArchTypePrefix - Get the "prefix" canonical name for the Kind architecture.
Definition: Triple.cpp:79
bool operator!=(const Triple &Other) const
Definition: Triple.h:263
bool isAndroidVersionLT(unsigned Major) const
Definition: Triple.h:623
bool isPS4CPU() const
Tests whether the target is the PS4 CPU.
Definition: Triple.h:608
void getWatchOSVersion(unsigned &Major, unsigned &Minor, unsigned &Micro) const
getWatchOSVersion - Parse the version number as with getOSVersion.
Definition: Triple.cpp:1091
bool isOSKFreeBSD() const
Tests whether the OS is kFreeBSD.
Definition: Triple.h:577
void setArchName(StringRef Str)
setArchName - Set the architecture (first) component of the triple by name.
Definition: Triple.cpp:1147
bool isOSBinFormatMachO() const
Tests whether the environment is MachO.
Definition: Triple.h:598
void setOSName(StringRef Str)
setOSName - Set the operating system (third) component of the triple by name.
Definition: Triple.cpp:1162
unsigned getOSMajorVersion() const
getOSMajorVersion - Return just the major version number, this is specialized because it is a common ...
Definition: Triple.h:327
bool isOSUnknown() const
Definition: Triple.h:504
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
bool isOSIAMCU() const
Definition: Triple.h:500
StringRef getArchName() const
getArchName - Get the architecture (first) component of the triple.
Definition: Triple.cpp:940
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:1024
bool isOSContiki() const
Definition: Triple.h:513
static ArchType getArchTypeForLLVMName(StringRef Str)
getArchTypeForLLVMName - The canonical type for the given LLVM architecture name (e.g., "x86").
Definition: Triple.cpp:259
StringRef getOSName() const
getOSName - Get the operating system (third) component of the triple.
Definition: Triple.cpp:949
bool isOSLinux() const
Tests whether the OS is Linux.
Definition: Triple.h:572
EnvironmentType getEnvironment() const
getEnvironment - Get the parsed environment type of this triple.
Definition: Triple.h:303
std::string merge(const Triple &Other) const
Merge target triples.
Definition: Triple.cpp:1538
bool isOSVersionLT(const Triple &Other) const
Definition: Triple.h:418
bool isOSFreeBSD() const
Definition: Triple.h:486
std::string normalize() const
Return the normalized form of this triple&#39;s string.
Definition: Triple.h:278
StringRef getEnvironmentName() const
getEnvironmentName - Get the optional environment (fourth) component of the triple, or "" if empty.
Definition: Triple.cpp:955
bool isOSCygMing() const
Tests for either Cygwin or MinGW OS.
Definition: Triple.h:551
const std::string & getTriple() const
Definition: Triple.h:356
bool isOSGlibc() const
Tests whether the OS uses glibc.
Definition: Triple.h:582
llvm::Triple getLittleEndianArchVariant() const
Form a triple with a little endian variant of the current architecture.
Definition: Triple.cpp:1438
bool isThumb() const
Tests whether the target is Thumb (little and big endian).
Definition: Triple.h:649
ObjectFormatType getObjectFormat() const
getFormat - Get the object format for this triple.
Definition: Triple.h:315
void setOSAndEnvironmentName(StringRef Str)
setOSAndEnvironmentName - Set the operating system and optional environment components with a single ...
Definition: Triple.cpp:1175
bool isArch64Bit() const
Test whether the architecture is 64-bit.
Definition: Triple.cpp:1243
bool isGNUEnvironment() const
Definition: Triple.h:506
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.h:427
StringRef getVendorName() const
getVendorName - Get the vendor (second) component of the triple.
Definition: Triple.cpp:944
const unsigned Kind
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
bool isSimulatorEnvironment() const
Definition: Triple.h:474
ObjectFormatType
Definition: Triple.h:211
bool isTvOS() const
Is this an Apple tvOS triple.
Definition: Triple.h:456
bool isAndroid() const
Tests whether the target is Android.
Definition: Triple.h:621
llvm::Triple get64BitArchVariant() const
Form a triple with a 64-bit variant of the current architecture.
Definition: Triple.cpp:1319
bool isNVPTX() const
Tests whether the target is NVPTX (32- or 64-bit).
Definition: Triple.h:644
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49
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:403
bool isOSBinFormatWasm() const
Tests whether the OS uses the Wasm binary format.
Definition: Triple.h:603
bool isWindowsMSVCEnvironment() const
Checks if the environment could be MSVC.
Definition: Triple.h:523
bool isARM() const
Tests whether the target is ARM (little and big endian).
Definition: Triple.h:654
void setArch(ArchType Kind)
setArch - Set the architecture (first) component of the triple to a known type.
Definition: Triple.cpp:1119
static StringRef getEnvironmentTypeName(EnvironmentType Kind)
getEnvironmentTypeName - Get the canonical name for the Kind environment.
Definition: Triple.cpp:216