Skip to content

Commit 38babd1

Browse files
committedJan 25, 2015
Add the triple for the Sony Playstation®4.
Lots more to follow. llvm-svn: 227060
1 parent efdbf4c commit 38babd1

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed
 

‎llvm/include/llvm/ADT/Triple.h

+15-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,8 @@ class Triple {
141141
AIX,
142142
CUDA, // NVIDIA CUDA
143143
NVCL, // NVIDIA OpenCL
144-
AMDHSA // AMD HSA Runtime
144+
AMDHSA, // AMD HSA Runtime
145+
PS4
145146
};
146147
enum EnvironmentType {
147148
UnknownEnvironment,
@@ -455,6 +456,19 @@ class Triple {
455456
return getObjectFormat() == Triple::MachO;
456457
}
457458

459+
/// \brief Tests whether the target is the PS4 CPU
460+
bool isPS4CPU() const {
461+
return getArch() == Triple::x86_64 &&
462+
getVendor() == Triple::SCEI &&
463+
getOS() == Triple::PS4;
464+
}
465+
466+
/// \brief Tests whether the target is the PS4 platform
467+
bool isPS4() const {
468+
return getVendor() == Triple::SCEI &&
469+
getOS() == Triple::PS4;
470+
}
471+
458472
/// @}
459473
/// @name Mutators
460474
/// @{

‎llvm/lib/Support/Triple.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ const char *Triple::getOSTypeName(OSType Kind) {
163163
case CUDA: return "cuda";
164164
case NVCL: return "nvcl";
165165
case AMDHSA: return "amdhsa";
166+
case PS4: return "ps4";
166167
}
167168

168169
llvm_unreachable("Invalid OSType");
@@ -356,6 +357,7 @@ static Triple::OSType parseOS(StringRef OSName) {
356357
.StartsWith("cuda", Triple::CUDA)
357358
.StartsWith("nvcl", Triple::NVCL)
358359
.StartsWith("amdhsa", Triple::AMDHSA)
360+
.StartsWith("ps4", Triple::PS4)
359361
.Default(Triple::UnknownOS);
360362
}
361363

0 commit comments

Comments
 (0)