Skip to content

Commit fbdbb3c

Browse files
compiler: Remove TargetOptions::adjust_abi
It has been completely replaced by a declarative, if maybe tedious, way of translating ABIs.
1 parent 994b8a4 commit fbdbb3c

File tree

2 files changed

+0
-49
lines changed

2 files changed

+0
-49
lines changed

compiler/rustc_target/src/callconv/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -696,7 +696,6 @@ impl<'a, Ty> FnAbi<'a, Ty> {
696696
"sparc" => sparc::compute_abi_info(cx, self),
697697
"sparc64" => sparc64::compute_abi_info(cx, self),
698698
"nvptx64" => {
699-
let abi = cx.target_spec().adjust_abi(abi, self.c_variadic);
700699
if abi == ExternAbi::PtxKernel || abi == ExternAbi::GpuKernel {
701700
nvptx64::compute_ptx_kernel_abi_info(cx, self)
702701
} else {

compiler/rustc_target/src/spec/mod.rs

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -2917,54 +2917,6 @@ impl DerefMut for Target {
29172917
}
29182918

29192919
impl Target {
2920-
/// Given a function ABI, turn it into the correct ABI for this target.
2921-
pub fn adjust_abi(&self, abi: ExternAbi, c_variadic: bool) -> ExternAbi {
2922-
use ExternAbi::*;
2923-
match abi {
2924-
// On Windows, `extern "system"` behaves like msvc's `__stdcall`.
2925-
// `__stdcall` only applies on x86 and on non-variadic functions:
2926-
// https://learn.microsoft.com/en-us/cpp/cpp/stdcall?view=msvc-170
2927-
System { unwind } => {
2928-
if self.is_like_windows && self.arch == "x86" && !c_variadic {
2929-
Stdcall { unwind }
2930-
} else {
2931-
C { unwind }
2932-
}
2933-
}
2934-
2935-
EfiApi => {
2936-
if self.arch == "arm" {
2937-
Aapcs { unwind: false }
2938-
} else if self.arch == "x86_64" {
2939-
Win64 { unwind: false }
2940-
} else {
2941-
C { unwind: false }
2942-
}
2943-
}
2944-
2945-
// See commentary in `is_abi_supported`.
2946-
Stdcall { unwind } | Thiscall { unwind } | Fastcall { unwind } => {
2947-
if self.arch == "x86" { abi } else { C { unwind } }
2948-
}
2949-
Vectorcall { unwind } => {
2950-
if ["x86", "x86_64"].contains(&&*self.arch) {
2951-
abi
2952-
} else {
2953-
C { unwind }
2954-
}
2955-
}
2956-
2957-
// The Windows x64 calling convention we use for `extern "Rust"`
2958-
// <https://learn.microsoft.com/en-us/cpp/build/x64-software-conventions#register-volatility-and-preservation>
2959-
// expects the callee to save `xmm6` through `xmm15`, but `PreserveMost`
2960-
// (that we use by default for `extern "rust-cold"`) doesn't save any of those.
2961-
// So to avoid bloating callers, just use the Rust convention here.
2962-
RustCold if self.is_like_windows && self.arch == "x86_64" => Rust,
2963-
2964-
abi => abi,
2965-
}
2966-
}
2967-
29682920
pub fn is_abi_supported(&self, abi: ExternAbi) -> bool {
29692921
use ExternAbi::*;
29702922
match abi {

0 commit comments

Comments
 (0)