@@ -38,7 +38,7 @@ fn apply_arg_attrs_to_abi_param(mut param: AbiParam, arg_attrs: ArgAttributes) -
38
38
param
39
39
}
40
40
41
- fn cast_target_to_abi_params ( cast : CastTarget ) -> SmallVec < [ AbiParam ; 2 ] > {
41
+ fn cast_target_to_abi_params ( cast : & CastTarget ) -> SmallVec < [ AbiParam ; 2 ] > {
42
42
let ( rest_count, rem_bytes) = if cast. rest . unit . size . bytes ( ) == 0 {
43
43
( 0 , 0 )
44
44
} else {
@@ -100,7 +100,10 @@ impl<'tcx> ArgAbiExt<'tcx> for ArgAbi<'tcx, Ty<'tcx>> {
100
100
}
101
101
_ => unreachable ! ( "{:?}" , self . layout. abi) ,
102
102
} ,
103
- PassMode :: Cast ( cast) => cast_target_to_abi_params ( cast) ,
103
+ PassMode :: Cast ( ref cast, pad_i32) => {
104
+ assert ! ( !pad_i32, "padding support not yet implemented" ) ;
105
+ cast_target_to_abi_params ( cast)
106
+ }
104
107
PassMode :: Indirect { attrs, extra_attrs : None , on_stack } => {
105
108
if on_stack {
106
109
// Abi requires aligning struct size to pointer size
@@ -145,7 +148,9 @@ impl<'tcx> ArgAbiExt<'tcx> for ArgAbi<'tcx, Ty<'tcx>> {
145
148
}
146
149
_ => unreachable ! ( "{:?}" , self . layout. abi) ,
147
150
} ,
148
- PassMode :: Cast ( cast) => ( None , cast_target_to_abi_params ( cast) . into_iter ( ) . collect ( ) ) ,
151
+ PassMode :: Cast ( ref cast, _) => {
152
+ ( None , cast_target_to_abi_params ( cast) . into_iter ( ) . collect ( ) )
153
+ }
149
154
PassMode :: Indirect { attrs : _, extra_attrs : None , on_stack } => {
150
155
assert ! ( !on_stack) ;
151
156
( Some ( AbiParam :: special ( pointer_ty ( tcx) , ArgumentPurpose :: StructReturn ) ) , vec ! [ ] )
@@ -160,7 +165,7 @@ impl<'tcx> ArgAbiExt<'tcx> for ArgAbi<'tcx, Ty<'tcx>> {
160
165
pub ( super ) fn to_casted_value < ' tcx > (
161
166
fx : & mut FunctionCx < ' _ , ' _ , ' tcx > ,
162
167
arg : CValue < ' tcx > ,
163
- cast : CastTarget ,
168
+ cast : & CastTarget ,
164
169
) -> SmallVec < [ Value ; 2 ] > {
165
170
let ( ptr, meta) = arg. force_stack ( fx) ;
166
171
assert ! ( meta. is_none( ) ) ;
@@ -179,7 +184,7 @@ pub(super) fn from_casted_value<'tcx>(
179
184
fx : & mut FunctionCx < ' _ , ' _ , ' tcx > ,
180
185
block_params : & [ Value ] ,
181
186
layout : TyAndLayout < ' tcx > ,
182
- cast : CastTarget ,
187
+ cast : & CastTarget ,
183
188
) -> CValue < ' tcx > {
184
189
let abi_params = cast_target_to_abi_params ( cast) ;
185
190
let abi_param_size: u32 = abi_params. iter ( ) . map ( |param| param. value_type . bytes ( ) ) . sum ( ) ;
@@ -224,7 +229,7 @@ pub(super) fn adjust_arg_for_abi<'tcx>(
224
229
let ( a, b) = arg. load_scalar_pair ( fx) ;
225
230
smallvec ! [ a, b]
226
231
}
227
- PassMode :: Cast ( cast) => to_casted_value ( fx, arg, cast) ,
232
+ PassMode :: Cast ( ref cast, _ ) => to_casted_value ( fx, arg, cast) ,
228
233
PassMode :: Indirect { .. } => {
229
234
if is_owned {
230
235
match arg. force_stack ( fx) {
@@ -268,7 +273,7 @@ pub(super) fn cvalue_for_param<'tcx>(
268
273
local,
269
274
local_field,
270
275
& block_params,
271
- arg_abi. mode ,
276
+ & arg_abi. mode ,
272
277
arg_abi. layout ,
273
278
) ;
274
279
@@ -282,7 +287,9 @@ pub(super) fn cvalue_for_param<'tcx>(
282
287
assert_eq ! ( block_params. len( ) , 2 , "{:?}" , block_params) ;
283
288
Some ( CValue :: by_val_pair ( block_params[ 0 ] , block_params[ 1 ] , arg_abi. layout ) )
284
289
}
285
- PassMode :: Cast ( cast) => Some ( from_casted_value ( fx, & block_params, arg_abi. layout , cast) ) ,
290
+ PassMode :: Cast ( ref cast, _) => {
291
+ Some ( from_casted_value ( fx, & block_params, arg_abi. layout , cast) )
292
+ }
286
293
PassMode :: Indirect { attrs : _, extra_attrs : None , on_stack : _ } => {
287
294
assert_eq ! ( block_params. len( ) , 1 , "{:?}" , block_params) ;
288
295
Some ( CValue :: by_ref ( Pointer :: new ( block_params[ 0 ] ) , arg_abi. layout ) )
0 commit comments