@@ -533,7 +533,15 @@ fn copy_all_cgu_workproducts_to_incr_comp_cache_dir(
533533        if  let  Some ( dwarf_object_file_path)  = & module. dwarf_object  { 
534534            files. push ( ( "dwo" ,  dwarf_object_file_path. as_path ( ) ) ) ; 
535535        } 
536- 
536+         if  let  Some ( path)  = & module. assembly  { 
537+             files. push ( ( "s" ,  path. as_path ( ) ) ) ; 
538+         } 
539+         if  let  Some ( path)  = & module. llvm_ir  { 
540+             files. push ( ( "ll" ,  path. as_path ( ) ) ) ; 
541+         } 
542+         if  let  Some ( path)  = & module. bytecode  { 
543+             files. push ( ( "bc" ,  path. as_path ( ) ) ) ; 
544+         } 
537545        if  let  Some ( ( id,  product) )  =
538546            copy_cgu_workproduct_to_incr_comp_cache_dir ( sess,  & module. name ,  files. as_slice ( ) ) 
539547        { 
@@ -937,12 +945,47 @@ fn execute_copy_from_cache_work_item<B: ExtraBackendMethods>(
937945            load_from_incr_comp_dir ( dwarf_obj_out,  saved_dwarf_object_file) 
938946        } ) ; 
939947
948+     let  assembly = module_config
949+         . emit_asm 
950+         . then ( || { 
951+             module. source . saved_files . get ( "s" ) . as_ref ( ) . and_then ( |saved_asm_file| { 
952+                 let  output_path =
953+                     cgcx. output_filenames . temp_path ( OutputType :: Assembly ,  Some ( & module. name ) ) ; 
954+                 load_from_incr_comp_dir ( output_path,  & saved_asm_file) 
955+             } ) 
956+         } ) 
957+         . flatten ( ) ; 
958+ 
959+     let  llvm_ir = module_config
960+         . emit_ir 
961+         . then ( || { 
962+             module. source . saved_files . get ( "ll" ) . as_ref ( ) . and_then ( |saved_ir_file| { 
963+                 let  output_path =
964+                     cgcx. output_filenames . temp_path ( OutputType :: LlvmAssembly ,  Some ( & module. name ) ) ; 
965+                 load_from_incr_comp_dir ( output_path,  & saved_ir_file) 
966+             } ) 
967+         } ) 
968+         . flatten ( ) ; 
969+ 
970+     let  bytecode = module_config
971+         . emit_bc 
972+         . then ( || { 
973+             module. source . saved_files . get ( "bc" ) . as_ref ( ) . and_then ( |saved_bc_file| { 
974+                 let  output_path =
975+                     cgcx. output_filenames . temp_path ( OutputType :: Bitcode ,  Some ( & module. name ) ) ; 
976+                 load_from_incr_comp_dir ( output_path,  & saved_bc_file) 
977+             } ) 
978+         } ) 
979+         . flatten ( ) ; 
980+ 
940981    WorkItemResult :: Finished ( CompiledModule  { 
941982        name :  module. name , 
942983        kind :  ModuleKind :: Regular , 
943984        object, 
944985        dwarf_object, 
945-         bytecode :  None , 
986+         bytecode, 
987+         assembly, 
988+         llvm_ir, 
946989    } ) 
947990} 
948991
0 commit comments