Add AMDGPU related triple vendors/OSes

As support expands to more runtimes, we'll need to
distinguish between more than just HSA and unknown.
This also lets us stop using unknown everywhere.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260790 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Matt Arsenault 2016-02-13 01:56:21 +00:00
parent be38c61412
commit e31b74e98b
3 changed files with 23 additions and 2 deletions

View File

@ -131,7 +131,9 @@ public:
NVIDIA,
CSR,
Myriad,
LastVendorType = Myriad
AMD,
Mesa,
LastVendorType = Mesa
};
enum OSType {
UnknownOS,
@ -163,7 +165,8 @@ public:
ELFIAMCU,
TvOS, // Apple tvOS
WatchOS, // Apple watchOS
LastOSType = WatchOS
Mesa3D,
LastOSType = Mesa3D
};
enum EnvironmentType {
UnknownEnvironment,

View File

@ -150,6 +150,8 @@ const char *Triple::getVendorTypeName(VendorType Kind) {
case NVIDIA: return "nvidia";
case CSR: return "csr";
case Myriad: return "myriad";
case AMD: return "amd";
case Mesa: return "mesa";
}
llvm_unreachable("Invalid VendorType!");
@ -186,6 +188,7 @@ const char *Triple::getOSTypeName(OSType Kind) {
case ELFIAMCU: return "elfiamcu";
case TvOS: return "tvos";
case WatchOS: return "watchos";
case Mesa3D: return "mesa3d";
}
llvm_unreachable("Invalid OSType");
@ -412,6 +415,8 @@ static Triple::VendorType parseVendor(StringRef VendorName) {
.Case("nvidia", Triple::NVIDIA)
.Case("csr", Triple::CSR)
.Case("myriad", Triple::Myriad)
.Case("amd", Triple::AMD)
.Case("mesa", Triple::Mesa)
.Default(Triple::UnknownVendor);
}
@ -445,6 +450,7 @@ static Triple::OSType parseOS(StringRef OSName) {
.StartsWith("elfiamcu", Triple::ELFIAMCU)
.StartsWith("tvos", Triple::TvOS)
.StartsWith("watchos", Triple::WatchOS)
.StartsWith("mesa3d", Triple::Mesa3D)
.Default(Triple::UnknownOS);
}

View File

@ -224,6 +224,18 @@ TEST(TripleTest, ParsedIDs) {
EXPECT_EQ(Triple::UnknownOS, T.getOS());
EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment());
T = Triple("amdgcn-mesa-mesa3d");
EXPECT_EQ(Triple::amdgcn, T.getArch());
EXPECT_EQ(Triple::Mesa, T.getVendor());
EXPECT_EQ(Triple::Mesa3D, T.getOS());
EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment());
T = Triple("amdgcn-amd-amdhsa");
EXPECT_EQ(Triple::amdgcn, T.getArch());
EXPECT_EQ(Triple::AMD, T.getVendor());
EXPECT_EQ(Triple::AMDHSA, T.getOS());
EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment());
T = Triple("huh");
EXPECT_EQ(Triple::UnknownArch, T.getArch());
}