@@ -176,11 +176,11 @@ pub(crate) unsafe fn codegen(
176176
177177 let llmod = unsafe { module. module_llvm . llmod . as_ref ( ) . unwrap ( ) } ;
178178 let mod_name = module. name . clone ( ) ;
179- let module_name = Some ( & mod_name[ ..] ) ;
179+ let module_name = & mod_name[ ..] ;
180180
181181 let out = cgcx
182182 . output_filenames
183- . temp_path ( OutputType :: Object , module_name) ;
183+ . temp_path_for_cgu ( OutputType :: Object , module_name, None ) ;
184184
185185 // nvvm ir *is* llvm ir so emit_ir fits the expectation of llvm ir which is why we
186186 // implement this. this is copy and pasted straight from rustc_codegen_llvm
@@ -189,9 +189,9 @@ pub(crate) unsafe fn codegen(
189189 let _timer = cgcx
190190 . prof
191191 . generic_activity_with_arg ( "NVVM_module_codegen_emit_ir" , & module. name [ ..] ) ;
192- let out = cgcx
193- . output_filenames
194- . temp_path ( OutputType :: LlvmAssembly , module_name) ;
192+ let out =
193+ cgcx . output_filenames
194+ . temp_path_for_cgu ( OutputType :: LlvmAssembly , module_name, None ) ;
195195 let out = out. to_str ( ) . unwrap ( ) ;
196196
197197 let result = unsafe {
@@ -229,6 +229,7 @@ pub(crate) unsafe fn codegen(
229229 bytecode : None ,
230230 assembly : None ,
231231 llvm_ir : None ,
232+ links_from_incr_cache : vec ! [ ] ,
232233 } )
233234}
234235
@@ -254,7 +255,7 @@ pub fn compile_codegen_unit(tcx: TyCtxt<'_>, cgu_name: Symbol) -> (ModuleCodegen
254255 // Instantiate monomorphizations without filling out definitions yet...
255256 let llvm_module = LlvmMod :: new ( cgu_name. as_str ( ) ) ;
256257 {
257- let cx = CodegenCx :: new ( tcx, cgu, & llvm_module) ;
258+ let mut cx = CodegenCx :: new ( tcx, cgu, & llvm_module) ;
258259
259260 let mono_items = cx. codegen_unit . items_in_deterministic_order ( cx. tcx ) ;
260261
@@ -267,22 +268,27 @@ pub fn compile_codegen_unit(tcx: TyCtxt<'_>, cgu_name: Symbol) -> (ModuleCodegen
267268 } ,
268269 ) in & mono_items
269270 {
270- mono_item. predefine :: < Builder < ' _ , ' _ , ' _ > > ( & cx, linkage, visibility) ;
271+ mono_item. predefine :: < Builder < ' _ , ' _ , ' _ > > (
272+ & mut cx,
273+ "mono_item" ,
274+ linkage,
275+ visibility,
276+ ) ;
271277 }
272278
273279 // ... and now that we have everything pre-defined, fill out those definitions.
274- for & ( mono_item, _ ) in & mono_items {
280+ for & ( mono_item, mono_item_data ) in & mono_items {
275281 if let MonoItem :: Fn ( func) = mono_item {
276- define_or_override_fn ( func, & cx) ;
282+ define_or_override_fn ( func, & mut cx) ;
277283 } else {
278- mono_item. define :: < Builder < ' _ , ' _ , ' _ > > ( & cx ) ;
284+ mono_item. define :: < Builder < ' _ , ' _ , ' _ > > ( & mut cx , "mono_item" , mono_item_data ) ;
279285 }
280286 }
281287
282288 // a main function for gpu kernels really makes no sense but
283289 // codegen it anyways.
284290 // sanitize attrs are not allowed in nvvm so do nothing further.
285- maybe_create_entry_wrapper :: < Builder < ' _ , ' _ , ' _ > > ( & cx ) ;
291+ maybe_create_entry_wrapper :: < Builder < ' _ , ' _ , ' _ > > ( & mut cx , cgu ) ;
286292
287293 // Run replace-all-uses-with for statics that need it
288294 for & ( old_g, new_g) in cx. statics_to_rauw . borrow ( ) . iter ( ) {
@@ -333,13 +339,8 @@ pub(crate) unsafe fn optimize(
333339
334340 let llmod = unsafe { & * module. module_llvm . llmod } ;
335341
336- let module_name = module. name . clone ( ) ;
337- let module_name = Some ( & module_name[ ..] ) ;
338-
339342 if config. emit_no_opt_bc {
340- let out = cgcx
341- . output_filenames
342- . temp_path_ext ( "no-opt.bc" , module_name) ;
343+ let out = cgcx. output_filenames . with_extension ( "no-opt.bc" ) ;
343344 let out = path_to_c_string ( & out) ;
344345 unsafe { llvm:: LLVMWriteBitcodeToFile ( llmod, out. as_ptr ( ) ) } ;
345346 }
0 commit comments