about summary refs log tree commit diff
path: root/compiler/rustc_target/src
diff options
context:
space:
mode:
authorScott McMurray <scottmcm@users.noreply.github.com>2022-05-29 00:25:14 -0700
committerScott McMurray <scottmcm@users.noreply.github.com>2022-05-30 00:19:23 -0700
commite90be842fb9129aa27e5b6412f245ca39999f9f1 (patch)
tree96cc6b49f01fae44002f56140f28014cceaa07e4 /compiler/rustc_target/src
parent0acc4a35853215a6f9388ab61455ced309711003 (diff)
downloadrust-e90be842fb9129aa27e5b6412f245ca39999f9f1.tar.gz
rust-e90be842fb9129aa27e5b6412f245ca39999f9f1.zip
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.
Diffstat (limited to 'compiler/rustc_target/src')
-rw-r--r--compiler/rustc_target/src/abi/call/mod.rs5
-rw-r--r--compiler/rustc_target/src/spec/abi.rs3
-rw-r--r--compiler/rustc_target/src/spec/mod.rs3
3 files changed, 10 insertions, 1 deletions
diff --git a/compiler/rustc_target/src/abi/call/mod.rs b/compiler/rustc_target/src/abi/call/mod.rs
index afce10ff1cb..ca1d1302ec6 100644
--- a/compiler/rustc_target/src/abi/call/mod.rs
+++ b/compiler/rustc_target/src/abi/call/mod.rs
@@ -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,
diff --git a/compiler/rustc_target/src/spec/abi.rs b/compiler/rustc_target/src/spec/abi.rs
index d9e571c72e5..337554dc96e 100644
--- a/compiler/rustc_target/src/spec/abi.rs
+++ b/compiler/rustc_target/src/spec/abi.rs
@@ -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
diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs
index 6dd245b047c..866cd5f0fe7 100644
--- a/compiler/rustc_target/src/spec/mod.rs
+++ b/compiler/rustc_target/src/spec/mod.rs
@@ -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[..]),