Home | History | Annotate | Download | only in Support

Lines Matching refs:Triple

1 //===--- Triple.cpp - Target triple helper class --------------------------===//
10 #include "llvm/ADT/Triple.h"
18 const char *Triple::getArchTypeName(ArchType Kind) {
59 const char *Triple::getArchTypePrefix(ArchType Kind) {
109 const char *Triple::getVendorTypeName(VendorType Kind) {
128 const char *Triple::getOSTypeName(OSType Kind) {
161 const char *Triple::getEnvironmentTypeName(EnvironmentType Kind) {
180 Triple::ArchType Triple::getArchTypeForLLVMName(StringRef Name) {
181 return StringSwitch<Triple::ArchType>(Name)
219 const char *Triple::getArchNameForAssembler() {
220 if (!isOSDarwin() && getVendor() != Triple::Apple)
247 static Triple::ArchType parseArch(StringRef ArchName) {
248 return StringSwitch<Triple::ArchType>(ArchName)
249 .Cases("i386", "i486", "i586", "i686", Triple::x86)
251 .Cases("i786", "i886", "i986", Triple::x86)
252 .Cases("amd64", "x86_64", "x86_64h", Triple::x86_64)
253 .Case("powerpc", Triple::ppc)
254 .Cases("powerpc64", "ppu", Triple::ppc64)
255 .Case("powerpc64le", Triple::ppc64le)
256 .Case("aarch64", Triple::aarch64)
257 .Case("aarch64_be", Triple::aarch64_be)
258 .Cases("arm", "xscale", Triple::arm)
261 .StartsWith("armv", Triple::arm)
262 .Case("armeb", Triple::armeb)
263 .StartsWith("armebv", Triple::armeb)
264 .Case("thumb", Triple::thumb)
265 .StartsWith("thumbv", Triple::thumb)
266 .Case("thumbeb", Triple::thumbeb)
267 .StartsWith("thumbebv", Triple::thumbeb)
268 .Case("arm64", Triple::arm64)
269 .Case("arm64_be", Triple::arm64_be)
270 .Case("msp430", Triple::msp430)
271 .Cases("mips", "mipseb", "mipsallegrex", Triple::mips)
272 .Cases("mipsel", "mipsallegrexel", Triple::mipsel)
273 .Cases("mips64", "mips64eb", Triple::mips64)
274 .Case("mips64el", Triple::mips64el)
275 .Case("r600", Triple::r600)
276 .Case("hexagon", Triple::hexagon)
277 .Case("s390x", Triple::systemz)
278 .Case("sparc", Triple::sparc)
279 .Cases("sparcv9", "sparc64", Triple::sparcv9)
280 .Case("tce", Triple::tce)
281 .Case("xcore", Triple::xcore)
282 .Case("nvptx", Triple::nvptx)
283 .Case("nvptx64", Triple::nvptx64)
284 .Case("le32", Triple::le32)
285 .Case("amdil", Triple::amdil)
286 .Case("spir", Triple::spir)
287 .Case("spir64", Triple::spir64)
288 .Case("kalimba", Triple::kalimba)
289 .Default(Triple::UnknownArch);
292 static Triple::VendorType parseVendor(StringRef VendorName) {
293 return StringSwitch<Triple::VendorType>(VendorName)
294 .Case("apple", Triple::Apple)
295 .Case("pc", Triple::PC)
296 .Case("scei", Triple::SCEI)
297 .Case("bgp", Triple::BGP)
298 .Case("bgq", Triple::BGQ)
299 .Case("fsl", Triple::Freescale)
300 .Case("ibm", Triple::IBM)
301 .Case("img", Triple::ImaginationTechnologies)
302 .Case("nvidia", Triple::NVIDIA)
303 .Case("csr", Triple::CSR)
304 .Default(Triple::UnknownVendor);
307 static Triple::OSType parseOS(StringRef OSName) {
308 return StringSwitch<Triple::OSType>(OSName)
309 .StartsWith("auroraux", Triple::AuroraUX)
310 .StartsWith("cygwin", Triple::Cygwin)
311 .StartsWith("darwin", Triple::Darwin)
312 .StartsWith("dragonfly", Triple::DragonFly)
313 .StartsWith("freebsd", Triple::FreeBSD)
314 .StartsWith("ios", Triple::IOS)
315 .StartsWith("kfreebsd", Triple::KFreeBSD)
316 .StartsWith("linux", Triple::Linux)
317 .StartsWith("lv2", Triple::Lv2)
318 .StartsWith("macosx", Triple::MacOSX)
319 .StartsWith("mingw32", Triple::MinGW32)
320 .StartsWith("netbsd", Triple::NetBSD)
321 .StartsWith("openbsd", Triple::OpenBSD)
322 .StartsWith("solaris", Triple::Solaris)
323 .StartsWith("win32", Triple::Win32)
324 .StartsWith("windows", Triple::Win32)
325 .StartsWith("haiku", Triple::Haiku)
326 .StartsWith("minix", Triple::Minix)
327 .StartsWith("rtems", Triple::RTEMS)
328 .StartsWith("nacl", Triple::NaCl)
329 .StartsWith("cnk", Triple::CNK)
330 .StartsWith("bitrig", Triple::Bitrig)
331 .StartsWith("aix", Triple::AIX)
332 .StartsWith("cuda", Triple::CUDA)
333 .StartsWith("nvcl", Triple::NVCL)
334 .Default(Triple::UnknownOS);
337 static Triple::EnvironmentType parseEnvironment(StringRef EnvironmentName) {
338 return StringSwitch<Triple::EnvironmentType>(EnvironmentName)
339 .StartsWith("eabihf", Triple::EABIHF)
340 .StartsWith("eabi", Triple::EABI)
341 .StartsWith("gnueabihf", Triple::GNUEABIHF)
342 .StartsWith("gnueabi", Triple::GNUEABI)
343 .StartsWith("gnux32", Triple::GNUX32)
344 .StartsWith("code16", Triple::CODE16)
345 .StartsWith("gnu", Triple::GNU)
346 .StartsWith("android", Triple::Android)
347 .StartsWith("msvc", Triple::MSVC)
348 .StartsWith("itanium", Triple::Itanium)
349 .StartsWith("cygnus", Triple::Cygnus)
350 .Default(Triple::UnknownEnvironment);
353 static Triple::ObjectFormatType parseFormat(StringRef EnvironmentName) {
354 return StringSwitch<Triple::ObjectFormatType>(EnvironmentName)
355 .EndsWith("coff", Triple::COFF)
356 .EndsWith("elf", Triple::ELF)
357 .EndsWith("macho", Triple::MachO)
358 .Default(Triple::UnknownObjectFormat);
361 static const char *getObjectFormatTypeName(Triple::ObjectFormatType Kind) {
363 case Triple::UnknownObjectFormat: return "";
364 case Triple::COFF: return "coff";
365 case Triple::ELF: return "elf";
366 case Triple::MachO: return "macho";
371 static Triple::ObjectFormatType getDefaultFormat(const Triple &T) {
373 return Triple::MachO;
375 return Triple::COFF;
376 return Triple::ELF;
379 /// \brief Construct a triple from the string representation provided.
383 Triple::Triple(const Twine &Str)
390 if (ObjectFormat == Triple::UnknownObjectFormat)
394 /// \brief Construct a triple from string representations of the architecture,
400 Triple::Triple(const Twine &ArchStr, const Twine &VendorStr, const Twine &OSStr)
405 Environment(), ObjectFormat(Triple::UnknownObjectFormat) {
409 /// \brief Construct a triple from string representations of the architecture,
414 Triple::Triple(const Twine &ArchStr, const Twine &VendorStr, const Twine &OSStr,
423 if (ObjectFormat == Triple::UnknownObjectFormat)
427 std::string Triple::normalize(StringRef Str) {
559 if (OS == Triple::Win32) {
563 if (ObjectFormat == UnknownObjectFormat || ObjectFormat == Triple::COFF)
568 } else if (OS == Triple::MinGW32) {
572 } else if (OS == Triple::Cygwin) {
577 if (OS == Triple::MinGW32 || OS == Triple::Cygwin ||
578 (OS == Triple::Win32 && Environment != UnknownEnvironment)) {
579 if (ObjectFormat != UnknownObjectFormat && ObjectFormat != Triple::COFF) {
594 StringRef Triple::getArchName() const {
598 StringRef Triple::getVendorName() const {
603 StringRef Triple::getOSName() const {
609 StringRef Triple::getEnvironmentName() const {
615 StringRef Triple::getOSAndEnvironmentName() const {
635 void Triple::getOSVersion(unsigned &Major, unsigned &Minor,
639 // Assume that the OS portion of the triple starts with the canonical name.
662 bool Triple::getMacOSXVersion(unsigned &Major, unsigned &Minor,
667 default: llvm_unreachable("unexpected OS for Darwin triple");
689 // Ignore the version from the triple. This is only handled because the
701 void Triple::getiOSVersion(unsigned &Major, unsigned &Minor,
704 default: llvm_unreachable("unexpected OS for Darwin triple");
707 // Ignore the version from the triple. This is only handled because the
724 void Triple::setTriple(const Twine &Str) {
725 *this = Triple(Str);
728 void Triple::setArch(ArchType Kind) {
732 void Triple::setVendor(VendorType Kind) {
736 void Triple::setOS(OSType Kind) {
740 void Triple::setEnvironment(EnvironmentType Kind) {
744 void Triple::setObjectFormat(ObjectFormatType Kind) {
752 void Triple::setArchName(StringRef Str) {
754 SmallString<64> Triple;
755 Triple += Str;
756 Triple += "-";
757 Triple += getVendorName();
758 Triple += "-";
759 Triple += getOSAndEnvironmentName();
760 setTriple(Triple.str());
763 void Triple::setVendorName(StringRef Str) {
767 void Triple::setOSName(StringRef Str) {
775 void Triple::setEnvironmentName(StringRef Str) {
780 void Triple::setOSAndEnvironmentName(StringRef Str) {
784 static unsigned getArchPointerBitWidth(llvm::Triple::ArchType Arch) {
786 case llvm::Triple::UnknownArch:
789 case llvm::Triple::msp430:
792 case llvm::Triple::amdil:
793 case llvm::Triple::arm:
794 case llvm::Triple::armeb:
795 case llvm::Triple::hexagon:
796 case llvm::Triple::le32:
797 case llvm::Triple::mips:
798 case llvm::Triple::mipsel:
799 case llvm::Triple::nvptx:
800 case llvm::Triple::ppc:
801 case llvm::Triple::r600:
802 case llvm::Triple::sparc:
803 case llvm::Triple::tce:
804 case llvm::Triple::thumb:
805 case llvm::Triple::thumbeb:
806 case llvm::Triple::x86:
807 case llvm::Triple::xcore:
808 case llvm::Triple::spir:
809 case llvm::Triple::kalimba:
812 case llvm::Triple::arm64:
813 case llvm::Triple::arm64_be:
814 case llvm::Triple::aarch64:
815 case llvm::Triple::aarch64_be:
816 case llvm::Triple::mips64:
817 case llvm::Triple::mips64el:
818 case llvm::Triple::nvptx64:
819 case llvm::Triple::ppc64:
820 case llvm::Triple::ppc64le:
821 case llvm::Triple::sparcv9:
822 case llvm::Triple::systemz:
823 case llvm::Triple::x86_64:
824 case llvm::Triple::spir64:
830 bool Triple::isArch64Bit() const {
834 bool Triple::isArch32Bit() const {
838 bool Triple::isArch16Bit() const {
842 Triple Triple::get32BitArchVariant() const {
843 Triple T(*this);
845 case Triple::UnknownArch:
846 case Triple::aarch64:
847 case Triple::aarch64_be:
848 case Triple::arm64:
849 case Triple::arm64_be:
850 case Triple::msp430:
851 case Triple::systemz:
852 case Triple::ppc64le:
856 case Triple::amdil:
857 case Triple::spir:
858 case Triple::arm:
859 case Triple::armeb:
860 case Triple::hexagon:
861 case Triple::kalimba:
862 case Triple::le32:
863 case Triple::mips:
864 case Triple::mipsel:
865 case Triple::nvptx:
866 case Triple::ppc:
867 case Triple::r600:
868 case Triple::sparc:
869 case Triple::tce:
870 case Triple::thumb:
871 case Triple::thumbeb:
872 case Triple::x86:
873 case Triple::xcore:
877 case Triple::mips64: T.setArch(Triple::mips); break;
878 case Triple::mips64el: T.setArch(Triple::mipsel); break;
879 case Triple::nvptx64: T.setArch(Triple::nvptx); break;
880 case Triple::ppc64: T.setArch(Triple::ppc); break;
881 case Triple::sparcv9: T.setArch(Triple::sparc); break;
882 case Triple::x86_64: T.setArch(Triple::x86); break;
883 case Triple::spir64: T.setArch(Triple::spir); break;
888 Triple Triple::get64BitArchVariant() const {
889 Triple T(*this);
891 case Triple::UnknownArch:
892 case Triple::amdil:
893 case Triple::arm:
894 case Triple::armeb:
895 case Triple::hexagon:
896 case Triple::kalimba:
897 case Triple::le32:
898 case Triple::msp430:
899 case Triple::r600:
900 case Triple::tce:
901 case Triple::thumb:
902 case Triple::thumbeb:
903 case Triple::xcore:
907 case Triple::aarch64:
908 case Triple::aarch64_be:
909 case Triple::spir64:
910 case Triple::mips64:
911 case Triple::mips64el:
912 case Triple::nvptx64:
913 case Triple::ppc64:
914 case Triple::ppc64le:
915 case Triple::sparcv9:
916 case Triple::systemz:
917 case Triple::x86_64:
918 case Triple::arm64:
919 case Triple::arm64_be:
923 case Triple::mips: T.setArch(Triple::mips64); break;
924 case Triple::mipsel: T.setArch(Triple::mips64el); break;
925 case Triple::nvptx: T.setArch(Triple::nvptx64); break;
926 case Triple::ppc: T.setArch(Triple::ppc64); break;
927 case Triple::sparc: T.setArch(Triple::sparcv9); break;
928 case Triple::x86: T.setArch(Triple::x86_64); break;
929 case Triple::spir: T.setArch(Triple::spir64); break;