[PS5] Add PS5OSTargetInfo class, update affected tests

This commit is contained in:
Paul Robinson 2022-06-01 11:02:10 -07:00
parent 5d005d8256
commit 8869ba3662
6 changed files with 31 additions and 9 deletions

View File

@ -61,8 +61,8 @@ LangStandard::Kind clang::getDefaultLanguageStandard(clang::Language Lang,
if (CLANG_DEFAULT_STD_C != LangStandard::lang_unspecified)
return CLANG_DEFAULT_STD_C;
// The PS4 uses C99 as the default C standard.
if (T.isPS4())
// The PS4 and PS5 use C99 as the default C standard.
if (T.isPS())
return LangStandard::lang_gnu99;
return LangStandard::lang_gnu17;
case Language::ObjC:

View File

@ -592,6 +592,8 @@ TargetInfo *AllocateTarget(const llvm::Triple &Triple,
return new NaClTargetInfo<X86_64TargetInfo>(Triple, Opts);
case llvm::Triple::PS4:
return new PS4OSTargetInfo<X86_64TargetInfo>(Triple, Opts);
case llvm::Triple::PS5:
return new PS5OSTargetInfo<X86_64TargetInfo>(Triple, Opts);
default:
return new X86_64TargetInfo(Triple, Opts);
}

View File

@ -596,6 +596,23 @@ public:
: PSOSTargetInfo<Target>(Triple, Opts) {}
};
// PS5 Target
template <typename Target>
class LLVM_LIBRARY_VISIBILITY PS5OSTargetInfo : public PSOSTargetInfo<Target> {
protected:
void getOSDefines(const LangOptions &Opts, const llvm::Triple &Triple,
MacroBuilder &Builder) const override {
// Start with base class defines.
PSOSTargetInfo<Target>::getOSDefines(Opts, Triple, Builder);
Builder.defineMacro("__PROSPERO__");
}
public:
PS5OSTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
: PSOSTargetInfo<Target>(Triple, Opts) {}
};
// RTEMS Target
template <typename Target>
class LLVM_LIBRARY_VISIBILITY RTEMSTargetInfo : public OSTargetInfo<Target> {

View File

@ -1241,7 +1241,8 @@
// TCE:#define __tce__ 1
// TCE:#define tce 1
//
// RUN: %clang_cc1 -E -dM -ffreestanding -fgnuc-version=4.2.1 -triple=x86_64-scei-ps4 < /dev/null | FileCheck -match-full-lines -check-prefix PS4 %s
// RUN: %clang_cc1 -E -dM -ffreestanding -triple=x86_64-scei-ps4 < /dev/null | FileCheck --match-full-lines --check-prefixes=PS4,PS4ONLY %s
// RUN: %clang_cc1 -E -dM -ffreestanding -triple=x86_64-sie-ps5 < /dev/null | FileCheck --match-full-lines --check-prefixes=PS4,PS5ONLY %s
//
// PS4:#define _LP64 1
// PS4:#define __BIGGEST_ALIGNMENT__ 32
@ -1311,8 +1312,9 @@
// PS4:#define __LP64__ 1
// PS4:#define __MMX__ 1
// PS4:#define __NO_MATH_INLINES 1
// PS4:#define __ORBIS__ 1
// PS4ONLY:#define __ORBIS__ 1
// PS4:#define __POINTER_WIDTH__ 64
// PS5ONLY:#define __PROSPERO__ 1
// PS4:#define __PTRDIFF_MAX__ 9223372036854775807L
// PS4:#define __PTRDIFF_TYPE__ long int
// PS4:#define __PTRDIFF_WIDTH__ 64
@ -1357,7 +1359,8 @@
// PS4:#define __x86_64__ 1
// PS4:#define unix 1
//
// RUN: %clang_cc1 -x c++ -E -dM -ffreestanding -triple=x86_64-scei-ps4 < /dev/null | FileCheck -match-full-lines -check-prefix PS4-CXX %s
// RUN: %clang_cc1 -x c++ -E -dM -ffreestanding -triple=x86_64-scei-ps4 < /dev/null | FileCheck --match-full-lines --check-prefix PS4-CXX %s
// RUN: %clang_cc1 -x c++ -E -dM -ffreestanding -triple=x86_64-sie-ps5 < /dev/null | FileCheck --match-full-lines --check-prefix PS4-CXX %s
// PS4-CXX:#define __STDCPP_DEFAULT_NEW_ALIGNMENT__ 32UL
//
// RUN: %clang_cc1 -E -dM -triple=x86_64-pc-mingw32 < /dev/null | FileCheck -match-full-lines -check-prefix X86-64-DECLSPEC %s

View File

@ -4,8 +4,8 @@
typedef __WCHAR_TYPE__ wchar_t;
#if defined(_WIN32) || defined(_M_IX86) || defined(__CYGWIN__) \
|| defined(_M_X64) || defined(__ORBIS__) || defined(SHORT_WCHAR) \
|| (defined(_AIX) && !defined(__64BIT__))
|| defined(_M_X64) || defined(__ORBIS__) || defined(__PROSPERO__) \
|| defined(SHORT_WCHAR) || (defined(_AIX) && !defined(__64BIT__))
#define WCHAR_T_TYPE unsigned short
#elif defined(__aarch64__)
// See AArch64TargetInfo constructor -- unsigned on non-darwin non-OpenBSD non-NetBSD.

View File

@ -87,8 +87,8 @@ TEST(RecursiveASTVisitor, VisitsLambdaExprAndImplicitClass) {
}
TEST(RecursiveASTVisitor, VisitsAttributedLambdaExpr) {
if (llvm::Triple(llvm::sys::getDefaultTargetTriple()).isPS4())
GTEST_SKIP(); // PS4 does not support fastcall.
if (llvm::Triple(llvm::sys::getDefaultTargetTriple()).isPS())
GTEST_SKIP(); // PS4/PS5 do not support fastcall.
LambdaExprVisitor Visitor;
Visitor.ExpectMatch("", 1, 12);
EXPECT_TRUE(Visitor.runOver(