]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/include/llvm/ADT/Triple.h
Update llvm to release_39 branch r278877.
[FreeBSD/FreeBSD.git] / contrib / llvm / include / llvm / ADT / Triple.h
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 {
47     UnknownArch,
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     avr,            // AVR: Atmel AVR microcontroller
54     bpfel,          // eBPF or extended BPF or 64-bit BPF (little endian)
55     bpfeb,          // eBPF or extended BPF or 64-bit BPF (big endian)
56     hexagon,        // Hexagon: hexagon
57     mips,           // MIPS: mips, mipsallegrex
58     mipsel,         // MIPSEL: mipsel, mipsallegrexel
59     mips64,         // MIPS64: mips64
60     mips64el,       // MIPS64EL: mips64el
61     msp430,         // MSP430: msp430
62     ppc,            // PPC: powerpc
63     ppc64,          // PPC64: powerpc64, ppu
64     ppc64le,        // PPC64LE: powerpc64le
65     r600,           // R600: AMD GPUs HD2XXX - HD6XXX
66     amdgcn,         // AMDGCN: AMD GCN GPUs
67     sparc,          // Sparc: sparc
68     sparcv9,        // Sparcv9: Sparcv9
69     sparcel,        // Sparc: (endianness = little). NB: 'Sparcle' is a CPU variant
70     systemz,        // SystemZ: s390x
71     tce,            // TCE (http://tce.cs.tut.fi/): tce
72     thumb,          // Thumb (little endian): thumb, thumbv.*
73     thumbeb,        // Thumb (big endian): thumbeb
74     x86,            // X86: i[3-9]86
75     x86_64,         // X86-64: amd64, x86_64
76     xcore,          // XCore: xcore
77     nvptx,          // NVPTX: 32-bit
78     nvptx64,        // NVPTX: 64-bit
79     le32,           // le32: generic little-endian 32-bit CPU (PNaCl)
80     le64,           // le64: generic little-endian 64-bit CPU (PNaCl)
81     amdil,          // AMDIL
82     amdil64,        // AMDIL with 64-bit pointers
83     hsail,          // AMD HSAIL
84     hsail64,        // AMD HSAIL with 64-bit pointers
85     spir,           // SPIR: standard portable IR for OpenCL 32-bit version
86     spir64,         // SPIR: standard portable IR for OpenCL 64-bit version
87     kalimba,        // Kalimba: generic kalimba
88     shave,          // SHAVE: Movidius vector VLIW processors
89     lanai,          // Lanai: Lanai 32-bit
90     wasm32,         // WebAssembly with 32-bit pointers
91     wasm64,         // WebAssembly with 64-bit pointers
92     renderscript32, // 32-bit RenderScript
93     renderscript64, // 64-bit RenderScript
94     LastArchType = renderscript64
95   };
96   enum SubArchType {
97     NoSubArch,
98
99     ARMSubArch_v8_2a,
100     ARMSubArch_v8_1a,
101     ARMSubArch_v8,
102     ARMSubArch_v8m_baseline,
103     ARMSubArch_v8m_mainline,
104     ARMSubArch_v7,
105     ARMSubArch_v7em,
106     ARMSubArch_v7m,
107     ARMSubArch_v7s,
108     ARMSubArch_v7k,
109     ARMSubArch_v6,
110     ARMSubArch_v6m,
111     ARMSubArch_v6k,
112     ARMSubArch_v6t2,
113     ARMSubArch_v5,
114     ARMSubArch_v5te,
115     ARMSubArch_v4t,
116
117     KalimbaSubArch_v3,
118     KalimbaSubArch_v4,
119     KalimbaSubArch_v5
120   };
121   enum VendorType {
122     UnknownVendor,
123
124     Apple,
125     PC,
126     SCEI,
127     BGP,
128     BGQ,
129     Freescale,
130     IBM,
131     ImaginationTechnologies,
132     MipsTechnologies,
133     NVIDIA,
134     CSR,
135     Myriad,
136     AMD,
137     Mesa,
138     LastVendorType = Mesa
139   };
140   enum OSType {
141     UnknownOS,
142
143     CloudABI,
144     Darwin,
145     DragonFly,
146     FreeBSD,
147     IOS,
148     KFreeBSD,
149     Linux,
150     Lv2,        // PS3
151     MacOSX,
152     NetBSD,
153     OpenBSD,
154     Solaris,
155     Win32,
156     Haiku,
157     Minix,
158     RTEMS,
159     NaCl,       // Native Client
160     CNK,        // BG/P Compute-Node Kernel
161     Bitrig,
162     AIX,
163     CUDA,       // NVIDIA CUDA
164     NVCL,       // NVIDIA OpenCL
165     AMDHSA,     // AMD HSA Runtime
166     PS4,
167     ELFIAMCU,
168     TvOS,       // Apple tvOS
169     WatchOS,    // Apple watchOS
170     Mesa3D,
171     LastOSType = Mesa3D
172   };
173   enum EnvironmentType {
174     UnknownEnvironment,
175
176     GNU,
177     GNUABI64,
178     GNUEABI,
179     GNUEABIHF,
180     GNUX32,
181     CODE16,
182     EABI,
183     EABIHF,
184     Android,
185     Musl,
186     MuslEABI,
187     MuslEABIHF,
188
189     MSVC,
190     Itanium,
191     Cygnus,
192     AMDOpenCL,
193     CoreCLR,
194     LastEnvironmentType = CoreCLR
195   };
196   enum ObjectFormatType {
197     UnknownObjectFormat,
198
199     COFF,
200     ELF,
201     MachO,
202   };
203
204 private:
205   std::string Data;
206
207   /// The parsed arch type.
208   ArchType Arch;
209
210   /// The parsed subarchitecture type.
211   SubArchType SubArch;
212
213   /// The parsed vendor type.
214   VendorType Vendor;
215
216   /// The parsed OS type.
217   OSType OS;
218
219   /// The parsed Environment type.
220   EnvironmentType Environment;
221
222   /// The object format type.
223   ObjectFormatType ObjectFormat;
224
225 public:
226   /// @name Constructors
227   /// @{
228
229   /// Default constructor is the same as an empty string and leaves all
230   /// triple fields unknown.
231   Triple() : Data(), Arch(), Vendor(), OS(), Environment(), ObjectFormat() {}
232
233   explicit Triple(const Twine &Str);
234   Triple(const Twine &ArchStr, const Twine &VendorStr, const Twine &OSStr);
235   Triple(const Twine &ArchStr, const Twine &VendorStr, const Twine &OSStr,
236          const Twine &EnvironmentStr);
237
238   bool operator==(const Triple &Other) const {
239     return Arch == Other.Arch && SubArch == Other.SubArch &&
240            Vendor == Other.Vendor && OS == Other.OS &&
241            Environment == Other.Environment &&
242            ObjectFormat == Other.ObjectFormat;
243   }
244
245   /// @}
246   /// @name Normalization
247   /// @{
248
249   /// normalize - Turn an arbitrary machine specification into the canonical
250   /// triple form (or something sensible that the Triple class understands if
251   /// nothing better can reasonably be done).  In particular, it handles the
252   /// common case in which otherwise valid components are in the wrong order.
253   static std::string normalize(StringRef Str);
254
255   /// Return the normalized form of this triple's string.
256   std::string normalize() const { return normalize(Data); }
257
258   /// @}
259   /// @name Typed Component Access
260   /// @{
261
262   /// getArch - Get the parsed architecture type of this triple.
263   ArchType getArch() const { return Arch; }
264
265   /// getSubArch - get the parsed subarchitecture type for this triple.
266   SubArchType getSubArch() const { return SubArch; }
267
268   /// getVendor - Get the parsed vendor type of this triple.
269   VendorType getVendor() const { return Vendor; }
270
271   /// getOS - Get the parsed operating system type of this triple.
272   OSType getOS() const { return OS; }
273
274   /// hasEnvironment - Does this triple have the optional environment
275   /// (fourth) component?
276   bool hasEnvironment() const {
277     return getEnvironmentName() != "";
278   }
279
280   /// getEnvironment - Get the parsed environment type of this triple.
281   EnvironmentType getEnvironment() const { return Environment; }
282
283   /// Parse the version number from the OS name component of the
284   /// triple, if present.
285   ///
286   /// For example, "fooos1.2.3" would return (1, 2, 3).
287   ///
288   /// If an entry is not defined, it will be returned as 0.
289   void getEnvironmentVersion(unsigned &Major, unsigned &Minor,
290                              unsigned &Micro) const;
291
292   /// getFormat - Get the object format for this triple.
293   ObjectFormatType getObjectFormat() const { return ObjectFormat; }
294
295   /// getOSVersion - Parse the version number from the OS name component of the
296   /// triple, if present.
297   ///
298   /// For example, "fooos1.2.3" would return (1, 2, 3).
299   ///
300   /// If an entry is not defined, it will be returned as 0.
301   void getOSVersion(unsigned &Major, unsigned &Minor, unsigned &Micro) const;
302
303   /// getOSMajorVersion - Return just the major version number, this is
304   /// specialized because it is a common query.
305   unsigned getOSMajorVersion() const {
306     unsigned Maj, Min, Micro;
307     getOSVersion(Maj, Min, Micro);
308     return Maj;
309   }
310
311   /// getMacOSXVersion - Parse the version number as with getOSVersion and then
312   /// translate generic "darwin" versions to the corresponding OS X versions.
313   /// This may also be called with IOS triples but the OS X version number is
314   /// just set to a constant 10.4.0 in that case.  Returns true if successful.
315   bool getMacOSXVersion(unsigned &Major, unsigned &Minor,
316                         unsigned &Micro) const;
317
318   /// getiOSVersion - Parse the version number as with getOSVersion.  This should
319   /// only be called with IOS or generic triples.
320   void getiOSVersion(unsigned &Major, unsigned &Minor,
321                      unsigned &Micro) const;
322
323   /// getWatchOSVersion - Parse the version number as with getOSVersion.  This
324   /// should only be called with WatchOS or generic triples.
325   void getWatchOSVersion(unsigned &Major, unsigned &Minor,
326                          unsigned &Micro) const;
327
328   /// @}
329   /// @name Direct Component Access
330   /// @{
331
332   const std::string &str() const { return Data; }
333
334   const std::string &getTriple() const { return Data; }
335
336   /// getArchName - Get the architecture (first) component of the
337   /// triple.
338   StringRef getArchName() const;
339
340   /// getVendorName - Get the vendor (second) component of the triple.
341   StringRef getVendorName() const;
342
343   /// getOSName - Get the operating system (third) component of the
344   /// triple.
345   StringRef getOSName() const;
346
347   /// getEnvironmentName - Get the optional environment (fourth)
348   /// component of the triple, or "" if empty.
349   StringRef getEnvironmentName() const;
350
351   /// getOSAndEnvironmentName - Get the operating system and optional
352   /// environment components as a single string (separated by a '-'
353   /// if the environment component is present).
354   StringRef getOSAndEnvironmentName() const;
355
356   /// @}
357   /// @name Convenience Predicates
358   /// @{
359
360   /// Test whether the architecture is 64-bit
361   ///
362   /// Note that this tests for 64-bit pointer width, and nothing else. Note
363   /// that we intentionally expose only three predicates, 64-bit, 32-bit, and
364   /// 16-bit. The inner details of pointer width for particular architectures
365   /// is not summed up in the triple, and so only a coarse grained predicate
366   /// system is provided.
367   bool isArch64Bit() const;
368
369   /// Test whether the architecture is 32-bit
370   ///
371   /// Note that this tests for 32-bit pointer width, and nothing else.
372   bool isArch32Bit() const;
373
374   /// Test whether the architecture is 16-bit
375   ///
376   /// Note that this tests for 16-bit pointer width, and nothing else.
377   bool isArch16Bit() const;
378
379   /// isOSVersionLT - Helper function for doing comparisons against version
380   /// numbers included in the target triple.
381   bool isOSVersionLT(unsigned Major, unsigned Minor = 0,
382                      unsigned Micro = 0) const {
383     unsigned LHS[3];
384     getOSVersion(LHS[0], LHS[1], LHS[2]);
385
386     if (LHS[0] != Major)
387       return LHS[0] < Major;
388     if (LHS[1] != Minor)
389       return LHS[1] < Minor;
390     if (LHS[2] != Micro)
391       return LHS[1] < Micro;
392
393     return false;
394   }
395
396   bool isOSVersionLT(const Triple &Other) const {
397     unsigned RHS[3];
398     Other.getOSVersion(RHS[0], RHS[1], RHS[2]);
399     return isOSVersionLT(RHS[0], RHS[1], RHS[2]);
400   }
401
402   /// isMacOSXVersionLT - Comparison function for checking OS X version
403   /// compatibility, which handles supporting skewed version numbering schemes
404   /// used by the "darwin" triples.
405   bool isMacOSXVersionLT(unsigned Major, unsigned Minor = 0,
406                          unsigned Micro = 0) const {
407     assert(isMacOSX() && "Not an OS X triple!");
408
409     // If this is OS X, expect a sane version number.
410     if (getOS() == Triple::MacOSX)
411       return isOSVersionLT(Major, Minor, Micro);
412
413     // Otherwise, compare to the "Darwin" number.
414     assert(Major == 10 && "Unexpected major version");
415     return isOSVersionLT(Minor + 4, Micro, 0);
416   }
417
418   /// isMacOSX - Is this a Mac OS X triple. For legacy reasons, we support both
419   /// "darwin" and "osx" as OS X triples.
420   bool isMacOSX() const {
421     return getOS() == Triple::Darwin || getOS() == Triple::MacOSX;
422   }
423
424   /// Is this an iOS triple.
425   /// Note: This identifies tvOS as a variant of iOS. If that ever
426   /// changes, i.e., if the two operating systems diverge or their version
427   /// numbers get out of sync, that will need to be changed.
428   /// watchOS has completely different version numbers so it is not included.
429   bool isiOS() const {
430     return getOS() == Triple::IOS || isTvOS();
431   }
432
433   /// Is this an Apple tvOS triple.
434   bool isTvOS() const {
435     return getOS() == Triple::TvOS;
436   }
437
438   /// Is this an Apple watchOS triple.
439   bool isWatchOS() const {
440     return getOS() == Triple::WatchOS;
441   }
442
443   bool isWatchABI() const {
444     return getSubArch() == Triple::ARMSubArch_v7k;
445   }
446
447   /// isOSDarwin - Is this a "Darwin" OS (OS X, iOS, or watchOS).
448   bool isOSDarwin() const {
449     return isMacOSX() || isiOS() || isWatchOS();
450   }
451
452   bool isOSNetBSD() const {
453     return getOS() == Triple::NetBSD;
454   }
455
456   bool isOSOpenBSD() const {
457     return getOS() == Triple::OpenBSD;
458   }
459
460   bool isOSFreeBSD() const {
461     return getOS() == Triple::FreeBSD;
462   }
463
464   bool isOSDragonFly() const { return getOS() == Triple::DragonFly; }
465
466   bool isOSSolaris() const {
467     return getOS() == Triple::Solaris;
468   }
469
470   bool isOSBitrig() const {
471     return getOS() == Triple::Bitrig;
472   }
473
474   bool isOSIAMCU() const {
475     return getOS() == Triple::ELFIAMCU;
476   }
477
478   bool isGNUEnvironment() const {
479     EnvironmentType Env = getEnvironment();
480     return Env == Triple::GNU || Env == Triple::GNUABI64 ||
481            Env == Triple::GNUEABI || Env == Triple::GNUEABIHF ||
482            Env == Triple::GNUX32;
483   }
484
485   /// Checks if the environment could be MSVC.
486   bool isWindowsMSVCEnvironment() const {
487     return getOS() == Triple::Win32 &&
488            (getEnvironment() == Triple::UnknownEnvironment ||
489             getEnvironment() == Triple::MSVC);
490   }
491
492   /// Checks if the environment is MSVC.
493   bool isKnownWindowsMSVCEnvironment() const {
494     return getOS() == Triple::Win32 && getEnvironment() == Triple::MSVC;
495   }
496
497   bool isWindowsCoreCLREnvironment() const {
498     return getOS() == Triple::Win32 && getEnvironment() == Triple::CoreCLR;
499   }
500
501   bool isWindowsItaniumEnvironment() const {
502     return getOS() == Triple::Win32 && getEnvironment() == Triple::Itanium;
503   }
504
505   bool isWindowsCygwinEnvironment() const {
506     return getOS() == Triple::Win32 && getEnvironment() == Triple::Cygnus;
507   }
508
509   bool isWindowsGNUEnvironment() const {
510     return getOS() == Triple::Win32 && getEnvironment() == Triple::GNU;
511   }
512
513   /// Tests for either Cygwin or MinGW OS
514   bool isOSCygMing() const {
515     return isWindowsCygwinEnvironment() || isWindowsGNUEnvironment();
516   }
517
518   /// Is this a "Windows" OS targeting a "MSVCRT.dll" environment.
519   bool isOSMSVCRT() const {
520     return isWindowsMSVCEnvironment() || isWindowsGNUEnvironment() ||
521            isWindowsItaniumEnvironment();
522   }
523
524   /// Tests whether the OS is Windows.
525   bool isOSWindows() const {
526     return getOS() == Triple::Win32;
527   }
528
529   /// Tests whether the OS is NaCl (Native Client)
530   bool isOSNaCl() const {
531     return getOS() == Triple::NaCl;
532   }
533
534   /// Tests whether the OS is Linux.
535   bool isOSLinux() const {
536     return getOS() == Triple::Linux;
537   }
538
539   /// Tests whether the OS is kFreeBSD.
540   bool isOSKFreeBSD() const {
541     return getOS() == Triple::KFreeBSD;
542   }
543
544   /// Tests whether the OS uses glibc.
545   bool isOSGlibc() const {
546     return getOS() == Triple::Linux || getOS() == Triple::KFreeBSD;
547   }
548
549   /// Tests whether the OS uses the ELF binary format.
550   bool isOSBinFormatELF() const {
551     return getObjectFormat() == Triple::ELF;
552   }
553
554   /// Tests whether the OS uses the COFF binary format.
555   bool isOSBinFormatCOFF() const {
556     return getObjectFormat() == Triple::COFF;
557   }
558
559   /// Tests whether the environment is MachO.
560   bool isOSBinFormatMachO() const {
561     return getObjectFormat() == Triple::MachO;
562   }
563
564   /// Tests whether the target is the PS4 CPU
565   bool isPS4CPU() const {
566     return getArch() == Triple::x86_64 &&
567            getVendor() == Triple::SCEI &&
568            getOS() == Triple::PS4;
569   }
570
571   /// Tests whether the target is the PS4 platform
572   bool isPS4() const {
573     return getVendor() == Triple::SCEI &&
574            getOS() == Triple::PS4;
575   }
576
577   /// Tests whether the target is Android
578   bool isAndroid() const { return getEnvironment() == Triple::Android; }
579
580   /// Tests whether the environment is musl-libc
581   bool isMusl() const {
582     return getEnvironment() == Triple::Musl ||
583            getEnvironment() == Triple::MuslEABI ||
584            getEnvironment() == Triple::MuslEABIHF;
585   }
586
587   /// Tests whether the target is NVPTX (32- or 64-bit).
588   bool isNVPTX() const {
589     return getArch() == Triple::nvptx || getArch() == Triple::nvptx64;
590   }
591
592   /// Tests wether the target supports comdat
593   bool supportsCOMDAT() const { return !isOSBinFormatMachO(); }
594
595   /// @}
596   /// @name Mutators
597   /// @{
598
599   /// setArch - Set the architecture (first) component of the triple
600   /// to a known type.
601   void setArch(ArchType Kind);
602
603   /// setVendor - Set the vendor (second) component of the triple to a
604   /// known type.
605   void setVendor(VendorType Kind);
606
607   /// setOS - Set the operating system (third) component of the triple
608   /// to a known type.
609   void setOS(OSType Kind);
610
611   /// setEnvironment - Set the environment (fourth) component of the triple
612   /// to a known type.
613   void setEnvironment(EnvironmentType Kind);
614
615   /// setObjectFormat - Set the object file format
616   void setObjectFormat(ObjectFormatType Kind);
617
618   /// setTriple - Set all components to the new triple \p Str.
619   void setTriple(const Twine &Str);
620
621   /// setArchName - Set the architecture (first) component of the
622   /// triple by name.
623   void setArchName(StringRef Str);
624
625   /// setVendorName - Set the vendor (second) component of the triple
626   /// by name.
627   void setVendorName(StringRef Str);
628
629   /// setOSName - Set the operating system (third) component of the
630   /// triple by name.
631   void setOSName(StringRef Str);
632
633   /// setEnvironmentName - Set the optional environment (fourth)
634   /// component of the triple by name.
635   void setEnvironmentName(StringRef Str);
636
637   /// setOSAndEnvironmentName - Set the operating system and optional
638   /// environment components with a single string.
639   void setOSAndEnvironmentName(StringRef Str);
640
641   /// @}
642   /// @name Helpers to build variants of a particular triple.
643   /// @{
644
645   /// Form a triple with a 32-bit variant of the current architecture.
646   ///
647   /// This can be used to move across "families" of architectures where useful.
648   ///
649   /// \returns A new triple with a 32-bit architecture or an unknown
650   ///          architecture if no such variant can be found.
651   llvm::Triple get32BitArchVariant() const;
652
653   /// Form a triple with a 64-bit variant of the current architecture.
654   ///
655   /// This can be used to move across "families" of architectures where useful.
656   ///
657   /// \returns A new triple with a 64-bit architecture or an unknown
658   ///          architecture if no such variant can be found.
659   llvm::Triple get64BitArchVariant() const;
660
661   /// Form a triple with a big endian variant of the current architecture.
662   ///
663   /// This can be used to move across "families" of architectures where useful.
664   ///
665   /// \returns A new triple with a big endian architecture or an unknown
666   ///          architecture if no such variant can be found.
667   llvm::Triple getBigEndianArchVariant() const;
668
669   /// Form a triple with a little endian variant of the current architecture.
670   ///
671   /// This can be used to move across "families" of architectures where useful.
672   ///
673   /// \returns A new triple with a little endian architecture or an unknown
674   ///          architecture if no such variant can be found.
675   llvm::Triple getLittleEndianArchVariant() const;
676
677   /// Get the (LLVM) name of the minimum ARM CPU for the arch we are targeting.
678   ///
679   /// \param Arch the architecture name (e.g., "armv7s"). If it is an empty
680   /// string then the triple's arch name is used.
681   StringRef getARMCPUForArch(StringRef Arch = StringRef()) const;
682
683   /// Tests whether the target triple is little endian.
684   ///
685   /// \returns true if the triple is little endian, false otherwise.
686   bool isLittleEndian() const;
687
688   /// @}
689   /// @name Static helpers for IDs.
690   /// @{
691
692   /// getArchTypeName - Get the canonical name for the \p Kind architecture.
693   static const char *getArchTypeName(ArchType Kind);
694
695   /// getArchTypePrefix - Get the "prefix" canonical name for the \p Kind
696   /// architecture. This is the prefix used by the architecture specific
697   /// builtins, and is suitable for passing to \see
698   /// Intrinsic::getIntrinsicForGCCBuiltin().
699   ///
700   /// \return - The architecture prefix, or 0 if none is defined.
701   static const char *getArchTypePrefix(ArchType Kind);
702
703   /// getVendorTypeName - Get the canonical name for the \p Kind vendor.
704   static const char *getVendorTypeName(VendorType Kind);
705
706   /// getOSTypeName - Get the canonical name for the \p Kind operating system.
707   static const char *getOSTypeName(OSType Kind);
708
709   /// getEnvironmentTypeName - Get the canonical name for the \p Kind
710   /// environment.
711   static const char *getEnvironmentTypeName(EnvironmentType Kind);
712
713   /// @}
714   /// @name Static helpers for converting alternate architecture names.
715   /// @{
716
717   /// getArchTypeForLLVMName - The canonical type for the given LLVM
718   /// architecture name (e.g., "x86").
719   static ArchType getArchTypeForLLVMName(StringRef Str);
720
721   /// @}
722 };
723
724 } // End llvm namespace
725
726
727 #endif