@@ -528,12 +528,20 @@ fn copy_all_cgu_workproducts_to_incr_comp_cache_dir(
528
528
for module in compiled_modules. modules . iter ( ) . filter ( |m| m. kind == ModuleKind :: Regular ) {
529
529
let mut files = Vec :: new ( ) ;
530
530
if let Some ( object_file_path) = & module. object {
531
- files. push ( ( "o" , object_file_path. as_path ( ) ) ) ;
531
+ files. push ( ( OutputType :: Object . extension ( ) , object_file_path. as_path ( ) ) ) ;
532
532
}
533
533
if let Some ( dwarf_object_file_path) = & module. dwarf_object {
534
534
files. push ( ( "dwo" , dwarf_object_file_path. as_path ( ) ) ) ;
535
535
}
536
-
536
+ if let Some ( path) = & module. assembly {
537
+ files. push ( ( OutputType :: Assembly . extension ( ) , path. as_path ( ) ) ) ;
538
+ }
539
+ if let Some ( path) = & module. llvm_ir {
540
+ files. push ( ( OutputType :: LlvmAssembly . extension ( ) , path. as_path ( ) ) ) ;
541
+ }
542
+ if let Some ( path) = & module. bytecode {
543
+ files. push ( ( OutputType :: Bitcode . extension ( ) , path. as_path ( ) ) ) ;
544
+ }
537
545
if let Some ( ( id, product) ) =
538
546
copy_cgu_workproduct_to_incr_comp_cache_dir ( sess, & module. name , files. as_slice ( ) )
539
547
{
@@ -937,12 +945,28 @@ fn execute_copy_from_cache_work_item<B: ExtraBackendMethods>(
937
945
load_from_incr_comp_dir ( dwarf_obj_out, saved_dwarf_object_file)
938
946
} ) ;
939
947
948
+ let load_from_incr_cache = |perform, output_type : OutputType | {
949
+ if perform {
950
+ let saved_file = module. source . saved_files . get ( output_type. extension ( ) ) ?;
951
+ let output_path = cgcx. output_filenames . temp_path ( output_type, Some ( & module. name ) ) ;
952
+ load_from_incr_comp_dir ( output_path, & saved_file)
953
+ } else {
954
+ None
955
+ }
956
+ } ;
957
+
958
+ let assembly = load_from_incr_cache ( module_config. emit_asm , OutputType :: Assembly ) ;
959
+ let llvm_ir = load_from_incr_cache ( module_config. emit_ir , OutputType :: LlvmAssembly ) ;
960
+ let bytecode = load_from_incr_cache ( module_config. emit_bc , OutputType :: Bitcode ) ;
961
+
940
962
WorkItemResult :: Finished ( CompiledModule {
941
963
name : module. name ,
942
964
kind : ModuleKind :: Regular ,
943
965
object,
944
966
dwarf_object,
945
- bytecode : None ,
967
+ bytecode,
968
+ assembly,
969
+ llvm_ir,
946
970
} )
947
971
}
948
972
0 commit comments