File tree 1 file changed +21
-11
lines changed
compiler/rustc_target/src/abi/call
1 file changed +21
-11
lines changed Original file line number Diff line number Diff line change 1
1
// see https://github.com/llvm/llvm-project/blob/main/llvm/lib/Target/BPF/BPFCallingConv.td
2
- use crate :: abi:: call:: { ArgAbi , FnAbi } ;
2
+ use crate :: abi:: call:: { ArgAbi , FnAbi , Reg , Uniform } ;
3
3
4
4
fn classify_ret < Ty > ( ret : & mut ArgAbi < ' _ , Ty > ) {
5
- if ret. layout . is_aggregate ( ) || ret. layout . size . bits ( ) > 64 {
6
- if ret. layout . size . bits ( ) != 128 {
7
- ret. make_indirect ( ) ;
8
- }
9
- } else {
5
+ let size = ret. layout . size ;
6
+ let bits = size. bits ( ) ;
7
+ if !ret. layout . is_aggregate ( ) && bits <= 64 {
10
8
ret. extend_integer_width_to ( 64 ) ;
9
+ return ;
10
+ }
11
+
12
+ if bits <= 128 {
13
+ ret. cast_to ( Uniform { unit : Reg :: i64 ( ) , total : size} ) ;
14
+ } else {
15
+ ret. make_indirect ( ) ;
11
16
}
12
17
}
13
18
14
19
fn classify_arg < Ty > ( arg : & mut ArgAbi < ' _ , Ty > ) {
15
- if arg. layout . is_aggregate ( ) || arg. layout . size . bits ( ) > 64 {
16
- if arg. layout . size . bits ( ) != 128 {
17
- arg. make_indirect ( ) ;
18
- }
19
- } else {
20
+ let size = arg. layout . size ;
21
+ let bits = size. bits ( ) ;
22
+ if !arg. layout . is_aggregate ( ) && bits <= 64 {
20
23
arg. extend_integer_width_to ( 64 ) ;
24
+ return ;
25
+ }
26
+
27
+ if bits <= 128 {
28
+ arg. cast_to ( Uniform { unit : Reg :: i64 ( ) , total : size} ) ;
29
+ } else {
30
+ arg. make_indirect ( ) ;
21
31
}
22
32
}
23
33
You can’t perform that action at this time.
0 commit comments