about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/back/lto.rs
diff options
context:
space:
mode:
authorDianQK <dianqk@dianqk.net>2025-02-06 21:59:36 +0800
committerDianQK <dianqk@dianqk.net>2025-02-23 21:23:38 +0800
commit9431427cc363d0a1c36401cb98f15a7426f2220f (patch)
tree6cafe2c42e4bc74ccaef638cf398e09cffb556e5 /compiler/rustc_codegen_llvm/src/back/lto.rs
parentf32ca1afafa6dbe565b7209067f29c8cf9d074c3 (diff)
downloadrust-9431427cc363d0a1c36401cb98f15a7426f2220f.tar.gz
rust-9431427cc363d0a1c36401cb98f15a7426f2220f.zip
Add `new_regular` and `new_allocator` to `ModuleCodegen`
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/back/lto.rs')
-rw-r--r--compiler/rustc_codegen_llvm/src/back/lto.rs13
1 files changed, 3 insertions, 10 deletions
diff --git a/compiler/rustc_codegen_llvm/src/back/lto.rs b/compiler/rustc_codegen_llvm/src/back/lto.rs
index 6676afe489f..dfad2db44fa 100644
--- a/compiler/rustc_codegen_llvm/src/back/lto.rs
+++ b/compiler/rustc_codegen_llvm/src/back/lto.rs
@@ -306,11 +306,8 @@ fn fat_lto(
             assert!(!serialized_modules.is_empty(), "must have at least one serialized module");
             let (buffer, name) = serialized_modules.remove(0);
             info!("no in-memory regular modules to choose from, parsing {:?}", name);
-            ModuleCodegen {
-                module_llvm: ModuleLlvm::parse(cgcx, &name, buffer.data(), dcx)?,
-                name: name.into_string().unwrap(),
-                kind: ModuleKind::Regular,
-            }
+            let llvm_module = ModuleLlvm::parse(cgcx, &name, buffer.data(), dcx)?;
+            ModuleCodegen::new_regular(name.into_string().unwrap(), llvm_module)
         }
     };
     {
@@ -778,11 +775,7 @@ pub(crate) unsafe fn optimize_thin_module(
     // crates but for locally codegened modules we may be able to reuse
     // that LLVM Context and Module.
     let module_llvm = ModuleLlvm::parse(cgcx, module_name, thin_module.data(), dcx)?;
-    let mut module = ModuleCodegen {
-        module_llvm,
-        name: thin_module.name().to_string(),
-        kind: ModuleKind::Regular,
-    };
+    let mut module = ModuleCodegen::new_regular(thin_module.name(), module_llvm);
     {
         let target = &*module.module_llvm.tm;
         let llmod = module.module_llvm.llmod();