11use crate :: abi:: call:: { ArgAttribute , FnAbi , PassMode , Reg , RegKind } ;
2- use crate :: abi:: { self , HasDataLayout , TyAbiInterface , TyAndLayout } ;
2+ use crate :: abi:: { HasDataLayout , TyAbiInterface } ;
33use crate :: spec:: HasTargetSpec ;
44
55#[ derive( PartialEq ) ]
@@ -8,24 +8,6 @@ pub enum Flavor {
88 Fastcall ,
99}
1010
11- fn is_single_fp_element < ' a , Ty , C > ( cx : & C , layout : TyAndLayout < ' a , Ty > ) -> bool
12- where
13- Ty : TyAbiInterface < ' a , C > + Copy ,
14- C : HasDataLayout ,
15- {
16- match layout. abi {
17- abi:: Abi :: Scalar ( scalar) => scalar. value . is_float ( ) ,
18- abi:: Abi :: Aggregate { .. } => {
19- if layout. fields . count ( ) == 1 && layout. fields . offset ( 0 ) . bytes ( ) == 0 {
20- is_single_fp_element ( cx, layout. field ( cx, 0 ) )
21- } else {
22- false
23- }
24- }
25- _ => false ,
26- }
27- }
28-
2911pub fn compute_abi_info < ' a , Ty , C > ( cx : & C , fn_abi : & mut FnAbi < ' a , Ty > , flavor : Flavor )
3012where
3113 Ty : TyAbiInterface < ' a , C > + Copy ,
4426 if t. abi_return_struct_as_int {
4527 // According to Clang, everyone but MSVC returns single-element
4628 // float aggregates directly in a floating-point register.
47- if !t. is_like_msvc && is_single_fp_element ( cx , fn_abi. ret . layout ) {
29+ if !t. is_like_msvc && fn_abi. ret . layout . is_single_fp_element ( cx ) {
4830 match fn_abi. ret . layout . size . bytes ( ) {
4931 4 => fn_abi. ret . cast_to ( Reg :: f32 ( ) ) ,
5032 8 => fn_abi. ret . cast_to ( Reg :: f64 ( ) ) ,
0 commit comments