Move global_asm into CodegenCx

This commit is contained in:
bjorn3
2020-07-09 19:24:53 +02:00
parent 548c46fe9d
commit 35701d8caa
4 changed files with 19 additions and 26 deletions

View File

@@ -123,6 +123,7 @@ impl<F: Fn() -> String> Drop for PrintOnPanic<F> {
struct CodegenCx<'tcx, B: Backend + 'static> {
tcx: TyCtxt<'tcx>,
module: Module<B>,
global_asm: String,
constants_cx: ConstantCx,
cached_context: Context,
vtables: FxHashMap<(Ty<'tcx>, Option<ty::PolyExistentialTraitRef<'tcx>>), DataId>,
@@ -148,6 +149,7 @@ impl<'tcx, B: Backend + 'static> CodegenCx<'tcx, B> {
CodegenCx {
tcx,
module,
global_asm: String::new(),
constants_cx: ConstantCx::default(),
cached_context: Context::new(),
vtables: FxHashMap::default(),
@@ -156,9 +158,9 @@ impl<'tcx, B: Backend + 'static> CodegenCx<'tcx, B> {
}
}
fn finalize(mut self) -> (Module<B>, Option<DebugContext<'tcx>>, UnwindContext<'tcx>) {
fn finalize(mut self) -> (Module<B>, String, Option<DebugContext<'tcx>>, UnwindContext<'tcx>) {
self.constants_cx.finalize(self.tcx, &mut self.module);
(self.module, self.debug_context, self.unwind_context)
(self.module, self.global_asm, self.debug_context, self.unwind_context)
}
}