1
1
use crate :: abi:: call:: { ArgAttribute , FnAbi , PassMode , Reg , RegKind } ;
2
- use crate :: abi:: { self , HasDataLayout , TyAbiInterface , TyAndLayout } ;
2
+ use crate :: abi:: { HasDataLayout , TyAbiInterface } ;
3
3
use crate :: spec:: HasTargetSpec ;
4
4
5
5
#[ derive( PartialEq ) ]
@@ -8,24 +8,6 @@ pub enum Flavor {
8
8
Fastcall ,
9
9
}
10
10
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
-
29
11
pub fn compute_abi_info < ' a , Ty , C > ( cx : & C , fn_abi : & mut FnAbi < ' a , Ty > , flavor : Flavor )
30
12
where
31
13
Ty : TyAbiInterface < ' a , C > + Copy ,
44
26
if t. abi_return_struct_as_int {
45
27
// According to Clang, everyone but MSVC returns single-element
46
28
// 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 ) {
48
30
match fn_abi. ret . layout . size . bytes ( ) {
49
31
4 => fn_abi. ret . cast_to ( Reg :: f32 ( ) ) ,
50
32
8 => fn_abi. ret . cast_to ( Reg :: f64 ( ) ) ,
0 commit comments