@@ -172,13 +172,13 @@ pub trait ArgTypeExt<'ll, 'tcx> {
172172 fn memory_ty ( & self , cx : & CodegenCx < ' ll , ' tcx , & ' ll Value > ) -> & ' ll Type ;
173173 fn store (
174174 & self ,
175- bx : & Builder < ' _ , ' ll , ' tcx , & ' ll Value > ,
175+ bx : & mut Builder < ' _ , ' ll , ' tcx , & ' ll Value > ,
176176 val : & ' ll Value ,
177177 dst : PlaceRef < ' tcx , & ' ll Value >
178178 ) ;
179179 fn store_fn_arg (
180180 & self ,
181- bx : & Builder < ' _ , ' ll , ' tcx , & ' ll Value > ,
181+ bx : & mut Builder < ' _ , ' ll , ' tcx , & ' ll Value > ,
182182 idx : & mut usize , dst : PlaceRef < ' tcx , & ' ll Value >
183183 ) ;
184184}
@@ -196,7 +196,7 @@ impl ArgTypeExt<'ll, 'tcx> for ArgType<'tcx, Ty<'tcx>> {
196196 /// or results of call/invoke instructions into their destinations.
197197 fn store (
198198 & self ,
199- bx : & Builder < ' _ , ' ll , ' tcx , & ' ll Value > ,
199+ bx : & mut Builder < ' _ , ' ll , ' tcx , & ' ll Value > ,
200200 val : & ' ll Value ,
201201 dst : PlaceRef < ' tcx , & ' ll Value >
202202 ) {
@@ -240,10 +240,13 @@ impl ArgTypeExt<'ll, 'tcx> for ArgType<'tcx, Ty<'tcx>> {
240240 bx. store ( val, llscratch, scratch_align) ;
241241
242242 // ...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 ( ) ) ;
243246 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,
247250 self . layout . align . min ( scratch_align) ,
248251 MemFlags :: empty ( )
249252 ) ;
@@ -257,7 +260,7 @@ impl ArgTypeExt<'ll, 'tcx> for ArgType<'tcx, Ty<'tcx>> {
257260
258261 fn store_fn_arg (
259262 & self ,
260- bx : & Builder < ' a , ' ll , ' tcx , & ' ll Value > ,
263+ bx : & mut Builder < ' a , ' ll , ' tcx , & ' ll Value > ,
261264 idx : & mut usize ,
262265 dst : PlaceRef < ' tcx , & ' ll Value >
263266 ) {
@@ -283,19 +286,19 @@ impl ArgTypeExt<'ll, 'tcx> for ArgType<'tcx, Ty<'tcx>> {
283286
284287impl < ' a , ' ll : ' a , ' tcx : ' ll > ArgTypeMethods < ' a , ' ll , ' tcx > for Builder < ' a , ' ll , ' tcx , & ' ll Value > {
285288 fn store_fn_arg (
286- & self ,
289+ & mut self ,
287290 ty : & ArgType < ' tcx , Ty < ' tcx > > ,
288291 idx : & mut usize , dst : PlaceRef < ' tcx , <Self :: CodegenCx as Backend < ' ll > >:: Value >
289292 ) {
290- ty. store_fn_arg ( & self , idx, dst)
293+ ty. store_fn_arg ( self , idx, dst)
291294 }
292295 fn store_arg_ty (
293- & self ,
296+ & mut self ,
294297 ty : & ArgType < ' tcx , Ty < ' tcx > > ,
295298 val : & ' ll Value ,
296299 dst : PlaceRef < ' tcx , & ' ll Value >
297300 ) {
298- ty. store ( & self , val, dst)
301+ ty. store ( self , val, dst)
299302 }
300303 fn memory_ty ( & self , ty : & ArgType < ' tcx , Ty < ' tcx > > ) -> & ' ll Type {
301304 ty. memory_ty ( self . cx ( ) )
@@ -322,7 +325,7 @@ pub trait FnTypeExt<'tcx> {
322325 fn llvm_type ( & self , cx : & CodegenCx < ' ll , ' tcx , & ' ll Value > ) -> & ' ll Type ;
323326 fn llvm_cconv ( & self ) -> llvm:: CallConv ;
324327 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 ) ;
326329}
327330
328331impl < ' tcx > FnTypeExt < ' tcx > for FnType < ' tcx , Ty < ' tcx > > {
@@ -752,7 +755,7 @@ impl<'tcx> FnTypeExt<'tcx> for FnType<'tcx, Ty<'tcx>> {
752755 }
753756 }
754757
755- fn apply_attrs_callsite ( & self , bx : & Builder < ' a , ' ll , ' tcx , & ' ll Value > , callsite : & ' ll Value ) {
758+ fn apply_attrs_callsite ( & self , bx : & mut Builder < ' a , ' ll , ' tcx , & ' ll Value > , callsite : & ' ll Value ) {
756759 let mut i = 0 ;
757760 let mut apply = |attrs : & ArgAttributes | {
758761 attrs. apply_callsite ( llvm:: AttributePlace :: Argument ( i) , callsite) ;
@@ -823,10 +826,10 @@ impl AbiMethods<'tcx> for CodegenCx<'ll, 'tcx, &'ll Value> {
823826
824827impl AbiBuilderMethods < ' a , ' ll , ' tcx > for Builder < ' a , ' ll , ' tcx , & ' ll Value > {
825828 fn apply_attrs_callsite (
826- & self ,
829+ & mut self ,
827830 ty : & FnType < ' tcx , Ty < ' tcx > > ,
828831 callsite : <Self :: CodegenCx as Backend < ' ll > >:: Value
829832 ) {
830- ty. apply_attrs_callsite ( & self , callsite)
833+ ty. apply_attrs_callsite ( self , callsite)
831834 }
832835}
0 commit comments