@@ -153,10 +153,9 @@ use maybe_pqp_cg_ssa::traits::{
153153} ;
154154use maybe_pqp_cg_ssa:: { CodegenResults , CompiledModule , ModuleCodegen , ModuleKind , TargetConfig } ;
155155use rspirv:: binary:: Assemble ;
156- use rustc_ast:: expand:: allocator:: AllocatorKind ;
157- use rustc_ast:: expand:: autodiff_attrs:: AutoDiffItem ;
156+ use rustc_ast:: expand:: allocator:: AllocatorMethod ;
158157use rustc_data_structures:: fx:: FxIndexMap ;
159- use rustc_errors:: { DiagCtxtHandle , FatalError } ;
158+ use rustc_errors:: DiagCtxtHandle ;
160159use rustc_metadata:: EncodedMetadata ;
161160use rustc_middle:: dep_graph:: { WorkProduct , WorkProductId } ;
162161use rustc_middle:: mir:: mono:: { MonoItem , MonoItemData } ;
@@ -283,6 +282,10 @@ impl CodegenBackend for SpirvCodegenBackend {
283282 ) ;
284283 drop ( timer) ;
285284 }
285+
286+ fn name ( & self ) -> & ' static str {
287+ "SpirvCodegenBackend"
288+ }
286289}
287290
288291struct SpirvModuleBuffer ( Vec < u32 > ) ;
@@ -301,16 +304,16 @@ impl ThinBufferMethods for SpirvModuleBuffer {
301304 fn data ( & self ) -> & [ u8 ] {
302305 self . as_bytes ( )
303306 }
304- fn thin_link_data ( & self ) -> & [ u8 ] {
305- & [ ]
306- }
307+ // fn thin_link_data(&self) -> &[u8] {
308+ // &[]
309+ // }
307310}
308311
309312impl SpirvCodegenBackend {
310313 fn optimize_common (
311314 _cgcx : & CodegenContext < Self > ,
312315 module : & mut ModuleCodegen < <Self as WriteBackendMethods >:: Module > ,
313- ) -> Result < ( ) , FatalError > {
316+ ) -> ( ) {
314317 // Apply DCE ("dead code elimination") to modules before ever serializing
315318 // them as `.spv` files (technically, `.rcgu.o` files inside `.rlib`s),
316319 // that will later get linked (potentially many times, esp. if this is
@@ -320,7 +323,7 @@ impl SpirvCodegenBackend {
320323
321324 // FIXME(eddyb) run as many optimization passes as possible, not just DCE.
322325
323- Ok ( ( ) )
326+ ( )
324327 }
325328}
326329
@@ -341,8 +344,8 @@ impl WriteBackendMethods for SpirvCodegenBackend {
341344 _exported_symbols_for_lto : & [ String ] ,
342345 _each_linked_rlib_for_lto : & [ PathBuf ] ,
343346 _modules : Vec < FatLtoInput < Self > > ,
344- _diff_fncs : Vec < AutoDiffItem > ,
345- ) -> Result < ModuleCodegen < Self :: Module > , FatalError > {
347+ // _diff_fncs: Vec<AutoDiffItem>,
348+ ) -> ModuleCodegen < Self :: Module > {
346349 assert ! (
347350 cgcx. lto == rustc_session:: config:: Lto :: Fat ,
348351 "`run_and_optimize_fat_lto` (for `WorkItemResult::NeedsFatLto`) should \
@@ -358,7 +361,7 @@ impl WriteBackendMethods for SpirvCodegenBackend {
358361 _each_linked_rlib_for_lto : & [ PathBuf ] , // njn: ?
359362 modules : Vec < ( String , Self :: ThinBuffer ) > ,
360363 cached_modules : Vec < ( SerializedModule < Self :: ModuleBuffer > , WorkProduct ) > ,
361- ) -> Result < ( Vec < ThinModule < Self > > , Vec < WorkProduct > ) , FatalError > {
364+ ) -> ( Vec < ThinModule < Self > > , Vec < WorkProduct > ) {
362365 link:: run_thin ( cgcx, modules, cached_modules)
363366 }
364367
@@ -375,14 +378,14 @@ impl WriteBackendMethods for SpirvCodegenBackend {
375378 _dcx : DiagCtxtHandle < ' _ > ,
376379 module : & mut ModuleCodegen < Self :: Module > ,
377380 _config : & ModuleConfig ,
378- ) -> Result < ( ) , FatalError > {
381+ ) -> ( ) {
379382 Self :: optimize_common ( cgcx, module)
380383 }
381384
382385 fn optimize_thin (
383386 cgcx : & CodegenContext < Self > ,
384387 thin_module : ThinModule < Self > ,
385- ) -> Result < ModuleCodegen < Self :: Module > , FatalError > {
388+ ) -> ModuleCodegen < Self :: Module > {
386389 // FIXME(eddyb) the inefficiency of Module -> [u8] -> Module roundtrips
387390 // comes from upstream and it applies to `rustc_codegen_llvm` as well,
388391 // eventually it should be properly addressed (for `ThinLocal` at least).
@@ -395,15 +398,15 @@ impl WriteBackendMethods for SpirvCodegenBackend {
395398 kind : ModuleKind :: Regular ,
396399 thin_lto_buffer : None ,
397400 } ;
398- Self :: optimize_common ( cgcx, & mut module) ? ;
399- Ok ( module)
401+ Self :: optimize_common ( cgcx, & mut module) ;
402+ module
400403 }
401404
402405 fn codegen (
403406 cgcx : & CodegenContext < Self > ,
404407 module : ModuleCodegen < Self :: Module > ,
405408 _config : & ModuleConfig ,
406- ) -> Result < CompiledModule , FatalError > {
409+ ) -> CompiledModule {
407410 let kind = module. kind ;
408411 let ( name, module_buffer) = Self :: serialize_module ( module) ;
409412
@@ -414,7 +417,7 @@ impl WriteBackendMethods for SpirvCodegenBackend {
414417 ) ;
415418 fs:: write ( & path, module_buffer. as_bytes ( ) ) . unwrap ( ) ;
416419
417- Ok ( CompiledModule {
420+ CompiledModule {
418421 name,
419422 kind,
420423 object : Some ( path) ,
@@ -423,13 +426,10 @@ impl WriteBackendMethods for SpirvCodegenBackend {
423426 assembly : None ,
424427 llvm_ir : None ,
425428 links_from_incr_cache : vec ! [ ] ,
426- } )
429+ }
427430 }
428431
429- fn prepare_thin (
430- module : ModuleCodegen < Self :: Module > ,
431- _want_summary : bool ,
432- ) -> ( String , Self :: ThinBuffer ) {
432+ fn prepare_thin ( module : ModuleCodegen < Self :: Module > ) -> ( String , Self :: ThinBuffer ) {
433433 Self :: serialize_module ( module)
434434 }
435435
@@ -442,13 +442,7 @@ impl WriteBackendMethods for SpirvCodegenBackend {
442442}
443443
444444impl ExtraBackendMethods for SpirvCodegenBackend {
445- fn codegen_allocator (
446- & self ,
447- _: TyCtxt < ' _ > ,
448- _: & str ,
449- _: AllocatorKind ,
450- _: AllocatorKind ,
451- ) -> Self :: Module {
445+ fn codegen_allocator ( & self , _: TyCtxt < ' _ > , _: & str , _: & [ AllocatorMethod ] ) -> Self :: Module {
452446 todo ! ( )
453447 }
454448
0 commit comments