@@ -5,15 +5,14 @@ use rustc_index::vec::IndexVec;
5
5
use rustc_middle:: ty:: adjustment:: PointerCast ;
6
6
use rustc_middle:: ty:: layout:: FnAbiOf ;
7
7
use rustc_middle:: ty:: print:: with_no_trimmed_paths;
8
- use rustc_middle:: ty:: SymbolName ;
9
8
10
9
use crate :: constant:: ConstantCx ;
11
10
use crate :: debuginfo:: FunctionDebugContext ;
12
11
use crate :: prelude:: * ;
13
12
use crate :: pretty_clif:: CommentWriter ;
14
13
15
- struct CodegenedFunction < ' tcx > {
16
- symbol_name : SymbolName < ' tcx > ,
14
+ struct CodegenedFunction {
15
+ symbol_name : String ,
17
16
func_id : FuncId ,
18
17
func : Function ,
19
18
clif_comments : CommentWriter ,
@@ -42,7 +41,7 @@ fn codegen_fn<'tcx>(
42
41
cached_func : Function ,
43
42
module : & mut dyn Module ,
44
43
instance : Instance < ' tcx > ,
45
- ) -> CodegenedFunction < ' tcx > {
44
+ ) -> CodegenedFunction {
46
45
debug_assert ! ( !instance. substs. needs_infer( ) ) ;
47
46
48
47
let mir = tcx. instance_mir ( instance. def ) ;
@@ -56,9 +55,9 @@ fn codegen_fn<'tcx>(
56
55
} ) ;
57
56
58
57
// Declare function
59
- let symbol_name = tcx. symbol_name ( instance) ;
58
+ let symbol_name = tcx. symbol_name ( instance) . name . to_string ( ) ;
60
59
let sig = get_function_sig ( tcx, module. isa ( ) . triple ( ) , instance) ;
61
- let func_id = module. declare_function ( symbol_name. name , Linkage :: Local , & sig) . unwrap ( ) ;
60
+ let func_id = module. declare_function ( & symbol_name, Linkage :: Local , & sig) . unwrap ( ) ;
62
61
63
62
// Make the FunctionBuilder
64
63
let mut func_ctx = FunctionBuilderContext :: new ( ) ;
@@ -81,7 +80,7 @@ fn codegen_fn<'tcx>(
81
80
let clif_comments = crate :: pretty_clif:: CommentWriter :: new ( tcx, instance) ;
82
81
83
82
let func_debug_cx = if let Some ( debug_context) = & mut cx. debug_context {
84
- Some ( debug_context. define_function ( tcx, symbol_name. name , mir. span ) )
83
+ Some ( debug_context. define_function ( tcx, & symbol_name, mir. span ) )
85
84
} else {
86
85
None
87
86
} ;
@@ -113,6 +112,7 @@ fn codegen_fn<'tcx>(
113
112
tcx. sess . time ( "codegen clif ir" , || codegen_fn_body ( & mut fx, start_block) ) ;
114
113
115
114
// Recover all necessary data from fx, before accessing func will prevent future access to it.
115
+ let symbol_name = fx. symbol_name ;
116
116
let clif_comments = fx. clif_comments ;
117
117
let func_debug_cx = fx. func_debug_cx ;
118
118
@@ -121,7 +121,7 @@ fn codegen_fn<'tcx>(
121
121
if cx. should_write_ir {
122
122
crate :: pretty_clif:: write_clif_file (
123
123
tcx. output_filenames ( ( ) ) ,
124
- symbol_name. name ,
124
+ & symbol_name,
125
125
"unopt" ,
126
126
module. isa ( ) ,
127
127
& func,
@@ -135,11 +135,11 @@ fn codegen_fn<'tcx>(
135
135
CodegenedFunction { symbol_name, func_id, func, clif_comments, func_debug_cx }
136
136
}
137
137
138
- fn compile_fn < ' tcx > (
138
+ fn compile_fn (
139
139
cx : & mut crate :: CodegenCx ,
140
140
cached_context : & mut Context ,
141
141
module : & mut dyn Module ,
142
- codegened_func : CodegenedFunction < ' tcx > ,
142
+ codegened_func : CodegenedFunction ,
143
143
) {
144
144
let clif_comments = codegened_func. clif_comments ;
145
145
@@ -195,7 +195,7 @@ fn compile_fn<'tcx>(
195
195
// Write optimized function to file for debugging
196
196
crate :: pretty_clif:: write_clif_file (
197
197
& cx. output_filenames ,
198
- codegened_func. symbol_name . name ,
198
+ & codegened_func. symbol_name ,
199
199
"opt" ,
200
200
module. isa ( ) ,
201
201
& context. func ,
@@ -205,7 +205,7 @@ fn compile_fn<'tcx>(
205
205
if let Some ( disasm) = & context. compiled_code ( ) . unwrap ( ) . disasm {
206
206
crate :: pretty_clif:: write_ir_file (
207
207
& cx. output_filenames ,
208
- & format ! ( "{}.vcode" , codegened_func. symbol_name. name ) ,
208
+ & format ! ( "{}.vcode" , codegened_func. symbol_name) ,
209
209
|file| file. write_all ( disasm. as_bytes ( ) ) ,
210
210
)
211
211
}
0 commit comments