@@ -101,7 +101,7 @@ pub struct StatRecorder<'a, 'tcx: 'a> {
101
101
102
102
impl < ' a , ' tcx > StatRecorder < ' a , ' tcx > {
103
103
pub fn new ( ccx : & ' a CrateContext < ' a , ' tcx > , name : String ) -> StatRecorder < ' a , ' tcx > {
104
- let istart = ccx. stats ( ) . borrow ( ) . n_llvm_insns ;
104
+ let istart = ccx. stats . borrow ( ) . n_llvm_insns ;
105
105
StatRecorder {
106
106
ccx,
107
107
name : Some ( name) ,
@@ -113,7 +113,7 @@ impl<'a, 'tcx> StatRecorder<'a, 'tcx> {
113
113
impl < ' a , ' tcx > Drop for StatRecorder < ' a , ' tcx > {
114
114
fn drop ( & mut self ) {
115
115
if self . ccx . sess ( ) . trans_stats ( ) {
116
- let mut stats = self . ccx . stats ( ) . borrow_mut ( ) ;
116
+ let mut stats = self . ccx . stats . borrow_mut ( ) ;
117
117
let iend = stats. n_llvm_insns ;
118
118
stats. fn_stats . push ( ( self . name . take ( ) . unwrap ( ) , iend - self . istart ) ) ;
119
119
stats. n_fns += 1 ;
@@ -194,7 +194,7 @@ pub fn unsized_info<'ccx, 'tcx>(ccx: &CrateContext<'ccx, 'tcx>,
194
194
target : Ty < ' tcx > ,
195
195
old_info : Option < ValueRef > )
196
196
-> ValueRef {
197
- let ( source, target) = ccx. tcx ( ) . struct_lockstep_tails ( source, target) ;
197
+ let ( source, target) = ccx. tcx . struct_lockstep_tails ( source, target) ;
198
198
match ( & source. sty , & target. sty ) {
199
199
( & ty:: TyArray ( _, len) , & ty:: TySlice ( _) ) => {
200
200
C_usize ( ccx, len. val . to_const_int ( ) . unwrap ( ) . to_u64 ( ) . unwrap ( ) )
@@ -206,7 +206,7 @@ pub fn unsized_info<'ccx, 'tcx>(ccx: &CrateContext<'ccx, 'tcx>,
206
206
old_info. expect ( "unsized_info: missing old info for trait upcast" )
207
207
}
208
208
( _, & ty:: TyDynamic ( ref data, ..) ) => {
209
- let vtable_ptr = ccx. layout_of ( ccx. tcx ( ) . mk_mut_ptr ( target) )
209
+ let vtable_ptr = ccx. layout_of ( ccx. tcx . mk_mut_ptr ( target) )
210
210
. field ( ccx, abi:: FAT_PTR_EXTRA ) ;
211
211
consts:: ptrcast ( meth:: get_vtable ( ccx, source, data. principal ( ) ) ,
212
212
vtable_ptr. llvm_type ( ccx) )
@@ -421,7 +421,7 @@ pub fn call_memcpy(b: &Builder,
421
421
let memcpy = ccx. get_intrinsic ( & key) ;
422
422
let src_ptr = b. pointercast ( src, Type :: i8p ( ccx) ) ;
423
423
let dst_ptr = b. pointercast ( dst, Type :: i8p ( ccx) ) ;
424
- let size = b. intcast ( n_bytes, ccx. isize_ty ( ) , false ) ;
424
+ let size = b. intcast ( n_bytes, ccx. isize_ty , false ) ;
425
425
let align = C_i32 ( ccx, align. abi ( ) as i32 ) ;
426
426
let volatile = C_bool ( ccx, false ) ;
427
427
b. call ( memcpy, & [ dst_ptr, src_ptr, size, align, volatile] , None ) ;
@@ -458,7 +458,7 @@ pub fn call_memset<'a, 'tcx>(b: &Builder<'a, 'tcx>,
458
458
pub fn trans_instance < ' a , ' tcx > ( ccx : & CrateContext < ' a , ' tcx > , instance : Instance < ' tcx > ) {
459
459
let _s = if ccx. sess ( ) . trans_stats ( ) {
460
460
let mut instance_name = String :: new ( ) ;
461
- DefPathBasedNames :: new ( ccx. tcx ( ) , true , true )
461
+ DefPathBasedNames :: new ( ccx. tcx , true , true )
462
462
. push_def_path ( instance. def_id ( ) , & mut instance_name) ;
463
463
Some ( StatRecorder :: new ( ccx, instance_name) )
464
464
} else {
@@ -470,16 +470,16 @@ pub fn trans_instance<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, instance: Instance
470
470
// release builds.
471
471
info ! ( "trans_instance({})" , instance) ;
472
472
473
- let fn_ty = instance. ty ( ccx. tcx ( ) ) ;
473
+ let fn_ty = instance. ty ( ccx. tcx ) ;
474
474
let sig = common:: ty_fn_sig ( ccx, fn_ty) ;
475
- let sig = ccx. tcx ( ) . erase_late_bound_regions_and_normalize ( & sig) ;
475
+ let sig = ccx. tcx . erase_late_bound_regions_and_normalize ( & sig) ;
476
476
477
- let lldecl = match ccx. instances ( ) . borrow ( ) . get ( & instance) {
477
+ let lldecl = match ccx. instances . borrow ( ) . get ( & instance) {
478
478
Some ( & val) => val,
479
479
None => bug ! ( "Instance `{:?}` not already declared" , instance)
480
480
} ;
481
481
482
- ccx. stats ( ) . borrow_mut ( ) . n_closures += 1 ;
482
+ ccx. stats . borrow_mut ( ) . n_closures += 1 ;
483
483
484
484
// The `uwtable` attribute according to LLVM is:
485
485
//
@@ -502,7 +502,7 @@ pub fn trans_instance<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, instance: Instance
502
502
attributes:: emit_uwtable ( lldecl, true ) ;
503
503
}
504
504
505
- let mir = ccx. tcx ( ) . instance_mir ( instance. def ) ;
505
+ let mir = ccx. tcx . instance_mir ( instance. def ) ;
506
506
mir:: trans_mir ( ccx, lldecl, & mir, instance, sig) ;
507
507
}
508
508
@@ -525,14 +525,14 @@ pub fn set_link_section(ccx: &CrateContext,
525
525
fn maybe_create_entry_wrapper ( ccx : & CrateContext ) {
526
526
let ( main_def_id, span) = match * ccx. sess ( ) . entry_fn . borrow ( ) {
527
527
Some ( ( id, span) ) => {
528
- ( ccx. tcx ( ) . hir . local_def_id ( id) , span)
528
+ ( ccx. tcx . hir . local_def_id ( id) , span)
529
529
}
530
530
None => return ,
531
531
} ;
532
532
533
- let instance = Instance :: mono ( ccx. tcx ( ) , main_def_id) ;
533
+ let instance = Instance :: mono ( ccx. tcx , main_def_id) ;
534
534
535
- if !ccx. codegen_unit ( ) . contains_item ( & MonoItem :: Fn ( instance) ) {
535
+ if !ccx. codegen_unit . contains_item ( & MonoItem :: Fn ( instance) ) {
536
536
// We want to create the wrapper in the same codegen unit as Rust's main
537
537
// function.
538
538
return ;
@@ -554,7 +554,7 @@ fn maybe_create_entry_wrapper(ccx: &CrateContext) {
554
554
use_start_lang_item : bool ) {
555
555
let llfty = Type :: func ( & [ Type :: c_int ( ccx) , Type :: i8p ( ccx) . ptr_to ( ) ] , & Type :: c_int ( ccx) ) ;
556
556
557
- let main_ret_ty = ccx. tcx ( ) . fn_sig ( rust_main_def_id) . output ( ) ;
557
+ let main_ret_ty = ccx. tcx . fn_sig ( rust_main_def_id) . output ( ) ;
558
558
// Given that `main()` has no arguments,
559
559
// then its return type cannot have
560
560
// late-bound regions, since late-bound
@@ -582,12 +582,12 @@ fn maybe_create_entry_wrapper(ccx: &CrateContext) {
582
582
// Params from native main() used as args for rust start function
583
583
let param_argc = get_param ( llfn, 0 ) ;
584
584
let param_argv = get_param ( llfn, 1 ) ;
585
- let arg_argc = bld. intcast ( param_argc, ccx. isize_ty ( ) , true ) ;
585
+ let arg_argc = bld. intcast ( param_argc, ccx. isize_ty , true ) ;
586
586
let arg_argv = param_argv;
587
587
588
588
let ( start_fn, args) = if use_start_lang_item {
589
- let start_def_id = ccx. tcx ( ) . require_lang_item ( StartFnLangItem ) ;
590
- let start_fn = callee:: resolve_and_get_fn ( ccx, start_def_id, ccx. tcx ( ) . mk_substs (
589
+ let start_def_id = ccx. tcx . require_lang_item ( StartFnLangItem ) ;
590
+ let start_fn = callee:: resolve_and_get_fn ( ccx, start_def_id, ccx. tcx . mk_substs (
591
591
iter:: once ( Kind :: from ( main_ret_ty) ) ) ) ;
592
592
( start_fn, vec ! [ bld. pointercast( rust_main, Type :: i8p( ccx) . ptr_to( ) ) ,
593
593
arg_argc, arg_argv] )
@@ -1205,8 +1205,8 @@ fn compile_codegen_unit<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
1205
1205
// Instantiate translation items without filling out definitions yet...
1206
1206
let ccx = CrateContext :: new ( tcx, cgu, & llmod_id) ;
1207
1207
let module = {
1208
- let trans_items = ccx. codegen_unit ( )
1209
- . items_in_deterministic_order ( ccx. tcx ( ) ) ;
1208
+ let trans_items = ccx. codegen_unit
1209
+ . items_in_deterministic_order ( ccx. tcx ) ;
1210
1210
for & ( trans_item, ( linkage, visibility) ) in & trans_items {
1211
1211
trans_item. predefine ( & ccx, linkage, visibility) ;
1212
1212
}
@@ -1221,7 +1221,7 @@ fn compile_codegen_unit<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
1221
1221
maybe_create_entry_wrapper ( & ccx) ;
1222
1222
1223
1223
// Run replace-all-uses-with for statics that need it
1224
- for & ( old_g, new_g) in ccx. statics_to_rauw ( ) . borrow ( ) . iter ( ) {
1224
+ for & ( old_g, new_g) in ccx. statics_to_rauw . borrow ( ) . iter ( ) {
1225
1225
unsafe {
1226
1226
let bitcast = llvm:: LLVMConstPointerCast ( new_g, llvm:: LLVMTypeOf ( old_g) ) ;
1227
1227
llvm:: LLVMReplaceAllUsesWith ( old_g, bitcast) ;
@@ -1231,13 +1231,13 @@ fn compile_codegen_unit<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
1231
1231
1232
1232
// Create the llvm.used variable
1233
1233
// This variable has type [N x i8*] and is stored in the llvm.metadata section
1234
- if !ccx. used_statics ( ) . borrow ( ) . is_empty ( ) {
1234
+ if !ccx. used_statics . borrow ( ) . is_empty ( ) {
1235
1235
let name = CString :: new ( "llvm.used" ) . unwrap ( ) ;
1236
1236
let section = CString :: new ( "llvm.metadata" ) . unwrap ( ) ;
1237
- let array = C_array ( Type :: i8 ( & ccx) . ptr_to ( ) , & * ccx. used_statics ( ) . borrow ( ) ) ;
1237
+ let array = C_array ( Type :: i8 ( & ccx) . ptr_to ( ) , & * ccx. used_statics . borrow ( ) ) ;
1238
1238
1239
1239
unsafe {
1240
- let g = llvm:: LLVMAddGlobal ( ccx. llmod ( ) ,
1240
+ let g = llvm:: LLVMAddGlobal ( ccx. llmod ,
1241
1241
val_ty ( array) . to_ref ( ) ,
1242
1242
name. as_ptr ( ) ) ;
1243
1243
llvm:: LLVMSetInitializer ( g, array) ;
@@ -1252,8 +1252,8 @@ fn compile_codegen_unit<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
1252
1252
}
1253
1253
1254
1254
let llvm_module = ModuleLlvm {
1255
- llcx : ccx. llcx ( ) ,
1256
- llmod : ccx. llmod ( ) ,
1255
+ llcx : ccx. llcx ,
1256
+ llmod : ccx. llmod ,
1257
1257
tm : create_target_machine ( ccx. sess ( ) ) ,
1258
1258
} ;
1259
1259
0 commit comments