From e2f90f7f74d805cd12d879feb3d3796acf088ae0 Mon Sep 17 00:00:00 2001 From: Scott McMurray Date: Sun, 29 May 2022 00:25:14 -0700 Subject: [PATCH 1/2] Add support for emitting functions with `coldcc` in LLVM The eventual goal is to try using this for things like the internal panicking stuff, to see whether it helps. --- src/abi/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/abi/mod.rs b/src/abi/mod.rs index decb784199064..59a7316c1c028 100644 --- a/src/abi/mod.rs +++ b/src/abi/mod.rs @@ -22,7 +22,7 @@ fn clif_sig_from_fn_abi<'tcx>( fn_abi: &FnAbi<'tcx, Ty<'tcx>>, ) -> Signature { let call_conv = match fn_abi.conv { - Conv::Rust | Conv::C => default_call_conv, + Conv::Rust | Conv::C | Conv::RustCold => default_call_conv, Conv::X86_64SysV => CallConv::SystemV, Conv::X86_64Win64 => CallConv::WindowsFastcall, Conv::ArmAapcs From 4ee48c09ee913f9fe44c784e16f42feb7f30c4d0 Mon Sep 17 00:00:00 2001 From: Scott McMurray Date: Sun, 29 May 2022 10:50:51 -0700 Subject: [PATCH 2/2] Use CallConv::Cold in cranelift for extern "rust-cold" --- src/abi/mod.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/abi/mod.rs b/src/abi/mod.rs index 59a7316c1c028..ffa5d747b1160 100644 --- a/src/abi/mod.rs +++ b/src/abi/mod.rs @@ -22,7 +22,8 @@ fn clif_sig_from_fn_abi<'tcx>( fn_abi: &FnAbi<'tcx, Ty<'tcx>>, ) -> Signature { let call_conv = match fn_abi.conv { - Conv::Rust | Conv::C | Conv::RustCold => default_call_conv, + Conv::Rust | Conv::C => default_call_conv, + Conv::RustCold => CallConv::Cold, Conv::X86_64SysV => CallConv::SystemV, Conv::X86_64Win64 => CallConv::WindowsFastcall, Conv::ArmAapcs