From a2acc6c6529fc25ed350b239efe459b08b0310a6 Mon Sep 17 00:00:00 2001 From: Zoltan Varga Date: Thu, 27 Apr 2023 03:03:25 -0400 Subject: [PATCH] [mono][llvm] Enable the cold calling conv on osx/linux. (#83519) --- src/mono/mono/mini/mini-llvm.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/mono/mono/mini/mini-llvm.c b/src/mono/mono/mini/mini-llvm.c index 7371ca215d1d3..72713899e6e7d 100644 --- a/src/mono/mono/mini/mini-llvm.c +++ b/src/mono/mono/mini/mini-llvm.c @@ -1220,6 +1220,12 @@ simd_op_to_llvm_type (int opcode) #endif } +#if defined(TARGET_OSX) || defined(TARGET_LINUX) +#define COLD_CCONV_SUPPORTED 1 +#elif !defined(TARGET_WATCHOS) && !defined(TARGET_ARM) && !defined(TARGET_ARM64) +#define COLD_CCONV_SUPPORTED 1 +#endif + static void set_cold_cconv (LLVMValueRef func) { @@ -1227,7 +1233,7 @@ set_cold_cconv (LLVMValueRef func) * xcode10 (watchOS) and ARM/ARM64 doesn't seem to support preserveall, it fails with: * fatal error: error in backend: Unsupported calling convention */ -#if !defined(TARGET_WATCHOS) && !defined(TARGET_ARM) && !defined(TARGET_ARM64) +#ifdef COLD_CCONV_SUPPORTED LLVMSetFunctionCallConv (func, LLVMColdCallConv); #endif } @@ -1235,7 +1241,7 @@ set_cold_cconv (LLVMValueRef func) static void set_call_cold_cconv (LLVMValueRef func) { -#if !defined(TARGET_WATCHOS) && !defined(TARGET_ARM) && !defined(TARGET_ARM64) +#ifdef COLD_CCONV_SUPPORTED LLVMSetInstructionCallConv (func, LLVMColdCallConv); #endif }