From d5772de0eb953d212cb3628814a32c1d34cd4681 Mon Sep 17 00:00:00 2001 From: Duncan Sands Date: Fri, 12 Oct 2012 11:08:57 +0000 Subject: [PATCH] Add powerpc-ibm-aix to Triple. Patch by Kai. llvm-svn: 165792 --- llvm/include/llvm/ADT/Triple.h | 6 ++++-- llvm/lib/Support/Triple.cpp | 4 ++++ llvm/unittests/ADT/TripleTest.cpp | 12 ++++++++++++ 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/llvm/include/llvm/ADT/Triple.h b/llvm/include/llvm/ADT/Triple.h index a052768..15fe55f 100644 --- a/llvm/include/llvm/ADT/Triple.h +++ b/llvm/include/llvm/ADT/Triple.h @@ -76,7 +76,8 @@ public: SCEI, BGP, BGQ, - Freescale + Freescale, + IBM }; enum OSType { UnknownOS, @@ -101,7 +102,8 @@ public: RTEMS, NativeClient, CNK, // BG/P Compute-Node Kernel - Bitrig + Bitrig, + AIX }; enum EnvironmentType { UnknownEnvironment, diff --git a/llvm/lib/Support/Triple.cpp b/llvm/lib/Support/Triple.cpp index abfaecc..2cc7a58 100644 --- a/llvm/lib/Support/Triple.cpp +++ b/llvm/lib/Support/Triple.cpp @@ -98,6 +98,7 @@ const char *Triple::getVendorTypeName(VendorType Kind) { case BGP: return "bgp"; case BGQ: return "bgq"; case Freescale: return "fsl"; + case IBM: return "ibm"; } llvm_unreachable("Invalid VendorType!"); @@ -128,6 +129,7 @@ const char *Triple::getOSTypeName(OSType Kind) { case NativeClient: return "nacl"; case CNK: return "cnk"; case Bitrig: return "bitrig"; + case AIX: return "aix"; } llvm_unreachable("Invalid OSType"); @@ -278,6 +280,7 @@ static Triple::VendorType parseVendor(StringRef VendorName) { .Case("bgp", Triple::BGP) .Case("bgq", Triple::BGQ) .Case("fsl", Triple::Freescale) + .Case("ibm", Triple::IBM) .Default(Triple::UnknownVendor); } @@ -304,6 +307,7 @@ static Triple::OSType parseOS(StringRef OSName) { .StartsWith("nacl", Triple::NativeClient) .StartsWith("cnk", Triple::CNK) .StartsWith("bitrig", Triple::Bitrig) + .StartsWith("aix", Triple::AIX) .Default(Triple::UnknownOS); } diff --git a/llvm/unittests/ADT/TripleTest.cpp b/llvm/unittests/ADT/TripleTest.cpp index 967437c..7c3ab97 100644 --- a/llvm/unittests/ADT/TripleTest.cpp +++ b/llvm/unittests/ADT/TripleTest.cpp @@ -105,6 +105,18 @@ TEST(TripleTest, ParsedIDs) { EXPECT_EQ(Triple::Linux, T.getOS()); EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment()); + T = Triple("powerpc-ibm-aix"); + EXPECT_EQ(Triple::ppc, T.getArch()); + EXPECT_EQ(Triple::IBM, T.getVendor()); + EXPECT_EQ(Triple::AIX, T.getOS()); + EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment()); + + T = Triple("powerpc64-ibm-aix"); + EXPECT_EQ(Triple::ppc64, T.getArch()); + EXPECT_EQ(Triple::IBM, T.getVendor()); + EXPECT_EQ(Triple::AIX, 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()); -- 2.7.4