1
- use crate :: abi:: call:: {
2
- ArgAbi , ArgAttribute , ArgAttributes , ArgExtension , CastTarget , FnAbi , PassMode , Reg , Uniform ,
1
+ use rustc_abi:: {
2
+ BackendRepr , FieldsShape , Float , HasDataLayout , Primitive , Reg , Size , TyAbiInterface ,
3
+ } ;
4
+
5
+ use crate :: callconv:: {
6
+ ArgAbi , ArgAttribute , ArgAttributes , ArgExtension , CastTarget , FnAbi , PassMode , Uniform ,
3
7
} ;
4
- use crate :: abi:: { self , HasDataLayout , Size , TyAbiInterface } ;
5
8
6
9
fn extend_integer_width_mips < Ty > ( arg : & mut ArgAbi < ' _ , Ty > , bits : u64 ) {
7
10
// Always sign extend u32 values on 64-bit mips
8
- if let abi :: BackendRepr :: Scalar ( scalar) = arg. layout . backend_repr {
9
- if let abi :: Int ( i, signed) = scalar. primitive ( ) {
11
+ if let BackendRepr :: Scalar ( scalar) = arg. layout . backend_repr {
12
+ if let Primitive :: Int ( i, signed) = scalar. primitive ( ) {
10
13
if !signed && i. size ( ) . bits ( ) == 32 {
11
14
if let PassMode :: Direct ( ref mut attrs) = arg. mode {
12
15
attrs. ext ( ArgExtension :: Sext ) ;
25
28
C : HasDataLayout ,
26
29
{
27
30
match ret. layout . field ( cx, i) . backend_repr {
28
- abi :: BackendRepr :: Scalar ( scalar) => match scalar. primitive ( ) {
29
- abi :: Float ( abi :: F32 ) => Some ( Reg :: f32 ( ) ) ,
30
- abi :: Float ( abi :: F64 ) => Some ( Reg :: f64 ( ) ) ,
31
+ BackendRepr :: Scalar ( scalar) => match scalar. primitive ( ) {
32
+ Primitive :: Float ( Float :: F32 ) => Some ( Reg :: f32 ( ) ) ,
33
+ Primitive :: Float ( Float :: F64 ) => Some ( Reg :: f64 ( ) ) ,
31
34
_ => None ,
32
35
} ,
33
36
_ => None ,
51
54
// use of float registers to structures (not unions) containing exactly one or two
52
55
// float fields.
53
56
54
- if let abi :: FieldsShape :: Arbitrary { .. } = ret. layout . fields {
57
+ if let FieldsShape :: Arbitrary { .. } = ret. layout . fields {
55
58
if ret. layout . fields . count ( ) == 1 {
56
59
if let Some ( reg) = float_reg ( cx, ret, 0 ) {
57
60
ret. cast_to ( reg) ;
@@ -90,16 +93,16 @@ where
90
93
let mut prefix_index = 0 ;
91
94
92
95
match arg. layout . fields {
93
- abi :: FieldsShape :: Primitive => unreachable ! ( ) ,
94
- abi :: FieldsShape :: Array { .. } => {
96
+ FieldsShape :: Primitive => unreachable ! ( ) ,
97
+ FieldsShape :: Array { .. } => {
95
98
// Arrays are passed indirectly
96
99
arg. make_indirect ( ) ;
97
100
return ;
98
101
}
99
- abi :: FieldsShape :: Union ( _) => {
102
+ FieldsShape :: Union ( _) => {
100
103
// Unions and are always treated as a series of 64-bit integer chunks
101
104
}
102
- abi :: FieldsShape :: Arbitrary { .. } => {
105
+ FieldsShape :: Arbitrary { .. } => {
103
106
// Structures are split up into a series of 64-bit integer chunks, but any aligned
104
107
// doubles not part of another aggregate are passed as floats.
105
108
let mut last_offset = Size :: ZERO ;
@@ -109,8 +112,8 @@ where
109
112
let offset = arg. layout . fields . offset ( i) ;
110
113
111
114
// We only care about aligned doubles
112
- if let abi :: BackendRepr :: Scalar ( scalar) = field. backend_repr {
113
- if scalar. primitive ( ) == abi :: Float ( abi :: F64 ) {
115
+ if let BackendRepr :: Scalar ( scalar) = field. backend_repr {
116
+ if scalar. primitive ( ) == Primitive :: Float ( Float :: F64 ) {
114
117
if offset. is_aligned ( dl. f64_align . abi ) {
115
118
// Insert enough integers to cover [last_offset, offset)
116
119
assert ! ( last_offset. is_aligned( dl. f64_align. abi) ) ;
0 commit comments