diff options
-rw-r--r-- | include/llvm/ADT/Triple.h | 7 | ||||
-rw-r--r-- | lib/Support/Triple.cpp | 6 | ||||
-rw-r--r-- | unittests/ADT/TripleTest.cpp | 18 |
3 files changed, 29 insertions, 2 deletions
diff --git a/include/llvm/ADT/Triple.h b/include/llvm/ADT/Triple.h index 102c95a368..f5f99d0f1b 100644 --- a/include/llvm/ADT/Triple.h +++ b/include/llvm/ADT/Triple.h @@ -72,7 +72,9 @@ public: Apple, PC, - SCEI + SCEI, + BGP, + BGQ }; enum OSType { UnknownOS, @@ -95,7 +97,8 @@ public: Haiku, Minix, RTEMS, - NativeClient + NativeClient, + CNK // BG/P Compute-Node Kernel }; enum EnvironmentType { UnknownEnvironment, diff --git a/lib/Support/Triple.cpp b/lib/Support/Triple.cpp index d261c53139..44a1b38d98 100644 --- a/lib/Support/Triple.cpp +++ b/lib/Support/Triple.cpp @@ -88,6 +88,8 @@ const char *Triple::getVendorTypeName(VendorType Kind) { case Apple: return "apple"; case PC: return "pc"; case SCEI: return "scei"; + case BGP: return "bgp"; + case BGQ: return "bgq"; } llvm_unreachable("Invalid VendorType!"); @@ -116,6 +118,7 @@ const char *Triple::getOSTypeName(OSType Kind) { case Minix: return "minix"; case RTEMS: return "rtems"; case NativeClient: return "nacl"; + case CNK: return "cnk"; } llvm_unreachable("Invalid OSType"); @@ -258,6 +261,8 @@ static Triple::VendorType parseVendor(StringRef VendorName) { .Case("apple", Triple::Apple) .Case("pc", Triple::PC) .Case("scei", Triple::SCEI) + .Case("bgp", Triple::BGP) + .Case("bgq", Triple::BGQ) .Default(Triple::UnknownVendor); } @@ -282,6 +287,7 @@ static Triple::OSType parseOS(StringRef OSName) { .StartsWith("minix", Triple::Minix) .StartsWith("rtems", Triple::RTEMS) .StartsWith("nacl", Triple::NativeClient) + .StartsWith("cnk", Triple::CNK) .Default(Triple::UnknownOS); } diff --git a/unittests/ADT/TripleTest.cpp b/unittests/ADT/TripleTest.cpp index 35a21877d5..479046e01d 100644 --- a/unittests/ADT/TripleTest.cpp +++ b/unittests/ADT/TripleTest.cpp @@ -87,6 +87,24 @@ TEST(TripleTest, ParsedIDs) { EXPECT_EQ(Triple::Linux, T.getOS()); EXPECT_EQ(Triple::GNU, T.getEnvironment()); + T = Triple("powerpc-bgp-linux"); + EXPECT_EQ(Triple::ppc, T.getArch()); + EXPECT_EQ(Triple::BGP, T.getVendor()); + EXPECT_EQ(Triple::Linux, T.getOS()); + EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment()); + + T = Triple("powerpc-bgp-cnk"); + EXPECT_EQ(Triple::ppc, T.getArch()); + EXPECT_EQ(Triple::BGP, T.getVendor()); + EXPECT_EQ(Triple::CNK, T.getOS()); + EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment()); + + T = Triple("powerpc64-bgq-linux"); + EXPECT_EQ(Triple::ppc64, T.getArch()); + EXPECT_EQ(Triple::BGQ, T.getVendor()); + EXPECT_EQ(Triple::Linux, T.getOS()); + EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment()); + T = Triple("powerpc-dunno-notsure"); EXPECT_EQ(Triple::ppc, T.getArch()); EXPECT_EQ(Triple::UnknownVendor, T.getVendor()); |