From c3daf6d220e5751e2de592b94141cef9d1cca055 Mon Sep 17 00:00:00 2001 From: bjorn3 Date: Mon, 23 Dec 2019 16:48:43 +0100 Subject: [PATCH] Add clif ir comment for write_cvalue --- src/abi/mod.rs | 1 + src/value_and_place.rs | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/abi/mod.rs b/src/abi/mod.rs index fc860010813..cde362e1834 100644 --- a/src/abi/mod.rs +++ b/src/abi/mod.rs @@ -329,6 +329,7 @@ pub fn codegen_fn_prelude(fx: &mut FunctionCx<'_, '_, impl Backend>, start_ebb: .collect::>(); fx.bcx.switch_to_block(start_ebb); + fx.bcx.ins().nop(); #[cfg(debug_assertions)] self::comments::add_locals_header_comment(fx); diff --git a/src/value_and_place.rs b/src/value_and_place.rs index df59fb8302c..fbc59f2706c 100644 --- a/src/value_and_place.rs +++ b/src/value_and_place.rs @@ -346,6 +346,19 @@ impl<'tcx> CPlace<'tcx> { } pub fn write_cvalue(self, fx: &mut FunctionCx<'_, 'tcx, impl Backend>, from: CValue<'tcx>) { + #[cfg(debug_assertions)] + { + use cranelift_codegen::cursor::{Cursor, CursorPosition}; + let cur_ebb = match fx.bcx.cursor().position() { + CursorPosition::After(ebb) => ebb, + _ => unreachable!(), + }; + fx.add_comment( + fx.bcx.func.layout.last_inst(cur_ebb).unwrap(), + format!("write_cvalue: {:?} <- {:?}",self, from), + ); + } + let from_ty = from.layout().ty; let to_ty = self.layout().ty;