@@ -10,7 +10,7 @@ use std::mem;
10
10
use cranelift_codegen:: ir:: { ArgumentPurpose , SigRef } ;
11
11
use cranelift_codegen:: isa:: CallConv ;
12
12
use cranelift_module:: ModuleError ;
13
- use rustc_abi:: ExternAbi ;
13
+ use rustc_abi:: { CanonAbi , ExternAbi , X86Call } ;
14
14
use rustc_codegen_ssa:: base:: is_call_from_compiler_builtins_to_upstream_monomorphization;
15
15
use rustc_codegen_ssa:: errors:: CompilerBuiltinsCannotCall ;
16
16
use rustc_middle:: middle:: codegen_fn_attrs:: CodegenFnAttrFlags ;
@@ -19,7 +19,7 @@ use rustc_middle::ty::layout::FnAbiOf;
19
19
use rustc_middle:: ty:: print:: with_no_trimmed_paths;
20
20
use rustc_session:: Session ;
21
21
use rustc_span:: source_map:: Spanned ;
22
- use rustc_target:: callconv:: { Conv , FnAbi , PassMode } ;
22
+ use rustc_target:: callconv:: { FnAbi , PassMode } ;
23
23
use smallvec:: SmallVec ;
24
24
25
25
use self :: pass_mode:: * ;
@@ -42,32 +42,27 @@ fn clif_sig_from_fn_abi<'tcx>(
42
42
Signature { params, returns, call_conv }
43
43
}
44
44
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 {
46
50
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")
59
63
}
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" )
71
66
}
72
67
}
73
68
}
@@ -610,7 +605,7 @@ pub(crate) fn codegen_terminator_call<'tcx>(
610
605
target : CallTarget ,
611
606
call_args : & mut Vec < Value > ,
612
607
) {
613
- if fn_abi. conv != Conv :: C {
608
+ if fn_abi. conv != CanonAbi :: C {
614
609
fx. tcx . dcx ( ) . span_fatal (
615
610
source_info. span ,
616
611
format ! ( "Variadic call for non-C abi {:?}" , fn_abi. conv) ,
0 commit comments