about summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa/src
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2023-07-20 11:19:52 +1000
committerNicholas Nethercote <n.nethercote@gmail.com>2023-07-31 16:20:18 +1000
commit4f598b852cf536a96234a1043a0af9f72d7e37e6 (patch)
tree8f000a1c4905d0c6fda7b412507ace15007e7e39 /compiler/rustc_codegen_ssa/src
parenta8c71f0a15983a17ed07490feb4a195ababff439 (diff)
downloadrust-4f598b852cf536a96234a1043a0af9f72d7e37e6.tar.gz
rust-4f598b852cf536a96234a1043a0af9f72d7e37e6.zip
Add comments to `WorkItemResult`.
And rename the `Compiled` variant as `Finished`, because that name makes
it clearer there is nothing left to do, contrasting nicely with the
`Needs*` variants.
Diffstat (limited to 'compiler/rustc_codegen_ssa/src')
-rw-r--r--compiler/rustc_codegen_ssa/src/back/write.rs18
1 files changed, 14 insertions, 4 deletions
diff --git a/compiler/rustc_codegen_ssa/src/back/write.rs b/compiler/rustc_codegen_ssa/src/back/write.rs
index df68cf1e28b..2ef0a7c1eac 100644
--- a/compiler/rustc_codegen_ssa/src/back/write.rs
+++ b/compiler/rustc_codegen_ssa/src/back/write.rs
@@ -751,9 +751,19 @@ impl<B: WriteBackendMethods> WorkItem<B> {
 
 /// A result produced by the backend.
 pub(crate) enum WorkItemResult<B: WriteBackendMethods> {
-    Compiled(CompiledModule),
+    /// The backend has finished compiling a CGU, nothing more required.
+    Finished(CompiledModule),
+
+    /// The backend has finished compiling a CGU, which now needs linking
+    /// because `-Zcombine-cgu` was specified.
     NeedsLink(ModuleCodegen<B::Module>),
+
+    /// The backend has finished compiling a CGU, which now needs to go through
+    /// fat LTO.
     NeedsFatLTO(FatLTOInput<B>),
+
+    /// The backend has finished compiling a CGU, which now needs to go through
+    /// thin LTO.
     NeedsThinLTO(String, B::ThinBuffer),
 }
 
@@ -906,7 +916,7 @@ fn execute_copy_from_cache_work_item<B: ExtraBackendMethods>(
             load_from_incr_comp_dir(dwarf_obj_out, &saved_dwarf_object_file)
         });
 
-    WorkItemResult::Compiled(CompiledModule {
+    WorkItemResult::Finished(CompiledModule {
         name: module.name,
         kind: ModuleKind::Regular,
         object,
@@ -936,7 +946,7 @@ fn finish_intra_module_work<B: ExtraBackendMethods>(
         || module.kind == ModuleKind::Allocator
     {
         let module = unsafe { B::codegen(cgcx, &diag_handler, module, module_config)? };
-        Ok(WorkItemResult::Compiled(module))
+        Ok(WorkItemResult::Finished(module))
     } else {
         Ok(WorkItemResult::NeedsLink(module))
     }
@@ -1522,7 +1532,7 @@ fn start_executing_work<B: ExtraBackendMethods>(
                     free_worker(worker_id);
 
                     match result {
-                        Ok(WorkItemResult::Compiled(compiled_module)) => {
+                        Ok(WorkItemResult::Finished(compiled_module)) => {
                             match compiled_module.kind {
                                 ModuleKind::Regular => {
                                     compiled_modules.push(compiled_module);