LLVM  7.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 
206  Simulator, // Simulator variants of other systems, e.g., Apple's iOS
208  };
211 
216  };
217 
218 private:
219  std::string Data;
220 
221  /// The parsed arch type.
222  ArchType Arch;
223 
224  /// The parsed subarchitecture type.
225  SubArchType SubArch;
226 
227  /// The parsed vendor type.
228  VendorType Vendor;
229 
230  /// The parsed OS type.
231  OSType OS;
232 
233  /// The parsed Environment type.
234  EnvironmentType Environment;
235 
236  /// The object format type.
237  ObjectFormatType ObjectFormat;
238 
239 public:
240  /// @name Constructors
241  /// @{
242 
243  /// Default constructor is the same as an empty string and leaves all
244  /// triple fields unknown.
246  : Data(), Arch(), SubArch(), Vendor(), OS(), Environment(),
247  ObjectFormat() {}
248 
249  explicit Triple(const Twine &Str);
250  Triple(const Twine &ArchStr, const Twine &VendorStr, const Twine &OSStr);
251  Triple(const Twine &ArchStr, const Twine &VendorStr, const Twine &OSStr,
252  const Twine &EnvironmentStr);
253 
254  bool operator==(const Triple &Other) const {
255  return Arch == Other.Arch && SubArch == Other.SubArch &&
256  Vendor == Other.Vendor && OS == Other.OS &&
257  Environment == Other.Environment &&
258  ObjectFormat == Other.ObjectFormat;
259  }
260 
261  bool operator!=(const Triple &Other) const {
262  return !(*this == Other);
263  }
264 
265  /// @}
266  /// @name Normalization
267  /// @{
268 
269  /// normalize - Turn an arbitrary machine specification into the canonical
270  /// triple form (or something sensible that the Triple class understands if
271  /// nothing better can reasonably be done). In particular, it handles the
272  /// common case in which otherwise valid components are in the wrong order.
273  static std::string normalize(StringRef Str);
274 
275  /// Return the normalized form of this triple's string.
276  std::string normalize() const { return normalize(Data); }
277 
278  /// @}
279  /// @name Typed Component Access
280  /// @{
281 
282  /// getArch - Get the parsed architecture type of this triple.
283  ArchType getArch() const { return Arch; }
284 
285  /// getSubArch - get the parsed subarchitecture type for this triple.
286  SubArchType getSubArch() const { return SubArch; }
287 
288  /// getVendor - Get the parsed vendor type of this triple.
289  VendorType getVendor() const { return Vendor; }
290 
291  /// getOS - Get the parsed operating system type of this triple.
292  OSType getOS() const { return OS; }
293 
294  /// hasEnvironment - Does this triple have the optional environment
295  /// (fourth) component?
296  bool hasEnvironment() const {
297  return getEnvironmentName() != "";
298  }
299 
300  /// getEnvironment - Get the parsed environment type of this triple.
301  EnvironmentType getEnvironment() const { return Environment; }
302 
303  /// Parse the version number from the OS name component of the
304  /// triple, if present.
305  ///
306  /// For example, "fooos1.2.3" would return (1, 2, 3).
307  ///
308  /// If an entry is not defined, it will be returned as 0.
309  void getEnvironmentVersion(unsigned &Major, unsigned &Minor,
310  unsigned &Micro) const;
311 
312  /// getFormat - Get the object format for this triple.
313  ObjectFormatType getObjectFormat() const { return ObjectFormat; }
314 
315  /// getOSVersion - Parse the version number from the OS name component of the
316  /// triple, if present.
317  ///
318  /// For example, "fooos1.2.3" would return (1, 2, 3).
319  ///
320  /// If an entry is not defined, it will be returned as 0.
321  void getOSVersion(unsigned &Major, unsigned &Minor, unsigned &Micro) const;
322 
323  /// getOSMajorVersion - Return just the major version number, this is
324  /// specialized because it is a common query.
325  unsigned getOSMajorVersion() const {
326  unsigned Maj, Min, Micro;
327  getOSVersion(Maj, Min, Micro);
328  return Maj;
329  }
330 
331  /// getMacOSXVersion - Parse the version number as with getOSVersion and then
332  /// translate generic "darwin" versions to the corresponding OS X versions.
333  /// This may also be called with IOS triples but the OS X version number is
334  /// just set to a constant 10.4.0 in that case. Returns true if successful.
335  bool getMacOSXVersion(unsigned &Major, unsigned &Minor,
336  unsigned &Micro) const;
337 
338  /// getiOSVersion - Parse the version number as with getOSVersion. This should
339  /// only be called with IOS or generic triples.
340  void getiOSVersion(unsigned &Major, unsigned &Minor,
341  unsigned &Micro) const;
342 
343  /// getWatchOSVersion - Parse the version number as with getOSVersion. This
344  /// should only be called with WatchOS or generic triples.
345  void getWatchOSVersion(unsigned &Major, unsigned &Minor,
346  unsigned &Micro) const;
347 
348  /// @}
349  /// @name Direct Component Access
350  /// @{
351 
352  const std::string &str() const { return Data; }
353 
354  const std::string &getTriple() const { return Data; }
355 
356  /// getArchName - Get the architecture (first) component of the
357  /// triple.
358  StringRef getArchName() const;
359 
360  /// getVendorName - Get the vendor (second) component of the triple.
361  StringRef getVendorName() const;
362 
363  /// getOSName - Get the operating system (third) component of the
364  /// triple.
365  StringRef getOSName() const;
366 
367  /// getEnvironmentName - Get the optional environment (fourth)
368  /// component of the triple, or "" if empty.
370 
371  /// getOSAndEnvironmentName - Get the operating system and optional
372  /// environment components as a single string (separated by a '-'
373  /// if the environment component is present).
375 
376  /// @}
377  /// @name Convenience Predicates
378  /// @{
379 
380  /// Test whether the architecture is 64-bit
381  ///
382  /// Note that this tests for 64-bit pointer width, and nothing else. Note
383  /// that we intentionally expose only three predicates, 64-bit, 32-bit, and
384  /// 16-bit. The inner details of pointer width for particular architectures
385  /// is not summed up in the triple, and so only a coarse grained predicate
386  /// system is provided.
387  bool isArch64Bit() const;
388 
389  /// Test whether the architecture is 32-bit
390  ///
391  /// Note that this tests for 32-bit pointer width, and nothing else.
392  bool isArch32Bit() const;
393 
394  /// Test whether the architecture is 16-bit
395  ///
396  /// Note that this tests for 16-bit pointer width, and nothing else.
397  bool isArch16Bit() const;
398 
399  /// isOSVersionLT - Helper function for doing comparisons against version
400  /// numbers included in the target triple.
401  bool isOSVersionLT(unsigned Major, unsigned Minor = 0,
402  unsigned Micro = 0) const {
403  unsigned LHS[3];
404  getOSVersion(LHS[0], LHS[1], LHS[2]);
405 
406  if (LHS[0] != Major)
407  return LHS[0] < Major;
408  if (LHS[1] != Minor)
409  return LHS[1] < Minor;
410  if (LHS[2] != Micro)
411  return LHS[1] < Micro;
412 
413  return false;
414  }
415 
416  bool isOSVersionLT(const Triple &Other) const {
417  unsigned RHS[3];
418  Other.getOSVersion(RHS[0], RHS[1], RHS[2]);
419  return isOSVersionLT(RHS[0], RHS[1], RHS[2]);
420  }
421 
422  /// isMacOSXVersionLT - Comparison function for checking OS X version
423  /// compatibility, which handles supporting skewed version numbering schemes
424  /// used by the "darwin" triples.
425  bool isMacOSXVersionLT(unsigned Major, unsigned Minor = 0,
426  unsigned Micro = 0) const {
427  assert(isMacOSX() && "Not an OS X triple!");
428 
429  // If this is OS X, expect a sane version number.
430  if (getOS() == Triple::MacOSX)
431  return isOSVersionLT(Major, Minor, Micro);
432 
433  // Otherwise, compare to the "Darwin" number.
434  assert(Major == 10 && "Unexpected major version");
435  return isOSVersionLT(Minor + 4, Micro, 0);
436  }
437 
438  /// isMacOSX - Is this a Mac OS X triple. For legacy reasons, we support both
439  /// "darwin" and "osx" as OS X triples.
440  bool isMacOSX() const {
441  return getOS() == Triple::Darwin || getOS() == Triple::MacOSX;
442  }
443 
444  /// Is this an iOS triple.
445  /// Note: This identifies tvOS as a variant of iOS. If that ever
446  /// changes, i.e., if the two operating systems diverge or their version
447  /// numbers get out of sync, that will need to be changed.
448  /// watchOS has completely different version numbers so it is not included.
449  bool isiOS() const {
450  return getOS() == Triple::IOS || isTvOS();
451  }
452 
453  /// Is this an Apple tvOS triple.
454  bool isTvOS() const {
455  return getOS() == Triple::TvOS;
456  }
457 
458  /// Is this an Apple watchOS triple.
459  bool isWatchOS() const {
460  return getOS() == Triple::WatchOS;
461  }
462 
463  bool isWatchABI() const {
465  }
466 
467  /// isOSDarwin - Is this a "Darwin" OS (OS X, iOS, or watchOS).
468  bool isOSDarwin() const {
469  return isMacOSX() || isiOS() || isWatchOS();
470  }
471 
472  bool isSimulatorEnvironment() const {
473  return getEnvironment() == Triple::Simulator;
474  }
475 
476  bool isOSNetBSD() const {
477  return getOS() == Triple::NetBSD;
478  }
479 
480  bool isOSOpenBSD() const {
481  return getOS() == Triple::OpenBSD;
482  }
483 
484  bool isOSFreeBSD() const {
485  return getOS() == Triple::FreeBSD;
486  }
487 
488  bool isOSFuchsia() const {
489  return getOS() == Triple::Fuchsia;
490  }
491 
492  bool isOSDragonFly() const { return getOS() == Triple::DragonFly; }
493 
494  bool isOSSolaris() const {
495  return getOS() == Triple::Solaris;
496  }
497 
498  bool isOSIAMCU() const {
499  return getOS() == Triple::ELFIAMCU;
500  }
501 
502  bool isOSUnknown() const { return getOS() == Triple::UnknownOS; }
503 
504  bool isGNUEnvironment() const {
506  return Env == Triple::GNU || Env == Triple::GNUABIN32 ||
507  Env == Triple::GNUABI64 || Env == Triple::GNUEABI ||
508  Env == Triple::GNUEABIHF || Env == Triple::GNUX32;
509  }
510 
511  bool isOSContiki() const {
512  return getOS() == Triple::Contiki;
513  }
514 
515  /// Tests whether the OS is Haiku.
516  bool isOSHaiku() const {
517  return getOS() == Triple::Haiku;
518  }
519 
520  /// Checks if the environment could be MSVC.
522  return getOS() == Triple::Win32 &&
525  }
526 
527  /// Checks if the environment is MSVC.
529  return getOS() == Triple::Win32 && getEnvironment() == Triple::MSVC;
530  }
531 
534  }
535 
538  }
539 
541  return getOS() == Triple::Win32 && getEnvironment() == Triple::Cygnus;
542  }
543 
544  bool isWindowsGNUEnvironment() const {
545  return getOS() == Triple::Win32 && getEnvironment() == Triple::GNU;
546  }
547 
548  /// Tests for either Cygwin or MinGW OS
549  bool isOSCygMing() const {
551  }
552 
553  /// Is this a "Windows" OS targeting a "MSVCRT.dll" environment.
554  bool isOSMSVCRT() const {
557  }
558 
559  /// Tests whether the OS is Windows.
560  bool isOSWindows() const {
561  return getOS() == Triple::Win32;
562  }
563 
564  /// Tests whether the OS is NaCl (Native Client)
565  bool isOSNaCl() const {
566  return getOS() == Triple::NaCl;
567  }
568 
569  /// Tests whether the OS is Linux.
570  bool isOSLinux() const {
571  return getOS() == Triple::Linux;
572  }
573 
574  /// Tests whether the OS is kFreeBSD.
575  bool isOSKFreeBSD() const {
576  return getOS() == Triple::KFreeBSD;
577  }
578 
579  /// Tests whether the OS uses glibc.
580  bool isOSGlibc() const {
581  return (getOS() == Triple::Linux || getOS() == Triple::KFreeBSD) &&
582  !isAndroid();
583  }
584 
585  /// Tests whether the OS uses the ELF binary format.
586  bool isOSBinFormatELF() const {
587  return getObjectFormat() == Triple::ELF;
588  }
589 
590  /// Tests whether the OS uses the COFF binary format.
591  bool isOSBinFormatCOFF() const {
592  return getObjectFormat() == Triple::COFF;
593  }
594 
595  /// Tests whether the environment is MachO.
596  bool isOSBinFormatMachO() const {
597  return getObjectFormat() == Triple::MachO;
598  }
599 
600  /// Tests whether the OS uses the Wasm binary format.
601  bool isOSBinFormatWasm() const {
602  return getObjectFormat() == Triple::Wasm;
603  }
604 
605  /// Tests whether the target is the PS4 CPU
606  bool isPS4CPU() const {
607  return getArch() == Triple::x86_64 &&
608  getVendor() == Triple::SCEI &&
609  getOS() == Triple::PS4;
610  }
611 
612  /// Tests whether the target is the PS4 platform
613  bool isPS4() const {
614  return getVendor() == Triple::SCEI &&
615  getOS() == Triple::PS4;
616  }
617 
618  /// Tests whether the target is Android
619  bool isAndroid() const { return getEnvironment() == Triple::Android; }
620 
621  bool isAndroidVersionLT(unsigned Major) const {
622  assert(isAndroid() && "Not an Android triple!");
623 
624  unsigned Env[3];
625  getEnvironmentVersion(Env[0], Env[1], Env[2]);
626 
627  // 64-bit targets did not exist before API level 21 (Lollipop).
628  if (isArch64Bit() && Env[0] < 21)
629  Env[0] = 21;
630 
631  return Env[0] < Major;
632  }
633 
634  /// Tests whether the environment is musl-libc
635  bool isMusl() const {
636  return getEnvironment() == Triple::Musl ||
639  }
640 
641  /// Tests whether the target is NVPTX (32- or 64-bit).
642  bool isNVPTX() const {
643  return getArch() == Triple::nvptx || getArch() == Triple::nvptx64;
644  }
645 
646  /// Tests whether the target is Thumb (little and big endian).
647  bool isThumb() const {
648  return getArch() == Triple::thumb || getArch() == Triple::thumbeb;
649  }
650 
651  /// Tests whether the target is ARM (little and big endian).
652  bool isARM() const {
653  return getArch() == Triple::arm || getArch() == Triple::armeb;
654  }
655 
656  /// Tests whether the target is AArch64 (little and big endian).
657  bool isAArch64() const {
659  }
660 
661  /// Tests whether the target supports comdat
662  bool supportsCOMDAT() const {
663  return !isOSBinFormatMachO();
664  }
665 
666  /// Tests whether the target uses emulated TLS as default.
667  bool hasDefaultEmulatedTLS() const {
669  }
670 
671  /// @}
672  /// @name Mutators
673  /// @{
674 
675  /// setArch - Set the architecture (first) component of the triple
676  /// to a known type.
677  void setArch(ArchType Kind);
678 
679  /// setVendor - Set the vendor (second) component of the triple to a
680  /// known type.
681  void setVendor(VendorType Kind);
682 
683  /// setOS - Set the operating system (third) component of the triple
684  /// to a known type.
685  void setOS(OSType Kind);
686 
687  /// setEnvironment - Set the environment (fourth) component of the triple
688  /// to a known type.
689  void setEnvironment(EnvironmentType Kind);
690 
691  /// setObjectFormat - Set the object file format
693 
694  /// setTriple - Set all components to the new triple \p Str.
695  void setTriple(const Twine &Str);
696 
697  /// setArchName - Set the architecture (first) component of the
698  /// triple by name.
699  void setArchName(StringRef Str);
700 
701  /// setVendorName - Set the vendor (second) component of the triple
702  /// by name.
703  void setVendorName(StringRef Str);
704 
705  /// setOSName - Set the operating system (third) component of the
706  /// triple by name.
707  void setOSName(StringRef Str);
708 
709  /// setEnvironmentName - Set the optional environment (fourth)
710  /// component of the triple by name.
711  void setEnvironmentName(StringRef Str);
712 
713  /// setOSAndEnvironmentName - Set the operating system and optional
714  /// environment components with a single string.
716 
717  /// @}
718  /// @name Helpers to build variants of a particular triple.
719  /// @{
720 
721  /// Form a triple with a 32-bit variant of the current architecture.
722  ///
723  /// This can be used to move across "families" of architectures where useful.
724  ///
725  /// \returns A new triple with a 32-bit architecture or an unknown
726  /// architecture if no such variant can be found.
728 
729  /// Form a triple with a 64-bit variant of the current architecture.
730  ///
731  /// This can be used to move across "families" of architectures where useful.
732  ///
733  /// \returns A new triple with a 64-bit architecture or an unknown
734  /// architecture if no such variant can be found.
736 
737  /// Form a triple with a big endian variant of the current architecture.
738  ///
739  /// This can be used to move across "families" of architectures where useful.
740  ///
741  /// \returns A new triple with a big endian architecture or an unknown
742  /// architecture if no such variant can be found.
744 
745  /// Form a triple with a little endian variant of the current architecture.
746  ///
747  /// This can be used to move across "families" of architectures where useful.
748  ///
749  /// \returns A new triple with a little endian architecture or an unknown
750  /// architecture if no such variant can be found.
752 
753  /// Get the (LLVM) name of the minimum ARM CPU for the arch we are targeting.
754  ///
755  /// \param Arch the architecture name (e.g., "armv7s"). If it is an empty
756  /// string then the triple's arch name is used.
758 
759  /// Tests whether the target triple is little endian.
760  ///
761  /// \returns true if the triple is little endian, false otherwise.
762  bool isLittleEndian() const;
763 
764  /// Test whether target triples are compatible.
765  bool isCompatibleWith(const Triple &Other) const;
766 
767  /// Merge target triples.
768  std::string merge(const Triple &Other) const;
769 
770  /// @}
771  /// @name Static helpers for IDs.
772  /// @{
773 
774  /// getArchTypeName - Get the canonical name for the \p Kind architecture.
775  static StringRef getArchTypeName(ArchType Kind);
776 
777  /// getArchTypePrefix - Get the "prefix" canonical name for the \p Kind
778  /// architecture. This is the prefix used by the architecture specific
779  /// builtins, and is suitable for passing to \see
780  /// Intrinsic::getIntrinsicForGCCBuiltin().
781  ///
782  /// \return - The architecture prefix, or 0 if none is defined.
783  static StringRef getArchTypePrefix(ArchType Kind);
784 
785  /// getVendorTypeName - Get the canonical name for the \p Kind vendor.
787 
788  /// getOSTypeName - Get the canonical name for the \p Kind operating system.
789  static StringRef getOSTypeName(OSType Kind);
790 
791  /// getEnvironmentTypeName - Get the canonical name for the \p Kind
792  /// environment.
794 
795  /// @}
796  /// @name Static helpers for converting alternate architecture names.
797  /// @{
798 
799  /// getArchTypeForLLVMName - The canonical type for the given LLVM
800  /// architecture name (e.g., "x86").
802 
803  /// @}
804 };
805 
806 } // End llvm namespace
807 
808 
809 #endif
bool isOSDarwin() const
isOSDarwin - Is this a "Darwin" OS (OS X, iOS, or watchOS).
Definition: Triple.h:468
bool isOSHaiku() const
Tests whether the OS is Haiku.
Definition: Triple.h:516
void getiOSVersion(unsigned &Major, unsigned &Minor, unsigned &Micro) const
getiOSVersion - Parse the version number as with getOSVersion.
Definition: Triple.cpp:1063
bool isOSMSVCRT() const
Is this a "Windows" OS targeting a "MSVCRT.dll" environment.
Definition: Triple.h:554
bool supportsCOMDAT() const
Tests whether the target supports comdat.
Definition: Triple.h:662
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:440
bool isOSBinFormatELF() const
Tests whether the OS uses the ELF binary format.
Definition: Triple.h:586
OSType getOS() const
getOS - Get the parsed operating system type of this triple.
Definition: Triple.h:292
void setVendor(VendorType Kind)
setVendor - Set the vendor (second) component of the triple to a known type.
Definition: Triple.cpp:1121
bool isArch16Bit() const
Test whether the architecture is 16-bit.
Definition: Triple.cpp:1249
bool isOSNaCl() const
Tests whether the OS is NaCl (Native Client)
Definition: Triple.h:565
bool isWatchOS() const
Is this an Apple watchOS triple.
Definition: Triple.h:459
bool hasEnvironment() const
hasEnvironment - Does this triple have the optional environment (fourth) component?
Definition: Triple.h:296
void setOS(OSType Kind)
setOS - Set the operating system (third) component of the triple to a known type. ...
Definition: Triple.cpp:1125
bool isOSFuchsia() const
Definition: Triple.h:488
void setEnvironment(EnvironmentType Kind)
setEnvironment - Set the environment (fourth) component of the triple to a known type.
Definition: Triple.cpp:1129
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:999
bool isWindowsCygwinEnvironment() const
Definition: Triple.h:540
StringRef getARMCPUForArch(StringRef Arch=StringRef()) const
Get the (LLVM) name of the minimum ARM CPU for the arch we are targeting.
Definition: Triple.cpp:1545
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:657
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:528
bool hasDefaultEmulatedTLS() const
Tests whether the target uses emulated TLS as default.
Definition: Triple.h:667
void setVendorName(StringRef Str)
setVendorName - Set the vendor (second) component of the triple by name.
Definition: Triple.cpp:1156
bool isOSSolaris() const
Definition: Triple.h:494
ELFYAML::ELF_STO Other
Definition: ELFYAML.cpp:770
Triple()
Default constructor is the same as an empty string and leaves all triple fields unknown.
Definition: Triple.h:245
SubArchType getSubArch() const
getSubArch - get the parsed subarchitecture type for this triple.
Definition: Triple.h:286
ArchType getArch() const
getArch - Get the parsed architecture type of this triple.
Definition: Triple.h:283
bool isArch32Bit() const
Test whether the architecture is 32-bit.
Definition: Triple.cpp:1245
bool isiOS() const
Is this an iOS triple.
Definition: Triple.h:449
bool isPS4() const
Tests whether the target is the PS4 platform.
Definition: Triple.h:613
bool isOSNetBSD() const
Definition: Triple.h:476
bool isWindowsItaniumEnvironment() const
Definition: Triple.h:536
bool isWindowsGNUEnvironment() const
Definition: Triple.h:544
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:532
const std::string & str() const
Definition: Triple.h:352
bool isOSDragonFly() const
Definition: Triple.h:492
bool isOSWindows() const
Tests whether the OS is Windows.
Definition: Triple.h:560
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:1009
bool isMusl() const
Tests whether the environment is musl-libc.
Definition: Triple.h:635
void setObjectFormat(ObjectFormatType Kind)
setObjectFormat - Set the object file format
Definition: Triple.cpp:1137
StringRef getOSAndEnvironmentName() const
getOSAndEnvironmentName - Get the operating system and optional environment components as a single st...
Definition: Triple.cpp:959
llvm::Triple get32BitArchVariant() const
Form a triple with a 32-bit variant of the current architecture.
Definition: Triple.cpp:1253
bool isLittleEndian() const
Tests whether the target triple is little endian.
Definition: Triple.cpp:1468
VendorType getVendor() const
getVendor - Get the parsed vendor type of this triple.
Definition: Triple.h:289
bool isOSBinFormatCOFF() const
Tests whether the OS uses the COFF binary format.
Definition: Triple.h:591
void setEnvironmentName(StringRef Str)
setEnvironmentName - Set the optional environment (fourth) component of the triple by name...
Definition: Triple.cpp:1168
bool isOSOpenBSD() const
Definition: Triple.h:480
llvm::Triple getBigEndianArchVariant() const
Form a triple with a big endian variant of the current architecture.
Definition: Triple.cpp:1381
bool isWatchABI() const
Definition: Triple.h:463
void setTriple(const Twine &Str)
setTriple - Set all components to the new triple Str.
Definition: Triple.cpp:1113
bool operator==(const Triple &Other) const
Definition: Triple.h:254
bool isCompatibleWith(const Triple &Other) const
Test whether target triples are compatible.
Definition: Triple.cpp:1512
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:261
bool isAndroidVersionLT(unsigned Major) const
Definition: Triple.h:621
bool isPS4CPU() const
Tests whether the target is the PS4 CPU.
Definition: Triple.h:606
void getWatchOSVersion(unsigned &Major, unsigned &Minor, unsigned &Micro) const
getWatchOSVersion - Parse the version number as with getOSVersion.
Definition: Triple.cpp:1089
bool isOSKFreeBSD() const
Tests whether the OS is kFreeBSD.
Definition: Triple.h:575
void setArchName(StringRef Str)
setArchName - Set the architecture (first) component of the triple by name.
Definition: Triple.cpp:1145
bool isOSBinFormatMachO() const
Tests whether the environment is MachO.
Definition: Triple.h:596
void setOSName(StringRef Str)
setOSName - Set the operating system (third) component of the triple by name.
Definition: Triple.cpp:1160
unsigned getOSMajorVersion() const
getOSMajorVersion - Return just the major version number, this is specialized because it is a common ...
Definition: Triple.h:325
bool isOSUnknown() const
Definition: Triple.h:502
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
bool isOSIAMCU() const
Definition: Triple.h:498
StringRef getArchName() const
getArchName - Get the architecture (first) component of the triple.
Definition: Triple.cpp:938
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:1022
bool isOSContiki() const
Definition: Triple.h:511
static ArchType getArchTypeForLLVMName(StringRef Str)
getArchTypeForLLVMName - The canonical type for the given LLVM architecture name (e.g., "x86").
Definition: Triple.cpp:257
StringRef getOSName() const
getOSName - Get the operating system (third) component of the triple.
Definition: Triple.cpp:947
bool isOSLinux() const
Tests whether the OS is Linux.
Definition: Triple.h:570
EnvironmentType getEnvironment() const
getEnvironment - Get the parsed environment type of this triple.
Definition: Triple.h:301
std::string merge(const Triple &Other) const
Merge target triples.
Definition: Triple.cpp:1536
bool isOSVersionLT(const Triple &Other) const
Definition: Triple.h:416
bool isOSFreeBSD() const
Definition: Triple.h:484
std::string normalize() const
Return the normalized form of this triple&#39;s string.
Definition: Triple.h:276
StringRef getEnvironmentName() const
getEnvironmentName - Get the optional environment (fourth) component of the triple, or "" if empty.
Definition: Triple.cpp:953
bool isOSCygMing() const
Tests for either Cygwin or MinGW OS.
Definition: Triple.h:549
const std::string & getTriple() const
Definition: Triple.h:354
bool isOSGlibc() const
Tests whether the OS uses glibc.
Definition: Triple.h:580
llvm::Triple getLittleEndianArchVariant() const
Form a triple with a little endian variant of the current architecture.
Definition: Triple.cpp:1436
bool isThumb() const
Tests whether the target is Thumb (little and big endian).
Definition: Triple.h:647
ObjectFormatType getObjectFormat() const
getFormat - Get the object format for this triple.
Definition: Triple.h:313
void setOSAndEnvironmentName(StringRef Str)
setOSAndEnvironmentName - Set the operating system and optional environment components with a single ...
Definition: Triple.cpp:1173
bool isArch64Bit() const
Test whether the architecture is 64-bit.
Definition: Triple.cpp:1241
bool isGNUEnvironment() const
Definition: Triple.h:504
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:425
StringRef getVendorName() const
getVendorName - Get the vendor (second) component of the triple.
Definition: Triple.cpp:942
const unsigned Kind
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
bool isSimulatorEnvironment() const
Definition: Triple.h:472
ObjectFormatType
Definition: Triple.h:209
bool isTvOS() const
Is this an Apple tvOS triple.
Definition: Triple.h:454
bool isAndroid() const
Tests whether the target is Android.
Definition: Triple.h:619
llvm::Triple get64BitArchVariant() const
Form a triple with a 64-bit variant of the current architecture.
Definition: Triple.cpp:1317
bool isNVPTX() const
Tests whether the target is NVPTX (32- or 64-bit).
Definition: Triple.h:642
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:401
bool isOSBinFormatWasm() const
Tests whether the OS uses the Wasm binary format.
Definition: Triple.h:601
bool isWindowsMSVCEnvironment() const
Checks if the environment could be MSVC.
Definition: Triple.h:521
bool isARM() const
Tests whether the target is ARM (little and big endian).
Definition: Triple.h:652
void setArch(ArchType Kind)
setArch - Set the architecture (first) component of the triple to a known type.
Definition: Triple.cpp:1117
static StringRef getEnvironmentTypeName(EnvironmentType Kind)
getEnvironmentTypeName - Get the canonical name for the Kind environment.
Definition: Triple.cpp:216