From d8c145fd49e1d71271a65143283465f18a3b513a Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Thu, 30 Jul 2015 08:16:51 +0000 Subject: [PATCH] Add amdopencl environment to triple This is used by the AMD x86 OpenCL implementation to change some ABI details on Windows and Linux. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243627 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/ADT/Triple.h | 3 ++- lib/Support/Triple.cpp | 2 ++ unittests/ADT/TripleTest.cpp | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/include/llvm/ADT/Triple.h b/include/llvm/ADT/Triple.h index 947812d94ec..4ad9396066a 100644 --- a/include/llvm/ADT/Triple.h +++ b/include/llvm/ADT/Triple.h @@ -170,7 +170,8 @@ public: MSVC, Itanium, Cygnus, - LastEnvironmentType = Cygnus + AMDOpenCL, + LastEnvironmentType = AMDOpenCL }; enum ObjectFormatType { UnknownObjectFormat, diff --git a/lib/Support/Triple.cpp b/lib/Support/Triple.cpp index c6646fb101b..f1b009e19e1 100644 --- a/lib/Support/Triple.cpp +++ b/lib/Support/Triple.cpp @@ -196,6 +196,7 @@ const char *Triple::getEnvironmentTypeName(EnvironmentType Kind) { case MSVC: return "msvc"; case Itanium: return "itanium"; case Cygnus: return "cygnus"; + case AMDOpenCL: return "amdopencl"; } llvm_unreachable("Invalid EnvironmentType!"); @@ -430,6 +431,7 @@ static Triple::EnvironmentType parseEnvironment(StringRef EnvironmentName) { .StartsWith("msvc", Triple::MSVC) .StartsWith("itanium", Triple::Itanium) .StartsWith("cygnus", Triple::Cygnus) + .StartsWith("amdopencl", Triple::AMDOpenCL) .Default(Triple::UnknownEnvironment); } diff --git a/unittests/ADT/TripleTest.cpp b/unittests/ADT/TripleTest.cpp index 2b1e871b94c..ead430bdc48 100644 --- a/unittests/ADT/TripleTest.cpp +++ b/unittests/ADT/TripleTest.cpp @@ -354,6 +354,8 @@ TEST(TripleTest, MutateName) { EXPECT_EQ(Triple::Darwin, T.getOS()); EXPECT_EQ("i386-pc-darwin", T.getTriple()); + T.setEnvironmentName("amdopencl"); + EXPECT_EQ(Triple::AMDOpenCL, T.getEnvironment()); } TEST(TripleTest, BitWidthPredicates) { -- 2.34.1