@@ -7,6 +7,7 @@ mod returning;
77use cranelift_module:: ModuleError ;
88use rustc_middle:: middle:: codegen_fn_attrs:: CodegenFnAttrFlags ;
99use rustc_middle:: ty:: layout:: FnAbiOf ;
10+ use rustc_session:: Session ;
1011use rustc_target:: abi:: call:: { Conv , FnAbi } ;
1112use rustc_target:: spec:: abi:: Abi ;
1213
@@ -22,7 +23,7 @@ fn clif_sig_from_fn_abi<'tcx>(
2223 default_call_conv : CallConv ,
2324 fn_abi : & FnAbi < ' tcx , Ty < ' tcx > > ,
2425) -> 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) ;
2627
2728 let inputs = fn_abi. args . iter ( ) . map ( |arg_abi| arg_abi. get_abi_param ( tcx) . into_iter ( ) ) . flatten ( ) ;
2829
@@ -33,24 +34,30 @@ fn clif_sig_from_fn_abi<'tcx>(
3334 Signature { params, returns, call_conv }
3435}
3536
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 {
3738 match c {
3839 Conv :: Rust | Conv :: C => default_call_conv,
3940 Conv :: RustCold => CallConv :: Cold ,
4041 Conv :: X86_64SysV => CallConv :: SystemV ,
4142 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
4454 | Conv :: Msp430Intr
4555 | Conv :: PtxKernel
46- | Conv :: X86Fastcall
47- | Conv :: X86Intr
48- | Conv :: X86Stdcall
49- | Conv :: X86ThisCall
50- | Conv :: X86VectorCall
5156 | Conv :: AmdGpuKernel
5257 | 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+ }
5461 }
5562}
5663
0 commit comments