@@ -119,49 +119,6 @@ impl<'a, 'll, CX: Borrow<SCx<'ll>>> GenericBuilder<'a, 'll, CX> {
119
119
}
120
120
}
121
121
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
-
165
122
/// Empty string, to be used where LLVM expects an instruction name, indicating
166
123
/// that the instruction is to be left unnamed (i.e. numbered, in textual IR).
167
124
// 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> {
1610
1567
let ret = unsafe { llvm:: LLVMBuildCatchRet ( self . llbuilder , funclet. cleanuppad ( ) , unwind) } ;
1611
1568
ret. expect ( "LLVM does not have support for catchret" )
1612
1569
}
1613
- }
1614
1570
1615
- impl < ' a , ' ll , ' tcx > Builder < ' a , ' ll , ' tcx > {
1616
1571
fn check_call < ' b > (
1617
1572
& mut self ,
1618
1573
typ : & str ,
@@ -1627,7 +1582,7 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
1627
1582
1628
1583
let param_tys = self . cx . func_params_types ( fn_ty) ;
1629
1584
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) ) )
1631
1586
. all ( |( expected_ty, actual_ty) | * expected_ty == actual_ty) ;
1632
1587
1633
1588
if all_args_match {
@@ -1637,7 +1592,7 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
1637
1592
let casted_args: Vec < _ > = iter:: zip ( param_tys, args)
1638
1593
. enumerate ( )
1639
1594
. 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) ;
1641
1596
if expected_ty != actual_ty {
1642
1597
debug ! (
1643
1598
"type mismatch in function call of {:?}. \
@@ -1653,12 +1608,12 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
1653
1608
1654
1609
Cow :: Owned ( casted_args)
1655
1610
}
1656
- }
1657
- impl < ' a , ' ll , CX : Borrow < SCx < ' ll > > > GenericBuilder < ' a , ' ll , CX > {
1611
+
1658
1612
pub ( crate ) fn va_arg ( & mut self , list : & ' ll Value , ty : & ' ll Type ) -> & ' ll Value {
1659
1613
unsafe { llvm:: LLVMBuildVAArg ( self . llbuilder , list, ty, UNNAMED ) }
1660
1614
}
1661
1615
}
1616
+
1662
1617
impl < ' a , ' ll , ' tcx > Builder < ' a , ' ll , ' tcx > {
1663
1618
pub ( crate ) fn call_intrinsic ( & mut self , intrinsic : & str , args : & [ & ' ll Value ] ) -> & ' ll Value {
1664
1619
let ( ty, f) = self . cx . get_intrinsic ( intrinsic) ;
0 commit comments