]> granicus.if.org Git - llvm/commitdiff
[mips] Recognise the triple used by Debian for MIPS n32 ABI
authorSimon Atanasyan <simon@atanasyan.com>
Thu, 14 Sep 2017 06:50:05 +0000 (06:50 +0000)
committerSimon Atanasyan <simon@atanasyan.com>
Thu, 14 Sep 2017 06:50:05 +0000 (06:50 +0000)
Triples like mips64-linux-gnuabin32 are documented in this article:
https://wiki.debian.org/Multiarch/Tuples

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313231 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/ADT/Triple.h
lib/Support/Triple.cpp
unittests/ADT/TripleTest.cpp

index 91ab8554d136176af7b9b79cc6f0920884e59999..4e1e218da78d828cf171f0f0a8e60fc13c330108 100644 (file)
@@ -185,6 +185,7 @@ public:
     UnknownEnvironment,
 
     GNU,
+    GNUABIN32,
     GNUABI64,
     GNUEABI,
     GNUEABIHF,
@@ -496,9 +497,9 @@ public:
 
   bool isGNUEnvironment() const {
     EnvironmentType Env = getEnvironment();
-    return Env == Triple::GNU || Env == Triple::GNUABI64 ||
-           Env == Triple::GNUEABI || Env == Triple::GNUEABIHF ||
-           Env == Triple::GNUX32;
+    return Env == Triple::GNU || Env == Triple::GNUABIN32 ||
+           Env == Triple::GNUABI64 || Env == Triple::GNUEABI ||
+           Env == Triple::GNUEABIHF || Env == Triple::GNUX32;
   }
 
   bool isOSContiki() const {
index 73dc59ce41b8b25b315f7a862160b3f3001cc324..8dc582ab95aae759f1e351136f7ca074cdb7d52c 100644 (file)
@@ -216,6 +216,7 @@ StringRef Triple::getEnvironmentTypeName(EnvironmentType Kind) {
   switch (Kind) {
   case UnknownEnvironment: return "unknown";
   case GNU: return "gnu";
+  case GNUABIN32: return "gnuabin32";
   case GNUABI64: return "gnuabi64";
   case GNUEABIHF: return "gnueabihf";
   case GNUEABI: return "gnueabi";
@@ -505,6 +506,7 @@ static Triple::EnvironmentType parseEnvironment(StringRef EnvironmentName) {
   return StringSwitch<Triple::EnvironmentType>(EnvironmentName)
     .StartsWith("eabihf", Triple::EABIHF)
     .StartsWith("eabi", Triple::EABI)
+    .StartsWith("gnuabin32", Triple::GNUABIN32)
     .StartsWith("gnuabi64", Triple::GNUABI64)
     .StartsWith("gnueabihf", Triple::GNUEABIHF)
     .StartsWith("gnueabi", Triple::GNUEABI)
index 0cedbd5a72349252a07158c25aad94d439dd70cb..db11f42649016b00ec87e6352cfdd0f123983319 100644 (file)
@@ -332,6 +332,12 @@ TEST(TripleTest, ParsedIDs) {
   EXPECT_EQ(Triple::Linux, T.getOS());
   EXPECT_EQ(Triple::GNU, T.getEnvironment());
 
+  T = Triple("mips64el-img-linux-gnuabin32");
+  EXPECT_EQ(Triple::mips64el, T.getArch());
+  EXPECT_EQ(Triple::ImaginationTechnologies, T.getVendor());
+  EXPECT_EQ(Triple::Linux, T.getOS());
+  EXPECT_EQ(Triple::GNUABIN32, T.getEnvironment());
+
   T = Triple("mips64el-unknown-linux-gnuabi64");
   EXPECT_EQ(Triple::mips64el, T.getArch());
   EXPECT_EQ(Triple::UnknownVendor, T.getVendor());