macos: fix build for arm64

Adds arm64 branches to some x86 specific code and modifies some casting
logic to make Clang happy
This commit is contained in:
sguo35 2022-04-04 12:37:10 -07:00 committed by Ivan
parent 219ddf3e11
commit e761b3235c
5 changed files with 20 additions and 5 deletions

2
3rdparty/llvm.cmake vendored
View File

@ -70,7 +70,7 @@ if(WITH_LLVM)
endif()
if(COMPILER_ARM)
set(LLVM_LIBS ${LLVM_LIBS} LLVMX86CodeGen LLVMX86AsmParser LLVMARMCodeGen LLVMARMAsmParser LLVMAArch64CodeGen LLVMAArch64AsmParser)
set(LLVM_LIBS ${LLVM_LIBS} LLVMX86CodeGen LLVMX86AsmParser LLVMAArch64CodeGen LLVMAArch64AsmParser)
endif()
if(WIN32 OR CMAKE_SYSTEM MATCHES "Linux")

View File

@ -1222,7 +1222,12 @@ usz get_x64_access_size(x64_context* context, x64_op_t op, x64_reg_t reg, usz d_
#elif defined(ARCH_ARM64)
#if defined(__APPLE__)
// https://github.com/bombela/backward-cpp/issues/200
#define RIP(context) ((context)->uc_mcontext->__ss.__pc)
#else
#define RIP(context) ((context)->uc_mcontext.pc)
#endif
#endif /* ARCH_ */

View File

@ -48,6 +48,12 @@
* SOFTWARE.
*/
// Suppress old-style casts in this file on Clang ARM64
#if defined(__clang__) && defined(ARCH_ARM64)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wold-style-cast"
#endif
/* Tunable configurations */
/* Enable precise implementation of math operations
@ -8774,3 +8780,7 @@ FORCE_INLINE void _sse2neon_mm_set_denormals_zero_mode(unsigned int flag)
#endif
#endif
#if defined(__clang__) && defined(ARCH_ARM64)
#pragma clang diagnostic pop
#endif

View File

@ -1514,7 +1514,7 @@ bool VKGSRender::release_GCM_label(u32 address, u32 args)
{
while (m_host_data_ptr->last_label_release_event > m_host_data_ptr->commands_complete_event)
{
_mm_pause();
utils::pause();
if (thread_ctrl::state() == thread_state::aborting)
{

View File

@ -166,7 +166,7 @@ namespace utils
struct scoped_av
{
AVFormatContext* format = nullptr;
AVCodec* codec = nullptr;
const AVCodec* codec = nullptr;
AVCodecContext* context = nullptr;
AVFrame* frame = nullptr;
SwrContext* swr = nullptr;
@ -180,8 +180,8 @@ namespace utils
swr_free(&swr);
if (context)
avcodec_close(context);
if (codec)
av_free(codec);
// AVCodec is managed by libavformat, no need to free it
// see: https://stackoverflow.com/a/18047320
if (format)
avformat_free_context(format);
}