@@ -7,6 +7,7 @@ mod returning;
7
7
use cranelift_module:: ModuleError ;
8
8
use rustc_middle:: middle:: codegen_fn_attrs:: CodegenFnAttrFlags ;
9
9
use rustc_middle:: ty:: layout:: FnAbiOf ;
10
+ use rustc_session:: Session ;
10
11
use rustc_target:: abi:: call:: { Conv , FnAbi } ;
11
12
use rustc_target:: spec:: abi:: Abi ;
12
13
@@ -22,7 +23,7 @@ fn clif_sig_from_fn_abi<'tcx>(
22
23
default_call_conv : CallConv ,
23
24
fn_abi : & FnAbi < ' tcx , Ty < ' tcx > > ,
24
25
) -> Signature {
25
- let call_conv = conv_to_call_conv ( fn_abi. conv , default_call_conv) ;
26
+ let call_conv = conv_to_call_conv ( tcx . sess , fn_abi. conv , default_call_conv) ;
26
27
27
28
let inputs = fn_abi. args . iter ( ) . map ( |arg_abi| arg_abi. get_abi_param ( tcx) . into_iter ( ) ) . flatten ( ) ;
28
29
@@ -33,24 +34,30 @@ fn clif_sig_from_fn_abi<'tcx>(
33
34
Signature { params, returns, call_conv }
34
35
}
35
36
36
- pub ( crate ) fn conv_to_call_conv ( c : Conv , default_call_conv : CallConv ) -> CallConv {
37
+ pub ( crate ) fn conv_to_call_conv ( sess : & Session , c : Conv , default_call_conv : CallConv ) -> CallConv {
37
38
match c {
38
39
Conv :: Rust | Conv :: C => default_call_conv,
39
40
Conv :: RustCold => CallConv :: Cold ,
40
41
Conv :: X86_64SysV => CallConv :: SystemV ,
41
42
Conv :: X86_64Win64 => CallConv :: WindowsFastcall ,
42
- Conv :: ArmAapcs
43
- | Conv :: CCmseNonSecureCall
43
+
44
+ // Should already get a back compat warning
45
+ Conv :: X86Fastcall | Conv :: X86Stdcall | Conv :: X86ThisCall | Conv :: X86VectorCall => {
46
+ default_call_conv
47
+ }
48
+
49
+ Conv :: X86Intr => sess. fatal ( "x86-interrupt call conv not yet implemented" ) ,
50
+
51
+ Conv :: ArmAapcs => sess. fatal ( "aapcs call conv not yet implemented" ) ,
52
+
53
+ Conv :: CCmseNonSecureCall
44
54
| Conv :: Msp430Intr
45
55
| Conv :: PtxKernel
46
- | Conv :: X86Fastcall
47
- | Conv :: X86Intr
48
- | Conv :: X86Stdcall
49
- | Conv :: X86ThisCall
50
- | Conv :: X86VectorCall
51
56
| Conv :: AmdGpuKernel
52
57
| Conv :: AvrInterrupt
53
- | Conv :: AvrNonBlockingInterrupt => todo ! ( "{:?}" , c) ,
58
+ | Conv :: AvrNonBlockingInterrupt => {
59
+ unreachable ! ( "tried to use {c:?} call conv which only exists on an unsupported target" ) ;
60
+ }
54
61
}
55
62
}
56
63
0 commit comments