Skip to content

Commit 077f903

Browse files
committed
[PS5] Add PS5 as a legal triple component
1 parent ee39417 commit 077f903

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

llvm/include/llvm/ADT/Triple.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ class Triple {
198198
NVCL, // NVIDIA OpenCL
199199
AMDHSA, // AMD HSA Runtime
200200
PS4,
201+
PS5,
201202
ELFIAMCU,
202203
TvOS, // Apple tvOS
203204
WatchOS, // Apple watchOS
@@ -677,6 +678,16 @@ class Triple {
677678
getOS() == Triple::PS4;
678679
}
679680

681+
/// Tests whether the target is the PS5 platform.
682+
bool isPS5() const {
683+
return getArch() == Triple::x86_64 &&
684+
getVendor() == Triple::SCEI &&
685+
getOS() == Triple::PS5;
686+
}
687+
688+
/// Tests whether the target is the PS4 or PS5 platform.
689+
bool isPS() const { return isPS4() || isPS5(); }
690+
680691
/// Tests whether the target is Android
681692
bool isAndroid() const { return getEnvironment() == Triple::Android; }
682693

llvm/lib/Support/Triple.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ StringRef Triple::getOSTypeName(OSType Kind) {
231231
case NetBSD: return "netbsd";
232232
case OpenBSD: return "openbsd";
233233
case PS4: return "ps4";
234+
case PS5: return "ps5";
234235
case RTEMS: return "rtems";
235236
case Solaris: return "solaris";
236237
case TvOS: return "tvos";
@@ -569,6 +570,7 @@ static Triple::OSType parseOS(StringRef OSName) {
569570
.StartsWith("nvcl", Triple::NVCL)
570571
.StartsWith("amdhsa", Triple::AMDHSA)
571572
.StartsWith("ps4", Triple::PS4)
573+
.StartsWith("ps5", Triple::PS5)
572574
.StartsWith("elfiamcu", Triple::ELFIAMCU)
573575
.StartsWith("tvos", Triple::TvOS)
574576
.StartsWith("watchos", Triple::WatchOS)

llvm/unittests/ADT/TripleTest.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,11 @@ TEST(TripleTest, ParsedIDs) {
140140
EXPECT_EQ(Triple::SCEI, T.getVendor());
141141
EXPECT_EQ(Triple::PS4, T.getOS());
142142

143+
T = Triple("x86_64-sie-ps5");
144+
EXPECT_EQ(Triple::x86_64, T.getArch());
145+
EXPECT_EQ(Triple::SCEI, T.getVendor());
146+
EXPECT_EQ(Triple::PS5, T.getOS());
147+
143148
T = Triple("powerpc-ibm-aix");
144149
EXPECT_EQ(Triple::ppc, T.getArch());
145150
EXPECT_EQ(Triple::IBM, T.getVendor());

0 commit comments

Comments
 (0)