[llvm] r251390 - [X86] Make elfiamcu an OS, not an environment.

Michael Kuperstein via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 27 00:23:59 PDT 2015


Author: mkuper
Date: Tue Oct 27 02:23:59 2015
New Revision: 251390

URL: http://llvm.org/viewvc/llvm-project?rev=251390&view=rev
Log:
[X86] Make elfiamcu an OS, not an environment.

GNU tools require elfiamcu to take up the entire OS field, so, e.g.
i?86-*-linux-elfiamcu is not considered a legal triple.
Make us compatible.

Differential Revision: http://reviews.llvm.org/D14081

Modified:
    llvm/trunk/include/llvm/ADT/Triple.h
    llvm/trunk/lib/Support/Triple.cpp
    llvm/trunk/lib/Target/X86/X86Subtarget.h
    llvm/trunk/test/CodeGen/X86/mcu-abi.ll
    llvm/trunk/unittests/ADT/TripleTest.cpp

Modified: llvm/trunk/include/llvm/ADT/Triple.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/Triple.h?rev=251390&r1=251389&r2=251390&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/Triple.h (original)
+++ llvm/trunk/include/llvm/ADT/Triple.h Tue Oct 27 02:23:59 2015
@@ -155,7 +155,8 @@ public:
     NVCL,       // NVIDIA OpenCL
     AMDHSA,     // AMD HSA Runtime
     PS4,
-    LastOSType = PS4
+    ELFIAMCU,
+    LastOSType = ELFIAMCU
   };
   enum EnvironmentType {
     UnknownEnvironment,
@@ -174,8 +175,7 @@ public:
     Cygnus,
     AMDOpenCL,
     CoreCLR,
-    ELFIAMCU,
-    LastEnvironmentType = ELFIAMCU
+    LastEnvironmentType = CoreCLR
   };
   enum ObjectFormatType {
     UnknownObjectFormat,
@@ -432,8 +432,8 @@ public:
     return getOS() == Triple::Bitrig;
   }
 
-  bool isEnvironmentIAMCU() const {
-    return getEnvironment() == Triple::ELFIAMCU;
+  bool isOSIAMCU() const {
+    return getOS() == Triple::ELFIAMCU;
   }
 
   bool isWindowsMSVCEnvironment() const {

Modified: llvm/trunk/lib/Support/Triple.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Triple.cpp?rev=251390&r1=251389&r2=251390&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Triple.cpp (original)
+++ llvm/trunk/lib/Support/Triple.cpp Tue Oct 27 02:23:59 2015
@@ -181,6 +181,7 @@ const char *Triple::getOSTypeName(OSType
   case NVCL: return "nvcl";
   case AMDHSA: return "amdhsa";
   case PS4: return "ps4";
+  case ELFIAMCU: return "elfiamcu";
   }
 
   llvm_unreachable("Invalid OSType");
@@ -202,7 +203,6 @@ const char *Triple::getEnvironmentTypeNa
   case Cygnus: return "cygnus";
   case AMDOpenCL: return "amdopencl";
   case CoreCLR: return "coreclr";
-  case ELFIAMCU: return "elfiamcu";
   }
 
   llvm_unreachable("Invalid EnvironmentType!");
@@ -436,6 +436,7 @@ static Triple::OSType parseOS(StringRef
     .StartsWith("nvcl", Triple::NVCL)
     .StartsWith("amdhsa", Triple::AMDHSA)
     .StartsWith("ps4", Triple::PS4)
+    .StartsWith("elfiamcu", Triple::ELFIAMCU)
     .Default(Triple::UnknownOS);
 }
 
@@ -454,7 +455,6 @@ static Triple::EnvironmentType parseEnvi
     .StartsWith("cygnus", Triple::Cygnus)
     .StartsWith("amdopencl", Triple::AMDOpenCL)
     .StartsWith("coreclr", Triple::CoreCLR)
-    .StartsWith("elfiamcu", Triple::ELFIAMCU)
     .Default(Triple::UnknownEnvironment);
 }
 

Modified: llvm/trunk/lib/Target/X86/X86Subtarget.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Subtarget.h?rev=251390&r1=251389&r2=251390&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86Subtarget.h (original)
+++ llvm/trunk/lib/Target/X86/X86Subtarget.h Tue Oct 27 02:23:59 2015
@@ -418,7 +418,7 @@ public:
   bool isTargetNaCl() const { return TargetTriple.isOSNaCl(); }
   bool isTargetNaCl32() const { return isTargetNaCl() && !is64Bit(); }
   bool isTargetNaCl64() const { return isTargetNaCl() && is64Bit(); }
-  bool isTargetMCU() const { return TargetTriple.isEnvironmentIAMCU(); }
+  bool isTargetMCU() const { return TargetTriple.isOSIAMCU(); }
 
   bool isTargetWindowsMSVC() const {
     return TargetTriple.isWindowsMSVCEnvironment();

Modified: llvm/trunk/test/CodeGen/X86/mcu-abi.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/mcu-abi.ll?rev=251390&r1=251389&r2=251390&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/mcu-abi.ll (original)
+++ llvm/trunk/test/CodeGen/X86/mcu-abi.ll Tue Oct 27 02:23:59 2015
@@ -1,4 +1,4 @@
-; RUN: llc < %s -mtriple=i686-pc-linux-elfiamcu | FileCheck %s
+; RUN: llc < %s -mtriple=i686-pc-elfiamcu | FileCheck %s
 
 ; CHECK-LABEL: test_lib_args:
 ; CHECK: movl %edx, %eax

Modified: llvm/trunk/unittests/ADT/TripleTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/TripleTest.cpp?rev=251390&r1=251389&r2=251390&view=diff
==============================================================================
--- llvm/trunk/unittests/ADT/TripleTest.cpp (original)
+++ llvm/trunk/unittests/ADT/TripleTest.cpp Tue Oct 27 02:23:59 2015
@@ -81,11 +81,11 @@ TEST(TripleTest, ParsedIDs) {
   EXPECT_EQ(Triple::Darwin, T.getOS());
   EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment());
 
-  T = Triple("i386-pc-linux-elfiamcu");
+  T = Triple("i386-pc-elfiamcu");
   EXPECT_EQ(Triple::x86, T.getArch());
   EXPECT_EQ(Triple::PC, T.getVendor());
-  EXPECT_EQ(Triple::Linux, T.getOS());
-  EXPECT_EQ(Triple::ELFIAMCU, T.getEnvironment());
+  EXPECT_EQ(Triple::ELFIAMCU, T.getOS());
+  EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment());
 
   T = Triple("x86_64-pc-linux-gnu");
   EXPECT_EQ(Triple::x86_64, T.getArch());




More information about the llvm-commits mailing list