1
Fork 0

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.
This commit is contained in:
Scott McMurray 2022-05-29 00:25:14 -07:00
parent 0acc4a3585
commit e90be842fb
12 changed files with 128 additions and 3 deletions

View file

@ -580,6 +580,11 @@ pub enum Conv {
C,
Rust,
/// For things unlikely to be called, where smaller caller codegen is
/// preferred over raw speed.
/// Stronger than just `#[cold]` because `fn` pointers might be incompatible.
RustCold,
// Target-specific calling conventions.
ArmAapcs,
CCmseNonSecureCall,

View file

@ -35,6 +35,7 @@ pub enum Abi {
RustCall,
PlatformIntrinsic,
Unadjusted,
RustCold,
}
#[derive(Copy, Clone)]
@ -81,6 +82,7 @@ const AbiDatas: &[AbiData] = &[
AbiData { abi: Abi::RustCall, name: "rust-call" },
AbiData { abi: Abi::PlatformIntrinsic, name: "platform-intrinsic" },
AbiData { abi: Abi::Unadjusted, name: "unadjusted" },
AbiData { abi: Abi::RustCold, name: "rust-cold" },
];
/// Returns the ABI with the given name (if any).
@ -139,6 +141,7 @@ impl Abi {
RustCall => 31,
PlatformIntrinsic => 32,
Unadjusted => 33,
RustCold => 34,
};
debug_assert!(
AbiDatas

View file

@ -1618,7 +1618,8 @@ impl Target {
| PlatformIntrinsic
| Unadjusted
| Cdecl { .. }
| EfiApi => true,
| EfiApi
| RustCold => true,
X86Interrupt => ["x86", "x86_64"].contains(&&self.arch[..]),
Aapcs { .. } => "arm" == self.arch,
CCmseNonSecureCall => ["arm", "aarch64"].contains(&&self.arch[..]),