@@ -7,13 +7,13 @@ use rustc_codegen_ssa::traits::BaseTypeCodegenMethods as _;
77use rustc_middle:: bug;
88use rustc_middle:: middle:: codegen_fn_attrs:: { CodegenFnAttrFlags , CodegenFnAttrs } ;
99use rustc_middle:: ty:: TyCtxt ;
10- use rustc_session:: config:: { DebugInfo , OomStrategy } ;
10+ use rustc_session:: config:: DebugInfo ;
1111use rustc_symbol_mangling:: mangle_internal_symbol;
1212
1313use crate :: attributes:: llfn_attrs_from_instance;
1414use crate :: builder:: SBuilder ;
1515use crate :: declare:: declare_simple_fn;
16- use crate :: llvm:: { self , FALSE , FromGeneric , TRUE , Type , Value } ;
16+ use crate :: llvm:: { self , FromGeneric , TRUE , Type } ;
1717use crate :: { SimpleCx , attributes, debuginfo} ;
1818
1919pub ( crate ) unsafe fn codegen (
@@ -28,7 +28,6 @@ pub(crate) unsafe fn codegen(
2828 64 => cx. type_i64 ( ) ,
2929 tws => bug ! ( "Unsupported target word size for int: {}" , tws) ,
3030 } ;
31- let i8 = cx. type_i8 ( ) ;
3231 let i8p = cx. type_ptr ( ) ;
3332
3433 for method in methods {
@@ -87,17 +86,6 @@ pub(crate) unsafe fn codegen(
8786 ) ;
8887 }
8988
90- // __rust_alloc_error_handler_should_panic_v2
91- create_const_value_function (
92- tcx,
93- & cx,
94- & mangle_internal_symbol ( tcx, OomStrategy :: SYMBOL ) ,
95- & i8,
96- unsafe {
97- llvm:: LLVMConstInt ( i8, tcx. sess . opts . unstable_opts . oom . should_panic ( ) as u64 , FALSE )
98- } ,
99- ) ;
100-
10189 // __rust_no_alloc_shim_is_unstable_v2
10290 create_wrapper_function (
10391 tcx,
@@ -117,34 +105,6 @@ pub(crate) unsafe fn codegen(
117105 }
118106}
119107
120- fn create_const_value_function (
121- tcx : TyCtxt < ' _ > ,
122- cx : & SimpleCx < ' _ > ,
123- name : & str ,
124- output : & Type ,
125- value : & Value ,
126- ) {
127- let ty = cx. type_func ( & [ ] , output) ;
128- let llfn = declare_simple_fn (
129- & cx,
130- name,
131- llvm:: CallConv :: CCallConv ,
132- llvm:: UnnamedAddr :: Global ,
133- llvm:: Visibility :: from_generic ( tcx. sess . default_visibility ( ) ) ,
134- ty,
135- ) ;
136-
137- attributes:: apply_to_llfn (
138- llfn,
139- llvm:: AttributePlace :: Function ,
140- & [ llvm:: AttributeKind :: AlwaysInline . create_attr ( cx. llcx ) ] ,
141- ) ;
142-
143- let llbb = unsafe { llvm:: LLVMAppendBasicBlockInContext ( cx. llcx , llfn, c"entry" . as_ptr ( ) ) } ;
144- let mut bx = SBuilder :: build ( & cx, llbb) ;
145- bx. ret ( value) ;
146- }
147-
148108fn create_wrapper_function (
149109 tcx : TyCtxt < ' _ > ,
150110 cx : & SimpleCx < ' _ > ,
0 commit comments