LLVM  3.7.0
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  bpfel, // eBPF or extended BPF or 64-bit BPF (little endian)
54  bpfeb, // eBPF or extended BPF or 64-bit BPF (big endian)
55  hexagon, // Hexagon: hexagon
56  mips, // MIPS: mips, mipsallegrex
57  mipsel, // MIPSEL: mipsel, mipsallegrexel
58  mips64, // MIPS64: mips64
59  mips64el, // MIPS64EL: mips64el
60  msp430, // MSP430: msp430
61  ppc, // PPC: powerpc
62  ppc64, // PPC64: powerpc64, ppu
63  ppc64le, // PPC64LE: powerpc64le
64  r600, // R600: AMD GPUs HD2XXX - HD6XXX
65  amdgcn, // AMDGCN: AMD GCN GPUs
66  sparc, // Sparc: sparc
67  sparcv9, // Sparcv9: Sparcv9
68  sparcel, // Sparc: (endianness = little). NB: 'Sparcle' is a CPU variant
69  systemz, // SystemZ: s390x
70  tce, // TCE (http://tce.cs.tut.fi/): tce
71  thumb, // Thumb (little endian): thumb, thumbv.*
72  thumbeb, // Thumb (big endian): thumbeb
73  x86, // X86: i[3-9]86
74  x86_64, // X86-64: amd64, x86_64
75  xcore, // XCore: xcore
76  nvptx, // NVPTX: 32-bit
77  nvptx64, // NVPTX: 64-bit
78  le32, // le32: generic little-endian 32-bit CPU (PNaCl / Emscripten)
79  le64, // le64: generic little-endian 64-bit CPU (PNaCl / Emscripten)
80  amdil, // AMDIL
81  amdil64, // AMDIL with 64-bit pointers
82  hsail, // AMD HSAIL
83  hsail64, // AMD HSAIL with 64-bit pointers
84  spir, // SPIR: standard portable IR for OpenCL 32-bit version
85  spir64, // SPIR: standard portable IR for OpenCL 64-bit version
86  kalimba, // Kalimba: generic kalimba
87  shave, // SHAVE: Movidius vector VLIW processors
88  wasm32, // WebAssembly with 32-bit pointers
89  wasm64, // WebAssembly with 64-bit pointers
91  };
92  enum SubArchType {
94 
108 
112  };
113  enum VendorType {
115 
117  PC,
128  };
129  enum OSType {
131 
139  Lv2, // PS3
148  NaCl, // Native Client
149  CNK, // BG/P Compute-Node Kernel
152  CUDA, // NVIDIA CUDA
153  NVCL, // NVIDIA OpenCL
154  AMDHSA, // AMD HSA Runtime
157  };
160 
169 
174  };
177 
181  };
182 
183 private:
184  std::string Data;
185 
186  /// The parsed arch type.
187  ArchType Arch;
188 
189  /// The parsed subarchitecture type.
190  SubArchType SubArch;
191 
192  /// The parsed vendor type.
193  VendorType Vendor;
194 
195  /// The parsed OS type.
196  OSType OS;
197 
198  /// The parsed Environment type.
199  EnvironmentType Environment;
200 
201  /// The object format type.
202  ObjectFormatType ObjectFormat;
203 
204 public:
205  /// @name Constructors
206  /// @{
207 
208  /// \brief Default constructor is the same as an empty string and leaves all
209  /// triple fields unknown.
210  Triple() : Data(), Arch(), Vendor(), OS(), Environment(), ObjectFormat() {}
211 
212  explicit Triple(const Twine &Str);
213  Triple(const Twine &ArchStr, const Twine &VendorStr, const Twine &OSStr);
214  Triple(const Twine &ArchStr, const Twine &VendorStr, const Twine &OSStr,
215  const Twine &EnvironmentStr);
216 
217  bool operator==(const Triple &Other) const {
218  return Arch == Other.Arch && SubArch == Other.SubArch &&
219  Vendor == Other.Vendor && OS == Other.OS &&
220  Environment == Other.Environment &&
221  ObjectFormat == Other.ObjectFormat;
222  }
223 
224  /// @}
225  /// @name Normalization
226  /// @{
227 
228  /// normalize - Turn an arbitrary machine specification into the canonical
229  /// triple form (or something sensible that the Triple class understands if
230  /// nothing better can reasonably be done). In particular, it handles the
231  /// common case in which otherwise valid components are in the wrong order.
232  static std::string normalize(StringRef Str);
233 
234  /// \brief Return the normalized form of this triple's string.
235  std::string normalize() const { return normalize(Data); }
236 
237  /// @}
238  /// @name Typed Component Access
239  /// @{
240 
241  /// getArch - Get the parsed architecture type of this triple.
242  ArchType getArch() const { return Arch; }
243 
244  /// getSubArch - get the parsed subarchitecture type for this triple.
245  SubArchType getSubArch() const { return SubArch; }
246 
247  /// getVendor - Get the parsed vendor type of this triple.
248  VendorType getVendor() const { return Vendor; }
249 
250  /// getOS - Get the parsed operating system type of this triple.
251  OSType getOS() const { return OS; }
252 
253  /// hasEnvironment - Does this triple have the optional environment
254  /// (fourth) component?
255  bool hasEnvironment() const {
256  return getEnvironmentName() != "";
257  }
258 
259  /// getEnvironment - Get the parsed environment type of this triple.
260  EnvironmentType getEnvironment() const { return Environment; }
261 
262  /// \brief Parse the version number from the OS name component of the
263  /// triple, if present.
264  ///
265  /// For example, "fooos1.2.3" would return (1, 2, 3).
266  ///
267  /// If an entry is not defined, it will be returned as 0.
268  void getEnvironmentVersion(unsigned &Major, unsigned &Minor,
269  unsigned &Micro) const;
270 
271  /// getFormat - Get the object format for this triple.
272  ObjectFormatType getObjectFormat() const { return ObjectFormat; }
273 
274  /// getOSVersion - Parse the version number from the OS name component of the
275  /// triple, if present.
276  ///
277  /// For example, "fooos1.2.3" would return (1, 2, 3).
278  ///
279  /// If an entry is not defined, it will be returned as 0.
280  void getOSVersion(unsigned &Major, unsigned &Minor, unsigned &Micro) const;
281 
282  /// getOSMajorVersion - Return just the major version number, this is
283  /// specialized because it is a common query.
284  unsigned getOSMajorVersion() const {
285  unsigned Maj, Min, Micro;
286  getOSVersion(Maj, Min, Micro);
287  return Maj;
288  }
289 
290  /// getMacOSXVersion - Parse the version number as with getOSVersion and then
291  /// translate generic "darwin" versions to the corresponding OS X versions.
292  /// This may also be called with IOS triples but the OS X version number is
293  /// just set to a constant 10.4.0 in that case. Returns true if successful.
294  bool getMacOSXVersion(unsigned &Major, unsigned &Minor,
295  unsigned &Micro) const;
296 
297  /// getiOSVersion - Parse the version number as with getOSVersion. This should
298  /// only be called with IOS triples.
299  void getiOSVersion(unsigned &Major, unsigned &Minor,
300  unsigned &Micro) const;
301 
302  /// @}
303  /// @name Direct Component Access
304  /// @{
305 
306  const std::string &str() const { return Data; }
307 
308  const std::string &getTriple() const { return Data; }
309 
310  /// getArchName - Get the architecture (first) component of the
311  /// triple.
312  StringRef getArchName() const;
313 
314  /// getVendorName - Get the vendor (second) component of the triple.
315  StringRef getVendorName() const;
316 
317  /// getOSName - Get the operating system (third) component of the
318  /// triple.
319  StringRef getOSName() const;
320 
321  /// getEnvironmentName - Get the optional environment (fourth)
322  /// component of the triple, or "" if empty.
324 
325  /// getOSAndEnvironmentName - Get the operating system and optional
326  /// environment components as a single string (separated by a '-'
327  /// if the environment component is present).
329 
330  /// @}
331  /// @name Convenience Predicates
332  /// @{
333 
334  /// \brief Test whether the architecture is 64-bit
335  ///
336  /// Note that this tests for 64-bit pointer width, and nothing else. Note
337  /// that we intentionally expose only three predicates, 64-bit, 32-bit, and
338  /// 16-bit. The inner details of pointer width for particular architectures
339  /// is not summed up in the triple, and so only a coarse grained predicate
340  /// system is provided.
341  bool isArch64Bit() const;
342 
343  /// \brief Test whether the architecture is 32-bit
344  ///
345  /// Note that this tests for 32-bit pointer width, and nothing else.
346  bool isArch32Bit() const;
347 
348  /// \brief Test whether the architecture is 16-bit
349  ///
350  /// Note that this tests for 16-bit pointer width, and nothing else.
351  bool isArch16Bit() const;
352 
353  /// isOSVersionLT - Helper function for doing comparisons against version
354  /// numbers included in the target triple.
355  bool isOSVersionLT(unsigned Major, unsigned Minor = 0,
356  unsigned Micro = 0) const {
357  unsigned LHS[3];
358  getOSVersion(LHS[0], LHS[1], LHS[2]);
359 
360  if (LHS[0] != Major)
361  return LHS[0] < Major;
362  if (LHS[1] != Minor)
363  return LHS[1] < Minor;
364  if (LHS[2] != Micro)
365  return LHS[1] < Micro;
366 
367  return false;
368  }
369 
370  bool isOSVersionLT(const Triple &Other) const {
371  unsigned RHS[3];
372  Other.getOSVersion(RHS[0], RHS[1], RHS[2]);
373  return isOSVersionLT(RHS[0], RHS[1], RHS[2]);
374  }
375 
376  /// isMacOSXVersionLT - Comparison function for checking OS X version
377  /// compatibility, which handles supporting skewed version numbering schemes
378  /// used by the "darwin" triples.
379  unsigned isMacOSXVersionLT(unsigned Major, unsigned Minor = 0,
380  unsigned Micro = 0) const {
381  assert(isMacOSX() && "Not an OS X triple!");
382 
383  // If this is OS X, expect a sane version number.
384  if (getOS() == Triple::MacOSX)
385  return isOSVersionLT(Major, Minor, Micro);
386 
387  // Otherwise, compare to the "Darwin" number.
388  assert(Major == 10 && "Unexpected major version");
389  return isOSVersionLT(Minor + 4, Micro, 0);
390  }
391 
392  /// isMacOSX - Is this a Mac OS X triple. For legacy reasons, we support both
393  /// "darwin" and "osx" as OS X triples.
394  bool isMacOSX() const {
395  return getOS() == Triple::Darwin || getOS() == Triple::MacOSX;
396  }
397 
398  /// Is this an iOS triple.
399  bool isiOS() const {
400  return getOS() == Triple::IOS;
401  }
402 
403  /// isOSDarwin - Is this a "Darwin" OS (OS X or iOS).
404  bool isOSDarwin() const {
405  return isMacOSX() || isiOS();
406  }
407 
408  bool isOSNetBSD() const {
409  return getOS() == Triple::NetBSD;
410  }
411 
412  bool isOSOpenBSD() const {
413  return getOS() == Triple::OpenBSD;
414  }
415 
416  bool isOSFreeBSD() const {
417  return getOS() == Triple::FreeBSD;
418  }
419 
420  bool isOSDragonFly() const { return getOS() == Triple::DragonFly; }
421 
422  bool isOSSolaris() const {
423  return getOS() == Triple::Solaris;
424  }
425 
426  bool isOSBitrig() const {
427  return getOS() == Triple::Bitrig;
428  }
429 
431  return getOS() == Triple::Win32 &&
434  }
435 
437  return getOS() == Triple::Win32 && getEnvironment() == Triple::MSVC;
438  }
439 
442  }
443 
445  return getOS() == Triple::Win32 && getEnvironment() == Triple::Cygnus;
446  }
447 
448  bool isWindowsGNUEnvironment() const {
449  return getOS() == Triple::Win32 && getEnvironment() == Triple::GNU;
450  }
451 
452  /// \brief Tests for either Cygwin or MinGW OS
453  bool isOSCygMing() const {
455  }
456 
457  /// \brief Is this a "Windows" OS targeting a "MSVCRT.dll" environment.
458  bool isOSMSVCRT() const {
461  }
462 
463  /// \brief Tests whether the OS is Windows.
464  bool isOSWindows() const {
465  return getOS() == Triple::Win32;
466  }
467 
468  /// \brief Tests whether the OS is NaCl (Native Client)
469  bool isOSNaCl() const {
470  return getOS() == Triple::NaCl;
471  }
472 
473  /// \brief Tests whether the OS is Linux.
474  bool isOSLinux() const {
475  return getOS() == Triple::Linux;
476  }
477 
478  /// \brief Tests whether the OS uses the ELF binary format.
479  bool isOSBinFormatELF() const {
480  return getObjectFormat() == Triple::ELF;
481  }
482 
483  /// \brief Tests whether the OS uses the COFF binary format.
484  bool isOSBinFormatCOFF() const {
485  return getObjectFormat() == Triple::COFF;
486  }
487 
488  /// \brief Tests whether the environment is MachO.
489  bool isOSBinFormatMachO() const {
490  return getObjectFormat() == Triple::MachO;
491  }
492 
493  /// \brief Tests whether the target is the PS4 CPU
494  bool isPS4CPU() const {
495  return getArch() == Triple::x86_64 &&
496  getVendor() == Triple::SCEI &&
497  getOS() == Triple::PS4;
498  }
499 
500  /// \brief Tests whether the target is the PS4 platform
501  bool isPS4() const {
502  return getVendor() == Triple::SCEI &&
503  getOS() == Triple::PS4;
504  }
505 
506  /// @}
507  /// @name Mutators
508  /// @{
509 
510  /// setArch - Set the architecture (first) component of the triple
511  /// to a known type.
512  void setArch(ArchType Kind);
513 
514  /// setVendor - Set the vendor (second) component of the triple to a
515  /// known type.
516  void setVendor(VendorType Kind);
517 
518  /// setOS - Set the operating system (third) component of the triple
519  /// to a known type.
520  void setOS(OSType Kind);
521 
522  /// setEnvironment - Set the environment (fourth) component of the triple
523  /// to a known type.
525 
526  /// setObjectFormat - Set the object file format
528 
529  /// setTriple - Set all components to the new triple \p Str.
530  void setTriple(const Twine &Str);
531 
532  /// setArchName - Set the architecture (first) component of the
533  /// triple by name.
534  void setArchName(StringRef Str);
535 
536  /// setVendorName - Set the vendor (second) component of the triple
537  /// by name.
538  void setVendorName(StringRef Str);
539 
540  /// setOSName - Set the operating system (third) component of the
541  /// triple by name.
542  void setOSName(StringRef Str);
543 
544  /// setEnvironmentName - Set the optional environment (fourth)
545  /// component of the triple by name.
546  void setEnvironmentName(StringRef Str);
547 
548  /// setOSAndEnvironmentName - Set the operating system and optional
549  /// environment components with a single string.
551 
552  /// @}
553  /// @name Helpers to build variants of a particular triple.
554  /// @{
555 
556  /// \brief Form a triple with a 32-bit variant of the current architecture.
557  ///
558  /// This can be used to move across "families" of architectures where useful.
559  ///
560  /// \returns A new triple with a 32-bit architecture or an unknown
561  /// architecture if no such variant can be found.
563 
564  /// \brief Form a triple with a 64-bit variant of the current architecture.
565  ///
566  /// This can be used to move across "families" of architectures where useful.
567  ///
568  /// \returns A new triple with a 64-bit architecture or an unknown
569  /// architecture if no such variant can be found.
571 
572  /// Form a triple with a big endian variant of the current architecture.
573  ///
574  /// This can be used to move across "families" of architectures where useful.
575  ///
576  /// \returns A new triple with a big endian architecture or an unknown
577  /// architecture if no such variant can be found.
579 
580  /// Form a triple with a little endian variant of the current architecture.
581  ///
582  /// This can be used to move across "families" of architectures where useful.
583  ///
584  /// \returns A new triple with a little endian architecture or an unknown
585  /// architecture if no such variant can be found.
587 
588  /// Get the (LLVM) name of the minimum ARM CPU for the arch we are targeting.
589  ///
590  /// \param Arch the architecture name (e.g., "armv7s"). If it is an empty
591  /// string then the triple's arch name is used.
592  const char* getARMCPUForArch(StringRef Arch = StringRef()) const;
593 
594  /// @}
595  /// @name Static helpers for IDs.
596  /// @{
597 
598  /// getArchTypeName - Get the canonical name for the \p Kind architecture.
599  static const char *getArchTypeName(ArchType Kind);
600 
601  /// getArchTypePrefix - Get the "prefix" canonical name for the \p Kind
602  /// architecture. This is the prefix used by the architecture specific
603  /// builtins, and is suitable for passing to \see
604  /// Intrinsic::getIntrinsicForGCCBuiltin().
605  ///
606  /// \return - The architecture prefix, or 0 if none is defined.
607  static const char *getArchTypePrefix(ArchType Kind);
608 
609  /// getVendorTypeName - Get the canonical name for the \p Kind vendor.
610  static const char *getVendorTypeName(VendorType Kind);
611 
612  /// getOSTypeName - Get the canonical name for the \p Kind operating system.
613  static const char *getOSTypeName(OSType Kind);
614 
615  /// getEnvironmentTypeName - Get the canonical name for the \p Kind
616  /// environment.
617  static const char *getEnvironmentTypeName(EnvironmentType Kind);
618 
619  /// @}
620  /// @name Static helpers for converting alternate architecture names.
621  /// @{
622 
623  /// getArchTypeForLLVMName - The canonical type for the given LLVM
624  /// architecture name (e.g., "x86").
626 
627  /// @}
628 };
629 
630 } // End llvm namespace
631 
632 
633 #endif
OSType getOS() const
getOS - Get the parsed operating system type of this triple.
Definition: Triple.h:251
unsigned getOSMajorVersion() const
getOSMajorVersion - Return just the major version number, this is specialized because it is a common ...
Definition: Triple.h:284
bool isOSBinFormatMachO() const
Tests whether the environment is MachO.
Definition: Triple.h:489
void setVendor(VendorType Kind)
setVendor - Set the vendor (second) component of the triple to a known type.
Definition: Triple.cpp:935
const std::string & str() const
Definition: Triple.h:306
void setOS(OSType Kind)
setOS - Set the operating system (third) component of the triple to a known type. ...
Definition: Triple.cpp:939
bool isOSDragonFly() const
Definition: Triple.h:420
void setEnvironment(EnvironmentType Kind)
setEnvironment - Set the environment (fourth) component of the triple to a known type.
Definition: Triple.cpp:943
llvm::Triple getBigEndianArchVariant() const
Form a triple with a big endian variant of the current architecture.
Definition: Triple.cpp:1168
bool isOSWindows() const
Tests whether the OS is Windows.
Definition: Triple.h:464
bool isOSCygMing() const
Tests for either Cygwin or MinGW OS.
Definition: Triple.h:453
bool isMacOSX() const
isMacOSX - Is this a Mac OS X triple.
Definition: Triple.h:394
bool isOSBitrig() const
Definition: Triple.h:426
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:79
ObjectFormatType getObjectFormat() const
getFormat - Get the object format for this triple.
Definition: Triple.h:272
void setVendorName(StringRef Str)
setVendorName - Set the vendor (second) component of the triple by name.
Definition: Triple.cpp:970
ELFYAML::ELF_STO Other
Definition: ELFYAML.cpp:591
Triple()
Default constructor is the same as an empty string and leaves all triple fields unknown.
Definition: Triple.h:210
bool isWindowsMSVCEnvironment() const
Definition: Triple.h:430
bool isArch64Bit() const
Test whether the architecture is 64-bit.
Definition: Triple.cpp:1046
unsigned 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:379
bool isOSLinux() const
Tests whether the OS is Linux.
Definition: Triple.h:474
bool isOSNaCl() const
Tests whether the OS is NaCl (Native Client)
Definition: Triple.h:469
StringRef getOSAndEnvironmentName() const
getOSAndEnvironmentName - Get the operating system and optional environment components as a single st...
Definition: Triple.cpp:804
ArchType getArch() const
getArch - Get the parsed architecture type of this triple.
Definition: Triple.h:242
SubArchType getSubArch() const
getSubArch - get the parsed subarchitecture type for this triple.
Definition: Triple.h:245
bool isOSNetBSD() const
Definition: Triple.h:408
llvm::Triple get32BitArchVariant() const
Form a triple with a 32-bit variant of the current architecture.
Definition: Triple.cpp:1058
bool isiOS() const
Is this an iOS triple.
Definition: Triple.h:399
StringRef getEnvironmentName() const
getEnvironmentName - Get the optional environment (fourth) component of the triple, or "" if empty.
Definition: Triple.cpp:798
void setObjectFormat(ObjectFormatType Kind)
setObjectFormat - Set the object file format
Definition: Triple.cpp:951
bool isWindowsGNUEnvironment() const
Definition: Triple.h:448
void setEnvironmentName(StringRef Str)
setEnvironmentName - Set the optional environment (fourth) component of the triple by name...
Definition: Triple.cpp:982
const std::string & getTriple() const
Definition: Triple.h:308
bool isOSOpenBSD() const
Definition: Triple.h:412
static const char * getVendorTypeName(VendorType Kind)
getVendorTypeName - Get the canonical name for the Kind vendor.
Definition: Triple.cpp:132
void setTriple(const Twine &Str)
setTriple - Set all components to the new triple Str.
Definition: Triple.cpp:927
void setArchName(StringRef Str)
setArchName - Set the architecture (first) component of the triple by name.
Definition: Triple.cpp:959
std::string normalize() const
Return the normalized form of this triple's string.
Definition: Triple.h:235
void getiOSVersion(unsigned &Major, unsigned &Minor, unsigned &Micro) const
getiOSVersion - Parse the version number as with getOSVersion.
Definition: Triple.cpp:904
bool isOSBinFormatCOFF() const
Tests whether the OS uses the COFF binary format.
Definition: Triple.h:484
void setOSName(StringRef Str)
setOSName - Set the operating system (third) component of the triple by name.
Definition: Triple.cpp:974
static const char * getArchTypePrefix(ArchType Kind)
getArchTypePrefix - Get the "prefix" canonical name for the Kind architecture.
Definition: Triple.cpp:70
bool isOSSolaris() const
Definition: Triple.h:422
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
bool isOSDarwin() const
isOSDarwin - Is this a "Darwin" OS (OS X or iOS).
Definition: Triple.h:404
static const char * getEnvironmentTypeName(EnvironmentType Kind)
getEnvironmentTypeName - Get the canonical name for the Kind environment.
Definition: Triple.cpp:185
llvm::Triple getLittleEndianArchVariant() const
Form a triple with a little endian variant of the current architecture.
Definition: Triple.cpp:1226
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:854
StringRef getOSName() const
getOSName - Get the operating system (third) component of the triple.
Definition: Triple.cpp:792
static ArchType getArchTypeForLLVMName(StringRef Str)
getArchTypeForLLVMName - The canonical type for the given LLVM architecture name (e.g., "x86").
Definition: Triple.cpp:219
static const char * getArchTypeName(ArchType Kind)
getArchTypeName - Get the canonical name for the Kind architecture.
Definition: Triple.cpp:20
bool isArch16Bit() const
Test whether the architecture is 16-bit.
Definition: Triple.cpp:1054
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:355
bool isOSBinFormatELF() const
Tests whether the OS uses the ELF binary format.
Definition: Triple.h:479
llvm::Triple get64BitArchVariant() const
Form a triple with a 64-bit variant of the current architecture.
Definition: Triple.cpp:1113
void setOSAndEnvironmentName(StringRef Str)
setOSAndEnvironmentName - Set the operating system and optional environment components with a single ...
Definition: Triple.cpp:987
bool isWindowsCygwinEnvironment() const
Definition: Triple.h:444
StringRef getArchName() const
getArchName - Get the architecture (first) component of the triple.
Definition: Triple.cpp:783
bool isOSMSVCRT() const
Is this a "Windows" OS targeting a "MSVCRT.dll" environment.
Definition: Triple.h:458
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:865
bool isPS4CPU() const
Tests whether the target is the PS4 CPU.
Definition: Triple.h:494
bool hasEnvironment() const
hasEnvironment - Does this triple have the optional environment (fourth) component?
Definition: Triple.h:255
bool isOSFreeBSD() const
Definition: Triple.h:416
bool isOSVersionLT(const Triple &Other) const
Definition: Triple.h:370
EnvironmentType getEnvironment() const
getEnvironment - Get the parsed environment type of this triple.
Definition: Triple.h:260
const char * getARMCPUForArch(StringRef Arch=StringRef()) const
Get the (LLVM) name of the minimum ARM CPU for the arch we are targeting.
Definition: Triple.cpp:1284
const ARM::ArchExtKind Kind
ObjectFormatType
Definition: Triple.h:175
bool isKnownWindowsMSVCEnvironment() const
Definition: Triple.h:436
bool isWindowsItaniumEnvironment() const
Definition: Triple.h:440
VendorType getVendor() const
getVendor - Get the parsed vendor type of this triple.
Definition: Triple.h:248
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:40
static const char * getOSTypeName(OSType Kind)
getOSTypeName - Get the canonical name for the Kind operating system.
Definition: Triple.cpp:152
bool isPS4() const
Tests whether the target is the PS4 platform.
Definition: Triple.h:501
bool isArch32Bit() const
Test whether the architecture is 32-bit.
Definition: Triple.cpp:1050
bool operator==(const Triple &Other) const
Definition: Triple.h:217
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:844
StringRef getVendorName() const
getVendorName - Get the vendor (second) component of the triple.
Definition: Triple.cpp:787
void setArch(ArchType Kind)
setArch - Set the architecture (first) component of the triple to a known type.
Definition: Triple.cpp:931