@@ -10,7 +10,7 @@ use std::mem;
1010use cranelift_codegen:: ir:: { ArgumentPurpose , SigRef } ;
1111use cranelift_codegen:: isa:: CallConv ;
1212use cranelift_module:: ModuleError ;
13- use rustc_abi:: ExternAbi ;
13+ use rustc_abi:: { CanonAbi , ExternAbi , X86Call } ;
1414use rustc_codegen_ssa:: base:: is_call_from_compiler_builtins_to_upstream_monomorphization;
1515use rustc_codegen_ssa:: errors:: CompilerBuiltinsCannotCall ;
1616use rustc_middle:: middle:: codegen_fn_attrs:: CodegenFnAttrFlags ;
@@ -19,7 +19,7 @@ use rustc_middle::ty::layout::FnAbiOf;
1919use rustc_middle:: ty:: print:: with_no_trimmed_paths;
2020use rustc_session:: Session ;
2121use rustc_span:: source_map:: Spanned ;
22- use rustc_target:: callconv:: { Conv , FnAbi , PassMode } ;
22+ use rustc_target:: callconv:: { FnAbi , PassMode } ;
2323use smallvec:: SmallVec ;
2424
2525use 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