[PATCH] D24897: Define "contiki" OS specifier.
Michael LeMay via llvm-commits
llvm-commits at lists.llvm.org
Sat Sep 24 21:00:27 PDT 2016
mlemay-intel updated this revision to Diff 72417.
mlemay-intel added a comment.
Added test.
https://reviews.llvm.org/D24897
Files:
include/llvm/ADT/Triple.h
lib/Support/Triple.cpp
lib/Target/X86/X86Subtarget.h
unittests/ADT/TripleTest.cpp
Index: unittests/ADT/TripleTest.cpp
===================================================================
--- unittests/ADT/TripleTest.cpp
+++ unittests/ADT/TripleTest.cpp
@@ -87,6 +87,12 @@
EXPECT_EQ(Triple::ELFIAMCU, T.getOS());
EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment());
+ T = Triple("i386-pc-contiki-unknown");
+ EXPECT_EQ(Triple::x86, T.getArch());
+ EXPECT_EQ(Triple::PC, T.getVendor());
+ EXPECT_EQ(Triple::Contiki, T.getOS());
+ EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment());
+
T = Triple("x86_64-pc-linux-gnu");
EXPECT_EQ(Triple::x86_64, T.getArch());
EXPECT_EQ(Triple::PC, T.getVendor());
Index: lib/Target/X86/X86Subtarget.h
===================================================================
--- lib/Target/X86/X86Subtarget.h
+++ lib/Target/X86/X86Subtarget.h
@@ -491,6 +491,7 @@
bool isTargetNaCl32() const { return isTargetNaCl() && !is64Bit(); }
bool isTargetNaCl64() const { return isTargetNaCl() && is64Bit(); }
bool isTargetMCU() const { return TargetTriple.isOSIAMCU(); }
+ bool isTargetContiki() const { return TargetTriple.isOSContiki(); }
bool isTargetWindowsMSVC() const {
return TargetTriple.isWindowsMSVCEnvironment();
Index: lib/Support/Triple.cpp
===================================================================
--- lib/Support/Triple.cpp
+++ lib/Support/Triple.cpp
@@ -192,6 +192,7 @@
case TvOS: return "tvos";
case WatchOS: return "watchos";
case Mesa3D: return "mesa3d";
+ case Contiki: return "contiki";
}
llvm_unreachable("Invalid OSType");
@@ -463,6 +464,7 @@
.StartsWith("tvos", Triple::TvOS)
.StartsWith("watchos", Triple::WatchOS)
.StartsWith("mesa3d", Triple::Mesa3D)
+ .StartsWith("contiki", Triple::Contiki)
.Default(Triple::UnknownOS);
}
Index: include/llvm/ADT/Triple.h
===================================================================
--- include/llvm/ADT/Triple.h
+++ include/llvm/ADT/Triple.h
@@ -168,7 +168,8 @@
TvOS, // Apple tvOS
WatchOS, // Apple watchOS
Mesa3D,
- LastOSType = Mesa3D
+ Contiki,
+ LastOSType = Contiki
};
enum EnvironmentType {
UnknownEnvironment,
@@ -483,6 +484,10 @@
Env == Triple::GNUX32;
}
+ bool isOSContiki() const {
+ return getOS() == Triple::Contiki;
+ }
+
/// Checks if the environment could be MSVC.
bool isWindowsMSVCEnvironment() const {
return getOS() == Triple::Win32 &&
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24897.72417.patch
Type: text/x-patch
Size: 2445 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160925/b8c558af/attachment.bin>
More information about the llvm-commits
mailing list