1
- use crate :: abi:: FnAbi ;
2
1
use crate :: attributes;
3
2
use crate :: debuginfo;
4
3
use crate :: llvm;
@@ -15,23 +14,20 @@ use rustc::mir::mono::CodegenUnit;
15
14
use rustc:: session:: config:: { self , CFGuard , DebugInfo } ;
16
15
use rustc:: session:: Session ;
17
16
use rustc:: ty:: layout:: {
18
- FnAbiExt , HasParamEnv , LayoutError , LayoutOf , PointeeInfo , Size , TyLayout , VariantIdx ,
17
+ HasParamEnv , LayoutError , LayoutOf , PointeeInfo , Size , TyLayout , VariantIdx ,
19
18
} ;
20
19
use rustc:: ty:: { self , Instance , Ty , TyCtxt } ;
21
20
use rustc_codegen_ssa:: base:: wants_msvc_seh;
22
21
use rustc_data_structures:: base_n;
23
22
use rustc_data_structures:: const_cstr;
24
23
use rustc_data_structures:: fx:: FxHashMap ;
25
24
use rustc_data_structures:: small_c_str:: SmallCStr ;
26
- use rustc_hir:: Unsafety ;
27
25
use rustc_target:: spec:: { HasTargetSpec , Target } ;
28
26
29
- use crate :: abi:: Abi ;
30
27
use rustc_span:: source_map:: { Span , DUMMY_SP } ;
31
28
use rustc_span:: symbol:: Symbol ;
32
29
use std:: cell:: { Cell , RefCell } ;
33
30
use std:: ffi:: CStr ;
34
- use std:: iter;
35
31
use std:: str;
36
32
use std:: sync:: Arc ;
37
33
@@ -87,7 +83,6 @@ pub struct CodegenCx<'ll, 'tcx> {
87
83
pub dbg_cx : Option < debuginfo:: CrateDebugContext < ' ll , ' tcx > > ,
88
84
89
85
eh_personality : Cell < Option < & ' ll Value > > ,
90
- eh_unwind_resume : Cell < Option < & ' ll Value > > ,
91
86
pub rust_try_fn : Cell < Option < & ' ll Value > > ,
92
87
93
88
intrinsics : RefCell < FxHashMap < & ' static str , & ' ll Value > > ,
@@ -328,7 +323,6 @@ impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> {
328
323
isize_ty,
329
324
dbg_cx,
330
325
eh_personality : Cell :: new ( None ) ,
331
- eh_unwind_resume : Cell :: new ( None ) ,
332
326
rust_try_fn : Cell :: new ( None ) ,
333
327
intrinsics : Default :: default ( ) ,
334
328
local_gen_sym_counter : Cell :: new ( 0 ) ,
@@ -406,45 +400,6 @@ impl MiscMethods<'tcx> for CodegenCx<'ll, 'tcx> {
406
400
llfn
407
401
}
408
402
409
- // Returns a Value of the "eh_unwind_resume" lang item if one is defined,
410
- // otherwise declares it as an external function.
411
- fn eh_unwind_resume ( & self ) -> & ' ll Value {
412
- let unwresume = & self . eh_unwind_resume ;
413
- if let Some ( llfn) = unwresume. get ( ) {
414
- return llfn;
415
- }
416
-
417
- let tcx = self . tcx ;
418
- assert ! ( self . sess( ) . target. target. options. custom_unwind_resume) ;
419
- if let Some ( def_id) = tcx. lang_items ( ) . eh_unwind_resume ( ) {
420
- let llfn = self . get_fn_addr (
421
- ty:: Instance :: resolve (
422
- tcx,
423
- ty:: ParamEnv :: reveal_all ( ) ,
424
- def_id,
425
- tcx. intern_substs ( & [ ] ) ,
426
- )
427
- . unwrap ( ) ,
428
- ) ;
429
- unwresume. set ( Some ( llfn) ) ;
430
- return llfn;
431
- }
432
-
433
- let sig = ty:: Binder :: bind ( tcx. mk_fn_sig (
434
- iter:: once ( tcx. mk_mut_ptr ( tcx. types . u8 ) ) ,
435
- tcx. types . never ,
436
- false ,
437
- Unsafety :: Unsafe ,
438
- Abi :: C ,
439
- ) ) ;
440
-
441
- let fn_abi = FnAbi :: of_fn_ptr ( self , sig, & [ ] ) ;
442
- let llfn = self . declare_fn ( "rust_eh_unwind_resume" , & fn_abi) ;
443
- attributes:: apply_target_cpu_attr ( self , llfn) ;
444
- unwresume. set ( Some ( llfn) ) ;
445
- llfn
446
- }
447
-
448
403
fn sess ( & self ) -> & Session {
449
404
& self . tcx . sess
450
405
}
0 commit comments