@@ -126,11 +126,11 @@ pub fn codegen_intrinsic_call(
126
126
} ,
127
127
"likely" => {
128
128
let expect = cx. get_intrinsic ( & ( "llvm.expect.i1" ) ) ;
129
- bx. call ( expect, & [ args[ 0 ] . immediate ( ) , CodegenCx :: c_bool ( cx , true ) ] , None )
129
+ bx. call ( expect, & [ args[ 0 ] . immediate ( ) , bx . cx ( ) . c_bool ( true ) ] , None )
130
130
}
131
131
"unlikely" => {
132
132
let expect = cx. get_intrinsic ( & ( "llvm.expect.i1" ) ) ;
133
- bx. call ( expect, & [ args[ 0 ] . immediate ( ) , CodegenCx :: c_bool ( cx , false ) ] , None )
133
+ bx. call ( expect, & [ args[ 0 ] . immediate ( ) , bx . cx ( ) . c_bool ( false ) ] , None )
134
134
}
135
135
"try" => {
136
136
try_intrinsic ( bx, cx,
@@ -146,7 +146,7 @@ pub fn codegen_intrinsic_call(
146
146
}
147
147
"size_of" => {
148
148
let tp_ty = substs. type_at ( 0 ) ;
149
- CodegenCx :: c_usize ( cx , cx. size_of ( tp_ty) . bytes ( ) )
149
+ cx . c_usize ( cx. size_of ( tp_ty) . bytes ( ) )
150
150
}
151
151
"size_of_val" => {
152
152
let tp_ty = substs. type_at ( 0 ) ;
@@ -155,12 +155,12 @@ pub fn codegen_intrinsic_call(
155
155
glue:: size_and_align_of_dst ( bx, tp_ty, Some ( meta) ) ;
156
156
llsize
157
157
} else {
158
- CodegenCx :: c_usize ( cx , cx. size_of ( tp_ty) . bytes ( ) )
158
+ cx . c_usize ( cx. size_of ( tp_ty) . bytes ( ) )
159
159
}
160
160
}
161
161
"min_align_of" => {
162
162
let tp_ty = substs. type_at ( 0 ) ;
163
- CodegenCx :: c_usize ( cx , cx. align_of ( tp_ty) . abi ( ) )
163
+ cx . c_usize ( cx. align_of ( tp_ty) . abi ( ) )
164
164
}
165
165
"min_align_of_val" => {
166
166
let tp_ty = substs. type_at ( 0 ) ;
@@ -169,20 +169,20 @@ pub fn codegen_intrinsic_call(
169
169
glue:: size_and_align_of_dst ( bx, tp_ty, Some ( meta) ) ;
170
170
llalign
171
171
} else {
172
- CodegenCx :: c_usize ( cx , cx. align_of ( tp_ty) . abi ( ) )
172
+ cx . c_usize ( cx. align_of ( tp_ty) . abi ( ) )
173
173
}
174
174
}
175
175
"pref_align_of" => {
176
176
let tp_ty = substs. type_at ( 0 ) ;
177
- CodegenCx :: c_usize ( cx , cx. align_of ( tp_ty) . pref ( ) )
177
+ cx . c_usize ( cx. align_of ( tp_ty) . pref ( ) )
178
178
}
179
179
"type_name" => {
180
180
let tp_ty = substs. type_at ( 0 ) ;
181
181
let ty_name = Symbol :: intern ( & tp_ty. to_string ( ) ) . as_str ( ) ;
182
- CodegenCx :: c_str_slice ( cx , ty_name)
182
+ cx . c_str_slice ( ty_name)
183
183
}
184
184
"type_id" => {
185
- CodegenCx :: c_u64 ( cx , cx. tcx . type_id_hash ( substs. type_at ( 0 ) ) )
185
+ cx . c_u64 ( cx. tcx . type_id_hash ( substs. type_at ( 0 ) ) )
186
186
}
187
187
"init" => {
188
188
let ty = substs. type_at ( 0 ) ;
@@ -196,8 +196,8 @@ pub fn codegen_intrinsic_call(
196
196
false ,
197
197
ty,
198
198
llresult,
199
- CodegenCx :: c_u8 ( cx , 0 ) ,
200
- CodegenCx :: c_usize ( cx , 1 )
199
+ cx . c_u8 ( 0 ) ,
200
+ cx . c_usize ( 1 )
201
201
) ;
202
202
}
203
203
return ;
@@ -209,7 +209,7 @@ pub fn codegen_intrinsic_call(
209
209
"needs_drop" => {
210
210
let tp_ty = substs. type_at ( 0 ) ;
211
211
212
- CodegenCx :: c_bool ( cx , bx. cx ( ) . type_needs_drop ( tp_ty) )
212
+ cx . c_bool ( bx. cx ( ) . type_needs_drop ( tp_ty) )
213
213
}
214
214
"offset" => {
215
215
let ptr = args[ 0 ] . immediate ( ) ;
@@ -286,9 +286,9 @@ pub fn codegen_intrinsic_call(
286
286
} ;
287
287
bx. call ( expect, & [
288
288
args[ 0 ] . immediate ( ) ,
289
- CodegenCx :: c_i32 ( cx , rw) ,
289
+ cx . c_i32 ( rw) ,
290
290
args[ 1 ] . immediate ( ) ,
291
- CodegenCx :: c_i32 ( cx , cache_type)
291
+ cx . c_i32 ( cache_type)
292
292
] , None )
293
293
} ,
294
294
"ctlz" | "ctlz_nonzero" | "cttz" | "cttz_nonzero" | "ctpop" | "bswap" |
@@ -300,12 +300,12 @@ pub fn codegen_intrinsic_call(
300
300
Some ( ( width, signed) ) =>
301
301
match name {
302
302
"ctlz" | "cttz" => {
303
- let y = CodegenCx :: c_bool ( bx . cx ( ) , false ) ;
303
+ let y = cx . c_bool ( false ) ;
304
304
let llfn = cx. get_intrinsic ( & format ! ( "llvm.{}.i{}" , name, width) ) ;
305
305
bx. call ( llfn, & [ args[ 0 ] . immediate ( ) , y] , None )
306
306
}
307
307
"ctlz_nonzero" | "cttz_nonzero" => {
308
- let y = CodegenCx :: c_bool ( bx . cx ( ) , true ) ;
308
+ let y = cx . c_bool ( true ) ;
309
309
let llvm_name = & format ! ( "llvm.{}.i{}" , & name[ ..4 ] , width) ;
310
310
let llfn = cx. get_intrinsic ( llvm_name) ;
311
311
bx. call ( llfn, & [ args[ 0 ] . immediate ( ) , y] , None )
@@ -707,8 +707,8 @@ fn copy_intrinsic(
707
707
) -> & ' ll Value {
708
708
let cx = bx. cx ( ) ;
709
709
let ( size, align) = cx. size_and_align_of ( ty) ;
710
- let size = CodegenCx :: c_usize ( cx , size. bytes ( ) ) ;
711
- let align = CodegenCx :: c_i32 ( cx , align. abi ( ) as i32 ) ;
710
+ let size = cx . c_usize ( size. bytes ( ) ) ;
711
+ let align = cx . c_i32 ( align. abi ( ) as i32 ) ;
712
712
713
713
let operation = if allow_overlap {
714
714
"memmove"
@@ -728,7 +728,7 @@ fn copy_intrinsic(
728
728
src_ptr,
729
729
bx. mul ( size, count) ,
730
730
align,
731
- CodegenCx :: c_bool ( cx , volatile) ] ,
731
+ cx . c_bool ( volatile) ] ,
732
732
None )
733
733
}
734
734
@@ -742,8 +742,8 @@ fn memset_intrinsic(
742
742
) -> & ' ll Value {
743
743
let cx = bx. cx ( ) ;
744
744
let ( size, align) = cx. size_and_align_of ( ty) ;
745
- let size = CodegenCx :: c_usize ( cx , size. bytes ( ) ) ;
746
- let align = CodegenCx :: c_i32 ( cx , align. abi ( ) as i32 ) ;
745
+ let size = cx . c_usize ( size. bytes ( ) ) ;
746
+ let align = cx . c_i32 ( align. abi ( ) as i32 ) ;
747
747
let dst = bx. pointercast ( dst, Type :: i8p ( cx) ) ;
748
748
call_memset ( bx, dst, val, bx. mul ( size, count) , align, volatile)
749
749
}
@@ -759,7 +759,7 @@ fn try_intrinsic(
759
759
if bx. sess ( ) . no_landing_pads ( ) {
760
760
bx. call ( func, & [ data] , None ) ;
761
761
let ptr_align = bx. tcx ( ) . data_layout . pointer_align ;
762
- bx. store ( CodegenCx :: c_null ( Type :: i8p ( & bx. cx ( ) ) ) , dest, ptr_align) ;
762
+ bx. store ( bx . cx ( ) . c_null ( Type :: i8p ( & bx. cx ( ) ) ) , dest, ptr_align) ;
763
763
} else if wants_msvc_seh ( bx. sess ( ) ) {
764
764
codegen_msvc_try ( bx, cx, func, data, local_ptr, dest) ;
765
765
} else {
@@ -841,7 +841,7 @@ fn codegen_msvc_try(
841
841
bx. invoke ( func, & [ data] , normal. llbb ( ) , catchswitch. llbb ( ) ,
842
842
None ) ;
843
843
844
- normal. ret ( CodegenCx :: c_i32 ( cx , 0 ) ) ;
844
+ normal. ret ( cx . c_i32 ( 0 ) ) ;
845
845
846
846
let cs = catchswitch. catch_switch ( None , None , 1 ) ;
847
847
catchswitch. add_handler ( cs, catchpad. llbb ( ) ) ;
@@ -851,19 +851,19 @@ fn codegen_msvc_try(
851
851
Some ( did) => :: consts:: get_static ( cx, did) ,
852
852
None => bug ! ( "msvc_try_filter not defined" ) ,
853
853
} ;
854
- let tok = catchpad. catch_pad ( cs, & [ tydesc, CodegenCx :: c_i32 ( cx , 0 ) , slot] ) ;
854
+ let tok = catchpad. catch_pad ( cs, & [ tydesc, cx . c_i32 ( 0 ) , slot] ) ;
855
855
let addr = catchpad. load ( slot, ptr_align) ;
856
856
857
857
let i64_align = bx. tcx ( ) . data_layout . i64_align ;
858
858
let arg1 = catchpad. load ( addr, i64_align) ;
859
- let val1 = CodegenCx :: c_i32 ( cx , 1 ) ;
859
+ let val1 = cx . c_i32 ( 1 ) ;
860
860
let arg2 = catchpad. load ( catchpad. inbounds_gep ( addr, & [ val1] ) , i64_align) ;
861
861
let local_ptr = catchpad. bitcast ( local_ptr, i64p) ;
862
862
catchpad. store ( arg1, local_ptr, i64_align) ;
863
863
catchpad. store ( arg2, catchpad. inbounds_gep ( local_ptr, & [ val1] ) , i64_align) ;
864
864
catchpad. catch_ret ( tok, caught. llbb ( ) ) ;
865
865
866
- caught. ret ( CodegenCx :: c_i32 ( cx , 1 ) ) ;
866
+ caught. ret ( cx . c_i32 ( 1 ) ) ;
867
867
} ) ;
868
868
869
869
// Note that no invoke is used here because by definition this function
@@ -919,7 +919,7 @@ fn codegen_gnu_try(
919
919
let data = llvm:: get_param ( bx. llfn ( ) , 1 ) ;
920
920
let local_ptr = llvm:: get_param ( bx. llfn ( ) , 2 ) ;
921
921
bx. invoke ( func, & [ data] , then. llbb ( ) , catch. llbb ( ) , None ) ;
922
- then. ret ( CodegenCx :: c_i32 ( cx , 0 ) ) ;
922
+ then. ret ( cx . c_i32 ( 0 ) ) ;
923
923
924
924
// Type indicator for the exception being thrown.
925
925
//
@@ -930,11 +930,11 @@ fn codegen_gnu_try(
930
930
let lpad_ty = Type :: struct_ ( cx, & [ Type :: i8p ( cx) , Type :: i32 ( cx) ] ,
931
931
false ) ;
932
932
let vals = catch. landing_pad ( lpad_ty, bx. cx ( ) . eh_personality ( ) , 1 ) ;
933
- catch. add_clause ( vals, CodegenCx :: c_null ( Type :: i8p ( cx) ) ) ;
933
+ catch. add_clause ( vals, bx . cx ( ) . c_null ( Type :: i8p ( cx) ) ) ;
934
934
let ptr = catch. extract_value ( vals, 0 ) ;
935
935
let ptr_align = bx. tcx ( ) . data_layout . pointer_align ;
936
936
catch. store ( ptr, catch. bitcast ( local_ptr, Type :: i8p ( cx) . ptr_to ( ) ) , ptr_align) ;
937
- catch. ret ( CodegenCx :: c_i32 ( cx , 1 ) ) ;
937
+ catch. ret ( cx . c_i32 ( 1 ) ) ;
938
938
} ) ;
939
939
940
940
// Note that no invoke is used here because by definition this function
@@ -1127,13 +1127,13 @@ fn generic_simd_intrinsic(
1127
1127
arg_idx, total_len) ;
1128
1128
None
1129
1129
}
1130
- Some ( idx) => Some ( CodegenCx :: c_i32 ( bx. cx ( ) , idx as i32 ) ) ,
1130
+ Some ( idx) => Some ( bx. cx ( ) . c_i32 ( idx as i32 ) ) ,
1131
1131
}
1132
1132
} )
1133
1133
. collect ( ) ;
1134
1134
let indices = match indices {
1135
1135
Some ( i) => i,
1136
- None => return Ok ( CodegenCx :: c_null ( llret_ty) )
1136
+ None => return Ok ( bx . cx ( ) . c_null ( llret_ty) )
1137
1137
} ;
1138
1138
1139
1139
return Ok ( bx. shuffle_vector ( args[ 0 ] . immediate ( ) ,
@@ -1402,7 +1402,7 @@ fn generic_simd_intrinsic(
1402
1402
1403
1403
// Alignment of T, must be a constant integer value:
1404
1404
let alignment_ty = Type :: i32 ( bx. cx ( ) ) ;
1405
- let alignment = CodegenCx :: c_i32 ( bx. cx ( ) , bx. cx ( ) . align_of ( in_elem) . abi ( ) as i32 ) ;
1405
+ let alignment = bx. cx ( ) . c_i32 ( bx. cx ( ) . align_of ( in_elem) . abi ( ) as i32 ) ;
1406
1406
1407
1407
// Truncate the mask vector to a vector of i1s:
1408
1408
let ( mask, mask_ty) = {
@@ -1502,7 +1502,7 @@ fn generic_simd_intrinsic(
1502
1502
1503
1503
// Alignment of T, must be a constant integer value:
1504
1504
let alignment_ty = Type :: i32 ( bx. cx ( ) ) ;
1505
- let alignment = CodegenCx :: c_i32 ( bx. cx ( ) , bx. cx ( ) . align_of ( in_elem) . abi ( ) as i32 ) ;
1505
+ let alignment = bx. cx ( ) . c_i32 ( bx. cx ( ) . align_of ( in_elem) . abi ( ) as i32 ) ;
1506
1506
1507
1507
// Truncate the mask vector to a vector of i1s:
1508
1508
let ( mask, mask_ty) = {
@@ -1580,8 +1580,8 @@ fn generic_simd_intrinsic(
1580
1580
} else {
1581
1581
// unordered arithmetic reductions do not:
1582
1582
match f. bit_width( ) {
1583
- 32 => CodegenCx :: c_undef( Type :: f32 ( bx. cx( ) ) ) ,
1584
- 64 => CodegenCx :: c_undef( Type :: f64 ( bx. cx( ) ) ) ,
1583
+ 32 => bx . cx ( ) . c_undef( Type :: f32 ( bx. cx( ) ) ) ,
1584
+ 64 => bx . cx ( ) . c_undef( Type :: f64 ( bx. cx( ) ) ) ,
1585
1585
v => {
1586
1586
return_error!( r#"
1587
1587
unsupported {} from `{}` with element `{}` of size `{}` to `{}`"# ,
0 commit comments