@@ -172,13 +172,13 @@ pub trait ArgTypeExt<'ll, 'tcx> {
172
172
fn memory_ty ( & self , cx : & CodegenCx < ' ll , ' tcx , & ' ll Value > ) -> & ' ll Type ;
173
173
fn store (
174
174
& self ,
175
- bx : & Builder < ' _ , ' ll , ' tcx , & ' ll Value > ,
175
+ bx : & mut Builder < ' _ , ' ll , ' tcx , & ' ll Value > ,
176
176
val : & ' ll Value ,
177
177
dst : PlaceRef < ' tcx , & ' ll Value >
178
178
) ;
179
179
fn store_fn_arg (
180
180
& self ,
181
- bx : & Builder < ' _ , ' ll , ' tcx , & ' ll Value > ,
181
+ bx : & mut Builder < ' _ , ' ll , ' tcx , & ' ll Value > ,
182
182
idx : & mut usize , dst : PlaceRef < ' tcx , & ' ll Value >
183
183
) ;
184
184
}
@@ -196,7 +196,7 @@ impl ArgTypeExt<'ll, 'tcx> for ArgType<'tcx, Ty<'tcx>> {
196
196
/// or results of call/invoke instructions into their destinations.
197
197
fn store (
198
198
& self ,
199
- bx : & Builder < ' _ , ' ll , ' tcx , & ' ll Value > ,
199
+ bx : & mut Builder < ' _ , ' ll , ' tcx , & ' ll Value > ,
200
200
val : & ' ll Value ,
201
201
dst : PlaceRef < ' tcx , & ' ll Value >
202
202
) {
@@ -240,10 +240,13 @@ impl ArgTypeExt<'ll, 'tcx> for ArgType<'tcx, Ty<'tcx>> {
240
240
bx. store ( val, llscratch, scratch_align) ;
241
241
242
242
// ...and then memcpy it to the intended destination.
243
+ let llval_cast = bx. pointercast ( dst. llval , cx. type_i8p ( ) ) ;
244
+ let llscratch_cast = bx. pointercast ( llscratch, cx. type_i8p ( ) ) ;
245
+ let size = cx. const_usize ( self . layout . size . bytes ( ) ) ;
243
246
bx. call_memcpy (
244
- bx . pointercast ( dst . llval , cx . type_i8p ( ) ) ,
245
- bx . pointercast ( llscratch , cx . type_i8p ( ) ) ,
246
- cx . const_usize ( self . layout . size . bytes ( ) ) ,
247
+ llval_cast ,
248
+ llscratch_cast ,
249
+ size,
247
250
self . layout . align . min ( scratch_align) ,
248
251
MemFlags :: empty ( )
249
252
) ;
@@ -257,7 +260,7 @@ impl ArgTypeExt<'ll, 'tcx> for ArgType<'tcx, Ty<'tcx>> {
257
260
258
261
fn store_fn_arg (
259
262
& self ,
260
- bx : & Builder < ' a , ' ll , ' tcx , & ' ll Value > ,
263
+ bx : & mut Builder < ' a , ' ll , ' tcx , & ' ll Value > ,
261
264
idx : & mut usize ,
262
265
dst : PlaceRef < ' tcx , & ' ll Value >
263
266
) {
@@ -283,19 +286,19 @@ impl ArgTypeExt<'ll, 'tcx> for ArgType<'tcx, Ty<'tcx>> {
283
286
284
287
impl < ' a , ' ll : ' a , ' tcx : ' ll > ArgTypeMethods < ' a , ' ll , ' tcx > for Builder < ' a , ' ll , ' tcx , & ' ll Value > {
285
288
fn store_fn_arg (
286
- & self ,
289
+ & mut self ,
287
290
ty : & ArgType < ' tcx , Ty < ' tcx > > ,
288
291
idx : & mut usize , dst : PlaceRef < ' tcx , <Self :: CodegenCx as Backend < ' ll > >:: Value >
289
292
) {
290
- ty. store_fn_arg ( & self , idx, dst)
293
+ ty. store_fn_arg ( self , idx, dst)
291
294
}
292
295
fn store_arg_ty (
293
- & self ,
296
+ & mut self ,
294
297
ty : & ArgType < ' tcx , Ty < ' tcx > > ,
295
298
val : & ' ll Value ,
296
299
dst : PlaceRef < ' tcx , & ' ll Value >
297
300
) {
298
- ty. store ( & self , val, dst)
301
+ ty. store ( self , val, dst)
299
302
}
300
303
fn memory_ty ( & self , ty : & ArgType < ' tcx , Ty < ' tcx > > ) -> & ' ll Type {
301
304
ty. memory_ty ( self . cx ( ) )
@@ -322,7 +325,7 @@ pub trait FnTypeExt<'tcx> {
322
325
fn llvm_type ( & self , cx : & CodegenCx < ' ll , ' tcx , & ' ll Value > ) -> & ' ll Type ;
323
326
fn llvm_cconv ( & self ) -> llvm:: CallConv ;
324
327
fn apply_attrs_llfn ( & self , llfn : & ' ll Value ) ;
325
- fn apply_attrs_callsite ( & self , bx : & Builder < ' a , ' ll , ' tcx , & ' ll Value > , callsite : & ' ll Value ) ;
328
+ fn apply_attrs_callsite ( & self , bx : & mut Builder < ' a , ' ll , ' tcx , & ' ll Value > , callsite : & ' ll Value ) ;
326
329
}
327
330
328
331
impl < ' tcx > FnTypeExt < ' tcx > for FnType < ' tcx , Ty < ' tcx > > {
@@ -725,7 +728,7 @@ impl<'tcx> FnTypeExt<'tcx> for FnType<'tcx, Ty<'tcx>> {
725
728
}
726
729
}
727
730
728
- fn apply_attrs_callsite ( & self , bx : & Builder < ' a , ' ll , ' tcx , & ' ll Value > , callsite : & ' ll Value ) {
731
+ fn apply_attrs_callsite ( & self , bx : & mut Builder < ' a , ' ll , ' tcx , & ' ll Value > , callsite : & ' ll Value ) {
729
732
let mut i = 0 ;
730
733
let mut apply = |attrs : & ArgAttributes | {
731
734
attrs. apply_callsite ( llvm:: AttributePlace :: Argument ( i) , callsite) ;
@@ -796,10 +799,10 @@ impl AbiMethods<'tcx> for CodegenCx<'ll, 'tcx, &'ll Value> {
796
799
797
800
impl AbiBuilderMethods < ' a , ' ll , ' tcx > for Builder < ' a , ' ll , ' tcx , & ' ll Value > {
798
801
fn apply_attrs_callsite (
799
- & self ,
802
+ & mut self ,
800
803
ty : & FnType < ' tcx , Ty < ' tcx > > ,
801
804
callsite : <Self :: CodegenCx as Backend < ' ll > >:: Value
802
805
) {
803
- ty. apply_attrs_callsite ( & self , callsite)
806
+ ty. apply_attrs_callsite ( self , callsite)
804
807
}
805
808
}
0 commit comments