@@ -171,13 +171,13 @@ pub trait ArgTypeExt<'ll, 'tcx> {
171171 fn memory_ty ( & self , cx : & CodegenCx < ' ll , ' tcx > ) -> & ' ll Type ;
172172 fn store (
173173 & self ,
174- bx : & Builder < ' _ , ' ll , ' tcx > ,
174+ bx : & mut Builder < ' _ , ' ll , ' tcx > ,
175175 val : & ' ll Value ,
176176 dst : PlaceRef < ' tcx , & ' ll Value > ,
177177 ) ;
178178 fn store_fn_arg (
179179 & self ,
180- bx : & Builder < ' _ , ' ll , ' tcx > ,
180+ bx : & mut Builder < ' _ , ' ll , ' tcx > ,
181181 idx : & mut usize ,
182182 dst : PlaceRef < ' tcx , & ' ll Value > ,
183183 ) ;
@@ -196,14 +196,13 @@ 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 > ,
199+ bx : & mut Builder < ' _ , ' ll , ' tcx > ,
200200 val : & ' ll Value ,
201201 dst : PlaceRef < ' tcx , & ' ll Value > ,
202202 ) {
203203 if self . is_ignore ( ) {
204204 return ;
205205 }
206- let cx = bx. cx ( ) ;
207206 if self . is_sized_indirect ( ) {
208207 OperandValue :: Ref ( val, None , self . layout . align ) . store ( bx, dst)
209208 } else if self . is_unsized_indirect ( ) {
@@ -213,7 +212,8 @@ impl ArgTypeExt<'ll, 'tcx> for ArgType<'tcx, Ty<'tcx>> {
213212 // uses it for i16 -> {i8, i8}, but not for i24 -> {i8, i8, i8}.
214213 let can_store_through_cast_ptr = false ;
215214 if can_store_through_cast_ptr {
216- let cast_dst = bx. pointercast ( dst. llval , cx. type_ptr_to ( cast. llvm_type ( cx) ) ) ;
215+ let cast_ptr_llty = bx. cx ( ) . type_ptr_to ( cast. llvm_type ( bx. cx ( ) ) ) ;
216+ let cast_dst = bx. pointercast ( dst. llval , cast_ptr_llty) ;
217217 bx. store ( val, cast_dst, self . layout . align ) ;
218218 } else {
219219 // The actual return type is a struct, but the ABI
@@ -231,21 +231,21 @@ impl ArgTypeExt<'ll, 'tcx> for ArgType<'tcx, Ty<'tcx>> {
231231 // bitcasting to the struct type yields invalid cast errors.
232232
233233 // We instead thus allocate some scratch space...
234- let scratch_size = cast. size ( cx ) ;
235- let scratch_align = cast. align ( cx ) ;
236- let llscratch = bx. alloca ( cast. llvm_type ( cx ) , "abi_cast" , scratch_align) ;
234+ let scratch_size = cast. size ( bx . cx ( ) ) ;
235+ let scratch_align = cast. align ( bx . cx ( ) ) ;
236+ let llscratch = bx. alloca ( cast. llvm_type ( bx . cx ( ) ) , "abi_cast" , scratch_align) ;
237237 bx. lifetime_start ( llscratch, scratch_size) ;
238238
239239 // ...where we first store the value...
240240 bx. store ( val, llscratch, scratch_align) ;
241241
242242 // ...and then memcpy it to the intended destination.
243243 bx. memcpy (
244- bx . pointercast ( dst. llval , cx . type_i8p ( ) ) ,
244+ dst. llval ,
245245 self . layout . align ,
246- bx . pointercast ( llscratch, cx . type_i8p ( ) ) ,
246+ llscratch,
247247 scratch_align,
248- cx . const_usize ( self . layout . size . bytes ( ) ) ,
248+ bx . cx ( ) . const_usize ( self . layout . size . bytes ( ) ) ,
249249 MemFlags :: empty ( )
250250 ) ;
251251
@@ -258,7 +258,7 @@ impl ArgTypeExt<'ll, 'tcx> for ArgType<'tcx, Ty<'tcx>> {
258258
259259 fn store_fn_arg (
260260 & self ,
261- bx : & Builder < ' a , ' ll , ' tcx > ,
261+ bx : & mut Builder < ' a , ' ll , ' tcx > ,
262262 idx : & mut usize ,
263263 dst : PlaceRef < ' tcx , & ' ll Value > ,
264264 ) {
@@ -284,14 +284,14 @@ impl ArgTypeExt<'ll, 'tcx> for ArgType<'tcx, Ty<'tcx>> {
284284
285285impl ArgTypeMethods < ' tcx > for Builder < ' a , ' ll , ' tcx > {
286286 fn store_fn_arg (
287- & self ,
287+ & mut self ,
288288 ty : & ArgType < ' tcx , Ty < ' tcx > > ,
289289 idx : & mut usize , dst : PlaceRef < ' tcx , Self :: Value >
290290 ) {
291291 ty. store_fn_arg ( self , idx, dst)
292292 }
293293 fn store_arg_ty (
294- & self ,
294+ & mut self ,
295295 ty : & ArgType < ' tcx , Ty < ' tcx > > ,
296296 val : & ' ll Value ,
297297 dst : PlaceRef < ' tcx , & ' ll Value >
@@ -324,7 +324,7 @@ pub trait FnTypeExt<'tcx> {
324324 fn ptr_to_llvm_type ( & self , cx : & CodegenCx < ' ll , ' tcx > ) -> & ' ll Type ;
325325 fn llvm_cconv ( & self ) -> llvm:: CallConv ;
326326 fn apply_attrs_llfn ( & self , llfn : & ' ll Value ) ;
327- fn apply_attrs_callsite ( & self , bx : & Builder < ' a , ' ll , ' tcx > , callsite : & ' ll Value ) ;
327+ fn apply_attrs_callsite ( & self , bx : & mut Builder < ' a , ' ll , ' tcx > , callsite : & ' ll Value ) ;
328328}
329329
330330impl < ' tcx > FnTypeExt < ' tcx > for FnType < ' tcx , Ty < ' tcx > > {
@@ -761,7 +761,7 @@ impl<'tcx> FnTypeExt<'tcx> for FnType<'tcx, Ty<'tcx>> {
761761 }
762762 }
763763
764- fn apply_attrs_callsite ( & self , bx : & Builder < ' a , ' ll , ' tcx > , callsite : & ' ll Value ) {
764+ fn apply_attrs_callsite ( & self , bx : & mut Builder < ' a , ' ll , ' tcx > , callsite : & ' ll Value ) {
765765 let mut i = 0 ;
766766 let mut apply = |attrs : & ArgAttributes | {
767767 attrs. apply_callsite ( llvm:: AttributePlace :: Argument ( i) , callsite) ;
@@ -832,7 +832,7 @@ impl AbiMethods<'tcx> for CodegenCx<'ll, 'tcx> {
832832
833833impl AbiBuilderMethods < ' tcx > for Builder < ' a , ' ll , ' tcx > {
834834 fn apply_attrs_callsite (
835- & self ,
835+ & mut self ,
836836 ty : & FnType < ' tcx , Ty < ' tcx > > ,
837837 callsite : Self :: Value
838838 ) {
0 commit comments