Skip to content

Commit 112e5e8

Browse files
committed
Auto merge of #141984 - matthiaskrgr:rollup-wy6j9ca, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - rust-lang/rust#137725 (Add `iter` macro) - rust-lang/rust#141455 (std: abort the process on failure to allocate a TLS key) - rust-lang/rust#141569 (Replace ad-hoc ABI "adjustments" with an `AbiMap` to `CanonAbi`) - rust-lang/rust#141698 (Use the informative error as the main const eval error message) - rust-lang/rust#141925 (Remove bootstrap cfgs from library/) - rust-lang/rust#141943 (Remove pre-expansion AST stats.) - rust-lang/rust#141945 (Remove `Path::is_ident`.) - rust-lang/rust#141957 (Add missing `dyn` keywords to tests that do not test for them Part 2) r? `@ghost` `@rustbot` modify labels: rollup
2 parents decbfcd + 582ad1f commit 112e5e8

File tree

1 file changed

+22
-27
lines changed

1 file changed

+22
-27
lines changed

src/abi/mod.rs

Lines changed: 22 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use std::mem;
1010
use cranelift_codegen::ir::{ArgumentPurpose, SigRef};
1111
use cranelift_codegen::isa::CallConv;
1212
use cranelift_module::ModuleError;
13-
use rustc_abi::ExternAbi;
13+
use rustc_abi::{CanonAbi, ExternAbi, X86Call};
1414
use rustc_codegen_ssa::base::is_call_from_compiler_builtins_to_upstream_monomorphization;
1515
use rustc_codegen_ssa::errors::CompilerBuiltinsCannotCall;
1616
use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags;
@@ -19,7 +19,7 @@ use rustc_middle::ty::layout::FnAbiOf;
1919
use rustc_middle::ty::print::with_no_trimmed_paths;
2020
use rustc_session::Session;
2121
use rustc_span::source_map::Spanned;
22-
use rustc_target::callconv::{Conv, FnAbi, PassMode};
22+
use rustc_target::callconv::{FnAbi, PassMode};
2323
use smallvec::SmallVec;
2424

2525
use self::pass_mode::*;
@@ -42,32 +42,27 @@ fn clif_sig_from_fn_abi<'tcx>(
4242
Signature { params, returns, call_conv }
4343
}
4444

45-
pub(crate) fn conv_to_call_conv(sess: &Session, c: Conv, default_call_conv: CallConv) -> CallConv {
45+
pub(crate) fn conv_to_call_conv(
46+
sess: &Session,
47+
c: CanonAbi,
48+
default_call_conv: CallConv,
49+
) -> CallConv {
4650
match c {
47-
Conv::Rust | Conv::C => default_call_conv,
48-
Conv::Cold | Conv::PreserveMost | Conv::PreserveAll => CallConv::Cold,
49-
Conv::X86_64SysV => CallConv::SystemV,
50-
Conv::X86_64Win64 => CallConv::WindowsFastcall,
51-
52-
// Should already get a back compat warning
53-
Conv::X86Fastcall | Conv::X86Stdcall | Conv::X86ThisCall | Conv::X86VectorCall => {
54-
default_call_conv
55-
}
56-
57-
Conv::X86Intr | Conv::RiscvInterrupt { .. } => {
58-
sess.dcx().fatal(format!("interrupt call conv {c:?} not yet implemented"))
51+
CanonAbi::Rust | CanonAbi::C => default_call_conv,
52+
CanonAbi::RustCold => CallConv::Cold,
53+
54+
CanonAbi::X86(x86_call) => match x86_call {
55+
X86Call::SysV64 => CallConv::SystemV,
56+
X86Call::Win64 => CallConv::WindowsFastcall,
57+
// Should already get a back compat warning
58+
_ => default_call_conv,
59+
},
60+
61+
CanonAbi::Interrupt(_) | CanonAbi::Arm(_) => {
62+
sess.dcx().fatal("call conv {c:?} is not yet implemented")
5963
}
60-
61-
Conv::ArmAapcs => sess.dcx().fatal("aapcs call conv not yet implemented"),
62-
Conv::CCmseNonSecureCall => {
63-
sess.dcx().fatal("C-cmse-nonsecure-call call conv is not yet implemented");
64-
}
65-
Conv::CCmseNonSecureEntry => {
66-
sess.dcx().fatal("C-cmse-nonsecure-entry call conv is not yet implemented");
67-
}
68-
69-
Conv::Msp430Intr | Conv::GpuKernel | Conv::AvrInterrupt | Conv::AvrNonBlockingInterrupt => {
70-
unreachable!("tried to use {c:?} call conv which only exists on an unsupported target");
64+
CanonAbi::GpuKernel => {
65+
unreachable!("tried to use {c:?} call conv which only exists on an unsupported target")
7166
}
7267
}
7368
}
@@ -610,7 +605,7 @@ pub(crate) fn codegen_terminator_call<'tcx>(
610605
target: CallTarget,
611606
call_args: &mut Vec<Value>,
612607
) {
613-
if fn_abi.conv != Conv::C {
608+
if fn_abi.conv != CanonAbi::C {
614609
fx.tcx.dcx().span_fatal(
615610
source_info.span,
616611
format!("Variadic call for non-C abi {:?}", fn_abi.conv),

0 commit comments

Comments
 (0)