1 //===--- Triple.cpp - Target triple helper class --------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #include "llvm/ADT/Triple.h"
11 #include "llvm/ADT/STLExtras.h"
12 #include "llvm/ADT/SmallString.h"
13 #include "llvm/ADT/StringSwitch.h"
14 #include "llvm/Support/ErrorHandling.h"
18 const char *Triple::getArchTypeName(ArchType Kind) {
20 case UnknownArch: return "unknown";
22 case aarch64: return "aarch64";
23 case aarch64_be: return "aarch64_be";
24 case arm: return "arm";
25 case hexagon: return "hexagon";
26 case mips: return "mips";
27 case mipsel: return "mipsel";
28 case mips64: return "mips64";
29 case mips64el: return "mips64el";
30 case msp430: return "msp430";
31 case ppc64: return "powerpc64";
32 case ppc64le: return "powerpc64le";
33 case ppc: return "powerpc";
34 case r600: return "r600";
35 case sparc: return "sparc";
36 case sparcv9: return "sparcv9";
37 case systemz: return "s390x";
38 case tce: return "tce";
39 case thumb: return "thumb";
40 case x86: return "i386";
41 case x86_64: return "x86_64";
42 case xcore: return "xcore";
43 case nvptx: return "nvptx";
44 case nvptx64: return "nvptx64";
45 case le32: return "le32";
46 case amdil: return "amdil";
47 case spir: return "spir";
48 case spir64: return "spir64";
51 llvm_unreachable("Invalid ArchType!");
54 const char *Triple::getArchTypePrefix(ArchType Kind) {
60 case aarch64_be: return "aarch64";
63 case thumb: return "arm";
67 case ppc: return "ppc";
72 case mips64el: return "mips";
74 case hexagon: return "hexagon";
76 case r600: return "r600";
79 case sparc: return "sparc";
81 case systemz: return "systemz";
84 case x86_64: return "x86";
86 case xcore: return "xcore";
88 case nvptx: return "nvptx";
89 case nvptx64: return "nvptx";
90 case le32: return "le32";
91 case amdil: return "amdil";
92 case spir: return "spir";
93 case spir64: return "spir";
97 const char *Triple::getVendorTypeName(VendorType Kind) {
99 case UnknownVendor: return "unknown";
101 case Apple: return "apple";
102 case PC: return "pc";
103 case SCEI: return "scei";
104 case BGP: return "bgp";
105 case BGQ: return "bgq";
106 case Freescale: return "fsl";
107 case IBM: return "ibm";
108 case NVIDIA: return "nvidia";
111 llvm_unreachable("Invalid VendorType!");
114 const char *Triple::getOSTypeName(OSType Kind) {
116 case UnknownOS: return "unknown";
118 case AuroraUX: return "auroraux";
119 case Cygwin: return "cygwin";
120 case Darwin: return "darwin";
121 case DragonFly: return "dragonfly";
122 case FreeBSD: return "freebsd";
123 case IOS: return "ios";
124 case KFreeBSD: return "kfreebsd";
125 case Linux: return "linux";
126 case Lv2: return "lv2";
127 case MacOSX: return "macosx";
128 case MinGW32: return "mingw32";
129 case NetBSD: return "netbsd";
130 case OpenBSD: return "openbsd";
131 case Solaris: return "solaris";
132 case Win32: return "win32";
133 case Haiku: return "haiku";
134 case Minix: return "minix";
135 case RTEMS: return "rtems";
136 case NaCl: return "nacl";
137 case CNK: return "cnk";
138 case Bitrig: return "bitrig";
139 case AIX: return "aix";
140 case CUDA: return "cuda";
141 case NVCL: return "nvcl";
144 llvm_unreachable("Invalid OSType");
147 const char *Triple::getEnvironmentTypeName(EnvironmentType Kind) {
149 case UnknownEnvironment: return "unknown";
150 case GNU: return "gnu";
151 case GNUEABIHF: return "gnueabihf";
152 case GNUEABI: return "gnueabi";
153 case GNUX32: return "gnux32";
154 case CODE16: return "code16";
155 case EABI: return "eabi";
156 case EABIHF: return "eabihf";
157 case MachO: return "macho";
158 case Android: return "android";
159 case ELF: return "elf";
162 llvm_unreachable("Invalid EnvironmentType!");
165 Triple::ArchType Triple::getArchTypeForLLVMName(StringRef Name) {
166 return StringSwitch<Triple::ArchType>(Name)
167 .Case("aarch64", aarch64)
168 .Case("aarch64_be", aarch64_be)
171 .Case("mipsel", mipsel)
172 .Case("mips64", mips64)
173 .Case("mips64el", mips64el)
174 .Case("msp430", msp430)
175 .Case("ppc64", ppc64)
178 .Case("ppc64le", ppc64le)
180 .Case("hexagon", hexagon)
181 .Case("sparc", sparc)
182 .Case("sparcv9", sparcv9)
183 .Case("systemz", systemz)
185 .Case("thumb", thumb)
187 .Case("x86-64", x86_64)
188 .Case("xcore", xcore)
189 .Case("nvptx", nvptx)
190 .Case("nvptx64", nvptx64)
192 .Case("amdil", amdil)
194 .Case("spir64", spir64)
195 .Default(UnknownArch);
198 // Returns architecture name that is understood by the target assembler.
199 const char *Triple::getArchNameForAssembler() {
200 if (!isOSDarwin() && getVendor() != Triple::Apple)
203 return StringSwitch<const char*>(getArchName())
204 .Case("i386", "i386")
205 .Case("x86_64", "x86_64")
206 .Case("powerpc", "ppc")
207 .Case("powerpc64", "ppc64")
208 .Case("powerpc64le", "ppc64le")
210 .Cases("armv4t", "thumbv4t", "armv4t")
211 .Cases("armv5", "armv5e", "thumbv5", "thumbv5e", "armv5")
212 .Cases("armv6", "thumbv6", "armv6")
213 .Cases("armv7", "thumbv7", "armv7")
214 .Case("r600", "r600")
215 .Case("nvptx", "nvptx")
216 .Case("nvptx64", "nvptx64")
217 .Case("le32", "le32")
218 .Case("amdil", "amdil")
219 .Case("spir", "spir")
220 .Case("spir64", "spir64")
224 static Triple::ArchType parseArch(StringRef ArchName) {
225 return StringSwitch<Triple::ArchType>(ArchName)
226 .Cases("i386", "i486", "i586", "i686", Triple::x86)
227 // FIXME: Do we need to support these?
228 .Cases("i786", "i886", "i986", Triple::x86)
229 .Cases("amd64", "x86_64", "x86_64h", Triple::x86_64)
230 .Case("powerpc", Triple::ppc)
231 .Cases("powerpc64", "ppu", Triple::ppc64)
232 .Case("powerpc64le", Triple::ppc64le)
233 .Case("aarch64", Triple::aarch64)
234 .Case("aarch64_be", Triple::aarch64_be)
235 .Cases("arm", "xscale", Triple::arm)
236 // FIXME: It would be good to replace these with explicit names for all the
237 // various suffixes supported.
238 .StartsWith("armv", Triple::arm)
239 .Case("thumb", Triple::thumb)
240 .StartsWith("thumbv", Triple::thumb)
241 .Case("msp430", Triple::msp430)
242 .Cases("mips", "mipseb", "mipsallegrex", Triple::mips)
243 .Cases("mipsel", "mipsallegrexel", Triple::mipsel)
244 .Cases("mips64", "mips64eb", Triple::mips64)
245 .Case("mips64el", Triple::mips64el)
246 .Case("r600", Triple::r600)
247 .Case("hexagon", Triple::hexagon)
248 .Case("s390x", Triple::systemz)
249 .Case("sparc", Triple::sparc)
250 .Cases("sparcv9", "sparc64", Triple::sparcv9)
251 .Case("tce", Triple::tce)
252 .Case("xcore", Triple::xcore)
253 .Case("nvptx", Triple::nvptx)
254 .Case("nvptx64", Triple::nvptx64)
255 .Case("le32", Triple::le32)
256 .Case("amdil", Triple::amdil)
257 .Case("spir", Triple::spir)
258 .Case("spir64", Triple::spir64)
259 .Default(Triple::UnknownArch);
262 static Triple::VendorType parseVendor(StringRef VendorName) {
263 return StringSwitch<Triple::VendorType>(VendorName)
264 .Case("apple", Triple::Apple)
265 .Case("pc", Triple::PC)
266 .Case("scei", Triple::SCEI)
267 .Case("bgp", Triple::BGP)
268 .Case("bgq", Triple::BGQ)
269 .Case("fsl", Triple::Freescale)
270 .Case("ibm", Triple::IBM)
271 .Case("nvidia", Triple::NVIDIA)
272 .Default(Triple::UnknownVendor);
275 static Triple::OSType parseOS(StringRef OSName) {
276 return StringSwitch<Triple::OSType>(OSName)
277 .StartsWith("auroraux", Triple::AuroraUX)
278 .StartsWith("cygwin", Triple::Cygwin)
279 .StartsWith("darwin", Triple::Darwin)
280 .StartsWith("dragonfly", Triple::DragonFly)
281 .StartsWith("freebsd", Triple::FreeBSD)
282 .StartsWith("ios", Triple::IOS)
283 .StartsWith("kfreebsd", Triple::KFreeBSD)
284 .StartsWith("linux", Triple::Linux)
285 .StartsWith("lv2", Triple::Lv2)
286 .StartsWith("macosx", Triple::MacOSX)
287 .StartsWith("mingw32", Triple::MinGW32)
288 .StartsWith("netbsd", Triple::NetBSD)
289 .StartsWith("openbsd", Triple::OpenBSD)
290 .StartsWith("solaris", Triple::Solaris)
291 .StartsWith("win32", Triple::Win32)
292 .StartsWith("haiku", Triple::Haiku)
293 .StartsWith("minix", Triple::Minix)
294 .StartsWith("rtems", Triple::RTEMS)
295 .StartsWith("nacl", Triple::NaCl)
296 .StartsWith("cnk", Triple::CNK)
297 .StartsWith("bitrig", Triple::Bitrig)
298 .StartsWith("aix", Triple::AIX)
299 .StartsWith("cuda", Triple::CUDA)
300 .StartsWith("nvcl", Triple::NVCL)
301 .Default(Triple::UnknownOS);
304 static Triple::EnvironmentType parseEnvironment(StringRef EnvironmentName) {
305 return StringSwitch<Triple::EnvironmentType>(EnvironmentName)
306 .StartsWith("eabihf", Triple::EABIHF)
307 .StartsWith("eabi", Triple::EABI)
308 .StartsWith("gnueabihf", Triple::GNUEABIHF)
309 .StartsWith("gnueabi", Triple::GNUEABI)
310 .StartsWith("gnux32", Triple::GNUX32)
311 .StartsWith("code16", Triple::CODE16)
312 .StartsWith("gnu", Triple::GNU)
313 .StartsWith("macho", Triple::MachO)
314 .StartsWith("android", Triple::Android)
315 .StartsWith("elf", Triple::ELF)
316 .Default(Triple::UnknownEnvironment);
319 /// \brief Construct a triple from the string representation provided.
321 /// This stores the string representation and parses the various pieces into
323 Triple::Triple(const Twine &Str)
325 Arch(parseArch(getArchName())),
326 Vendor(parseVendor(getVendorName())),
327 OS(parseOS(getOSName())),
328 Environment(parseEnvironment(getEnvironmentName())) {
331 /// \brief Construct a triple from string representations of the architecture,
334 /// This joins each argument into a canonical string representation and parses
335 /// them into enum members. It leaves the environment unknown and omits it from
336 /// the string representation.
337 Triple::Triple(const Twine &ArchStr, const Twine &VendorStr, const Twine &OSStr)
338 : Data((ArchStr + Twine('-') + VendorStr + Twine('-') + OSStr).str()),
339 Arch(parseArch(ArchStr.str())),
340 Vendor(parseVendor(VendorStr.str())),
341 OS(parseOS(OSStr.str())),
345 /// \brief Construct a triple from string representations of the architecture,
346 /// vendor, OS, and environment.
348 /// This joins each argument into a canonical string representation and parses
349 /// them into enum members.
350 Triple::Triple(const Twine &ArchStr, const Twine &VendorStr, const Twine &OSStr,
351 const Twine &EnvironmentStr)
352 : Data((ArchStr + Twine('-') + VendorStr + Twine('-') + OSStr + Twine('-') +
353 EnvironmentStr).str()),
354 Arch(parseArch(ArchStr.str())),
355 Vendor(parseVendor(VendorStr.str())),
356 OS(parseOS(OSStr.str())),
357 Environment(parseEnvironment(EnvironmentStr.str())) {
360 std::string Triple::normalize(StringRef Str) {
361 // Parse into components.
362 SmallVector<StringRef, 4> Components;
363 Str.split(Components, "-");
365 // If the first component corresponds to a known architecture, preferentially
366 // use it for the architecture. If the second component corresponds to a
367 // known vendor, preferentially use it for the vendor, etc. This avoids silly
368 // component movement when a component parses as (eg) both a valid arch and a
370 ArchType Arch = UnknownArch;
371 if (Components.size() > 0)
372 Arch = parseArch(Components[0]);
373 VendorType Vendor = UnknownVendor;
374 if (Components.size() > 1)
375 Vendor = parseVendor(Components[1]);
376 OSType OS = UnknownOS;
377 if (Components.size() > 2)
378 OS = parseOS(Components[2]);
379 EnvironmentType Environment = UnknownEnvironment;
380 if (Components.size() > 3)
381 Environment = parseEnvironment(Components[3]);
383 // Note which components are already in their final position. These will not
386 Found[0] = Arch != UnknownArch;
387 Found[1] = Vendor != UnknownVendor;
388 Found[2] = OS != UnknownOS;
389 Found[3] = Environment != UnknownEnvironment;
391 // If they are not there already, permute the components into their canonical
392 // positions by seeing if they parse as a valid architecture, and if so moving
393 // the component to the architecture position etc.
394 for (unsigned Pos = 0; Pos != array_lengthof(Found); ++Pos) {
396 continue; // Already in the canonical position.
398 for (unsigned Idx = 0; Idx != Components.size(); ++Idx) {
399 // Do not reparse any components that already matched.
400 if (Idx < array_lengthof(Found) && Found[Idx])
403 // Does this component parse as valid for the target position?
405 StringRef Comp = Components[Idx];
407 default: llvm_unreachable("unexpected component type!");
409 Arch = parseArch(Comp);
410 Valid = Arch != UnknownArch;
413 Vendor = parseVendor(Comp);
414 Valid = Vendor != UnknownVendor;
418 Valid = OS != UnknownOS;
421 Environment = parseEnvironment(Comp);
422 Valid = Environment != UnknownEnvironment;
426 continue; // Nope, try the next component.
428 // Move the component to the target position, pushing any non-fixed
429 // components that are in the way to the right. This tends to give
430 // good results in the common cases of a forgotten vendor component
431 // or a wrongly positioned environment.
433 // Insert left, pushing the existing components to the right. For
434 // example, a-b-i386 -> i386-a-b when moving i386 to the front.
435 StringRef CurrentComponent(""); // The empty component.
436 // Replace the component we are moving with an empty component.
437 std::swap(CurrentComponent, Components[Idx]);
438 // Insert the component being moved at Pos, displacing any existing
439 // components to the right.
440 for (unsigned i = Pos; !CurrentComponent.empty(); ++i) {
441 // Skip over any fixed components.
442 while (i < array_lengthof(Found) && Found[i])
444 // Place the component at the new position, getting the component
445 // that was at this position - it will be moved right.
446 std::swap(CurrentComponent, Components[i]);
448 } else if (Pos > Idx) {
449 // Push right by inserting empty components until the component at Idx
450 // reaches the target position Pos. For example, pc-a -> -pc-a when
451 // moving pc to the second position.
453 // Insert one empty component at Idx.
454 StringRef CurrentComponent(""); // The empty component.
455 for (unsigned i = Idx; i < Components.size();) {
456 // Place the component at the new position, getting the component
457 // that was at this position - it will be moved right.
458 std::swap(CurrentComponent, Components[i]);
459 // If it was placed on top of an empty component then we are done.
460 if (CurrentComponent.empty())
462 // Advance to the next component, skipping any fixed components.
463 while (++i < array_lengthof(Found) && Found[i])
466 // The last component was pushed off the end - append it.
467 if (!CurrentComponent.empty())
468 Components.push_back(CurrentComponent);
470 // Advance Idx to the component's new position.
471 while (++Idx < array_lengthof(Found) && Found[Idx])
473 } while (Idx < Pos); // Add more until the final position is reached.
475 assert(Pos < Components.size() && Components[Pos] == Comp &&
476 "Component moved wrong!");
482 // Special case logic goes here. At this point Arch, Vendor and OS have the
483 // correct values for the computed components.
485 // Stick the corrected components back together to form the normalized string.
486 std::string Normalized;
487 for (unsigned i = 0, e = Components.size(); i != e; ++i) {
488 if (i) Normalized += '-';
489 Normalized += Components[i];
494 StringRef Triple::getArchName() const {
495 return StringRef(Data).split('-').first; // Isolate first component
498 StringRef Triple::getVendorName() const {
499 StringRef Tmp = StringRef(Data).split('-').second; // Strip first component
500 return Tmp.split('-').first; // Isolate second component
503 StringRef Triple::getOSName() const {
504 StringRef Tmp = StringRef(Data).split('-').second; // Strip first component
505 Tmp = Tmp.split('-').second; // Strip second component
506 return Tmp.split('-').first; // Isolate third component
509 StringRef Triple::getEnvironmentName() const {
510 StringRef Tmp = StringRef(Data).split('-').second; // Strip first component
511 Tmp = Tmp.split('-').second; // Strip second component
512 return Tmp.split('-').second; // Strip third component
515 StringRef Triple::getOSAndEnvironmentName() const {
516 StringRef Tmp = StringRef(Data).split('-').second; // Strip first component
517 return Tmp.split('-').second; // Strip second component
520 static unsigned EatNumber(StringRef &Str) {
521 assert(!Str.empty() && Str[0] >= '0' && Str[0] <= '9' && "Not a number");
525 // Consume the leading digit.
526 Result = Result*10 + (Str[0] - '0');
530 } while (!Str.empty() && Str[0] >= '0' && Str[0] <= '9');
535 void Triple::getOSVersion(unsigned &Major, unsigned &Minor,
536 unsigned &Micro) const {
537 StringRef OSName = getOSName();
539 // Assume that the OS portion of the triple starts with the canonical name.
540 StringRef OSTypeName = getOSTypeName(getOS());
541 if (OSName.startswith(OSTypeName))
542 OSName = OSName.substr(OSTypeName.size());
544 // Any unset version defaults to 0.
545 Major = Minor = Micro = 0;
547 // Parse up to three components.
548 unsigned *Components[3] = { &Major, &Minor, &Micro };
549 for (unsigned i = 0; i != 3; ++i) {
550 if (OSName.empty() || OSName[0] < '0' || OSName[0] > '9')
553 // Consume the leading number.
554 *Components[i] = EatNumber(OSName);
556 // Consume the separator, if present.
557 if (OSName.startswith("."))
558 OSName = OSName.substr(1);
562 bool Triple::getMacOSXVersion(unsigned &Major, unsigned &Minor,
563 unsigned &Micro) const {
564 getOSVersion(Major, Minor, Micro);
567 default: llvm_unreachable("unexpected OS for Darwin triple");
569 // Default to darwin8, i.e., MacOSX 10.4.
572 // Darwin version numbers are skewed from OS X versions.
589 // Ignore the version from the triple. This is only handled because the
590 // the clang driver combines OS X and IOS support into a common Darwin
591 // toolchain that wants to know the OS X version number even when targeting
601 void Triple::getiOSVersion(unsigned &Major, unsigned &Minor,
602 unsigned &Micro) const {
604 default: llvm_unreachable("unexpected OS for Darwin triple");
607 // Ignore the version from the triple. This is only handled because the
608 // the clang driver combines OS X and IOS support into a common Darwin
609 // toolchain that wants to know the iOS version number even when targeting
616 getOSVersion(Major, Minor, Micro);
624 void Triple::setTriple(const Twine &Str) {
628 void Triple::setArch(ArchType Kind) {
629 setArchName(getArchTypeName(Kind));
632 void Triple::setVendor(VendorType Kind) {
633 setVendorName(getVendorTypeName(Kind));
636 void Triple::setOS(OSType Kind) {
637 setOSName(getOSTypeName(Kind));
640 void Triple::setEnvironment(EnvironmentType Kind) {
641 setEnvironmentName(getEnvironmentTypeName(Kind));
644 void Triple::setArchName(StringRef Str) {
645 // Work around a miscompilation bug for Twines in gcc 4.0.3.
646 SmallString<64> Triple;
649 Triple += getVendorName();
651 Triple += getOSAndEnvironmentName();
652 setTriple(Triple.str());
655 void Triple::setVendorName(StringRef Str) {
656 setTriple(getArchName() + "-" + Str + "-" + getOSAndEnvironmentName());
659 void Triple::setOSName(StringRef Str) {
660 if (hasEnvironment())
661 setTriple(getArchName() + "-" + getVendorName() + "-" + Str +
662 "-" + getEnvironmentName());
664 setTriple(getArchName() + "-" + getVendorName() + "-" + Str);
667 void Triple::setEnvironmentName(StringRef Str) {
668 setTriple(getArchName() + "-" + getVendorName() + "-" + getOSName() +
672 void Triple::setOSAndEnvironmentName(StringRef Str) {
673 setTriple(getArchName() + "-" + getVendorName() + "-" + Str);
676 static unsigned getArchPointerBitWidth(llvm::Triple::ArchType Arch) {
678 case llvm::Triple::UnknownArch:
681 case llvm::Triple::msp430:
684 case llvm::Triple::amdil:
685 case llvm::Triple::arm:
686 case llvm::Triple::hexagon:
687 case llvm::Triple::le32:
688 case llvm::Triple::mips:
689 case llvm::Triple::mipsel:
690 case llvm::Triple::nvptx:
691 case llvm::Triple::ppc:
692 case llvm::Triple::r600:
693 case llvm::Triple::sparc:
694 case llvm::Triple::tce:
695 case llvm::Triple::thumb:
696 case llvm::Triple::x86:
697 case llvm::Triple::xcore:
698 case llvm::Triple::spir:
701 case llvm::Triple::aarch64:
702 case llvm::Triple::aarch64_be:
703 case llvm::Triple::mips64:
704 case llvm::Triple::mips64el:
705 case llvm::Triple::nvptx64:
706 case llvm::Triple::ppc64:
707 case llvm::Triple::ppc64le:
708 case llvm::Triple::sparcv9:
709 case llvm::Triple::systemz:
710 case llvm::Triple::x86_64:
711 case llvm::Triple::spir64:
714 llvm_unreachable("Invalid architecture value");
717 bool Triple::isArch64Bit() const {
718 return getArchPointerBitWidth(getArch()) == 64;
721 bool Triple::isArch32Bit() const {
722 return getArchPointerBitWidth(getArch()) == 32;
725 bool Triple::isArch16Bit() const {
726 return getArchPointerBitWidth(getArch()) == 16;
729 Triple Triple::get32BitArchVariant() const {
732 case Triple::UnknownArch:
733 case Triple::aarch64:
734 case Triple::aarch64_be:
736 case Triple::systemz:
737 case Triple::ppc64le:
738 T.setArch(UnknownArch);
744 case Triple::hexagon:
759 case Triple::mips64: T.setArch(Triple::mips); break;
760 case Triple::mips64el: T.setArch(Triple::mipsel); break;
761 case Triple::nvptx64: T.setArch(Triple::nvptx); break;
762 case Triple::ppc64: T.setArch(Triple::ppc); break;
763 case Triple::sparcv9: T.setArch(Triple::sparc); break;
764 case Triple::x86_64: T.setArch(Triple::x86); break;
765 case Triple::spir64: T.setArch(Triple::spir); break;
770 Triple Triple::get64BitArchVariant() const {
773 case Triple::UnknownArch:
776 case Triple::hexagon:
783 T.setArch(UnknownArch);
786 case Triple::aarch64:
787 case Triple::aarch64_be:
790 case Triple::mips64el:
791 case Triple::nvptx64:
793 case Triple::ppc64le:
794 case Triple::sparcv9:
795 case Triple::systemz:
800 case Triple::mips: T.setArch(Triple::mips64); break;
801 case Triple::mipsel: T.setArch(Triple::mips64el); break;
802 case Triple::nvptx: T.setArch(Triple::nvptx64); break;
803 case Triple::ppc: T.setArch(Triple::ppc64); break;
804 case Triple::sparc: T.setArch(Triple::sparcv9); break;
805 case Triple::x86: T.setArch(Triple::x86_64); break;
806 case Triple::spir: T.setArch(Triple::spir64); break;