@@ -119,49 +119,6 @@ impl<'a, 'll, CX: Borrow<SCx<'ll>>> GenericBuilder<'a, 'll, CX> {
119119 }
120120}
121121
122- impl < ' a , ' ll > SBuilder < ' a , ' ll > {
123- fn check_call < ' b > (
124- & mut self ,
125- typ : & str ,
126- fn_ty : & ' ll Type ,
127- llfn : & ' ll Value ,
128- args : & ' b [ & ' ll Value ] ,
129- ) -> Cow < ' b , [ & ' ll Value ] > {
130- assert ! (
131- self . cx. type_kind( fn_ty) == TypeKind :: Function ,
132- "builder::{typ} not passed a function, but {fn_ty:?}"
133- ) ;
134-
135- let param_tys = self . cx . func_params_types ( fn_ty) ;
136-
137- let all_args_match = iter:: zip ( & param_tys, args. iter ( ) . map ( |& v| self . cx . val_ty ( v) ) )
138- . all ( |( expected_ty, actual_ty) | * expected_ty == actual_ty) ;
139-
140- if all_args_match {
141- return Cow :: Borrowed ( args) ;
142- }
143-
144- let casted_args: Vec < _ > = iter:: zip ( param_tys, args)
145- . enumerate ( )
146- . map ( |( i, ( expected_ty, & actual_val) ) | {
147- let actual_ty = self . cx . val_ty ( actual_val) ;
148- if expected_ty != actual_ty {
149- debug ! (
150- "type mismatch in function call of {:?}. \
151- Expected {:?} for param {}, got {:?}; injecting bitcast",
152- llfn, expected_ty, i, actual_ty
153- ) ;
154- self . bitcast ( actual_val, expected_ty)
155- } else {
156- actual_val
157- }
158- } )
159- . collect ( ) ;
160-
161- Cow :: Owned ( casted_args)
162- }
163- }
164-
165122/// Empty string, to be used where LLVM expects an instruction name, indicating
166123/// that the instruction is to be left unnamed (i.e. numbered, in textual IR).
167124// FIXME(eddyb) pass `&CStr` directly to FFI once it's a thin pointer.
@@ -1610,9 +1567,7 @@ impl<'a, 'll, CX: Borrow<SCx<'ll>>> GenericBuilder<'a, 'll, CX> {
16101567 let ret = unsafe { llvm:: LLVMBuildCatchRet ( self . llbuilder , funclet. cleanuppad ( ) , unwind) } ;
16111568 ret. expect ( "LLVM does not have support for catchret" )
16121569 }
1613- }
16141570
1615- impl < ' a , ' ll , ' tcx > Builder < ' a , ' ll , ' tcx > {
16161571 fn check_call < ' b > (
16171572 & mut self ,
16181573 typ : & str ,
@@ -1627,7 +1582,7 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
16271582
16281583 let param_tys = self . cx . func_params_types ( fn_ty) ;
16291584
1630- let all_args_match = iter:: zip ( & param_tys, args. iter ( ) . map ( |& v| self . val_ty ( v) ) )
1585+ let all_args_match = iter:: zip ( & param_tys, args. iter ( ) . map ( |& v| self . cx . val_ty ( v) ) )
16311586 . all ( |( expected_ty, actual_ty) | * expected_ty == actual_ty) ;
16321587
16331588 if all_args_match {
@@ -1637,7 +1592,7 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
16371592 let casted_args: Vec < _ > = iter:: zip ( param_tys, args)
16381593 . enumerate ( )
16391594 . map ( |( i, ( expected_ty, & actual_val) ) | {
1640- let actual_ty = self . val_ty ( actual_val) ;
1595+ let actual_ty = self . cx . val_ty ( actual_val) ;
16411596 if expected_ty != actual_ty {
16421597 debug ! (
16431598 "type mismatch in function call of {:?}. \
@@ -1653,12 +1608,12 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
16531608
16541609 Cow :: Owned ( casted_args)
16551610 }
1656- }
1657- impl < ' a , ' ll , CX : Borrow < SCx < ' ll > > > GenericBuilder < ' a , ' ll , CX > {
1611+
16581612 pub ( crate ) fn va_arg ( & mut self , list : & ' ll Value , ty : & ' ll Type ) -> & ' ll Value {
16591613 unsafe { llvm:: LLVMBuildVAArg ( self . llbuilder , list, ty, UNNAMED ) }
16601614 }
16611615}
1616+
16621617impl < ' a , ' ll , ' tcx > Builder < ' a , ' ll , ' tcx > {
16631618 pub ( crate ) fn call_intrinsic ( & mut self , intrinsic : & str , args : & [ & ' ll Value ] ) -> & ' ll Value {
16641619 let ( ty, f) = self . cx . get_intrinsic ( intrinsic) ;
0 commit comments