@@ -5,7 +5,7 @@ use rustc_middle::ty::adjustment::PointerCast;
5
5
6
6
use crate :: prelude:: * ;
7
7
8
- pub ( crate ) fn trans_fn < ' tcx > (
8
+ pub ( crate ) fn codegen_fn < ' tcx > (
9
9
cx : & mut crate :: CodegenCx < ' tcx , impl Module > ,
10
10
instance : Instance < ' tcx > ,
11
11
linkage : Linkage ,
@@ -202,7 +202,7 @@ fn codegen_fn_content(fx: &mut FunctionCx<'_, '_, impl Module>) {
202
202
fx. bcx . ins ( ) . nop ( ) ;
203
203
for stmt in & bb_data. statements {
204
204
fx. set_debug_loc ( stmt. source_info ) ;
205
- trans_stmt ( fx, block, stmt) ;
205
+ codegen_stmt ( fx, block, stmt) ;
206
206
}
207
207
208
208
#[ cfg( debug_assertions) ]
@@ -258,7 +258,7 @@ fn codegen_fn_content(fx: &mut FunctionCx<'_, '_, impl Module>) {
258
258
continue ;
259
259
}
260
260
}
261
- let cond = trans_operand ( fx, cond) . load_scalar ( fx) ;
261
+ let cond = codegen_operand ( fx, cond) . load_scalar ( fx) ;
262
262
263
263
let target = fx. get_block ( * target) ;
264
264
let failure = fx. bcx . create_block ( ) ;
@@ -276,8 +276,8 @@ fn codegen_fn_content(fx: &mut FunctionCx<'_, '_, impl Module>) {
276
276
277
277
match msg {
278
278
AssertKind :: BoundsCheck { ref len, ref index } => {
279
- let len = trans_operand ( fx, len) . load_scalar ( fx) ;
280
- let index = trans_operand ( fx, index) . load_scalar ( fx) ;
279
+ let len = codegen_operand ( fx, len) . load_scalar ( fx) ;
280
+ let index = codegen_operand ( fx, index) . load_scalar ( fx) ;
281
281
let location = fx
282
282
. get_caller_location ( bb_data. terminator ( ) . source_info . span )
283
283
. load_scalar ( fx) ;
@@ -301,7 +301,7 @@ fn codegen_fn_content(fx: &mut FunctionCx<'_, '_, impl Module>) {
301
301
switch_ty,
302
302
targets,
303
303
} => {
304
- let discr = trans_operand ( fx, discr) . load_scalar ( fx) ;
304
+ let discr = codegen_operand ( fx, discr) . load_scalar ( fx) ;
305
305
306
306
if switch_ty. kind ( ) == fx. tcx . types . bool . kind ( ) {
307
307
assert_eq ! ( targets. iter( ) . count( ) , 1 ) ;
@@ -396,14 +396,14 @@ fn codegen_fn_content(fx: &mut FunctionCx<'_, '_, impl Module>) {
396
396
| TerminatorKind :: FalseUnwind { .. }
397
397
| TerminatorKind :: DropAndReplace { .. }
398
398
| TerminatorKind :: GeneratorDrop => {
399
- bug ! ( "shouldn't exist at trans {:?}" , bb_data. terminator( ) ) ;
399
+ bug ! ( "shouldn't exist at codegen {:?}" , bb_data. terminator( ) ) ;
400
400
}
401
401
TerminatorKind :: Drop {
402
402
place,
403
403
target,
404
404
unwind : _,
405
405
} => {
406
- let drop_place = trans_place ( fx, * place) ;
406
+ let drop_place = codegen_place ( fx, * place) ;
407
407
crate :: abi:: codegen_drop ( fx, bb_data. terminator ( ) . source_info . span , drop_place) ;
408
408
409
409
let target_block = fx. get_block ( * target) ;
@@ -416,7 +416,7 @@ fn codegen_fn_content(fx: &mut FunctionCx<'_, '_, impl Module>) {
416
416
fx. bcx . finalize ( ) ;
417
417
}
418
418
419
- fn trans_stmt < ' tcx > (
419
+ fn codegen_stmt < ' tcx > (
420
420
fx : & mut FunctionCx < ' _ , ' tcx , impl Module > ,
421
421
#[ allow( unused_variables) ] cur_block : Block ,
422
422
stmt : & Statement < ' tcx > ,
@@ -439,19 +439,19 @@ fn trans_stmt<'tcx>(
439
439
place,
440
440
variant_index,
441
441
} => {
442
- let place = trans_place ( fx, * * place) ;
442
+ let place = codegen_place ( fx, * * place) ;
443
443
crate :: discriminant:: codegen_set_discriminant ( fx, place, * variant_index) ;
444
444
}
445
445
StatementKind :: Assign ( to_place_and_rval) => {
446
- let lval = trans_place ( fx, to_place_and_rval. 0 ) ;
446
+ let lval = codegen_place ( fx, to_place_and_rval. 0 ) ;
447
447
let dest_layout = lval. layout ( ) ;
448
448
match & to_place_and_rval. 1 {
449
449
Rvalue :: Use ( operand) => {
450
- let val = trans_operand ( fx, operand) ;
450
+ let val = codegen_operand ( fx, operand) ;
451
451
lval. write_cvalue ( fx, val) ;
452
452
}
453
453
Rvalue :: Ref ( _, _, place) | Rvalue :: AddressOf ( _, place) => {
454
- let place = trans_place ( fx, * place) ;
454
+ let place = codegen_place ( fx, * place) ;
455
455
let ref_ = place. place_ref ( fx, lval. layout ( ) ) ;
456
456
lval. write_cvalue ( fx, ref_) ;
457
457
}
@@ -460,29 +460,29 @@ fn trans_stmt<'tcx>(
460
460
lval. write_cvalue ( fx, val) ;
461
461
}
462
462
Rvalue :: BinaryOp ( bin_op, lhs, rhs) => {
463
- let lhs = trans_operand ( fx, lhs) ;
464
- let rhs = trans_operand ( fx, rhs) ;
463
+ let lhs = codegen_operand ( fx, lhs) ;
464
+ let rhs = codegen_operand ( fx, rhs) ;
465
465
466
466
let res = crate :: num:: codegen_binop ( fx, * bin_op, lhs, rhs) ;
467
467
lval. write_cvalue ( fx, res) ;
468
468
}
469
469
Rvalue :: CheckedBinaryOp ( bin_op, lhs, rhs) => {
470
- let lhs = trans_operand ( fx, lhs) ;
471
- let rhs = trans_operand ( fx, rhs) ;
470
+ let lhs = codegen_operand ( fx, lhs) ;
471
+ let rhs = codegen_operand ( fx, rhs) ;
472
472
473
473
let res = if !fx. tcx . sess . overflow_checks ( ) {
474
474
let val =
475
- crate :: num:: trans_int_binop ( fx, * bin_op, lhs, rhs) . load_scalar ( fx) ;
475
+ crate :: num:: codegen_int_binop ( fx, * bin_op, lhs, rhs) . load_scalar ( fx) ;
476
476
let is_overflow = fx. bcx . ins ( ) . iconst ( types:: I8 , 0 ) ;
477
477
CValue :: by_val_pair ( val, is_overflow, lval. layout ( ) )
478
478
} else {
479
- crate :: num:: trans_checked_int_binop ( fx, * bin_op, lhs, rhs)
479
+ crate :: num:: codegen_checked_int_binop ( fx, * bin_op, lhs, rhs)
480
480
} ;
481
481
482
482
lval. write_cvalue ( fx, res) ;
483
483
}
484
484
Rvalue :: UnaryOp ( un_op, operand) => {
485
- let operand = trans_operand ( fx, operand) ;
485
+ let operand = codegen_operand ( fx, operand) ;
486
486
let layout = operand. layout ( ) ;
487
487
let val = operand. load_scalar ( fx) ;
488
488
let res = match un_op {
@@ -500,7 +500,7 @@ fn trans_stmt<'tcx>(
500
500
ty:: Int ( IntTy :: I128 ) => {
501
501
// FIXME remove this case once ineg.i128 works
502
502
let zero = CValue :: const_val ( fx, layout, 0 ) ;
503
- crate :: num:: trans_int_binop ( fx, BinOp :: Sub , zero, operand)
503
+ crate :: num:: codegen_int_binop ( fx, BinOp :: Sub , zero, operand)
504
504
}
505
505
ty:: Int ( _) => CValue :: by_val ( fx. bcx . ins ( ) . ineg ( val) , layout) ,
506
506
ty:: Float ( _) => CValue :: by_val ( fx. bcx . ins ( ) . fneg ( val) , layout) ,
@@ -534,11 +534,11 @@ fn trans_stmt<'tcx>(
534
534
| Rvalue :: Cast ( CastKind :: Pointer ( PointerCast :: MutToConstPointer ) , operand, to_ty)
535
535
| Rvalue :: Cast ( CastKind :: Pointer ( PointerCast :: ArrayToPointer ) , operand, to_ty) => {
536
536
let to_layout = fx. layout_of ( fx. monomorphize ( to_ty) ) ;
537
- let operand = trans_operand ( fx, operand) ;
537
+ let operand = codegen_operand ( fx, operand) ;
538
538
lval. write_cvalue ( fx, operand. cast_pointer_to ( to_layout) ) ;
539
539
}
540
540
Rvalue :: Cast ( CastKind :: Misc , operand, to_ty) => {
541
- let operand = trans_operand ( fx, operand) ;
541
+ let operand = codegen_operand ( fx, operand) ;
542
542
let from_ty = operand. layout ( ) . ty ;
543
543
let to_ty = fx. monomorphize ( to_ty) ;
544
544
@@ -639,7 +639,7 @@ fn trans_stmt<'tcx>(
639
639
operand,
640
640
_to_ty,
641
641
) => {
642
- let operand = trans_operand ( fx, operand) ;
642
+ let operand = codegen_operand ( fx, operand) ;
643
643
match * operand. layout ( ) . ty . kind ( ) {
644
644
ty:: Closure ( def_id, substs) => {
645
645
let instance = Instance :: resolve_closure (
@@ -657,18 +657,18 @@ fn trans_stmt<'tcx>(
657
657
}
658
658
}
659
659
Rvalue :: Cast ( CastKind :: Pointer ( PointerCast :: Unsize ) , operand, _to_ty) => {
660
- let operand = trans_operand ( fx, operand) ;
660
+ let operand = codegen_operand ( fx, operand) ;
661
661
operand. unsize_value ( fx, lval) ;
662
662
}
663
663
Rvalue :: Discriminant ( place) => {
664
- let place = trans_place ( fx, * place) ;
664
+ let place = codegen_place ( fx, * place) ;
665
665
let value = place. to_cvalue ( fx) ;
666
666
let discr =
667
667
crate :: discriminant:: codegen_get_discriminant ( fx, value, dest_layout) ;
668
668
lval. write_cvalue ( fx, discr) ;
669
669
}
670
670
Rvalue :: Repeat ( operand, times) => {
671
- let operand = trans_operand ( fx, operand) ;
671
+ let operand = codegen_operand ( fx, operand) ;
672
672
let times = fx
673
673
. monomorphize ( times)
674
674
. eval ( fx. tcx , ParamEnv :: reveal_all ( ) )
@@ -706,7 +706,7 @@ fn trans_stmt<'tcx>(
706
706
}
707
707
}
708
708
Rvalue :: Len ( place) => {
709
- let place = trans_place ( fx, * place) ;
709
+ let place = codegen_place ( fx, * place) ;
710
710
let usize_layout = fx. layout_of ( fx. tcx . types . usize ) ;
711
711
let len = codegen_array_len ( fx, place) ;
712
712
lval. write_cvalue ( fx, CValue :: by_val ( len, usize_layout) ) ;
@@ -754,13 +754,13 @@ fn trans_stmt<'tcx>(
754
754
Rvalue :: Aggregate ( kind, operands) => match * * kind {
755
755
AggregateKind :: Array ( _ty) => {
756
756
for ( i, operand) in operands. iter ( ) . enumerate ( ) {
757
- let operand = trans_operand ( fx, operand) ;
757
+ let operand = codegen_operand ( fx, operand) ;
758
758
let index = fx. bcx . ins ( ) . iconst ( fx. pointer_type , i as i64 ) ;
759
759
let to = lval. place_index ( fx, index) ;
760
760
to. write_cvalue ( fx, operand) ;
761
761
}
762
762
}
763
- _ => unreachable ! ( "shouldn't exist at trans {:?}" , to_place_and_rval. 1 ) ,
763
+ _ => unreachable ! ( "shouldn't exist at codegen {:?}" , to_place_and_rval. 1 ) ,
764
764
} ,
765
765
}
766
766
}
@@ -813,20 +813,20 @@ fn trans_stmt<'tcx>(
813
813
assert ! ( !alignstack) ;
814
814
815
815
assert_eq ! ( inputs. len( ) , 2 ) ;
816
- let leaf = trans_operand ( fx, & inputs[ 0 ] . 1 ) . load_scalar ( fx) ; // %eax
817
- let subleaf = trans_operand ( fx, & inputs[ 1 ] . 1 ) . load_scalar ( fx) ; // %ecx
816
+ let leaf = codegen_operand ( fx, & inputs[ 0 ] . 1 ) . load_scalar ( fx) ; // %eax
817
+ let subleaf = codegen_operand ( fx, & inputs[ 1 ] . 1 ) . load_scalar ( fx) ; // %ecx
818
818
819
819
let ( eax, ebx, ecx, edx) =
820
820
crate :: intrinsics:: codegen_cpuid_call ( fx, leaf, subleaf) ;
821
821
822
822
assert_eq ! ( outputs. len( ) , 4 ) ;
823
- trans_place ( fx, outputs[ 0 ] )
823
+ codegen_place ( fx, outputs[ 0 ] )
824
824
. write_cvalue ( fx, CValue :: by_val ( eax, fx. layout_of ( fx. tcx . types . u32 ) ) ) ;
825
- trans_place ( fx, outputs[ 1 ] )
825
+ codegen_place ( fx, outputs[ 1 ] )
826
826
. write_cvalue ( fx, CValue :: by_val ( ebx, fx. layout_of ( fx. tcx . types . u32 ) ) ) ;
827
- trans_place ( fx, outputs[ 2 ] )
827
+ codegen_place ( fx, outputs[ 2 ] )
828
828
. write_cvalue ( fx, CValue :: by_val ( ecx, fx. layout_of ( fx. tcx . types . u32 ) ) ) ;
829
- trans_place ( fx, outputs[ 3 ] )
829
+ codegen_place ( fx, outputs[ 3 ] )
830
830
. write_cvalue ( fx, CValue :: by_val ( edx, fx. layout_of ( fx. tcx . types . u32 ) ) ) ;
831
831
}
832
832
"xgetbv" => {
@@ -892,7 +892,7 @@ fn codegen_array_len<'tcx>(
892
892
}
893
893
}
894
894
895
- pub ( crate ) fn trans_place < ' tcx > (
895
+ pub ( crate ) fn codegen_place < ' tcx > (
896
896
fx : & mut FunctionCx < ' _ , ' tcx , impl Module > ,
897
897
place : Place < ' tcx > ,
898
898
) -> CPlace < ' tcx > {
@@ -964,16 +964,16 @@ pub(crate) fn trans_place<'tcx>(
964
964
cplace
965
965
}
966
966
967
- pub ( crate ) fn trans_operand < ' tcx > (
967
+ pub ( crate ) fn codegen_operand < ' tcx > (
968
968
fx : & mut FunctionCx < ' _ , ' tcx , impl Module > ,
969
969
operand : & Operand < ' tcx > ,
970
970
) -> CValue < ' tcx > {
971
971
match operand {
972
972
Operand :: Move ( place) | Operand :: Copy ( place) => {
973
- let cplace = trans_place ( fx, * place) ;
973
+ let cplace = codegen_place ( fx, * place) ;
974
974
cplace. to_cvalue ( fx)
975
975
}
976
- Operand :: Constant ( const_) => crate :: constant:: trans_constant ( fx, const_) ,
976
+ Operand :: Constant ( const_) => crate :: constant:: codegen_constant ( fx, const_) ,
977
977
}
978
978
}
979
979
0 commit comments