@@ -1120,41 +1120,31 @@ pub fn trans_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
1120
1120
codegen_units,
1121
1121
previous_work_products,
1122
1122
symbol_map. clone ( ) ) ;
1123
- let modules: Vec < _ > = crate_context_list. iter_all ( )
1124
- . map ( |ccx| {
1125
- let source = match ccx. previous_work_product ( ) {
1126
- Some ( buf) => ModuleSource :: Preexisting ( buf. clone ( ) ) ,
1127
- None => ModuleSource :: Translated ( ModuleLlvm {
1128
- llcx : ccx. llcx ( ) ,
1129
- llmod : ccx. llmod ( ) ,
1130
- } ) ,
1131
- } ;
1132
1123
1133
- ModuleTranslation {
1134
- name : String :: from ( ccx. codegen_unit ( ) . name ( ) ) ,
1135
- symbol_name_hash : ccx. codegen_unit ( )
1136
- . compute_symbol_name_hash ( & shared_ccx,
1137
- & symbol_map) ,
1138
- source : source,
1139
- }
1124
+ let modules: Vec < ModuleTranslation > = crate_context_list
1125
+ . iter_all ( )
1126
+ . map ( |ccx| {
1127
+ let dep_node = ccx. codegen_unit ( ) . work_product_dep_node ( ) ;
1128
+ tcx. dep_graph . with_task ( dep_node,
1129
+ ccx,
1130
+ AssertDepGraphSafe ( symbol_map. clone ( ) ) ,
1131
+ module_translation)
1140
1132
} )
1141
1133
. collect ( ) ;
1142
1134
1143
- for ccx in crate_context_list. iter_need_trans ( ) {
1144
- let dep_node = ccx. codegen_unit ( ) . work_product_dep_node ( ) ;
1145
- tcx. dep_graph . with_task ( dep_node,
1146
- ccx,
1147
- AssertDepGraphSafe ( symbol_map. clone ( ) ) ,
1148
- trans_decl_task) ;
1149
-
1135
+ fn module_translation < ' a , ' tcx > ( ccx : CrateContext < ' a , ' tcx > ,
1136
+ symbol_map : AssertDepGraphSafe < Rc < SymbolMap < ' tcx > > > )
1137
+ -> ModuleTranslation {
1138
+ // FIXME(#40304): Instead of this, the symbol-map should be an
1139
+ // on-demand thing that we compute.
1140
+ let AssertDepGraphSafe ( symbol_map) = symbol_map;
1150
1141
1151
- fn trans_decl_task < ' a , ' tcx > ( ccx : CrateContext < ' a , ' tcx > ,
1152
- symbol_map : AssertDepGraphSafe < Rc < SymbolMap < ' tcx > > > ) {
1142
+ let source = if let Some ( buf) = ccx. previous_work_product ( ) {
1143
+ // Don't need to translate this module.
1144
+ ModuleSource :: Preexisting ( buf. clone ( ) )
1145
+ } else {
1153
1146
// Instantiate translation items without filling out definitions yet...
1154
1147
1155
- // FIXME(#40304): Instead of this, the symbol-map should be an
1156
- // on-demand thing that we compute.
1157
- let AssertDepGraphSafe ( symbol_map) = symbol_map;
1158
1148
let cgu = ccx. codegen_unit ( ) ;
1159
1149
let trans_items = cgu. items_in_deterministic_order ( ccx. tcx ( ) , & symbol_map) ;
1160
1150
for & ( trans_item, linkage) in & trans_items {
@@ -1200,6 +1190,19 @@ pub fn trans_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
1200
1190
if ccx. sess ( ) . opts . debuginfo != NoDebugInfo {
1201
1191
debuginfo:: finalize ( & ccx) ;
1202
1192
}
1193
+
1194
+ ModuleSource :: Translated ( ModuleLlvm {
1195
+ llcx : ccx. llcx ( ) ,
1196
+ llmod : ccx. llmod ( ) ,
1197
+ } )
1198
+ } ;
1199
+
1200
+ ModuleTranslation {
1201
+ name : String :: from ( ccx. codegen_unit ( ) . name ( ) ) ,
1202
+ symbol_name_hash : ccx. codegen_unit ( )
1203
+ . compute_symbol_name_hash ( ccx. shared ( ) ,
1204
+ & symbol_map) ,
1205
+ source : source,
1203
1206
}
1204
1207
}
1205
1208
0 commit comments