@@ -22,7 +22,19 @@ fn clif_sig_from_fn_abi<'tcx>(
22
22
default_call_conv : CallConv ,
23
23
fn_abi : & FnAbi < ' tcx , Ty < ' tcx > > ,
24
24
) -> Signature {
25
- let call_conv = match fn_abi. conv {
25
+ let call_conv = conv_to_call_conv ( fn_abi. conv , default_call_conv) ;
26
+
27
+ let inputs = fn_abi. args . iter ( ) . map ( |arg_abi| arg_abi. get_abi_param ( tcx) . into_iter ( ) ) . flatten ( ) ;
28
+
29
+ let ( return_ptr, returns) = fn_abi. ret . get_abi_return ( tcx) ;
30
+ // Sometimes the first param is an pointer to the place where the return value needs to be stored.
31
+ let params: Vec < _ > = return_ptr. into_iter ( ) . chain ( inputs) . collect ( ) ;
32
+
33
+ Signature { params, returns, call_conv }
34
+ }
35
+
36
+ pub ( crate ) fn conv_to_call_conv ( c : Conv , default_call_conv : CallConv ) -> CallConv {
37
+ match c {
26
38
Conv :: Rust | Conv :: C => default_call_conv,
27
39
Conv :: RustCold => CallConv :: Cold ,
28
40
Conv :: X86_64SysV => CallConv :: SystemV ,
@@ -38,15 +50,8 @@ fn clif_sig_from_fn_abi<'tcx>(
38
50
| Conv :: X86VectorCall
39
51
| Conv :: AmdGpuKernel
40
52
| Conv :: AvrInterrupt
41
- | Conv :: AvrNonBlockingInterrupt => todo ! ( "{:?}" , fn_abi. conv) ,
42
- } ;
43
- let inputs = fn_abi. args . iter ( ) . map ( |arg_abi| arg_abi. get_abi_param ( tcx) . into_iter ( ) ) . flatten ( ) ;
44
-
45
- let ( return_ptr, returns) = fn_abi. ret . get_abi_return ( tcx) ;
46
- // Sometimes the first param is an pointer to the place where the return value needs to be stored.
47
- let params: Vec < _ > = return_ptr. into_iter ( ) . chain ( inputs) . collect ( ) ;
48
-
49
- Signature { params, returns, call_conv }
53
+ | Conv :: AvrNonBlockingInterrupt => todo ! ( "{:?}" , c) ,
54
+ }
50
55
}
51
56
52
57
pub ( crate ) fn get_function_sig < ' tcx > (
0 commit comments