From 1a6365f95f1f41cc9225695f50a5a43f8ecf1833 Mon Sep 17 00:00:00 2001 From: CohenArthur Date: Sat, 22 Aug 2020 15:25:36 +0200 Subject: [PATCH] FunctionCx: WIP: Fix overzealous sed usage --- src/base.rs | 2 +- src/common.rs | 2 +- src/constant.rs | 4 ++-- src/driver/mod.rs | 2 +- src/lib.rs | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/base.rs b/src/base.rs index cbb845af77c..bdcb931b827 100644 --- a/src/base.rs +++ b/src/base.rs @@ -49,7 +49,7 @@ pub(crate) fn trans_fn<'tcx, B: Backend + 'static>( cold_blocks: EntitySet::new(), clif_comments, - constants_cx: &mut cx.codegen_cx.constants_cx, + constants_cx: &mut cx.constants_cx, vtables: &mut cx.vtables, source_info_set: indexmap::IndexSet::new(), next_ssa_var: 0, diff --git a/src/common.rs b/src/common.rs index d959ddc2f4d..df91668c1e9 100644 --- a/src/common.rs +++ b/src/common.rs @@ -265,7 +265,7 @@ pub(crate) fn type_sign(ty: Ty<'_>) -> bool { } pub(crate) struct FunctionCx<'clif, 'tcx, B: Backend + 'static> { - pub(crate) .codegen_cx: &'clif CodegenCx<'tcx, B>, + pub(crate) codegen_cx: &'clif mut crate::CodegenCx<'tcx, B>, pub(crate) global_asm: &'clif mut String, pub(crate) pointer_type: Type, // Cached from module diff --git a/src/constant.rs b/src/constant.rs index 2e0dd9d7edc..3c05e4aa793 100644 --- a/src/constant.rs +++ b/src/constant.rs @@ -167,7 +167,7 @@ pub(crate) fn trans_const_value<'tcx>( let alloc_kind = fx.codegen_cx.tcx.get_global_alloc(ptr.alloc_id); let base_addr = match alloc_kind { Some(GlobalAlloc::Memory(alloc)) => { - fx.codegen_cx.constants_cx.todo.push(TodoItem::Alloc(ptr.alloc_id)); + fx.constants_cx.todo.push(TodoItem::Alloc(ptr.alloc_id)); let data_id = data_id_for_alloc_id(fx.codegen_cx.module, ptr.alloc_id, alloc.align, alloc.mutability); let local_data_id = fx.codegen_cx.module.declare_data_in_func(data_id, &mut fx.bcx.func); #[cfg(debug_assertions)] @@ -216,7 +216,7 @@ fn pointer_for_allocation<'tcx>( alloc: &'tcx Allocation, ) -> crate::pointer::Pointer { let alloc_id = fx.codegen_cx.tcx.create_memory_alloc(alloc); - fx.codegen_cx.constants_cx.todo.push(TodoItem::Alloc(alloc_id)); + fx.constants_cx.todo.push(TodoItem::Alloc(alloc_id)); let data_id = data_id_for_alloc_id(fx.codegen_cx.module, alloc_id, alloc.align, alloc.mutability); let local_data_id = fx.codegen_cx.module.declare_data_in_func(data_id, &mut fx.bcx.func); diff --git a/src/driver/mod.rs b/src/driver/mod.rs index 81f0e874b3a..797039d0fd2 100644 --- a/src/driver/mod.rs +++ b/src/driver/mod.rs @@ -88,7 +88,7 @@ fn trans_mono_item<'tcx, B: Backend + 'static>( cx.codegen_cx.tcx.sess.time("codegen fn", || crate::base::trans_fn(cx, inst, linkage)); } MonoItem::Static(def_id) => { - crate::constant::codegen_static(&mut cx.codegen_cx.constants_cx, def_id); + crate::constant::codegen_static(&mut cx.constants_cx, def_id); } MonoItem::GlobalAsm(hir_id) => { let item = tcx.hir().expect_item(hir_id); diff --git a/src/lib.rs b/src/lib.rs index 87e8936a53e..b9acc27efdf 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -160,7 +160,7 @@ impl<'tcx, B: Backend + 'static> CodegenCx<'tcx, B> { } fn finalize(mut self) -> (Module, String, Option>, UnwindContext<'tcx>) { - self.codegen_cx.constants_cx.finalize(self.codegen_cx.tcx, &mut self.codegen_cx.module); + self.constants_cx.finalize(self.codegen_cx.tcx, &mut self.codegen_cx.module); (self.codegen_cx.module, self.global_asm, self.debug_context, self.unwind_context) } }