diff --git a/include/llvm/ADT/Triple.h b/include/llvm/ADT/Triple.h index bb0e05c0deb..5f3742c8998 100644 --- a/include/llvm/ADT/Triple.h +++ b/include/llvm/ADT/Triple.h @@ -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 { diff --git a/lib/Support/Triple.cpp b/lib/Support/Triple.cpp index f3b3de7af3f..142a9b9e200 100644 --- a/lib/Support/Triple.cpp +++ b/lib/Support/Triple.cpp @@ -181,6 +181,7 @@ const char *Triple::getOSTypeName(OSType Kind) { 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::getEnvironmentTypeName(EnvironmentType Kind) { 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 OSName) { .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 parseEnvironment(StringRef EnvironmentName) { .StartsWith("cygnus", Triple::Cygnus) .StartsWith("amdopencl", Triple::AMDOpenCL) .StartsWith("coreclr", Triple::CoreCLR) - .StartsWith("elfiamcu", Triple::ELFIAMCU) .Default(Triple::UnknownEnvironment); } diff --git a/lib/Target/X86/X86Subtarget.h b/lib/Target/X86/X86Subtarget.h index c1842e1a5fd..85d4d1ae404 100644 --- a/lib/Target/X86/X86Subtarget.h +++ b/lib/Target/X86/X86Subtarget.h @@ -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(); diff --git a/test/CodeGen/X86/mcu-abi.ll b/test/CodeGen/X86/mcu-abi.ll index 4da9f3d91ba..6dc2c993032 100644 --- a/test/CodeGen/X86/mcu-abi.ll +++ b/test/CodeGen/X86/mcu-abi.ll @@ -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 diff --git a/unittests/ADT/TripleTest.cpp b/unittests/ADT/TripleTest.cpp index 015eb853e5b..97635cae488 100644 --- a/unittests/ADT/TripleTest.cpp +++ b/unittests/ADT/TripleTest.cpp @@ -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());