Lines 161-166
StringRef Triple::getVendorTypeName(VendorType Kind) {
Link Here
|
161 |
case Myriad: return "myriad"; |
161 |
case Myriad: return "myriad"; |
162 |
case AMD: return "amd"; |
162 |
case AMD: return "amd"; |
163 |
case Mesa: return "mesa"; |
163 |
case Mesa: return "mesa"; |
|
|
164 |
case SoftFloat: return "softfloat"; |
165 |
case HardFloat: return "hardfloat"; |
164 |
} |
166 |
} |
165 |
|
167 |
|
166 |
llvm_unreachable("Invalid VendorType!"); |
168 |
llvm_unreachable("Invalid VendorType!"); |
Lines 443-448
static Triple::VendorType parseVendor(StringRef VendorName) {
Link Here
|
443 |
.Case("myriad", Triple::Myriad) |
445 |
.Case("myriad", Triple::Myriad) |
444 |
.Case("amd", Triple::AMD) |
446 |
.Case("amd", Triple::AMD) |
445 |
.Case("mesa", Triple::Mesa) |
447 |
.Case("mesa", Triple::Mesa) |
|
|
448 |
.Case("softfloat", Triple::SoftFloat) |
449 |
.Case("hardfloat", Triple::HardFloat) |
446 |
.Default(Triple::UnknownVendor); |
450 |
.Default(Triple::UnknownVendor); |
447 |
} |
451 |
} |
448 |
|
452 |
|
Lines 482-489
static Triple::OSType parseOS(StringRef OSName) {
Link Here
|
482 |
.Default(Triple::UnknownOS); |
486 |
.Default(Triple::UnknownOS); |
483 |
} |
487 |
} |
484 |
|
488 |
|
485 |
static Triple::EnvironmentType parseEnvironment(StringRef EnvironmentName) { |
489 |
static Triple::EnvironmentType parseEnvironment(StringRef EnvironmentName, |
486 |
return StringSwitch<Triple::EnvironmentType>(EnvironmentName) |
490 |
Triple::VendorType Vendor) { |
|
|
491 |
auto ET = StringSwitch<Triple::EnvironmentType>(EnvironmentName) |
487 |
.StartsWith("eabihf", Triple::EABIHF) |
492 |
.StartsWith("eabihf", Triple::EABIHF) |
488 |
.StartsWith("eabi", Triple::EABI) |
493 |
.StartsWith("eabi", Triple::EABI) |
489 |
.StartsWith("gnuabi64", Triple::GNUABI64) |
494 |
.StartsWith("gnuabi64", Triple::GNUABI64) |
Lines 503-508
static Triple::EnvironmentType parseEnvironment(StringRef EnvironmentName) {
Link Here
|
503 |
.StartsWith("coreclr", Triple::CoreCLR) |
508 |
.StartsWith("coreclr", Triple::CoreCLR) |
504 |
.StartsWith("opencl", Triple::OpenCL) |
509 |
.StartsWith("opencl", Triple::OpenCL) |
505 |
.Default(Triple::UnknownEnvironment); |
510 |
.Default(Triple::UnknownEnvironment); |
|
|
511 |
|
512 |
// Gentoo abuses the vendor field for softfloat/hardfloat ARM |
513 |
// e.g. arm-softfloat-linux-gnueabi, arm-hardfloat-linux-gnueabi |
514 |
if (Vendor == Triple::HardFloat) { |
515 |
switch (ET) { |
516 |
case Triple::EABI: |
517 |
ET = Triple::EABIHF; |
518 |
break; |
519 |
case Triple::GNUEABI: |
520 |
ET = Triple::GNUEABIHF; |
521 |
break; |
522 |
case Triple::MuslEABI: |
523 |
ET = Triple::MuslEABIHF; |
524 |
break; |
525 |
default: |
526 |
break; |
527 |
} |
528 |
} |
529 |
|
530 |
return ET; |
506 |
} |
531 |
} |
507 |
|
532 |
|
508 |
static Triple::ObjectFormatType parseFormat(StringRef EnvironmentName) { |
533 |
static Triple::ObjectFormatType parseFormat(StringRef EnvironmentName) { |
Lines 670-676
Triple::Triple(const Twine &Str)
Link Here
|
670 |
if (Components.size() > 2) { |
695 |
if (Components.size() > 2) { |
671 |
OS = parseOS(Components[2]); |
696 |
OS = parseOS(Components[2]); |
672 |
if (Components.size() > 3) { |
697 |
if (Components.size() > 3) { |
673 |
Environment = parseEnvironment(Components[3]); |
698 |
Environment = parseEnvironment(Components[3], Vendor); |
674 |
ObjectFormat = parseFormat(Components[3]); |
699 |
ObjectFormat = parseFormat(Components[3]); |
675 |
} |
700 |
} |
676 |
} |
701 |
} |
Lines 709-715
Triple::Triple(const Twine &ArchStr, const Twine &VendorStr, const Twine &OSStr,
Link Here
|
709 |
SubArch(parseSubArch(ArchStr.str())), |
734 |
SubArch(parseSubArch(ArchStr.str())), |
710 |
Vendor(parseVendor(VendorStr.str())), |
735 |
Vendor(parseVendor(VendorStr.str())), |
711 |
OS(parseOS(OSStr.str())), |
736 |
OS(parseOS(OSStr.str())), |
712 |
Environment(parseEnvironment(EnvironmentStr.str())), |
737 |
Environment(parseEnvironment(EnvironmentStr.str(), Vendor)), |
713 |
ObjectFormat(parseFormat(EnvironmentStr.str())) { |
738 |
ObjectFormat(parseFormat(EnvironmentStr.str())) { |
714 |
if (ObjectFormat == Triple::UnknownObjectFormat) |
739 |
if (ObjectFormat == Triple::UnknownObjectFormat) |
715 |
ObjectFormat = getDefaultFormat(*this); |
740 |
ObjectFormat = getDefaultFormat(*this); |
Lines 742-748
std::string Triple::normalize(StringRef Str) {
Link Here
|
742 |
} |
767 |
} |
743 |
EnvironmentType Environment = UnknownEnvironment; |
768 |
EnvironmentType Environment = UnknownEnvironment; |
744 |
if (Components.size() > 3) |
769 |
if (Components.size() > 3) |
745 |
Environment = parseEnvironment(Components[3]); |
770 |
Environment = parseEnvironment(Components[3], Vendor); |
746 |
ObjectFormatType ObjectFormat = UnknownObjectFormat; |
771 |
ObjectFormatType ObjectFormat = UnknownObjectFormat; |
747 |
if (Components.size() > 4) |
772 |
if (Components.size() > 4) |
748 |
ObjectFormat = parseFormat(Components[4]); |
773 |
ObjectFormat = parseFormat(Components[4]); |
Lines 787-793
std::string Triple::normalize(StringRef Str) {
Link Here
|
787 |
Valid = OS != UnknownOS || IsCygwin || IsMinGW32; |
812 |
Valid = OS != UnknownOS || IsCygwin || IsMinGW32; |
788 |
break; |
813 |
break; |
789 |
case 3: |
814 |
case 3: |
790 |
Environment = parseEnvironment(Comp); |
815 |
Environment = parseEnvironment(Comp, Vendor); |
791 |
Valid = Environment != UnknownEnvironment; |
816 |
Valid = Environment != UnknownEnvironment; |
792 |
if (!Valid) { |
817 |
if (!Valid) { |
793 |
ObjectFormat = parseFormat(Comp); |
818 |
ObjectFormat = parseFormat(Comp); |