@@ -3,6 +3,7 @@ mod builder_methods;
3
3
use crate :: abi:: { ConvSpirvType , SpirvType } ;
4
4
use crate :: builder_spirv:: { BuilderCursor , SpirvValue , SpirvValueExt } ;
5
5
use crate :: codegen_cx:: CodegenCx ;
6
+ use rspirv:: spirv:: StorageClass ;
6
7
use rustc_ast:: ast:: { InlineAsmOptions , InlineAsmTemplatePiece } ;
7
8
use rustc_codegen_ssa:: common:: IntPredicate ;
8
9
use rustc_codegen_ssa:: mir:: operand:: { OperandRef , OperandValue } ;
@@ -207,7 +208,6 @@ impl<'a, 'spv, 'tcx> ArgAbiMethods<'tcx> for Builder<'a, 'spv, 'tcx> {
207
208
}
208
209
match arg_abi. mode {
209
210
PassMode :: Ignore => ( ) ,
210
- PassMode :: Direct ( _) => OperandValue :: Immediate ( next ( self , idx) ) . store ( self , dst) ,
211
211
PassMode :: Pair ( ..) => {
212
212
OperandValue :: Pair ( next ( self , idx) , next ( self , idx) ) . store ( self , dst)
213
213
}
@@ -217,11 +217,9 @@ impl<'a, 'spv, 'tcx> ArgAbiMethods<'tcx> for Builder<'a, 'spv, 'tcx> {
217
217
arg_abi. layout . align . abi ,
218
218
)
219
219
. store ( self , dst) ,
220
- PassMode :: Indirect ( _, None ) => {
221
- OperandValue :: Ref ( next ( self , idx) , None , arg_abi. layout . align . abi ) . store ( self , dst)
222
- }
223
- PassMode :: Cast ( _) => {
224
- panic ! ( "TODO: store_fn_arg PassMode::Cast not implemented yet" ) ;
220
+ PassMode :: Direct ( _) | PassMode :: Indirect ( _, None ) | PassMode :: Cast ( _) => {
221
+ let next_arg = next ( self , idx) ;
222
+ self . store_arg ( arg_abi, next_arg, dst)
225
223
}
226
224
}
227
225
}
@@ -236,14 +234,18 @@ impl<'a, 'spv, 'tcx> ArgAbiMethods<'tcx> for Builder<'a, 'spv, 'tcx> {
236
234
return ;
237
235
}
238
236
if arg_abi. is_sized_indirect ( ) {
239
- OperandValue :: Ref ( val, None , arg_abi. layout . align . abi ) . store ( self , dst)
237
+ OperandValue :: Ref ( val, None , arg_abi. layout . align . abi ) . store ( self , dst) ;
240
238
} else if arg_abi. is_unsized_indirect ( ) {
241
239
panic ! ( "unsized `ArgAbi` must be handled through `store_fn_arg`" ) ;
242
240
} else if let PassMode :: Cast ( cast) = arg_abi. mode {
243
- panic ! (
244
- "TODO: PassMode::Cast not implemented yet for store_arg: {:?}" ,
245
- cast
246
- ) ;
241
+ let cast_ty = cast. spirv_type ( self ) ;
242
+ let cast_ptr_ty = SpirvType :: Pointer {
243
+ storage_class : StorageClass :: Generic ,
244
+ pointee : cast_ty,
245
+ }
246
+ . def ( self ) ;
247
+ let cast_dst = self . pointercast ( dst. llval , cast_ptr_ty) ;
248
+ self . store ( val, cast_dst, arg_abi. layout . align . abi ) ;
247
249
} else {
248
250
OperandValue :: Immediate ( val) . store ( self , dst) ;
249
251
}
0 commit comments