@@ -18,9 +18,9 @@ fn reg_to_abi_param(reg: Reg) -> AbiParam {
18
18
let clif_ty = match ( reg. kind , reg. size . bytes ( ) ) {
19
19
( RegKind :: Integer , 1 ) => types:: I8 ,
20
20
( RegKind :: Integer , 2 ) => types:: I16 ,
21
- ( RegKind :: Integer , 4 ) => types:: I32 ,
22
- ( RegKind :: Integer , 8 ) => types:: I64 ,
23
- ( RegKind :: Integer , 16 ) => types:: I128 ,
21
+ ( RegKind :: Integer , 3 ..= 4 ) => types:: I32 ,
22
+ ( RegKind :: Integer , 5 ..= 8 ) => types:: I64 ,
23
+ ( RegKind :: Integer , 9 ..= 16 ) => types:: I128 ,
24
24
( RegKind :: Float , 4 ) => types:: F32 ,
25
25
( RegKind :: Float , 8 ) => types:: F64 ,
26
26
( RegKind :: Vector , size) => types:: I8 . by ( u16:: try_from ( size) . unwrap ( ) ) . unwrap ( ) ,
@@ -48,23 +48,9 @@ fn cast_target_to_abi_params(cast: CastTarget) -> SmallVec<[AbiParam; 2]> {
48
48
)
49
49
} ;
50
50
51
- if cast. prefix . iter ( ) . all ( |x| x. is_none ( ) ) {
52
- // Simplify to a single unit when there is no prefix and size <= unit size
53
- if cast. rest . total <= cast. rest . unit . size {
54
- let clif_ty = match ( cast. rest . unit . kind , cast. rest . unit . size . bytes ( ) ) {
55
- ( RegKind :: Integer , 1 ) => types:: I8 ,
56
- ( RegKind :: Integer , 2 ) => types:: I16 ,
57
- ( RegKind :: Integer , 3 ..=4 ) => types:: I32 ,
58
- ( RegKind :: Integer , 5 ..=8 ) => types:: I64 ,
59
- ( RegKind :: Integer , 9 ..=16 ) => types:: I128 ,
60
- ( RegKind :: Float , 4 ) => types:: F32 ,
61
- ( RegKind :: Float , 8 ) => types:: F64 ,
62
- ( RegKind :: Vector , size) => types:: I8 . by ( u16:: try_from ( size) . unwrap ( ) ) . unwrap ( ) ,
63
- _ => unreachable ! ( "{:?}" , cast. rest. unit) ,
64
- } ;
65
- return smallvec ! [ AbiParam :: new( clif_ty) ] ;
66
- }
67
- }
51
+ // Note: Unlike the LLVM equivalent of this code we don't have separate branches for when there
52
+ // is no prefix as a single unit, an array and a heterogeneous struct are not represented using
53
+ // different types in Cranelift IR. Instead a single array of primitive types is used.
68
54
69
55
// Create list of fields in the main structure
70
56
let mut args = cast
0 commit comments