@@ -5,7 +5,7 @@ use rustc_middle::ty::adjustment::PointerCast;
55
66use crate :: prelude:: * ;
77
8- pub ( crate ) fn trans_fn < ' tcx > (
8+ pub ( crate ) fn codegen_fn < ' tcx > (
99 cx : & mut crate :: CodegenCx < ' tcx , impl Module > ,
1010 instance : Instance < ' tcx > ,
1111 linkage : Linkage ,
@@ -202,7 +202,7 @@ fn codegen_fn_content(fx: &mut FunctionCx<'_, '_, impl Module>) {
202202 fx. bcx . ins ( ) . nop ( ) ;
203203 for stmt in & bb_data. statements {
204204 fx. set_debug_loc ( stmt. source_info ) ;
205- trans_stmt ( fx, block, stmt) ;
205+ codegen_stmt ( fx, block, stmt) ;
206206 }
207207
208208 #[ cfg( debug_assertions) ]
@@ -258,7 +258,7 @@ fn codegen_fn_content(fx: &mut FunctionCx<'_, '_, impl Module>) {
258258 continue ;
259259 }
260260 }
261- let cond = trans_operand ( fx, cond) . load_scalar ( fx) ;
261+ let cond = codegen_operand ( fx, cond) . load_scalar ( fx) ;
262262
263263 let target = fx. get_block ( * target) ;
264264 let failure = fx. bcx . create_block ( ) ;
@@ -276,8 +276,8 @@ fn codegen_fn_content(fx: &mut FunctionCx<'_, '_, impl Module>) {
276276
277277 match msg {
278278 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) ;
281281 let location = fx
282282 . get_caller_location ( bb_data. terminator ( ) . source_info . span )
283283 . load_scalar ( fx) ;
@@ -301,7 +301,7 @@ fn codegen_fn_content(fx: &mut FunctionCx<'_, '_, impl Module>) {
301301 switch_ty,
302302 targets,
303303 } => {
304- let discr = trans_operand ( fx, discr) . load_scalar ( fx) ;
304+ let discr = codegen_operand ( fx, discr) . load_scalar ( fx) ;
305305
306306 if switch_ty. kind ( ) == fx. tcx . types . bool . kind ( ) {
307307 assert_eq ! ( targets. iter( ) . count( ) , 1 ) ;
@@ -396,14 +396,14 @@ fn codegen_fn_content(fx: &mut FunctionCx<'_, '_, impl Module>) {
396396 | TerminatorKind :: FalseUnwind { .. }
397397 | TerminatorKind :: DropAndReplace { .. }
398398 | TerminatorKind :: GeneratorDrop => {
399- bug ! ( "shouldn't exist at trans {:?}" , bb_data. terminator( ) ) ;
399+ bug ! ( "shouldn't exist at codegen {:?}" , bb_data. terminator( ) ) ;
400400 }
401401 TerminatorKind :: Drop {
402402 place,
403403 target,
404404 unwind : _,
405405 } => {
406- let drop_place = trans_place ( fx, * place) ;
406+ let drop_place = codegen_place ( fx, * place) ;
407407 crate :: abi:: codegen_drop ( fx, bb_data. terminator ( ) . source_info . span , drop_place) ;
408408
409409 let target_block = fx. get_block ( * target) ;
@@ -416,7 +416,7 @@ fn codegen_fn_content(fx: &mut FunctionCx<'_, '_, impl Module>) {
416416 fx. bcx . finalize ( ) ;
417417}
418418
419- fn trans_stmt < ' tcx > (
419+ fn codegen_stmt < ' tcx > (
420420 fx : & mut FunctionCx < ' _ , ' tcx , impl Module > ,
421421 #[ allow( unused_variables) ] cur_block : Block ,
422422 stmt : & Statement < ' tcx > ,
@@ -439,19 +439,19 @@ fn trans_stmt<'tcx>(
439439 place,
440440 variant_index,
441441 } => {
442- let place = trans_place ( fx, * * place) ;
442+ let place = codegen_place ( fx, * * place) ;
443443 crate :: discriminant:: codegen_set_discriminant ( fx, place, * variant_index) ;
444444 }
445445 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 ) ;
447447 let dest_layout = lval. layout ( ) ;
448448 match & to_place_and_rval. 1 {
449449 Rvalue :: Use ( operand) => {
450- let val = trans_operand ( fx, operand) ;
450+ let val = codegen_operand ( fx, operand) ;
451451 lval. write_cvalue ( fx, val) ;
452452 }
453453 Rvalue :: Ref ( _, _, place) | Rvalue :: AddressOf ( _, place) => {
454- let place = trans_place ( fx, * place) ;
454+ let place = codegen_place ( fx, * place) ;
455455 let ref_ = place. place_ref ( fx, lval. layout ( ) ) ;
456456 lval. write_cvalue ( fx, ref_) ;
457457 }
@@ -460,29 +460,29 @@ fn trans_stmt<'tcx>(
460460 lval. write_cvalue ( fx, val) ;
461461 }
462462 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) ;
465465
466466 let res = crate :: num:: codegen_binop ( fx, * bin_op, lhs, rhs) ;
467467 lval. write_cvalue ( fx, res) ;
468468 }
469469 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) ;
472472
473473 let res = if !fx. tcx . sess . overflow_checks ( ) {
474474 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) ;
476476 let is_overflow = fx. bcx . ins ( ) . iconst ( types:: I8 , 0 ) ;
477477 CValue :: by_val_pair ( val, is_overflow, lval. layout ( ) )
478478 } 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)
480480 } ;
481481
482482 lval. write_cvalue ( fx, res) ;
483483 }
484484 Rvalue :: UnaryOp ( un_op, operand) => {
485- let operand = trans_operand ( fx, operand) ;
485+ let operand = codegen_operand ( fx, operand) ;
486486 let layout = operand. layout ( ) ;
487487 let val = operand. load_scalar ( fx) ;
488488 let res = match un_op {
@@ -500,7 +500,7 @@ fn trans_stmt<'tcx>(
500500 ty:: Int ( IntTy :: I128 ) => {
501501 // FIXME remove this case once ineg.i128 works
502502 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)
504504 }
505505 ty:: Int ( _) => CValue :: by_val ( fx. bcx . ins ( ) . ineg ( val) , layout) ,
506506 ty:: Float ( _) => CValue :: by_val ( fx. bcx . ins ( ) . fneg ( val) , layout) ,
@@ -534,11 +534,11 @@ fn trans_stmt<'tcx>(
534534 | Rvalue :: Cast ( CastKind :: Pointer ( PointerCast :: MutToConstPointer ) , operand, to_ty)
535535 | Rvalue :: Cast ( CastKind :: Pointer ( PointerCast :: ArrayToPointer ) , operand, to_ty) => {
536536 let to_layout = fx. layout_of ( fx. monomorphize ( to_ty) ) ;
537- let operand = trans_operand ( fx, operand) ;
537+ let operand = codegen_operand ( fx, operand) ;
538538 lval. write_cvalue ( fx, operand. cast_pointer_to ( to_layout) ) ;
539539 }
540540 Rvalue :: Cast ( CastKind :: Misc , operand, to_ty) => {
541- let operand = trans_operand ( fx, operand) ;
541+ let operand = codegen_operand ( fx, operand) ;
542542 let from_ty = operand. layout ( ) . ty ;
543543 let to_ty = fx. monomorphize ( to_ty) ;
544544
@@ -639,7 +639,7 @@ fn trans_stmt<'tcx>(
639639 operand,
640640 _to_ty,
641641 ) => {
642- let operand = trans_operand ( fx, operand) ;
642+ let operand = codegen_operand ( fx, operand) ;
643643 match * operand. layout ( ) . ty . kind ( ) {
644644 ty:: Closure ( def_id, substs) => {
645645 let instance = Instance :: resolve_closure (
@@ -657,18 +657,18 @@ fn trans_stmt<'tcx>(
657657 }
658658 }
659659 Rvalue :: Cast ( CastKind :: Pointer ( PointerCast :: Unsize ) , operand, _to_ty) => {
660- let operand = trans_operand ( fx, operand) ;
660+ let operand = codegen_operand ( fx, operand) ;
661661 operand. unsize_value ( fx, lval) ;
662662 }
663663 Rvalue :: Discriminant ( place) => {
664- let place = trans_place ( fx, * place) ;
664+ let place = codegen_place ( fx, * place) ;
665665 let value = place. to_cvalue ( fx) ;
666666 let discr =
667667 crate :: discriminant:: codegen_get_discriminant ( fx, value, dest_layout) ;
668668 lval. write_cvalue ( fx, discr) ;
669669 }
670670 Rvalue :: Repeat ( operand, times) => {
671- let operand = trans_operand ( fx, operand) ;
671+ let operand = codegen_operand ( fx, operand) ;
672672 let times = fx
673673 . monomorphize ( times)
674674 . eval ( fx. tcx , ParamEnv :: reveal_all ( ) )
@@ -706,7 +706,7 @@ fn trans_stmt<'tcx>(
706706 }
707707 }
708708 Rvalue :: Len ( place) => {
709- let place = trans_place ( fx, * place) ;
709+ let place = codegen_place ( fx, * place) ;
710710 let usize_layout = fx. layout_of ( fx. tcx . types . usize ) ;
711711 let len = codegen_array_len ( fx, place) ;
712712 lval. write_cvalue ( fx, CValue :: by_val ( len, usize_layout) ) ;
@@ -754,13 +754,13 @@ fn trans_stmt<'tcx>(
754754 Rvalue :: Aggregate ( kind, operands) => match * * kind {
755755 AggregateKind :: Array ( _ty) => {
756756 for ( i, operand) in operands. iter ( ) . enumerate ( ) {
757- let operand = trans_operand ( fx, operand) ;
757+ let operand = codegen_operand ( fx, operand) ;
758758 let index = fx. bcx . ins ( ) . iconst ( fx. pointer_type , i as i64 ) ;
759759 let to = lval. place_index ( fx, index) ;
760760 to. write_cvalue ( fx, operand) ;
761761 }
762762 }
763- _ => unreachable ! ( "shouldn't exist at trans {:?}" , to_place_and_rval. 1 ) ,
763+ _ => unreachable ! ( "shouldn't exist at codegen {:?}" , to_place_and_rval. 1 ) ,
764764 } ,
765765 }
766766 }
@@ -813,20 +813,20 @@ fn trans_stmt<'tcx>(
813813 assert ! ( !alignstack) ;
814814
815815 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
818818
819819 let ( eax, ebx, ecx, edx) =
820820 crate :: intrinsics:: codegen_cpuid_call ( fx, leaf, subleaf) ;
821821
822822 assert_eq ! ( outputs. len( ) , 4 ) ;
823- trans_place ( fx, outputs[ 0 ] )
823+ codegen_place ( fx, outputs[ 0 ] )
824824 . 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 ] )
826826 . 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 ] )
828828 . 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 ] )
830830 . write_cvalue ( fx, CValue :: by_val ( edx, fx. layout_of ( fx. tcx . types . u32 ) ) ) ;
831831 }
832832 "xgetbv" => {
@@ -892,7 +892,7 @@ fn codegen_array_len<'tcx>(
892892 }
893893}
894894
895- pub ( crate ) fn trans_place < ' tcx > (
895+ pub ( crate ) fn codegen_place < ' tcx > (
896896 fx : & mut FunctionCx < ' _ , ' tcx , impl Module > ,
897897 place : Place < ' tcx > ,
898898) -> CPlace < ' tcx > {
@@ -964,16 +964,16 @@ pub(crate) fn trans_place<'tcx>(
964964 cplace
965965}
966966
967- pub ( crate ) fn trans_operand < ' tcx > (
967+ pub ( crate ) fn codegen_operand < ' tcx > (
968968 fx : & mut FunctionCx < ' _ , ' tcx , impl Module > ,
969969 operand : & Operand < ' tcx > ,
970970) -> CValue < ' tcx > {
971971 match operand {
972972 Operand :: Move ( place) | Operand :: Copy ( place) => {
973- let cplace = trans_place ( fx, * place) ;
973+ let cplace = codegen_place ( fx, * place) ;
974974 cplace. to_cvalue ( fx)
975975 }
976- Operand :: Constant ( const_) => crate :: constant:: trans_constant ( fx, const_) ,
976+ Operand :: Constant ( const_) => crate :: constant:: codegen_constant ( fx, const_) ,
977977 }
978978}
979979
0 commit comments