Add the triple for the Sony Playstation®4.
authorAlex Rosenberg <alexr@leftfield.org>
Sun, 25 Jan 2015 22:46:59 +0000 (22:46 +0000)
committerAlex Rosenberg <alexr@leftfield.org>
Sun, 25 Jan 2015 22:46:59 +0000 (22:46 +0000)
Lots more to follow.

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

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

index 48df27e4bb642afe576dd739a805324e4242a93e..55c884f65f0bc4bb9ea158e150bec384c9c2cbd9 100644 (file)
@@ -141,7 +141,8 @@ public:
     AIX,
     CUDA,       // NVIDIA CUDA
     NVCL,       // NVIDIA OpenCL
-    AMDHSA      // AMD HSA Runtime
+    AMDHSA,     // AMD HSA Runtime
+    PS4
   };
   enum EnvironmentType {
     UnknownEnvironment,
@@ -455,6 +456,19 @@ public:
     return getObjectFormat() == Triple::MachO;
   }
 
+  /// \brief Tests whether the target is the PS4 CPU
+  bool isPS4CPU() const {
+    return getArch() == Triple::x86_64 &&
+           getVendor() == Triple::SCEI &&
+           getOS() == Triple::PS4;
+  }
+
+  /// \brief Tests whether the target is the PS4 platform
+  bool isPS4() const {
+    return getVendor() == Triple::SCEI &&
+           getOS() == Triple::PS4;
+  }
+
   /// @}
   /// @name Mutators
   /// @{
index 68548299d34d729f0eae35a5250d7b4bb8b5c6b0..4032d6d77c9c41c2dbfea17c1b605cb92b7d6a13 100644 (file)
@@ -163,6 +163,7 @@ const char *Triple::getOSTypeName(OSType Kind) {
   case CUDA: return "cuda";
   case NVCL: return "nvcl";
   case AMDHSA: return "amdhsa";
+  case PS4: return "ps4";
   }
 
   llvm_unreachable("Invalid OSType");
@@ -356,6 +357,7 @@ static Triple::OSType parseOS(StringRef OSName) {
     .StartsWith("cuda", Triple::CUDA)
     .StartsWith("nvcl", Triple::NVCL)
     .StartsWith("amdhsa", Triple::AMDHSA)
+    .StartsWith("ps4", Triple::PS4)
     .Default(Triple::UnknownOS);
 }