summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa/src
diff options
context:
space:
mode:
authorbjorn3 <bjorn3@users.noreply.github.com>2022-04-30 21:20:08 +0200
committerbjorn3 <bjorn3@users.noreply.github.com>2022-04-30 21:20:08 +0200
commit78c65a52db0016f489862ecea92a09ad66a2b960 (patch)
treeb5e4db99724f287f91fdfa5ab9fe7939fe6af7ce /compiler/rustc_codegen_ssa/src
parentfab72301d9089761766b389df209986c2bc38e5d (diff)
downloadrust-78c65a52db0016f489862ecea92a09ad66a2b960.tar.gz
rust-78c65a52db0016f489862ecea92a09ad66a2b960.zip
Merge new_metadata into codegen_allocator
Diffstat (limited to 'compiler/rustc_codegen_ssa/src')
-rw-r--r--compiler/rustc_codegen_ssa/src/back/lto.rs4
-rw-r--r--compiler/rustc_codegen_ssa/src/base.rs11
-rw-r--r--compiler/rustc_codegen_ssa/src/traits/backend.rs4
3 files changed, 4 insertions, 15 deletions
diff --git a/compiler/rustc_codegen_ssa/src/back/lto.rs b/compiler/rustc_codegen_ssa/src/back/lto.rs
index 3c5b0e5cc43..cb6244050df 100644
--- a/compiler/rustc_codegen_ssa/src/back/lto.rs
+++ b/compiler/rustc_codegen_ssa/src/back/lto.rs
@@ -69,9 +69,7 @@ impl<B: WriteBackendMethods> LtoModuleCodegen<B> {
     ) -> Result<ModuleCodegen<B::Module>, FatalError> {
         match self {
             LtoModuleCodegen::Fat { mut module, .. } => {
-                {
-                    B::optimize_fat(cgcx, &mut module)?;
-                }
+                B::optimize_fat(cgcx, &mut module)?;
                 Ok(module)
             }
             LtoModuleCodegen::Thin(thin) => B::optimize_thin(cgcx, thin),
diff --git a/compiler/rustc_codegen_ssa/src/base.rs b/compiler/rustc_codegen_ssa/src/base.rs
index 019c9c179d8..5bc95614c19 100644
--- a/compiler/rustc_codegen_ssa/src/base.rs
+++ b/compiler/rustc_codegen_ssa/src/base.rs
@@ -575,15 +575,8 @@ pub fn codegen_crate<B: ExtraBackendMethods>(
     } else if let Some(kind) = tcx.allocator_kind(()) {
         let llmod_id =
             cgu_name_builder.build_cgu_name(LOCAL_CRATE, &["crate"], Some("allocator")).to_string();
-        let mut module_llvm = backend.new_metadata(tcx, &llmod_id);
-        tcx.sess.time("write_allocator_module", || {
-            backend.codegen_allocator(
-                tcx,
-                &mut module_llvm,
-                &llmod_id,
-                kind,
-                tcx.lang_items().oom().is_some(),
-            )
+        let module_llvm = tcx.sess.time("write_allocator_module", || {
+            backend.codegen_allocator(tcx, &llmod_id, kind, tcx.lang_items().oom().is_some())
         });
 
         Some(ModuleCodegen { name: llmod_id, module_llvm, kind: ModuleKind::Allocator })
diff --git a/compiler/rustc_codegen_ssa/src/traits/backend.rs b/compiler/rustc_codegen_ssa/src/traits/backend.rs
index 856b7742583..1e53c73d1bb 100644
--- a/compiler/rustc_codegen_ssa/src/traits/backend.rs
+++ b/compiler/rustc_codegen_ssa/src/traits/backend.rs
@@ -114,15 +114,13 @@ pub trait CodegenBackend {
 }
 
 pub trait ExtraBackendMethods: CodegenBackend + WriteBackendMethods + Sized + Send + Sync {
-    fn new_metadata(&self, sess: TyCtxt<'_>, mod_name: &str) -> Self::Module;
     fn codegen_allocator<'tcx>(
         &self,
         tcx: TyCtxt<'tcx>,
-        module_llvm: &mut Self::Module,
         module_name: &str,
         kind: AllocatorKind,
         has_alloc_error_handler: bool,
-    );
+    ) -> Self::Module;
     /// This generates the codegen unit and returns it along with
     /// a `u64` giving an estimate of the unit's processing cost.
     fn compile_codegen_unit(