Index: llvm/trunk/include/llvm/ADT/Triple.h =================================================================== --- llvm/trunk/include/llvm/ADT/Triple.h +++ llvm/trunk/include/llvm/ADT/Triple.h @@ -174,7 +174,8 @@ Cygnus, AMDOpenCL, CoreCLR, - LastEnvironmentType = CoreCLR + ELFIAMCU, + LastEnvironmentType = ELFIAMCU }; enum ObjectFormatType { UnknownObjectFormat, @@ -431,6 +432,10 @@ return getOS() == Triple::Bitrig; } + bool isEnvironmentIAMCU() const { + return getEnvironment() == Triple::ELFIAMCU; + } + bool isWindowsMSVCEnvironment() const { return getOS() == Triple::Win32 && (getEnvironment() == Triple::UnknownEnvironment || Index: llvm/trunk/lib/Support/Triple.cpp =================================================================== --- llvm/trunk/lib/Support/Triple.cpp +++ llvm/trunk/lib/Support/Triple.cpp @@ -202,6 +202,7 @@ case Cygnus: return "cygnus"; case AMDOpenCL: return "amdopencl"; case CoreCLR: return "coreclr"; + case ELFIAMCU: return "elfiamcu"; } llvm_unreachable("Invalid EnvironmentType!"); @@ -453,6 +454,7 @@ .StartsWith("cygnus", Triple::Cygnus) .StartsWith("amdopencl", Triple::AMDOpenCL) .StartsWith("coreclr", Triple::CoreCLR) + .StartsWith("elfiamcu", Triple::ELFIAMCU) .Default(Triple::UnknownEnvironment); } Index: llvm/trunk/lib/Target/X86/X86Subtarget.h =================================================================== --- llvm/trunk/lib/Target/X86/X86Subtarget.h +++ llvm/trunk/lib/Target/X86/X86Subtarget.h @@ -418,6 +418,7 @@ 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 isTargetWindowsMSVC() const { return TargetTriple.isWindowsMSVCEnvironment(); Index: llvm/trunk/unittests/ADT/TripleTest.cpp =================================================================== --- llvm/trunk/unittests/ADT/TripleTest.cpp +++ llvm/trunk/unittests/ADT/TripleTest.cpp @@ -81,6 +81,12 @@ EXPECT_EQ(Triple::Darwin, T.getOS()); EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment()); + T = Triple("i386-pc-linux-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()); + T = Triple("x86_64-pc-linux-gnu"); EXPECT_EQ(Triple::x86_64, T.getArch()); EXPECT_EQ(Triple::PC, T.getVendor());